dispatch-node-sdk
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -67,2 +67,6 @@ 'use strict'; | ||
var _products = require('./products'); | ||
var _products2 = _interopRequireDefault(_products); | ||
var _rawClient = require('./rawClient'); | ||
@@ -150,2 +154,4 @@ | ||
this.configuration = new _configuration2.default(this); | ||
this.products = new _products2.default(this); | ||
} | ||
@@ -152,0 +158,0 @@ |
@@ -13,3 +13,3 @@ 'use strict'; | ||
var BRANDS = exports.BRANDS = '/v1/brands'; | ||
var CONVERSATIONS = exports.CONVERSATIONS = '/v1/conversations'; | ||
var CONVERSATION = exports.CONVERSATION = '/v1/conversation'; | ||
var CUSTOMERS = exports.CUSTOMERS = '/v1/customers'; | ||
@@ -16,0 +16,0 @@ var HYBRID_JOBS = exports.HYBRID_JOBS = '/v1/hybrid_jobs'; |
@@ -20,3 +20,5 @@ 'use strict'; | ||
return client.doAuthenticatedRequest('GET', _endpoints.CONVERSATIONS, { organization_id: organizationID, customer_user_id: customerUserID }).then(function (response) { | ||
var endpoint = _endpoints.CONVERSATION + '?organization_id=' + organizationID + '&customer_user_id=' + customerUserID; | ||
return client.doAuthenticatedRequest('GET', endpoint).then(function (response) { | ||
return response.conversation; | ||
@@ -23,0 +25,0 @@ }); |
@@ -15,2 +15,3 @@ import * as endpoints from './endpoints'; | ||
import organizationMethods from './entities/organization'; | ||
import Products from './products'; | ||
import RawClient, { AUTH_MODE_NONE, AUTH_MODE_BEARER } from './rawClient'; | ||
@@ -74,2 +75,4 @@ import Request from './request'; | ||
this.configuration = new Configuration(this); | ||
this.products = new Products(this); | ||
} | ||
@@ -76,0 +79,0 @@ |
@@ -8,3 +8,3 @@ export const ACCOUNTS = '/v1/accounts'; | ||
export const BRANDS = '/v1/brands'; | ||
export const CONVERSATIONS = '/v1/conversations'; | ||
export const CONVERSATION = '/v1/conversation'; | ||
export const CUSTOMERS = '/v1/customers'; | ||
@@ -11,0 +11,0 @@ export const HYBRID_JOBS = '/v1/hybrid_jobs'; |
@@ -1,2 +0,2 @@ | ||
import { CONVERSATIONS } from '../endpoints'; | ||
import { CONVERSATION } from '../endpoints'; | ||
@@ -10,4 +10,6 @@ export default function conversationMethods(client) { | ||
const endpoint = `${CONVERSATION}?organization_id=${organizationID}&customer_user_id=${customerUserID}`; | ||
return client | ||
.doAuthenticatedRequest('GET', CONVERSATIONS, { organization_id: organizationID, customer_user_id: customerUserID }) | ||
.doAuthenticatedRequest('GET', endpoint) | ||
.then(response => response.conversation); | ||
@@ -14,0 +16,0 @@ }, |
import expect from 'expect'; | ||
import Dispatch from '../dispatch'; | ||
import nock from 'nock'; | ||
import * as endpoints from '../endpoints'; | ||
import { CONVERSATION } from '../endpoints'; | ||
@@ -21,10 +21,9 @@ const testClientID = '12345'; | ||
it('should call the dispatch API endpoint with correct params', (done) => { | ||
const conversationOptionsSnakeCase = { organization_id: 456, customer_user_id: 789 }; | ||
const conversationOptionsCamelCase = { organizationID: 456, customerUserID: 789 }; | ||
const options = { organizationID: 456, customerUserID: 789 }; | ||
const conversationResponse = { ok: true }; | ||
const scope = nock('https://api.dispatch.me') | ||
.get(endpoints.CONVERSATIONS, conversationOptionsSnakeCase) | ||
.get(`${CONVERSATION}?organization_id=${options.organizationID}&customer_user_id=${options.customerUserID}`) | ||
.reply(200, { conversation: conversationResponse }); | ||
client.entities.conversation.getConversation(conversationOptionsCamelCase) | ||
client.entities.conversation.getConversation(options) | ||
.then((response) => { | ||
@@ -31,0 +30,0 @@ expect(scope.isDone()).toEqual(true); |
{ | ||
"name": "dispatch-node-sdk", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "High- and low-level libraries for interacting with the Dispatch API", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/index.js", |
@@ -6,2 +6,19 @@ Dispatch JavaScript SDK | ||
# Versioning | ||
There are now two maintained versions of Dispatch Javascript SDK. | ||
All versions will be remained publish, but our goal is two have at most 2 maintained versions at a time. | ||
The versions are version 1 and version 2 and can be found on the branches `trunk/1.X.X` and `trunk/2.X.X` respectively. | ||
When making changes to a version, please branch off of the proper trunk and then submit a PR into that trunk. | ||
If the change needs to go into both versions, please submit a PR for each version and then each version will be incremented and published separately. | ||
## Key Differences: | ||
### Version 1 | ||
All API endpoints point to the v1 endpoints of the Dispatch API. | ||
### Version 2 | ||
All API endpoints point to the v1 endpoints of the Dispatch API with the exception of the jobs endpoint. | ||
The jobs endpoint now points to the v2 endpoint. | ||
Also, the endpoints for job offers and hybdrid jobs have been removed. | ||
# Installation | ||
@@ -161,3 +178,3 @@ ``` | ||
Get one customer by **id**: | ||
```client.entities.customer(:id)``` | ||
@@ -164,0 +181,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
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
234955
74
6094
282