drip-nodejs
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -47,7 +47,8 @@ module.exports = { | ||
* @param {object} campaignId - Required. The campaign id | ||
* @param {object} options - An object with status and sort details | ||
* @param {callback} callback - An optional callback | ||
* @returns {promise} | ||
*/ | ||
listAllSubscribesToCampaign(campaignId, callback) { | ||
return this.get(`v2/${this.accountId}/campaigns/${campaignId}/subscribers`, {}, callback); | ||
listAllSubscribesToCampaign(campaignId, options = {}, callback) { | ||
return this.get(`v2/${this.accountId}/campaigns/${campaignId}/subscribers`, { qs: options }, callback); | ||
}, | ||
@@ -54,0 +55,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
module.exports = '3.0.0'; | ||
module.exports = '3.1.0'; |
{ | ||
"name": "drip-nodejs", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "A complete NodeJS wrapper for connecting to the Drip v2 REST API", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -90,3 +90,3 @@ [![Build Status](https://travis-ci.org/samudary/drip-nodejs.svg?branch=master)](https://travis-ci.org/samudary/drip-nodejs) | ||
| Pause a campaign | `client.pauseCampaign(campaignId, callback)` | | ||
| List specific campaign's subscribers | `client.listAllSubscribesToCampaign(campaignId, callback)` | | ||
| List specific campaign's subscribers | `client.listAllSubscribesToCampaign(campaignId, options = {}, callback)` | | ||
| Subscribe to a campaign | `client.subscribeToCampaign(campaignId, payload, callback)` | | ||
@@ -93,0 +93,0 @@ |
@@ -59,3 +59,3 @@ const sinon = require('sinon'); | ||
client.listAllSubscribesToCampaign(campaignId, (error, response) => { | ||
client.listAllSubscribesToCampaign(campaignId, {}, (error, response) => { | ||
expect(response.statusCode).toBe(200); | ||
@@ -67,2 +67,12 @@ expect(client.request.callCount).toBe(1); | ||
it('should list all active subscribers to a campaign and call request with get', (done) => { | ||
expect(typeof client.listAllSubscribesToCampaign).toEqual('function'); | ||
client.listAllSubscribesToCampaign(campaignId, { status: 'active' }, (error, response) => { | ||
expect(response.statusCode).toBe(200); | ||
expect(client.request.callCount).toBe(1); | ||
}); | ||
done(); | ||
}); | ||
it('should subscriber someone to a campaign and call request with post', (done) => { | ||
@@ -160,3 +170,3 @@ expect(typeof client.subscribeToCampaign).toEqual('function'); | ||
client.listAllSubscribesToCampaign(campaignId) | ||
client.listAllSubscribesToCampaign(campaignId, {}) | ||
.then((response) => { | ||
@@ -169,5 +179,19 @@ expect(response.statusCode).toBe(200); | ||
expect(client.get).toHaveBeenCalledWith('v2/9999999/campaigns/4444444/subscribers', {}, undefined); | ||
expect(client.get).toHaveBeenCalledWith('v2/9999999/campaigns/4444444/subscribers', { qs: {} }, undefined); | ||
}); | ||
it('should list all active subscribers to a campaign', (done) => { | ||
expect(typeof client.listAllSubscribesToCampaign).toEqual('function'); | ||
client.listAllSubscribesToCampaign(campaignId, { status: 'active' }) | ||
.then((response) => { | ||
expect(response.statusCode).toBe(200); | ||
expect(client.request.callCount).toBe(1); | ||
}) | ||
.catch(failTest); | ||
done(); | ||
expect(client.get).toHaveBeenCalledWith('v2/9999999/campaigns/4444444/subscribers', { qs: { status: 'active' } }, undefined); | ||
}); | ||
it('should list all subscribers to a campaign', (done) => { | ||
@@ -174,0 +198,0 @@ expect(typeof client.subscribeToCampaign).toEqual('function'); |
112339
2637