Comparing version
## Change Log | ||
### v1.3.2 (2016/04/13) | ||
- [#139](https://github.com/SparkPost/node-sparkpost/pull/139) Make Gruntfile.js cross-platform friendly (@coldacid) | ||
- [#137](https://github.com/SparkPost/node-sparkpost/pull/137) Fix missing `subaccounts` property in SparkPost class (@coldacid) | ||
- [#134](https://github.com/SparkPost/node-sparkpost/pull/134) Let inboundDomains.create() use a domain name as per the docs (@orval) | ||
- [#132](https://github.com/SparkPost/node-sparkpost/pull/132) Some docs erroneously refer to recipient lists (@orval) | ||
### v1.3.1 (2016/04/01) | ||
@@ -4,0 +10,0 @@ - [#130](https://github.com/SparkPost/node-sparkpost/pull/130) Refactored toApiFormat.js to use json-pointer (@orval) |
@@ -17,3 +17,3 @@ # Relay Webhooks | ||
* **create(options, callback)** | ||
Create a new recipient list | ||
Create a new relay webhook | ||
* `options.target` - url of the target to which to POST relay batches **required** | ||
@@ -20,0 +20,0 @@ * `options.domain` - inbound domain associated with this webhook **required** |
@@ -18,3 +18,3 @@ # Templates | ||
* **create(options, callback)** | ||
Create a new recipient list | ||
Create a new template | ||
* `options.template` - a template object **required** | ||
@@ -21,0 +21,0 @@ * `callback` - see all function |
@@ -19,3 +19,3 @@ # Webhooks | ||
* **create(webhook, callback)** | ||
Create a new recipient list | ||
Create a new webhook | ||
* `webhook` - a webhook object **required** | ||
@@ -22,0 +22,0 @@ * `callback` - see all function |
var matchdep = require('matchdep') | ||
, gruntTimer = require('time-grunt'); | ||
, gruntTimer = require('time-grunt') | ||
, path = require('path'); | ||
@@ -12,3 +13,3 @@ module.exports = function(grunt) { | ||
var config = { | ||
binPath: './node_modules/.bin' | ||
binPath: path.join('.', 'node_modules', '.bin'), | ||
}; | ||
@@ -50,3 +51,3 @@ | ||
coverage: { | ||
command : '<%= config.binPath %>/istanbul cover --report lcov --dir test/reports/ <%= config.binPath %>/_mocha test/spec -- --reporter ' + reporter, | ||
command : path.join(config.binPath, 'istanbul') + ' cover --report lcov --dir test/reports/ node_modules/mocha/bin/_mocha test/spec -- --reporter ' + reporter, | ||
options : { | ||
@@ -58,3 +59,3 @@ stdout : true, | ||
test: { | ||
command: '<%= config.binPath %>/_mocha test/spec' | ||
command: path.join(config.binPath, '_mocha') + ' test/spec' | ||
} | ||
@@ -61,0 +62,0 @@ }, |
'use strict'; | ||
var api = 'inbound-domains' | ||
, toApiFormat = require('./toApiFormat'); | ||
var api = 'inbound-domains'; | ||
@@ -43,3 +42,5 @@ module.exports = function(client) { | ||
uri: api | ||
, json: toApiFormat(domain) | ||
, json: { | ||
domain: domain | ||
} | ||
}; | ||
@@ -46,0 +47,0 @@ client.post(options, callback); |
@@ -63,2 +63,3 @@ 'use strict'; | ||
this.sendingDomains = require('./sendingDomains')(this); | ||
this.subaccounts = require('./subaccounts')(this); | ||
this.suppressionList = require('./suppressionList')(this); | ||
@@ -65,0 +66,0 @@ this.templates = require('./templates')(this); |
@@ -14,4 +14,13 @@ 'use strict'; | ||
model.key_grants = Array.isArray(input.keyGrants) ? input.keyGrants : [input.keyGrants]; | ||
model.key_valid_ips = Array.isArray(input.keyValidIps) ? input.keyValidIps : [input.keyValidIps]; | ||
// server returns 500 if key_valid_ips is empty array | ||
if (input.keyValidIps) { | ||
var keyValidIpsIsArray = Array.isArray(input.keyValidIps); | ||
if (keyValidIpsIsArray && input.keyValidIps.length > 0) { | ||
model.key_valid_ips = input.keyValidIps; | ||
} else if (!keyValidIpsIsArray) { | ||
model.key_valid_ips = [input.keyValidIps]; | ||
} | ||
} | ||
return model; | ||
@@ -18,0 +27,0 @@ }; |
{ | ||
"name": "sparkpost", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "A Node.js wrapper for interfacing with your favorite SparkPost APIs", | ||
@@ -5,0 +5,0 @@ "main": "./lib/sparkpost.js", |
@@ -125,2 +125,57 @@ var chai = require('chai') | ||
}); | ||
it('should not set key_valid_ips in request if keyValidIps is missing from options', function(done) { | ||
var options = { | ||
name: 'test', | ||
keyLabel: 'test', | ||
keyGrants: [] | ||
}; | ||
subaccounts.create(options, function(err, data) { | ||
expect(client.post.firstCall.args[0].json.key_valid_ips).to.be.undefined; | ||
done(); | ||
}) | ||
}); | ||
it('should not set key_valid_ips in request if keyValidIps is empty array', function(done) { | ||
var options = { | ||
name: 'test', | ||
keyLabel: 'test', | ||
keyGrants: [], | ||
keyValidIps: [] | ||
}; | ||
subaccounts.create(options, function(err, data) { | ||
expect(client.post.firstCall.args[0].json.key_valid_ips).to.be.undefined; | ||
done(); | ||
}) | ||
}); | ||
it('should set key_valid_ips in request if keyValidIps is in options and is a non-empty array', function(done) { | ||
var options = { | ||
name: 'test', | ||
keyLabel: 'test', | ||
keyGrants: [], | ||
keyValidIps: ['127.0.0.1'] | ||
}; | ||
subaccounts.create(options, function(err, data) { | ||
expect(client.post.firstCall.args[0].json.key_valid_ips).to.eql(['127.0.0.1']); | ||
done(); | ||
}) | ||
}); | ||
it('should set key_valid_ips in request if keyValidIps is in options and is not an array', function(done) { | ||
var options = { | ||
name: 'test', | ||
keyLabel: 'test', | ||
keyGrants: [], | ||
keyValidIps: '127.0.0.1' | ||
}; | ||
subaccounts.create(options, function(err, data) { | ||
expect(client.post.firstCall.args[0].json.key_valid_ips).to.eql(['127.0.0.1']); | ||
done(); | ||
}) | ||
}); | ||
}); | ||
@@ -127,0 +182,0 @@ |
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
275411
0.91%4554
1.29%