Comparing version 1.0.1 to 1.1.0
// NODE SDK Test Key | ||
// e2e1b620ff9cf2db919d3c40160c4851d445d454 | ||
var toApiFormat = require('./lib/toApiFormat'); | ||
var testObj = ["oneTag", "twoTag", "threeTag"]; | ||
var validationObj = ["one_tag", "two_tag", "three_tag"]; | ||
var out = toApiFormat(testObj); | ||
console.log(out); | ||
/* | ||
@@ -19,13 +9,13 @@ var key = 'e2e1b620ff9cf2db919d3c40160c4851d445d454'//'YOURAPIKEY' | ||
/*var SparkPost = require('./lib/sparkpost'), | ||
var SparkPost = require('./lib/sparkpost'), | ||
client = new SparkPost('e2e1b620ff9cf2db919d3c40160c4851d445d454'); | ||
client.webhooks.getDocumentation(function(err, res) { | ||
client.sendingDomains.all(function(err, res) { | ||
if (err) { | ||
console.log(err); | ||
} else { | ||
console.log(res.body); | ||
console.log(res); | ||
console.log('Congrats you can use our SDK!'); | ||
} | ||
});*/ | ||
}); | ||
@@ -32,0 +22,0 @@ |
## Change Log | ||
### v1.1.0 (2015/08/13) | ||
- [#92](https://github.com/SparkPost/node-sparkpost/pull/92) Added Coveralls.io (@aydrian) | ||
- [#91](https://github.com/SparkPost/node-sparkpost/pull/91) Added Recipient List Update method, Docs, and Examples (@aydrian) | ||
- [#85](https://github.com/SparkPost/node-sparkpost/pull/85) Added getDocumentation and getSamples functions to Webhooks resource (@aydrian) | ||
### v1.0.1 (2015/08/06) | ||
@@ -15,7 +20,6 @@ - [#88](https://github.com/SparkPost/node-sparkpost/pull/88) Modified toApiFormat spec test file to fit standard naming convention. Added tests for code coverage. (@aydrian) | ||
- [#66](https://github.com/SparkPost/node-sparkpost/pull/66) Issue [#51](https://github.com/SparkPost/node-sparkpost/issues/51) Modify the base object to handle non 2XX status and simplify second callback param (@aydrian) | ||
- [#64]( | ||
- [#56](https://github.com/SparkPost/node-sparkpost/pull/56) Issue [#46](https://github.com/SparkPost/node-sparkpost/issues/46) Updates to Transmissions library (@aydrian) | ||
- [#55](https://github.com/SparkPost/node-sparkpost/pull/55) Fix doc about using process.env.SPARKPOST_API_KEY (@bizob2828) | ||
- [#54](https://github.com/SparkPost/node-sparkpost/pull/54) fixed link to transmissions in readme (@bizob2828) | ||
- [#45](https://github.com/SparkPost/node-sparkpost/pull/45) Issue [#45](https://github.com/SparkPost/node-sparkpost/issues/44) Accept camelCase or native API format seamlessly | ||
- [#45](https://github.com/SparkPost/node-sparkpost/pull/45) Issue [#45](https://github.com/SparkPost/node-sparkpost/issues/44) Accept camelCase or native API format seamlessly (@bdeanindy) | ||
- Issue [#64](https://github.com/SparkPost/node-sparkpost/issues/64) Update webhooks to use toApiFormat | ||
@@ -26,3 +30,3 @@ - Issue [#63](https://github.com/SparkPost/node-sparkpost/issues/63) Updated suppressionlists to use toApiFormat | ||
- Issue [#58](https://github.com/SparkPost/node-sparkpost/issues/58) Update recipientLists to use toApiFormat | ||
- Issue [#57] Update transmissions to use toApiFormat (@bdeanindy) | ||
- Issue [#57](https://github.com/SparkPost/node-sparkpost/issues/58) Update transmissions to use toApiFormat | ||
@@ -29,0 +33,0 @@ ### v0.9.0 (2015/05/12) - *breaking* |
@@ -22,2 +22,8 @@ # Recipient Lists | ||
* `callback` - see all function | ||
* **update(options, callback)** | ||
Update an existing recipient list | ||
* `options.id` - the id of the recipient list you want to update **required** | ||
* `options.recipients` - an array of recipients to add to the list **required** | ||
* `options.num_rcpt_errors` - limit the number of recipient errors returned | ||
* `callback` - see all function | ||
* **delete(id, callback)** | ||
@@ -24,0 +30,0 @@ Delete an existing recipient list |
@@ -40,2 +40,9 @@ # Webhooks | ||
* `callback` - see all function | ||
* **getDocumentation(callback)** | ||
Lists descriptions of the events, event types, and event fields that could be included in a Webhooks post to your target URL. | ||
* `callback` - see all function | ||
* **getSamples(options, callback)** | ||
List an example of the event data that will be posted by a Webhook for the specified events. | ||
* `options.events` - `String` event types for which to get a sample payload Defaults to all event types | ||
* `callback` - see all function | ||
@@ -42,0 +49,0 @@ ## Examples |
@@ -55,2 +55,10 @@ var matchdep = require('matchdep') | ||
} | ||
}, | ||
coveralls: { | ||
options: { | ||
force: true | ||
}, | ||
grunt_coveralls_coverage: { | ||
src: 'test/reports/lcov.info' | ||
} | ||
} | ||
@@ -57,0 +65,0 @@ }); |
@@ -40,2 +40,3 @@ 'use strict'; | ||
} | ||
var reqOpts = { | ||
@@ -54,2 +55,24 @@ uri: api | ||
client.post(reqOpts, callback); | ||
}, | ||
update: function(options, callback) { | ||
options = options || {}; | ||
if(!options.id) { | ||
callback(new Error('recipients list id is required')); | ||
return; | ||
} | ||
var reqOpts = { | ||
uri: api + '/' + options.id | ||
}; | ||
if (options.num_rcpt_errors) { | ||
reqOpts.qs = reqOpts.qs || {}; | ||
reqOpts.qs.num_rcpt_errors = options.num_rcpt_errors; | ||
delete options.num_rcpt_errors; | ||
} | ||
reqOpts.json = toApiFormat(options); | ||
client.put(reqOpts, callback); | ||
} | ||
@@ -56,0 +79,0 @@ }; |
@@ -119,2 +119,25 @@ 'use strict'; | ||
client.get(reqOpts, callback); | ||
}, | ||
getDocumentation: function(callback) { | ||
var reqOpts = { | ||
uri: api + '/events/documentation' | ||
}; | ||
client.get(reqOpts, callback); | ||
}, | ||
getSamples: function(options, callback){ | ||
var reqOpts = { | ||
uri: api + '/events/samples' | ||
}; | ||
if (typeof options === 'function') { | ||
callback = options; | ||
options = {}; | ||
} | ||
if (options.events) { | ||
reqOpts.qs = reqOpts.qs || {}; | ||
reqOpts.qs.events = options.events; | ||
} | ||
client.get(reqOpts, callback); | ||
} | ||
@@ -121,0 +144,0 @@ }; |
{ | ||
"name": "sparkpost", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "A Node.js wrapper for interfacing with your favorite SparkPost APIs", | ||
"main": "./lib/sparkpost.js", | ||
"scripts": { | ||
"test": "grunt" | ||
"test": "grunt", | ||
"ci": "grunt && grunt coveralls:grunt_coveralls_coverage" | ||
}, | ||
@@ -12,3 +13,3 @@ "keywords": [ | ||
"messaging" | ||
], | ||
], | ||
"repository": { | ||
@@ -29,2 +30,3 @@ "type": "git", | ||
"grunt-contrib-jshint": "0.10.0", | ||
"grunt-coveralls": "^1.0.0", | ||
"grunt-shell": "1.1.1", | ||
@@ -43,5 +45,5 @@ "istanbul": "0.3.2", | ||
"dependencies": { | ||
"lodash": "3.9.3", | ||
"lodash": "^3.9.3", | ||
"request": "2.42.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
[![Travis CI](https://travis-ci.org/SparkPost/node-sparkpost.svg?branch=master)](https://travis-ci.org/SparkPost/node-sparkpost) | ||
[![Travis CI](https://travis-ci.org/SparkPost/node-sparkpost.svg?branch=master)](https://travis-ci.org/SparkPost/node-sparkpost) [![Coverage Status](https://coveralls.io/repos/SparkPost/node-sparkpost/badge.svg?branch=master&service=github)](https://coveralls.io/github/SparkPost/node-sparkpost?branch=master) | ||
@@ -3,0 +3,0 @@ ![SparkPost Build by MessageSystems](/docs/sparkpost_logo.png) |
@@ -105,2 +105,47 @@ var chai = require('chai') | ||
describe('update Method', function() { | ||
var test_list = [ | ||
{ | ||
address: { | ||
email: 'test@test.com', | ||
name: 'test' | ||
} | ||
} | ||
]; | ||
it('should call client put method with the appropriate uri', function(done) { | ||
var options = { | ||
id: 'test_list', | ||
recipients: test_list | ||
}; | ||
recipientLists.update(options, function(err, data) { | ||
expect(client.put.firstCall.args[0].uri).to.equal('recipient-lists/' + options.id); | ||
done(); | ||
}); | ||
}); | ||
it('should throw an error if id is missing', function(done) { | ||
recipientLists.update(null, function(err) { | ||
expect(err.message).to.equal('recipients list id is required'); | ||
expect(client.put).not.to.have.been.called; | ||
done(); | ||
}); | ||
}); | ||
it('should allow num_rcpt_errors to be set in options', function(done) { | ||
var options = { | ||
id: 'test_list', | ||
recipients: test_list, | ||
num_rcpt_errors: 3 | ||
}; | ||
recipientLists.update(options, function(err, data) { | ||
expect(client.put.firstCall.args[0].qs).to.deep.equal({num_rcpt_errors: 3}); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe('delete Method', function() { | ||
@@ -107,0 +152,0 @@ it('should call client delete method with the appropriate uri', function(done) { |
@@ -222,2 +222,39 @@ var chai = require('chai') | ||
}); | ||
describe('getDocumentation Method', function() { | ||
it('should call client get method with the appropriate uri', function(done) { | ||
var options = { | ||
id: 'test' | ||
}; | ||
webhooks.getDocumentation(function(err, data) { | ||
expect(client.get.firstCall.args[0].uri).to.equal('webhooks/events/documentation'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
describe('getSamples Method', function() { | ||
it('should call client get method with the appropriate uri', function(done) { | ||
var options = { | ||
id: 'test' | ||
}; | ||
webhooks.getSamples(function(err, data) { | ||
expect(client.get.firstCall.args[0].uri).to.equal('webhooks/events/samples'); | ||
done(); | ||
}); | ||
}); | ||
it('should allow events to be set in options', function(done) { | ||
var options = { | ||
events: 'bounces' | ||
}; | ||
webhooks.getSamples(options, function(err, data) { | ||
expect(client.get.firstCall.args[0].qs).to.deep.equal({events: 'bounces'}); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
221989
98
3394
16
+ Addedlodash@3.10.1(transitive)
- Removedlodash@3.9.3(transitive)
Updatedlodash@^3.9.3