Skip to content

Commit aeb7b7f

Browse files
authored
Merge pull request #67 from sendwithus/fix-deactivate-drip-campaign
Fix deactivate drip campaign
2 parents 529c478 + 7d5ca96 commit aeb7b7f

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

lib/sendwithus.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ Sendwithus.prototype.dripCampaignDeactivate = function (
231231
var url = this._buildUrl("drip_campaigns", drip_campaign_id, "deactivate");
232232
var options = this._getOptions();
233233
this.emit("request", "POST", url, options.headers, data);
234-
this._fetch(callback).del(url, options);
234+
this._fetch(callback).postJson(url, data, options);
235235
};
236236

237237
Sendwithus.prototype.dripCampaignDeactivateAll = function (data, callback) {

npm-shrinkwrap.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sendwithus",
3-
"version": "6.0.2",
3+
"version": "6.0.3",
44
"author": "Sendwithus <[email protected]>",
55
"description": "Sendwithus.com Node.js client",
66
"main": "index.js",

test/test.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,12 @@ describe("Customers Endpoint", function () {
316316
describe("Drip Campaigns Endpoint", function () {
317317
beforeEach(function () {
318318
this.sendwithus = sendwithusFactory(API_KEY);
319-
this.recipientData = {
319+
this.recipientActivateData = {
320+
recipient: {
321+
address: "[email protected]",
322+
}
323+
};
324+
this.recipientDeactivateData = {
320325
recipient_address: "[email protected]",
321326
};
322327
});
@@ -336,7 +341,7 @@ describe("Drip Campaigns Endpoint", function () {
336341
it("should activate a recipient successfully", function (done) {
337342
this.sendwithus.dripCampaignActivate(
338343
ENABLED_DRIP_ID,
339-
this.recipientData,
344+
this.recipientActivateData,
340345
function (err, result) {
341346
try {
342347
assert.ifError(err);
@@ -352,7 +357,7 @@ describe("Drip Campaigns Endpoint", function () {
352357
it("should return an error (400) when activating on an inactive drip campaign", function (done) {
353358
this.sendwithus.dripCampaignActivate(
354359
DISABLED_DRIP_ID,
355-
this.recipientData,
360+
this.recipientActivateData,
356361
function (err, response) {
357362
try {
358363
assert.ok(err, "Error was thrown");
@@ -373,7 +378,7 @@ describe("Drip Campaigns Endpoint", function () {
373378
it("should return an error (400) when activating on a drip campaign that does not exist", function (done) {
374379
this.sendwithus.dripCampaignActivate(
375380
FALSE_DRIP_ID,
376-
this.recipientData,
381+
this.recipientActivateData,
377382
function (err, response) {
378383
try {
379384
assert.ok(err, "Error was thrown");
@@ -391,13 +396,11 @@ describe("Drip Campaigns Endpoint", function () {
391396
);
392397
});
393398

394-
it.skip("should deactivate a recipient successfully", function (done) {
395-
// SendWithUs currently returns a 405 METHOD NOT ALLOWED error for this endpoint.
399+
it("should deactivate a recipient successfully", function (done) {
396400
this.sendwithus.dripCampaignDeactivate(
397401
ENABLED_DRIP_ID,
398-
this.recipientData,
402+
this.recipientDeactivateData,
399403
function (err, result) {
400-
console.log(err)
401404
try {
402405
assert.ifError(err);
403406
assert.ok(result.success, "Response was successful");
@@ -411,7 +414,7 @@ describe("Drip Campaigns Endpoint", function () {
411414

412415
it("should deactivate all drip campaigns for recipient successfully", function (done) {
413416
this.sendwithus.dripCampaignDeactivateAll(
414-
this.recipientData,
417+
this.recipientDeactivateData,
415418
function (err, result) {
416419
try {
417420
assert.ifError(err);

0 commit comments

Comments
 (0)