dispatch-node-sdk
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -21,2 +21,14 @@ 'use strict'; | ||
var _queryString = require('./queryString'); | ||
var queryString = _interopRequireWildcard(_queryString); | ||
var _job = require('./entities/job'); | ||
var _job2 = _interopRequireDefault(_job); | ||
var _Collection = require('./entities/Collection'); | ||
var _Collection2 = _interopRequireDefault(_Collection); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -28,6 +40,6 @@ | ||
var DEFAULT_PER_PAGE = 20; | ||
var Dispatch = function () { | ||
function Dispatch(clientID, clientSecret) { | ||
var _this = this; | ||
var host = arguments.length <= 2 || arguments[2] === undefined ? 'https://api.dispatch.me' : arguments[2]; | ||
@@ -41,14 +53,4 @@ | ||
this.entities = { | ||
job: function job(jobId) { | ||
return { | ||
getNotes: function getNotes() { | ||
var filters = { | ||
file_token_null: 1, | ||
entity_type: 'Job', | ||
entity_id: jobId | ||
}; | ||
return _this.getCollection(endpoints.ATTACHMENTS, filters); | ||
} | ||
}; | ||
} | ||
job: (0, _job2.default)(this), | ||
jobs: new _Collection2.default(this, endpoints.JOBS) | ||
}; | ||
@@ -118,3 +120,3 @@ } | ||
value: function loginEmailPassword(email, password) { | ||
var _this2 = this; | ||
var _this = this; | ||
@@ -128,3 +130,3 @@ return this.getNoAuthClient().post('/oauth/token', { | ||
}).then(function (response) { | ||
return _this2.handleBearerToken(response.access_token, response.refresh_token); | ||
return _this.handleBearerToken(response.access_token, response.refresh_token); | ||
}); | ||
@@ -156,6 +158,6 @@ } | ||
value: function loginPhoneNumber(phoneNumber, verificationCode) { | ||
var _this3 = this; | ||
var _this2 = this; | ||
return this.getNoAuthClient().post('/v1/phone_numbers/' + phoneNumber + '/verification_codes/' + verificationCode).then(function (response) { | ||
return _this3.handleBearerToken(response.access_token, response.refresh_token); | ||
return _this2.handleBearerToken(response.access_token, response.refresh_token); | ||
}); | ||
@@ -179,3 +181,3 @@ } | ||
value: function exchangeToken() { | ||
var _this4 = this; | ||
var _this3 = this; | ||
@@ -190,3 +192,3 @@ var refreshToken = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0]; | ||
}).then(function (response) { | ||
return _this4.handleBearerToken(response.access_token, response.refresh_token); | ||
return _this3.handleBearerToken(response.access_token, response.refresh_token); | ||
}); | ||
@@ -209,10 +211,6 @@ } | ||
var fullPath = endpoint; | ||
if (filter) { | ||
(function () { | ||
var queryParams = []; | ||
Object.getOwnPropertyNames(filter).forEach(function (prop) { | ||
queryParams.push('filter[' + prop + ']=' + encodeURIComponent(filter[prop])); | ||
}); | ||
fullPath = fullPath + '?' + queryParams.join('&'); | ||
})(); | ||
var queryParams = queryString.stringify(filter); | ||
fullPath = fullPath + '?' + queryParams; | ||
} | ||
@@ -238,4 +236,5 @@ | ||
value: function getModel(endpoint, id) { | ||
var model = new _model2.default({ id: id }, endpoint, this.getAuthClient()); | ||
return model.refresh(); | ||
return this.getAuthClient().get(endpoint + '?filter[id_eq]=' + id).then(function (response) { | ||
return response[Object.keys(response)[0]][0]; | ||
}); | ||
} | ||
@@ -242,0 +241,0 @@ |
@@ -6,2 +6,13 @@ 'use strict'; | ||
}); | ||
var ATTACHMENTS = exports.ATTACHMENTS = '/v1/attachments'; | ||
var ACCOUNTS = exports.ACCOUNTS = '/v1/accounts'; | ||
var APPOINTMENTS = exports.APPOINTMENTS = '/v1/appointments'; | ||
var ATTACHMENTS = exports.ATTACHMENTS = '/v1/attachments'; | ||
var BILLING_CONTRACTS = exports.BILLING_CONTRACTS = '/v2/billing_contracts'; | ||
var BILLING_DOCUMENTS = exports.BILLING_DOCUMENTS = '/v2/billing_documents'; | ||
var BILLING_ITEMS = exports.BILLING_ITEMS = '/v2/billing_items'; | ||
var BRANDS = exports.BRANDS = '/v1/brands'; | ||
var CUSTOMERS = exports.CUSTOMERS = '/v1/customers'; | ||
var HYBRID_JOBS = exports.HYBRID_JOBS = '/v1/hybrid_jobs'; | ||
var JOBS = exports.JOBS = '/v1/jobs'; | ||
var SURVEY_RESPONSES = exports.SURVEY_RESPONSES = '/v1/survey_responses'; | ||
var USERS = exports.USERS = '/v1/users'; |
{ | ||
"name": "dispatch-node-sdk", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "High- and low-level libraries for interacting with the Dispatch API", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/index.js", |
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
81884
37
2075