sailthru-client
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -8,4 +8,2 @@ (function() { | ||
VERSION = require('./sailthru').VERSION; | ||
exports.SailthruUtil = SailthruUtil = (function() { | ||
@@ -53,5 +51,5 @@ function SailthruUtil() {} | ||
exports.log = function(string) { | ||
return log('sailthru-client ' + VERSION + ' - ' + string); | ||
return log('sailthru-client - ' + string); | ||
}; | ||
}).call(this); |
@@ -22,3 +22,3 @@ (function() { | ||
exports.VERSION = '2.1.0'; | ||
exports.VERSION = '3.0.1'; | ||
@@ -282,4 +282,4 @@ USER_AGENT = 'Sailthru API Node/JavaScript Client'; | ||
data: json_payload | ||
}).on('complete', function(data) { | ||
return callback(null, data); | ||
}).on('complete', function(result, response) { | ||
return callback(null, result); | ||
}); | ||
@@ -665,3 +665,3 @@ }; | ||
if (binary_data_params === undefined) { | ||
binary_data_params = Array; | ||
binary_data_params = []; | ||
} | ||
@@ -676,3 +676,3 @@ data = this._getOptions(options); | ||
} | ||
return this.apiPost('job', data, callback, binary_data_params); | ||
return this.apiPost('job', data, binary_data_params, callback); | ||
}; | ||
@@ -679,0 +679,0 @@ |
{ | ||
"name": "sailthru-client", | ||
"description": "Node.js client for Sailthru API", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"author": { | ||
@@ -16,13 +16,15 @@ "name": "George Liao", | ||
"dependencies": { | ||
"restler": ">=0.2.3" | ||
"restler": "^3.4.0" | ||
}, | ||
"devDependencies": { | ||
"grunt": "^0.4.5", | ||
"grunt": "^1.0.1", | ||
"grunt-contrib-nodeunit": "^1.0.0", | ||
"nock": "^7.7.2", | ||
"nodeunit": ">=0.8.4" | ||
"mock-require": "^2.0.0", | ||
"nock": "^9.0.2", | ||
"nodeunit": "^0.10.2" | ||
}, | ||
"engines": { | ||
"node": ">=0.4" | ||
} | ||
}, | ||
"license": "MIT" | ||
} |
(function() { | ||
var mock = require('mock-require'); | ||
mock('fs', { | ||
statSync: function() {return {size: 2}; }, | ||
open: function(a,b,c,cb) { cb(); }, | ||
read: function(a,b,c,d,cb){ cb(); }, | ||
close: function() {} | ||
}); | ||
var SailthruClient = require('../lib/sailthru').createSailthruClient('abcd12345', '1324qwerty'), | ||
SailthruClientBadUrl = require('../lib/sailthru').createSailthruClient('abcd12345', '1324qwerty', 'http://foo'), | ||
nock = require('nock'); | ||
SailthruClientBadUrl = require('../lib/sailthru').createSailthruClient('abcd12345', '1324qwerty', 'http://foo'), | ||
nock = require('nock'); | ||
@@ -14,2 +22,6 @@ SailthruClient.disableLogging(); | ||
exports.tearDown = function(cb) { | ||
cb(); | ||
}; | ||
exports.receiveOptoutPost = function(test) { | ||
@@ -302,2 +314,79 @@ var params1, params2, params3, params4, params5, params6, params7, real1, real2, real3, real4, real5, real6, real7; | ||
exports.processJobNormalCall = function(test) { | ||
nock('http://api.sailthru.com') | ||
.post(/^\/job/, function(q) { | ||
var data = JSON.parse(q.json); | ||
return data.job === 'import' && data.list === 'abc'; | ||
}).reply(200, {/* don't care about response */}); | ||
test.expect(1); | ||
var callback = function(err, res) { | ||
test.equal(err, undefined); | ||
test.done(); | ||
}; | ||
var options = { | ||
list: 'abc' | ||
}; | ||
SailthruClient.processJob('import', options, callback); | ||
}; | ||
exports.processJobWithReportEmail = function(test) { | ||
nock('http://api.sailthru.com') | ||
.post(/^\/job/, function(q) { | ||
var data = JSON.parse(q.json); | ||
return data.job === 'import' && data.list === 'abc' && data.report_email === 'report@example.com'; | ||
}).reply(200, {/* don't care about response */}); | ||
test.expect(1); | ||
var callback = function(err, res) { | ||
test.equal(err, undefined); | ||
test.done(); | ||
}; | ||
var options = { | ||
list: 'abc' | ||
}; | ||
SailthruClient.processJob('import', options, 'report@example.com', callback); | ||
}; | ||
exports.processJobWithReportEmailAndPostback = function(test) { | ||
nock('http://api.sailthru.com') | ||
.post(/^\/job/, function(q) { | ||
var data = JSON.parse(q.json); | ||
return data.job === 'import' && data.list === 'abc' && data.report_email === 'report@example.com' | ||
&& data.postback_url === 'http://example.com/post.php'; | ||
}).reply(200, {/* don't care about response */}); | ||
test.expect(1); | ||
var callback = function(err, res) { | ||
test.equal(err, undefined); | ||
test.done(); | ||
}; | ||
var options = { | ||
list: 'abc' | ||
}; | ||
SailthruClient.processJob('import', options, 'report@example.com', 'http://example.com/post.php', callback); | ||
}; | ||
exports.processJobWithFile = function(test) { | ||
nock(/.*sailthru.com.*/) | ||
.post(/.*/, function(q) { | ||
return q.match(/new_users.csv/); | ||
}).reply(200, 'success'); | ||
test.expect(1); | ||
var callback = function(err, res) { | ||
test.equal(err, undefined); | ||
test.done(); | ||
}; | ||
var options = { | ||
list: 'abc', | ||
file: 'tmp/new_users.csv' | ||
}; | ||
SailthruClient.processJob('import', options, 'report@example.com', 'http://example.com/post.php', ['file'], callback); | ||
}; | ||
exports.getLastRateLimitInfoSingleCase = function(test) { | ||
@@ -304,0 +393,0 @@ nock('http://api.sailthru.com') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46545
1193
5
Updatedrestler@^3.4.0