dispatch-node-sdk
Advanced tools
Comparing version 0.0.38 to 0.0.39
@@ -69,6 +69,2 @@ 'use strict'; | ||
var _survey = require('./entities/survey'); | ||
var _survey2 = _interopRequireDefault(_survey); | ||
var _user = require('./entities/user'); | ||
@@ -119,3 +115,2 @@ | ||
organizations: new _Collection2.default(this, endpoints.ORGANIZATIONS), | ||
survey: (0, _survey2.default)(this), | ||
user: (0, _user2.default)(this), | ||
@@ -122,0 +117,0 @@ users: new _Collection2.default(this, endpoints.USERS) |
@@ -18,4 +18,3 @@ 'use strict'; | ||
var ORGANIZATIONS = exports.ORGANIZATIONS = '/v1/organizations'; | ||
var PUBLIC_SURVEY_RESPONSES = exports.PUBLIC_SURVEY_RESPONSES = '/v1/public/survey_responses'; | ||
var SURVEY_RESPONSES = exports.SURVEY_RESPONSES = '/v1/survey_responses'; | ||
var USERS = exports.USERS = '/v1/users'; |
@@ -120,18 +120,2 @@ 'use strict'; | ||
}); | ||
}, | ||
getSurveys: function getSurveys() { | ||
var query = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var DEFAULT_QUERY = { | ||
job_id_eq: id | ||
}; | ||
if (query.filter) { | ||
query.filter = Object.assign({}, query.filter, DEFAULT_QUERY); | ||
} else { | ||
query.filter = DEFAULT_QUERY; | ||
} | ||
return client.getCollection(endpoints.SURVEY_RESPONSES, query); | ||
} | ||
@@ -138,0 +122,0 @@ }; |
@@ -275,3 +275,2 @@ import _ from 'underscore'; | ||
} | ||
return this.doAuthenticatedRequest('GET', fullPath).then(response => { | ||
@@ -278,0 +277,0 @@ if (opts.raw === true) { |
@@ -1,2 +0,2 @@ | ||
import { CUSTOMERS } from '../endpoints'; | ||
import { CUSTOMERS, ATTACHMENTS } from '../endpoints'; | ||
@@ -10,3 +10,12 @@ export default function customerMethods(client) { | ||
}, | ||
getAttachments: () => { | ||
const query = { | ||
filter: { | ||
entity_type: 'Customer', | ||
entity_id: id, | ||
}, | ||
}; | ||
return client.getCollection(ATTACHMENTS, query); | ||
}, | ||
}); | ||
} |
@@ -27,2 +27,13 @@ import expect from 'expect'; | ||
}); | ||
describe('attachments', () => { | ||
it('should return the right attachments for a customer', () => { | ||
const client = new Dispatch(testClientID, testClientSecret); | ||
client.setBearerToken(testBearerToken, testRefreshToken); | ||
const scope = nock('https://api.dispatch.me') | ||
.get(`${endpoints.ATTACHMENTS}?filter[entity_type]=Customer&filter[entity_id]=456`) | ||
.reply(200); | ||
client.entities.customer(456).getAttachments(); | ||
expect(scope.isDone()).toEqual(true); | ||
}); | ||
}); | ||
}); |
{ | ||
"name": "dispatch-node-sdk", | ||
"version": "0.0.38", | ||
"version": "0.0.39", | ||
"description": "High- and low-level libraries for interacting with the Dispatch API", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/index.js", |
@@ -156,2 +156,19 @@ Dispatch JavaScript SDK | ||
## Entities | ||
### customers | ||
Get one customer by **id**: | ||
```client.entities.customer(:id)``` | ||
Update one customer by **id** and **properties**: | ||
```client.entities.customer(:id).update(: properties)``` | ||
Get all attachments for a customer by **id**: | ||
```client.entities.customer(:id).getAttachments()``` | ||
## Auxiliary Services | ||
@@ -158,0 +175,0 @@ The Dispatch client has built-in support for interacting with auxiliary Dispatch APIs such as the Files API or Configuration Service. You should not have to use this directly as there are abstracted functions like `uploadFile` and `configuration.getForEntity` that make use of it, but if you need to, you can do the following: |
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
265
173914
59
4469