Skip to content

Commit

Permalink
revert: Removing lock status (#165)
Browse files Browse the repository at this point in the history
revert(lock): Lock status commits

This reverts commit 67763d4.
This reverts commit 6029075.

---------

Co-authored-by: Adrian Garcia <joadgaji>
  • Loading branch information
wikiadrian authored Aug 25, 2023
1 parent 67763d4 commit 1cb68a5
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 257 deletions.
100 changes: 0 additions & 100 deletions doc/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ the following fields :</p>
<dd></dd>
<dt><a href="#Odometer">Odometer</a> : <code>Object</code></dt>
<dd></dd>
<dt><a href="#SecurityResponse">SecurityResponse</a> : <code>Object</code></dt>
<dd></dd>
<dt><a href="#Location">Location</a> : <code>Object</code></dt>
<dd></dd>
<dt><a href="#Attributes">Attributes</a> : <code>Object</code></dt>
Expand Down Expand Up @@ -628,7 +626,6 @@ 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)
* [.lockStatus()](#Vehicle+lockStatus) ⇒ <code>LockStatus</code>

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

Expand Down Expand Up @@ -983,19 +980,6 @@ 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+lockStatus"></a>

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

**Kind**: instance method of [<code>Vehicle</code>](#Vehicle)
**Throws**:

- [<code>SmartcarError</code>](#SmartcarError) - an instance of SmartcarError.
See the [errors section](https://github.com/smartcar/node-sdk/tree/master/doc#errors)
for all possible errors.

**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 Expand Up @@ -1333,90 +1317,6 @@ the following fields :
}
}
```
<a name="SecurityResponse"></a>
## SecurityResponse : <code>Object</code>
**Kind**: global typedef
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| isLocked | <code>Boolean</code> | Whether the vehicle is locked or not. |
| doors | <code>Array</code> | The status of each of the vehicle's doors. |
| windows | <code>Array</code> | The status of each of the vehicle's windows. |
| sunroof | <code>Array</code> | The status of each of the vehicle's sunroof. |
| storage | <code>Array</code> | The status of each of the vehicle's storage. |
| chargingPort | <code>Array</code> | The status of each of the vehicle's chargingPort. |
| meta | [<code>Meta</code>](#Meta) | |
**Example**
```js
{
isLocked: true,
doors: [
{
type: 'frontLeft',
status: 'LOCKED',
},
{
type: 'frontRight',
status: 'LOCKED',
},
{
type: 'backLeft',
status: 'LOCKED',
},
{
type: 'backRight',
status: 'LOCKED',
},
],
windows: [
{
type: 'frontLeft',
status: 'CLOSED',
},
{
type: 'frontRight',
status: 'CLOSED',
},
{
type: 'backLeft',
status: 'CLOSED',
},
{
type: 'backRight',
status: 'CLOSED',
},
],
sunroof: [
{
type: 'sunroof',
status: 'CLOSED',
},
],
storage: [
{
type: 'rear',
status: 'CLOSED',
},
{
type: 'front',
status: 'CLOSED',
},
],
chargingPort: [
{
type: 'chargingPort',
status: 'CLOSED',
},
],
meta: {
dataAge: new Date('2018-05-04T07:20:50.844Z'),
requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
},
}
```
<a name="Location"></a>
## Location : <code>Object</code>
Expand Down
1 change: 0 additions & 1 deletion lib/smartcar-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ 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
93 changes: 0 additions & 93 deletions lib/vehicle.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const METHODS_MAP = {
startCharge: {requestType: 'post', path: 'charge', body: {action: 'START'}},
stopCharge: {requestType: 'post', path: 'charge', body: {action: 'STOP'}},
disconnect: {requestType: 'delete', path: 'application'},
lockStatus: {path: 'security'},
};

/** @exports Vehicle */
Expand Down Expand Up @@ -596,86 +595,6 @@ Vehicle.prototype.request = async function(
* }
* }
*/

/**
* @type {Object}
* @typedef SecurityResponse
* @property {Boolean} isLocked - Whether the vehicle is locked or not.
* @property {Array} doors - The status of each of the vehicle's doors.
* @property {Array} windows - The status of each of the vehicle's windows.
* @property {Array} sunroof - The status of each of the vehicle's sunroof.
* @property {Array} storage - The status of each of the vehicle's storage.
* @property {Array} chargingPort - The status of each of the vehicle's chargingPort.
* @property {Meta} meta
*
* @example
* {
* isLocked: true,
* doors: [
* {
* type: 'frontLeft',
* status: 'LOCKED',
* },
* {
* type: 'frontRight',
* status: 'LOCKED',
* },
* {
* type: 'backLeft',
* status: 'LOCKED',
* },
* {
* type: 'backRight',
* status: 'LOCKED',
* },
* ],
* windows: [
* {
* type: 'frontLeft',
* status: 'CLOSED',
* },
* {
* type: 'frontRight',
* status: 'CLOSED',
* },
* {
* type: 'backLeft',
* status: 'CLOSED',
* },
* {
* type: 'backRight',
* status: 'CLOSED',
* },
* ],
* sunroof: [
* {
* type: 'sunroof',
* status: 'CLOSED',
* },
* ],
* storage: [
* {
* type: 'rear',
* status: 'CLOSED',
* },
* {
* type: 'front',
* status: 'CLOSED',
* },
* ],
* chargingPort: [
* {
* type: 'chargingPort',
* status: 'CLOSED',
* },
* ],
* meta: {
* dataAge: new Date('2018-05-04T07:20:50.844Z'),
* requestId: '26c14915-0c26-43c5-8e42-9edfc2a66a0f',
* },
* }
*/

/**
* @name Vehicle#odometer
* @function
Expand Down Expand Up @@ -828,16 +747,4 @@ Vehicle.prototype.request = async function(
* for all possible errors.
*/

/**
* @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 - 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.
*/

module.exports = Vehicle;
37 changes: 0 additions & 37 deletions test/end-to-end/vehicle.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ test.before(async(t) => {
getVehicle('FORD', [
'required:control_charge',
'required:control_security',
'required:read_security',
]),
getVehicle('KIA', [
'required:read_charge',
Expand Down Expand Up @@ -313,22 +312,6 @@ test('vehicle unlock', async(t) => {
t.is(response.meta.requestId.length, 36);
});

test('vehicle read security', async(t) => {
const response = await t.context.ford.lockStatus();
t.deepEqual(
_.xor(_.keys(response), [
'isLocked',
'doors',
'windows',
'sunroof',
'storage',
'chargingPort',
'meta',
]),
[],
);
});

test('vehicle startCharge', async(t) => {
const response = await t.context.ford.startCharge();
t.deepEqual(
Expand Down Expand Up @@ -394,26 +377,6 @@ test('vehicle batch', async(t) => {
t.is(location.meta.requestId.length, 36);
});

test('vehicle batch - security', async(t) => {
const response = await t.context.ford.batch([
'/security',
]);

const lockStatus = response.lockStatus();
t.deepEqual(
_.xor(_.keys(lockStatus), [
'isLocked',
'doors',
'windows',
'sunroof',
'storage',
'chargingPort',
'meta',
]),
[],
);
});

test('vehicle request - odometer', async(t) => {
const response = await t.context.volt.request(
'get',
Expand Down
26 changes: 0 additions & 26 deletions test/unit/lib/vehicle.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,29 +350,3 @@ test('request - set charge limit', async function(t) {
);
t.true(t.context.n.isDone());
});

test('request - security', async function(t) {
sinon.restore(); // clear all spys

t.context.n = nocks
.base()
.get('/security')
.reply(200,
{
isLocked: true,
doors: [],
windows: [],
storage: [],
sunroof: [],
chargingPort: [],
}, {'sc-request-id': 'requestId'});

const serviceRequestSpy = sinon.spy(vehicle.service, 'request');

const response = await vehicle.lockStatus();

t.true(serviceRequestSpy.calledOnceWith('get', 'security'));
t.is(response.meta.requestId, 'requestId');
t.is(response.isLocked, true);
t.true(t.context.n.isDone());
});

0 comments on commit 1cb68a5

Please sign in to comment.