dispatch-node-sdk
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -47,2 +47,12 @@ 'use strict'; | ||
}); | ||
}, | ||
addNote: function addNote(text) { | ||
return client.getAuthClient().post(endpoints.ATTACHMENTS, { | ||
entity_type: 'Job', | ||
entity_id: id, | ||
description: text | ||
}).then(function (response) { | ||
return response.attachment; | ||
}); | ||
} | ||
@@ -49,0 +59,0 @@ }; |
@@ -110,3 +110,3 @@ import nock from 'nock'; | ||
client.getCollection('/v1/jobs', null, {raw: true}).then(response => { | ||
client.getCollection('/v1/jobs', null, { raw: true }).then(response => { | ||
expect(response.jobs.length).toEqual(2); | ||
@@ -113,0 +113,0 @@ done(); |
@@ -44,2 +44,12 @@ import * as endpoints from '../endpoints'; | ||
}, | ||
addNote: (text) => { | ||
return client.getAuthClient().post(endpoints.ATTACHMENTS, { | ||
entity_type: 'Job', | ||
entity_id: id, | ||
description: text, | ||
}).then(response => { | ||
return response.attachment; | ||
}); | ||
}, | ||
}; | ||
@@ -46,0 +56,0 @@ }; |
@@ -98,2 +98,18 @@ import expect from 'expect'; | ||
}); | ||
describe('addNote', () => { | ||
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: 'Job', | ||
entity_id: 123, | ||
description: 'Test note', | ||
}) | ||
.reply(201); | ||
client.entities.job(123).addNote('Test note'); | ||
expect(scope.isDone()).toEqual(true); | ||
}); | ||
}); | ||
}); |
@@ -17,3 +17,2 @@ function getNodesList(obj) { | ||
} | ||
} else { | ||
@@ -20,0 +19,0 @@ nodes.push([prop, val]); |
@@ -17,3 +17,3 @@ import expect from 'expect'; | ||
it.only('should work with a nested object with arrays', () => { | ||
it('should work with a nested object with arrays', () => { | ||
expect(stringify({ | ||
@@ -24,3 +24,3 @@ foo: 'bar', | ||
boop: { | ||
foop: ['1', '2','3','4'], | ||
foop: ['1', '2', '3', '4'], | ||
}, | ||
@@ -27,0 +27,0 @@ })).toEqual('foo=bar&baz=true&bing=10&boop[foop][]=1&boop[foop][]=2&boop[foop][]=3&boop[foop][]=4'); |
{ | ||
"name": "dispatch-node-sdk", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"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
65365
1665