Socket
Socket
Sign inDemoInstall

dispatch-node-sdk

Package Overview
Dependencies
Maintainers
21
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 3.14.0 to 3.15.0

13

dist/lib/entities/organization.js

@@ -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) {

16

lib/entities/organization.js

@@ -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) => {

2

package.json
{
"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",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc