Skip to content

Commit 23cdac8

Browse files
Merge pull request #179 from particle-iot/feature/sc-124365/particle-api-js-fix-setledgerinstance-having
feat: [sc-124365] Fix setLedgerInstance Having Wrong Request Body
2 parents b19e641 + 2c4ab73 commit 23cdac8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/Particle.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,17 +2485,17 @@ class Particle {
24852485
* @param {string} [options.org] The Organization ID or slug. If not provided, the request will go to your sandbox account.
24862486
* @param {string} options.ledgerName Ledger name.
24872487
* @param {string} options.scopeValue Scope value.
2488-
* @param {object} options.data The data to set to the instance
2488+
* @param {object} options.instance The instance with the data
24892489
* @param {Object} [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
24902490
* @param {Object} [options.context] Request context.
24912491
*
24922492
* @returns {Promise<RequestResponse>} A promise that resolves to the updated ledger instance data.
24932493
*/
2494-
setLedgerInstance({ auth, org, ledgerName, scopeValue, data, headers, context }) {
2494+
setLedgerInstance({ auth, org, ledgerName, scopeValue, instance, headers, context }) {
24952495
return this.put({
24962496
uri: this._namespacedPath(org, `ledgers/${ledgerName}/instances/${scopeValue}`),
24972497
auth,
2498-
data: { data },
2498+
data: { instance },
24992499
headers,
25002500
context
25012501
});

test/Particle.spec.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ const props = {
142142
description: 'my ledger',
143143
direction: 'Downstream'
144144
},
145-
scopeValue: '1234'
145+
scopeValue: '1234',
146+
instance: {
147+
property: 'yes'
148+
}
146149
};
147150

148151
const product = 'ze-product-v1';
@@ -2869,8 +2872,8 @@ describe('ParticleAPI', () => {
28692872
uri: `/v1/orgs/${org}/ledgers/${props.ledgerName}/instances/${props.scopeValue}`,
28702873
auth: props.auth,
28712874
data: {
2872-
data: {
2873-
sentient: true
2875+
instance: {
2876+
property: 'yes'
28742877
}
28752878
}
28762879
});

0 commit comments

Comments
 (0)