dispatch-node-sdk
Advanced tools
Comparing version 3.14.0 to 3.15.0
@@ -27,2 +27,15 @@ "use strict"; | ||
}, | ||
addPhoto: function addPhoto(fileToken, name, description, privateBool, options) { | ||
var body = { | ||
entity_type: 'Organization', | ||
entity_id: id, | ||
description: description, | ||
name: name, | ||
file_token: fileToken, | ||
"private": privateBool | ||
}; | ||
return client.doAuthenticatedRequest('POST', _endpoints.ATTACHMENTS, body, options).then(function (response) { | ||
return response.attachment; | ||
}); | ||
}, | ||
dateIsInWorkHours: function dateIsInWorkHours(date) { | ||
@@ -29,0 +42,0 @@ if (!id || !date) throw new Error('Usage: organization(id).dateIsInWorkHours(date)'); |
@@ -68,2 +68,17 @@ "use strict"; | ||
}); | ||
describe('addPhoto', function () { | ||
it('should call endpoint with correct body', function () { | ||
var client = new _dispatch["default"](testClientID, testClientSecret); | ||
client.setBearerToken(testBearerToken, testRefreshToken); | ||
var scope = (0, _nock["default"])('https://api.dispatch.me').post("".concat(endpoints.ATTACHMENTS), { | ||
entity_type: 'Organization', | ||
entity_id: 123, | ||
file_token: '12345', | ||
name: 'test name', | ||
description: 'test description' | ||
}).reply(201); | ||
client.entities.organization(123).addPhoto('12345', 'test name', 'test description'); | ||
(0, _expect["default"])(scope.isDone()).toEqual(true); | ||
}); | ||
}); | ||
describe('dateIsInWorkHours', function () { | ||
@@ -70,0 +85,0 @@ it('should work for an organization that has hours and timezone set', function (done) { |
@@ -1,2 +0,2 @@ | ||
import { CONVERSATIONS, CUSTOMERS } from '../endpoints'; | ||
import { ATTACHMENTS, CONVERSATIONS, CUSTOMERS } from '../endpoints'; | ||
import { inWorkHours } from '../workHours'; | ||
@@ -12,2 +12,16 @@ | ||
}, | ||
addPhoto: (fileToken, name, description, privateBool, options) => { | ||
const body = { | ||
entity_type: 'Organization', | ||
entity_id: id, | ||
description, | ||
name, | ||
file_token: fileToken, | ||
private: privateBool, | ||
}; | ||
return client | ||
.doAuthenticatedRequest('POST', ATTACHMENTS, body, options) | ||
.then(response => response.attachment); | ||
}, | ||
dateIsInWorkHours: (date) => { | ||
@@ -14,0 +28,0 @@ if (!id || !date) throw new Error('Usage: organization(id).dateIsInWorkHours(date)'); |
@@ -78,2 +78,22 @@ import expect, { spyOn, restoreSpies } from 'expect'; | ||
describe('addPhoto', () => { | ||
it('should call endpoint with correct body', () => { | ||
const client = new Dispatch(testClientID, testClientSecret); | ||
client.setBearerToken(testBearerToken, testRefreshToken); | ||
const scope = nock('https://api.dispatch.me') | ||
.post(`${endpoints.ATTACHMENTS}`, { | ||
entity_type: 'Organization', | ||
entity_id: 123, | ||
file_token: '12345', | ||
name: 'test name', | ||
description: 'test description', | ||
}) | ||
.reply(201); | ||
client.entities | ||
.organization(123) | ||
.addPhoto('12345', 'test name', 'test description'); | ||
expect(scope.isDone()).toEqual(true); | ||
}); | ||
}); | ||
describe('dateIsInWorkHours', () => { | ||
@@ -80,0 +100,0 @@ it('should work for an organization that has hours and timezone set', (done) => { |
{ | ||
"name": "dispatch-node-sdk", | ||
"version": "3.14.0", | ||
"version": "3.15.0", | ||
"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
408656
10207