particle-api-js
Advanced tools
Comparing version 5.2.6 to 5.2.7
# changelog | ||
## 5.2.7 - 2 May 2016 | ||
* Fix files parameter default name to be `file` and not `file1`. | ||
## 5.2.6 - 25 Mar 2016 | ||
@@ -4,0 +8,0 @@ |
# callFunction | ||
[src/Particle.js:258-262](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L258-L262 "Source code on GitHub") | ||
[src/Particle.js:258-262](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L258-L262 "Source code on GitHub") | ||
@@ -19,3 +19,3 @@ Call a device function | ||
[src/Particle.js:92-97](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L92-L97 "Source code on GitHub") | ||
[src/Particle.js:92-97](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L92-L97 "Source code on GitHub") | ||
@@ -35,3 +35,3 @@ Claim a device to the account. The device must be online and unclaimed. | ||
[src/Particle.js:204-213](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L204-L213 "Source code on GitHub") | ||
[src/Particle.js:204-213](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L204-L213 "Source code on GitHub") | ||
@@ -52,3 +52,3 @@ Compile firmware using the Particle Cloud | ||
[src/Particle.js:38-42](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L38-L42 "Source code on GitHub") | ||
[src/Particle.js:38-42](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L38-L42 "Source code on GitHub") | ||
@@ -67,3 +67,3 @@ Create a user account for the Particle Cloud | ||
[src/Particle.js:331-339](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L331-L339 "Source code on GitHub") | ||
[src/Particle.js:331-339](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L331-L339 "Source code on GitHub") | ||
@@ -91,3 +91,3 @@ Create a webhook | ||
[src/Particle.js:347-349](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L347-L349 "Source code on GitHub") | ||
[src/Particle.js:347-349](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L347-L349 "Source code on GitHub") | ||
@@ -106,3 +106,3 @@ Delete a webhook | ||
[src/Particle.js:221-230](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L221-L230 "Source code on GitHub") | ||
[src/Particle.js:221-230](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L221-L230 "Source code on GitHub") | ||
@@ -121,3 +121,3 @@ Download a firmware binary | ||
[src/Particle.js:173-182](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L173-L182 "Source code on GitHub") | ||
[src/Particle.js:173-182](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L173-L182 "Source code on GitHub") | ||
@@ -138,3 +138,3 @@ Compile and flash application firmware to a device | ||
[src/Particle.js:190-194](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L190-L194 "Source code on GitHub") | ||
[src/Particle.js:190-194](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L190-L194 "Source code on GitHub") | ||
@@ -153,3 +153,3 @@ Flash the Tinker application to a device | ||
[src/Particle.js:126-128](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L126-L128 "Source code on GitHub") | ||
[src/Particle.js:126-128](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L126-L128 "Source code on GitHub") | ||
@@ -168,3 +168,3 @@ Generate a claim code to use in the device claiming process. | ||
[src/Particle.js:82-84](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L82-L84 "Source code on GitHub") | ||
[src/Particle.js:82-84](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L82-L84 "Source code on GitHub") | ||
@@ -183,3 +183,3 @@ Get detailed informationa about a device | ||
[src/Particle.js:274-298](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L274-L298 "Source code on GitHub") | ||
[src/Particle.js:274-298](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L274-L298 "Source code on GitHub") | ||
@@ -202,3 +202,3 @@ Get a stream of events | ||
[src/Particle.js:365-367](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L365-L367 "Source code on GitHub") | ||
[src/Particle.js:365-367](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L365-L367 "Source code on GitHub") | ||
@@ -216,3 +216,3 @@ Get details about the current user | ||
[src/Particle.js:148-150](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L148-L150 "Source code on GitHub") | ||
[src/Particle.js:148-150](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L148-L150 "Source code on GitHub") | ||
@@ -232,3 +232,3 @@ Get the value of a device variable | ||
[src/Particle.js:63-65](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L63-L65 "Source code on GitHub") | ||
[src/Particle.js:63-65](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L63-L65 "Source code on GitHub") | ||
@@ -247,3 +247,3 @@ List all valid access tokens for a Particle Cloud account | ||
[src/Particle.js:393-399](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L393-L399 "Source code on GitHub") | ||
[src/Particle.js:393-399](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L393-L399 "Source code on GitHub") | ||
@@ -262,3 +262,3 @@ List valid build targets to be used for compiling | ||
[src/Particle.js:72-74](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L72-L74 "Source code on GitHub") | ||
[src/Particle.js:72-74](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L72-L74 "Source code on GitHub") | ||
@@ -276,3 +276,3 @@ List devices claimed to the account | ||
[src/Particle.js:356-358](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L356-L358 "Source code on GitHub") | ||
[src/Particle.js:356-358](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L356-L358 "Source code on GitHub") | ||
@@ -290,3 +290,3 @@ List all webhooks owned by the account | ||
[src/Particle.js:21-30](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L21-L30 "Source code on GitHub") | ||
[src/Particle.js:21-30](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L21-L30 "Source code on GitHub") | ||
@@ -306,3 +306,3 @@ Login to Particle Cloud using an existing Particle acccount. | ||
[src/Particle.js:308-314](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L308-L314 "Source code on GitHub") | ||
[src/Particle.js:308-314](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L308-L314 "Source code on GitHub") | ||
@@ -323,3 +323,3 @@ Publish a event to the Particle Cloud | ||
[src/Particle.js:51-55](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L51-L55 "Source code on GitHub") | ||
[src/Particle.js:51-55](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L51-L55 "Source code on GitHub") | ||
@@ -339,3 +339,3 @@ Revoke an access token | ||
[src/Particle.js:105-107](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L105-L107 "Source code on GitHub") | ||
[src/Particle.js:105-107](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L105-L107 "Source code on GitHub") | ||
@@ -354,3 +354,3 @@ Unclaim / Remove a device from your account | ||
[src/Particle.js:116-118](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L116-L118 "Source code on GitHub") | ||
[src/Particle.js:116-118](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L116-L118 "Source code on GitHub") | ||
@@ -370,3 +370,3 @@ Rename a device | ||
[src/Particle.js:240-248](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L240-L248 "Source code on GitHub") | ||
[src/Particle.js:240-248](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L240-L248 "Source code on GitHub") | ||
@@ -387,3 +387,3 @@ Send a new device public key to the Particle Cloud | ||
[src/Particle.js:159-163](https://github.com/spark/particle-api-js/blob/fcc35d0601f35e273ea09f4b37c3cfe1f8cb4f7e/src/Particle.js#L159-L163 "Source code on GitHub") | ||
[src/Particle.js:159-163](https://github.com/spark/particle-api-js/blob/ba89f4b44be0dcfebfd66f7020a3afadf96cfd9e/src/Particle.js#L159-L163 "Source code on GitHub") | ||
@@ -390,0 +390,0 @@ Instruct the device to turn on/off the LED in a rainbow pattern |
@@ -662,4 +662,2 @@ 'use strict'; | ||
value: function request(_ref31) { | ||
var _this = this; | ||
var uri = _ref31.uri; | ||
@@ -677,2 +675,29 @@ var method = _ref31.method; | ||
var requestFiles = undefined; | ||
if (files) { | ||
requestFiles = {}; | ||
Object.keys(files).forEach(function (k, i) { | ||
var name = i ? 'file' + (i + 1) : 'file'; | ||
requestFiles[name] = { | ||
data: files[k], | ||
path: k | ||
}; | ||
}); | ||
} | ||
return this._request({ uri: uri, method: method, data: data, auth: auth, query: query, form: form, files: requestFiles }); | ||
} | ||
}, { | ||
key: '_request', | ||
value: function _request(_ref32) { | ||
var _this = this; | ||
var uri = _ref32.uri; | ||
var method = _ref32.method; | ||
var data = _ref32.data; | ||
var auth = _ref32.auth; | ||
var query = _ref32.query; | ||
var form = _ref32.form; | ||
var files = _ref32.files; | ||
return new Promise(function (fulfill, reject) { | ||
@@ -686,4 +711,4 @@ var req = (0, _superagent2.default)(method, uri); | ||
if (files) { | ||
Object.keys(files).forEach(function (k, i) { | ||
req.attach('file' + (i + 1), files[k], k); | ||
Object.keys(files).forEach(function (k) { | ||
req.attach(k, files[k].data, files[k].path); | ||
}); | ||
@@ -690,0 +715,0 @@ if (form) { |
{ | ||
"name": "particle-api-js", | ||
"version": "5.2.6", | ||
"version": "5.2.7", | ||
"description": "Particle API Client", | ||
@@ -5,0 +5,0 @@ "main": "lib/Particle.js", |
@@ -76,3 +76,3 @@ const should = require('should'); // monkeypatch the world~!1 | ||
*/ | ||
sinon.stub(api, 'request', (opts) => { | ||
sinon.stub(api, '_request', (opts) => { | ||
return new Promise((resolve) => resolve(opts)); | ||
@@ -220,2 +220,3 @@ }); | ||
files.should.be.instanceOf(Object); | ||
files.should.have.property('file').and.be.ok; | ||
form.build_target_version.should.equal(props.targetVersion); | ||
@@ -235,2 +236,3 @@ }); | ||
files.should.be.instanceOf(Object); | ||
files.should.have.property('file').and.be.ok; | ||
form.build_target_version.should.equal(props.targetVersion); | ||
@@ -237,0 +239,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
961935
21
2470