Skip to content

Commit

Permalink
fix(batch): Fix the lock status method name in batching (#164)
Browse files Browse the repository at this point in the history
* fix(batch): Fix the lock status method name in batching

We added the security path in the map to translate it to lockStatus

Asana: https://app.asana.com/0/1205281929337658/1205139255747900/f

---------

Co-authored-by: Adrian Garcia <joadgaji>
  • Loading branch information
wikiadrian authored Aug 25, 2023
1 parent 6029075 commit 67763d4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions doc/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ Initializes a new Service object to make requests to the Smartcar API.
* [.startCharge()](#Vehicle+startCharge)[<code>ActionResponse</code>](#ActionResponse)
* [.stopCharge()](#Vehicle+stopCharge)[<code>ActionResponse</code>](#ActionResponse)
* [.disconnect()](#Vehicle+disconnect)[<code>ActionResponse</code>](#ActionResponse)
* [.security()](#Vehicle+security)[<code>SecurityResponse</code>](#SecurityResponse)
* [.lockStatus()](#Vehicle+lockStatus) ⇒ <code>LockStatus</code>

<a name="new_Vehicle_new"></a>

Expand Down Expand Up @@ -983,9 +983,9 @@ to make requests to it again.
for all possible errors.

**See**: [Smartcar API Doc - Disconnect](https://smartcar.com/docs/api#delete-disconnect)
<a name="Vehicle+security"></a>
<a name="Vehicle+lockStatus"></a>

### vehicle.security() ⇒ [<code>SecurityResponse</code>](#SecurityResponse)
### vehicle.lockStatus() ⇒ <code>LockStatus</code>
Returns the lock status of the vehicle.

**Kind**: instance method of [<code>Vehicle</code>](#Vehicle)
Expand All @@ -995,7 +995,7 @@ Returns the lock status of the vehicle.
See the [errors section](https://github.com/smartcar/node-sdk/tree/master/doc#errors)
for all possible errors.

**See**: [Smartcar API Doc - Security](https://smartcar.com/docs/api#get-security)
**See**: [Smartcar API Doc - Lock Status](https://smartcar.com/docs/api#get-security)
<a name="METHODS_MAP"></a>

## METHODS\_MAP : <code>object.&lt;String, Object&gt;</code>
Expand Down
1 change: 1 addition & 0 deletions lib/smartcar-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const getNameFromPath = (path) => {
// '/' should have a method name of 'attributes'
// '/tires/pressure' should be tirePressure and NOT tiresPressure
const BATCH_PATH_TO_ATTRIBUTE = {
'/security': 'lockStatus',
'/tires/pressure': 'tirePressure',
'/': 'attributes',
};
Expand Down
6 changes: 3 additions & 3 deletions lib/vehicle.js
Original file line number Diff line number Diff line change
Expand Up @@ -829,12 +829,12 @@ Vehicle.prototype.request = async function(
*/

/**
* @name Vehicle#security
* @name Vehicle#lockStatus
* @function
* @memberof Vehicle
* @description Returns the lock status of the vehicle.
* @see {@link https://smartcar.com/docs/api#get-security|Smartcar API Doc - Security}
* @return {SecurityResponse}
* @see {@link https://smartcar.com/docs/api#get-security|Smartcar API Doc - Lock Status}
* @return {LockStatus}
* @throws {SmartcarError} - an instance of SmartcarError.
* See the [errors section](https://github.com/smartcar/node-sdk/tree/master/doc#errors)
* for all possible errors.
Expand Down
4 changes: 2 additions & 2 deletions test/end-to-end/vehicle.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,9 @@ test('vehicle batch - security', async(t) => {
'/security',
]);

const security = response.security();
const lockStatus = response.lockStatus();
t.deepEqual(
_.xor(_.keys(security), [
_.xor(_.keys(lockStatus), [
'isLocked',
'doors',
'windows',
Expand Down

0 comments on commit 67763d4

Please sign in to comment.