Comparing version 2.0.0 to 2.1.0-rc1
@@ -0,1 +1,7 @@ | ||
## 2.1.0-rc1 | ||
Features: | ||
- Adds support for Autopilot (retrieving configuration, listing people, adding people, and removing people) | ||
## 2.0.0 (2020-03-18) | ||
@@ -2,0 +8,0 @@ |
var merge = require('./utils/merge'); | ||
var Client = require('./Client'); | ||
var VERSION = '2.0.0'; | ||
var VERSION = '2.1.0-rc1'; | ||
var DEFAULT_HOST = 'api.delighted.com'; | ||
@@ -19,3 +19,5 @@ var DEFAULT_PORT = 443; | ||
'surveyResponse': require('./resources/SurveyResponse'), | ||
'unsubscribe': require('./resources/Unsubscribe') | ||
'unsubscribe': require('./resources/Unsubscribe'), | ||
'autopilotConfiguration': require('./resources/autopilot/Configuration'), | ||
'autopilotMembership': require('./resources/autopilot/Membership') | ||
}; | ||
@@ -22,0 +24,0 @@ |
@@ -12,3 +12,3 @@ var extend = require('./utils/extend'); | ||
Resource.defaults = ['materialize', 'toJSON', '_composePath', '_identifierString'] | ||
Resource.defaults = ['materialize', 'toJSON', 'getPath', '_composePath', '_identifierString'] | ||
@@ -18,2 +18,6 @@ merge(Resource.prototype, { | ||
getPath: function() { | ||
return this.path; | ||
}, | ||
materialize: function(attributes) { | ||
@@ -42,3 +46,3 @@ var Constructor = this.constructor; | ||
save: function() { | ||
return this.client.put(this.path, this).then(function(response) { | ||
return this.client.put(this.getPath(), this).then(function(response) { | ||
return this.materialize(response.body); | ||
@@ -49,3 +53,3 @@ }.bind(this)); | ||
all: function(params) { | ||
return this.client.get(this.path, params).then(function(response) { | ||
return this.client.get(this.getPath(), params).then(function(response) { | ||
return response.body.map(this.materialize, this); | ||
@@ -56,7 +60,7 @@ }.bind(this)); | ||
list: function(params) { | ||
return new ListResource(this, this.path, params, this.client); | ||
return new ListResource(this, this.getPath(), params, this.client); | ||
}, | ||
create: function(data) { | ||
return this.client.post(this.path, data).then(function(response) { | ||
return this.client.post(this.getPath(), data).then(function(response) { | ||
return this.materialize(response.body); | ||
@@ -84,3 +88,3 @@ }.bind(this)); | ||
_composePath: function(id) { | ||
return id ? (this.path + '/' + encodeURIComponent(id)) : this.path; | ||
return id ? (this.getPath() + '/' + encodeURIComponent(id)) : this.getPath(); | ||
}, | ||
@@ -87,0 +91,0 @@ |
{ | ||
"name": "delighted", | ||
"version": "2.0.0", | ||
"version": "2.1.0-rc1", | ||
"description": "Delighted API Node Client", | ||
@@ -15,3 +15,3 @@ "main": "delighted.js", | ||
"lint": "jshint lib", | ||
"test": "mocha test/*_test.js test/**/*_test.js" | ||
"test": "mocha 'test/*_test.js' 'test/**/*_test.js'" | ||
}, | ||
@@ -18,0 +18,0 @@ "repository": { |
@@ -164,2 +164,31 @@ [![Build Status](https://travis-ci.org/delighted/delighted-node.svg?branch=master)](https://travis-ci.org/delighted/delighted-node) | ||
### Autopilot | ||
Retrieve existing autopilot configuration for a platform: | ||
```javascript | ||
delighted.autopilotConfiguration.retrieve('email'); | ||
delighted.autopilotConfiguration.retrieve('sms'); | ||
``` | ||
To interact with the autopilot person api, configure the autopilotMembership instance with the platform. You can list all people imported to Autopilot, add a new person, or delete an existing person: | ||
```javascript | ||
// List all people in Autopilot | ||
delighted.autopilotMembership.forEmail().list().autoPagingEach((person) => { | ||
console.log(person); | ||
}, { auto_handle_rate_limits: true }); | ||
delighted.autopilotMembership.forSms().list().autoPagingEach((person) => { | ||
console.log(person); | ||
}, { auto_handle_rate_limits: true }); | ||
// Create a new person | ||
delighted.autopilotMembership.forEmail().create({ person_email: 'email@example.com' }); | ||
delighted.autopilotMembership.forSms().create({ phone_number: '+15556667777' }); | ||
// Remove a person | ||
delighted.autopilotMembership.forEmail().delete({ person_email: 'email@example.com' }); | ||
delighted.autopilotMembership.forSms().delete( {phone_number: '+15556667777' }); | ||
``` | ||
## Rate limits | ||
@@ -166,0 +195,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
38395
25
692
283
1