Socket
Socket
Sign inDemoInstall

dispatch-node-sdk

Package Overview
Dependencies
Maintainers
5
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dispatch-node-sdk - npm Package Compare versions

Comparing version 0.0.36 to 0.0.37

lib/entities/survey.js

2

lib/dispatch.js

@@ -17,2 +17,3 @@ import _ from 'underscore';

import Configuration from './configuration';
import surveyMethods from './entities/survey';
import userMethods from './entities/user';

@@ -50,2 +51,3 @@

organizations: new Collection(this, endpoints.ORGANIZATIONS),
survey: surveyMethods(this),
user: userMethods(this),

@@ -52,0 +54,0 @@ users: new Collection(this, endpoints.USERS),

@@ -13,3 +13,4 @@ export const ACCOUNTS = '/v1/accounts';

export const ORGANIZATIONS = '/v1/organizations';
export const PUBLIC_SURVEY_RESPONSES = '/v1/public/survey_responses';
export const SURVEY_RESPONSES = '/v1/survey_responses';
export const USERS = '/v1/users';

@@ -101,3 +101,17 @@ import * as endpoints from '../endpoints';

},
getSurveys: (query = {}) => {
const 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);
},
});
}

@@ -180,2 +180,27 @@ import expect from 'expect';

});
describe('getSurveys', () => {
it('should call endpoint with correct default query string', () => {
const client = new Dispatch(testClientID, testClientSecret);
const scope = nock('https://api.dispatch.me')
.get(`${endpoints.SURVEY_RESPONSES}?filter[job_id_eq]=123`)
.reply(200);
client.setBearerToken(testBearerToken, testRefreshToken);
client.entities.job(123).getSurveys();
expect(scope.isDone()).toEqual(true);
});
it('should allow a specified query string', () => {
const client = new Dispatch(testClientID, testClientSecret);
const query = { filter: { is_submitted_eq: false } };
const scope = nock('https://api.dispatch.me')
.get(`${endpoints.SURVEY_RESPONSES}?filter[is_submitted_eq]=false&filter[job_id_eq]=123`)
.reply(200);
client.setBearerToken(testBearerToken, testRefreshToken);
client.entities.job(123).getSurveys(query);
expect(scope.isDone()).toEqual(true);
});
});
});

2

package.json
{
"name": "dispatch-node-sdk",
"version": "0.0.36",
"version": "0.0.37",
"description": "High- and low-level libraries for interacting with the Dispatch API",

@@ -5,0 +5,0 @@ "main": "dist/lib/index.js",

@@ -87,2 +87,34 @@ Dispatch JavaScript SDK

You can also get meta data (such as pagination, etc.) using `getCollectionWithMeta`:
```javascript
client.getCollectionWithMeta('/v1/jobs', {
filter: {
status_eq: 'unscheduled',
}
}).then(response => {
...
})
```
where response has the following structure:
```javascript
response: {
data: [...],
meta: {...},
}
```
if there are more then one sources of data returned from the API that are not meta:
```javascript
response: {
data: {
source1: [...],
source2: [...],
...
},
meta: {...},
}
```
#### Creating a Model

@@ -89,0 +121,0 @@ ```javascript

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc