Skip to content

Commit

Permalink
Merge fa5a2a1 into 0541063
Browse files Browse the repository at this point in the history
  • Loading branch information
mseminatore committed Nov 16, 2018
2 parents 0541063 + fa5a2a1 commit a2fb674
Show file tree
Hide file tree
Showing 48 changed files with 98 additions and 96 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
# TeslaJS Change log

## V4.0.0
* migrated to all lower-case

## V3.0.0
* addressed #47

Expand Down
32 changes: 31 additions & 1 deletion MIGRATION.md
@@ -1,6 +1,36 @@
# TeslaJS Migration Buid

## V2.x to V3.0.0
## V3.x to V4.x

Unfortunately we learned recently that npm does not respect case-sensitive file systems.
As a result on Mac and Linux if you:

npm install teslajs

as the library documentation suggests, npm will install the library under node_modules
into a directory called `teslajs`. This will break calls to `require("TeslaJS")`.
However, if you instead:

npm install TeslaJS

npm will install the library under node_modules into a directory called `TeslaJS`.
This will work correctly with `require("TelsaJS")`. It seems the right solution is
to attempt to remove case issues from the equation.

Unfortunately the rules of `semver` say this is a breaking change, thus the bump
from 3.x to 4.x. So the **big** change from 3.x to 4.x is simply to update all `require`
statements to use all lower-case as in:

npm install teslajs
...
require('teslajs');

Since I was removing case from the equation I also renamed the `Examples` dir to
be `samples` instead.

Apologies for the churn!

## V2.x to V3.x

The primary breaking change in V3.x compared to 2.x is the API renaming change of
`allVehicles()` to `vehicles()` and `vehicles()` to `vehicle()`.
24 changes: 12 additions & 12 deletions README.md
Expand Up @@ -49,13 +49,13 @@ You can read the complete history of changes in the

Here are some of the more recent features and fixes:

1. In **3.0.0** rationalized the `vehicle()` and `vehicles()` interfaces
2. In **2.1.46** fix incorrect media endpoints
3. In **2.1.45** added media playback sample and methods
4. In **2.1.44** added minified version
5. In **2.1.43** added support and samples for software update and navigation request endpoints
1. In **4.0.0** migrated to lower-case lib name
2. In **3.0.0** rationalized the `vehicle()` and `vehicles()` interfaces
3. In **2.1.46** fix incorrect media endpoints
4. In **2.1.45** added media playback sample and methods
5. In **2.1.44** added minified version

## Migrating major versions
## Migrating Major Version Changes

You can find instructions on how to migrate across major version changes by reading
the [MIGRATION](https://github.com/mseminatore/TeslaJS/blob/master/MIGRATION.md) guide.
Expand Down Expand Up @@ -185,14 +185,14 @@ To do so, from your project directory type:

npm update

# Usage Examples
# Library Usage Examples

## Login Example

As you can see below, it is very simple to login and acquire an OAuth token.

```javascript
var tjs = require('TeslaJS');
var tjs = require('teslajs');

var username = "<your MyTesla email>";
var password = "<your MyTesla password>";
Expand Down Expand Up @@ -450,11 +450,11 @@ Sample | Description
## login.js

This sample demonstrates the basic login process which returns the OAuth token required for other API calls. The sample
writes out a file called **.token** which stores the OAuth token. Other samples will use this cached token if present
to avoid the need to enter the **username** and **password** and login via the Tesla servers.
writes out a file called **.token** which stores the OAuth token. Other samples will use this cached token, if present,
to avoid the need to request the **username** and **password** and login redundantly via the Tesla servers.

>If you prefer not to have your OAuth token stored locally do not run this sample. Instead you may run the samples and provide
>the **username** and **password** each time on the command line.
> If you prefer not to have your OAuth token stored locally do not run this sample. Instead you may run the samples and provide
> the **username** and **password** each time on the command line.
Usage:

Expand Down
2 changes: 1 addition & 1 deletion docgen.cmd
@@ -1,6 +1,6 @@
@echo off

echo========================== Generating Docs ================================
cmd /c ".\node_modules\.bin\jsdoc2md" TeslaJS.js > docs\DOCS.md
cmd /c ".\node_modules\.bin\jsdoc2md" teslajs.js > docs\DOCS.md
echo ..Documentation generated..
echo===========================================================================
113 changes: 41 additions & 72 deletions docs/DOCS.md
Expand Up @@ -96,22 +96,16 @@
<dt><a href="#logoutAsync">logoutAsync(authToken)</a> ⇒ <code>Promise</code></dt>
<dd><p>Logout and invalidate the current auth token</p>
</dd>
<dt><a href="#vehicles">vehicles(options, callback)</a> ⇒ <code>Vehicle</code></dt>
<dd><p>Return vehicle information on the requested vehicle</p>
</dd>
<dt><a href="#vehicle">vehicle(options, callback)</a> ⇒ <code>Vehicle</code></dt>
<dd><p>Return vehicle information on the requested vehicle</p>
</dd>
<dt><a href="#vehicleAsync">vehicleAsync(options)</a> ⇒ <code>Promise</code></dt>
<dd><p>Return vehicle information on the requested vehicle</p>
</dd>
<dt><a href="#vehiclesAsync">vehiclesAsync(options)</a> ⇒ <code>Promise</code></dt>
<dd><p>Return vehicle information on the requested vehicle</p>
</dd>
<dt><a href="#allVehicles">allVehicles(options, callback)</a> ⇒ <code>Array.&lt;Vehicles&gt;</code></dt>
<dt><a href="#vehicles">vehicles(options, callback)</a> ⇒ <code>Array.&lt;Vehicles&gt;</code></dt>
<dd><p>Return vehicle information on ALL vehicles</p>
</dd>
<dt><a href="#allVehiclesAsync">allVehiclesAsync(options, callback)</a> ⇒ <code>Promise</code></dt>
<dt><a href="#vehiclesAsync">vehiclesAsync(options, callback)</a> ⇒ <code>Promise</code></dt>
<dd><p>Return vehicle information on ALL vehicles</p>
</dd>
<dt><a href="#get_command">get_command(options, command, callback)</a></dt>
Expand Down Expand Up @@ -386,12 +380,12 @@ Note: charging to 100% frequently is NOT recommended for long-term battery healt
## Typedefs

<dl>
<dt><a href="#optionsType">optionsType</a> : <code>object</code></dt>
<dd><p>TeslaJS options parameter</p>
</dd>
<dt><a href="#nodeBack">nodeBack</a> : <code>function</code></dt>
<dd><p>Node-style callback function</p>
</dd>
<dt><a href="#optionsType">optionsType</a> : <code>object</code></dt>
<dd><p>TeslaJS options parameter</p>
</dd>
</dl>

<a name="streamingPortal"></a>
Expand All @@ -406,82 +400,82 @@ Note: charging to 100% frequently is NOT recommended for long-term battery healt
**Default**: <code>https://owner-api.teslamotors.com</code>
<a name="API_LOG_ALWAYS"></a>

## API_LOG_ALWAYS
## API\_LOG\_ALWAYS
**Kind**: global variable
**Default**: <code>0</code>
<a name="API_ERR_LEVEL"></a>

## API_ERR_LEVEL
## API\_ERR\_LEVEL
**Kind**: global variable
**Default**: <code>1</code>
<a name="API_CALL_LEVEL"></a>

## API_CALL_LEVEL
## API\_CALL\_LEVEL
**Kind**: global variable
**Default**: <code>2</code>
<a name="API_RETURN_LEVEL"></a>

## API_RETURN_LEVEL
## API\_RETURN\_LEVEL
**Kind**: global variable
**Default**: <code>3</code>
<a name="API_BODY_LEVEL"></a>

## API_BODY_LEVEL
## API\_BODY\_LEVEL
**Kind**: global variable
**Default**: <code>4</code>
<a name="API_REQUEST_LEVEL"></a>

## API_REQUEST_LEVEL
## API\_REQUEST\_LEVEL
**Kind**: global variable
**Default**: <code>5</code>
<a name="API_RESPONSE_LEVEL"></a>

## API_RESPONSE_LEVEL
## API\_RESPONSE\_LEVEL
**Kind**: global variable
**Default**: <code>6</code>
<a name="API_LOG_ALL"></a>

## API_LOG_ALL
## API\_LOG\_ALL
**Kind**: global variable
**Default**: <code>255</code>
<a name="CHARGE_STORAGE"></a>

## CHARGE_STORAGE
## CHARGE\_STORAGE
**Kind**: global variable
**Default**: <code>50</code>
<a name="CHARGE_DAILY"></a>

## CHARGE_DAILY
## CHARGE\_DAILY
**Kind**: global variable
**Default**: <code>70</code>
<a name="CHARGE_STANDARD"></a>

## CHARGE_STANDARD
## CHARGE\_STANDARD
**Kind**: global variable
**Default**: <code>90</code>
<a name="CHARGE_RANGE"></a>

## CHARGE_RANGE
## CHARGE\_RANGE
**Kind**: global variable
**Default**: <code>100</code>
<a name="SUNROOF_VENT"></a>

## SUNROOF_VENT
## SUNROOF\_VENT
**Kind**: global variable
**Default**: <code>vent</code>
<a name="SUNROOF_CLOSED"></a>

## SUNROOF_CLOSED
## SUNROOF\_CLOSED
**Kind**: global variable
**Default**: <code>close</code>
<a name="MIN_TEMP"></a>

## MIN_TEMP
## MIN\_TEMP
**Kind**: global variable
**Default**: <code>15</code>
<a name="MAX_TEMP"></a>

## MAX_TEMP
## MAX\_TEMP
**Kind**: global variable
**Default**: <code>28</code>
<a name="FRUNK"></a>
Expand Down Expand Up @@ -677,19 +671,6 @@ Logout and invalidate the current auth token
| --- | --- | --- |
| authToken | <code>string</code> | Tesla provided OAuth token |

<a name="vehicles"></a>

## vehicles(options, callback) ⇒ <code>Vehicle</code>
Return vehicle information on the requested vehicle

**Kind**: global function
**Returns**: <code>Vehicle</code> - vehicle JSON data

| Param | Type | Description |
| --- | --- | --- |
| options | [<code>optionsType</code>](#optionsType) | options object |
| callback | [<code>nodeBack</code>](#nodeBack) | Node-style callback |

<a name="vehicle"></a>

## vehicle(options, callback) ⇒ <code>Vehicle</code>
Expand All @@ -715,21 +696,9 @@ Return vehicle information on the requested vehicle
| --- | --- | --- |
| options | [<code>optionsType</code>](#optionsType) | options object |

<a name="vehiclesAsync"></a>

## vehiclesAsync(options) ⇒ <code>Promise</code>
Return vehicle information on the requested vehicle

**Kind**: global function
**Returns**: <code>Promise</code> - vehicle JSON data

| Param | Type | Description |
| --- | --- | --- |
| options | [<code>optionsType</code>](#optionsType) | options object |

<a name="allVehicles"></a>
<a name="vehicles"></a>

## allVehicles(options, callback) ⇒ <code>Array.&lt;Vehicles&gt;</code>
## vehicles(options, callback) ⇒ <code>Array.&lt;Vehicles&gt;</code>
Return vehicle information on ALL vehicles

**Kind**: global function
Expand All @@ -740,9 +709,9 @@ Return vehicle information on ALL vehicles
| options | [<code>optionsType</code>](#optionsType) | options object |
| callback | [<code>nodeBack</code>](#nodeBack) | Node-style callback |

<a name="allVehiclesAsync"></a>
<a name="vehiclesAsync"></a>

## allVehiclesAsync(options, callback) ⇒ <code>Promise</code>
## vehiclesAsync(options, callback) ⇒ <code>Promise</code>
Return vehicle information on ALL vehicles

**Kind**: global function
Expand All @@ -755,7 +724,7 @@ Return vehicle information on ALL vehicles

<a name="get_command"></a>

## get_command(options, command, callback)
## get\_command(options, command, callback)
Generic REST call for GET commands

**Kind**: global function
Expand All @@ -768,7 +737,7 @@ Generic REST call for GET commands

<a name="get_commandAsync"></a>

## get_commandAsync(options, command) ⇒ <code>Promise</code>
## get\_commandAsync(options, command) ⇒ <code>Promise</code>
Generic Async REST call for GET commands

**Kind**: global function
Expand All @@ -781,7 +750,7 @@ Generic Async REST call for GET commands

<a name="post_command"></a>

## post_command(options, command, body, callback)
## post\_command(options, command, body, callback)
Generic REST call for POST commands

**Kind**: global function
Expand All @@ -795,7 +764,7 @@ Generic REST call for POST commands

<a name="post_commandAsync"></a>

## post_commandAsync(options, command, body) ⇒ <code>Promise</code>
## post\_commandAsync(options, command, body) ⇒ <code>Promise</code>
Generic Async REST call for POST commands

**Kind**: global function
Expand Down Expand Up @@ -1937,6 +1906,18 @@ Start streaming car data
| callback | [<code>nodeBack</code>](#nodeBack) | Node-style callback |
| onDataCb | [<code>nodeBack</code>](#nodeBack) | Node-style callback |

<a name="nodeBack"></a>

## nodeBack : <code>function</code>
Node-style callback function

**Kind**: global typedef

| Param | Type | Description |
| --- | --- | --- |
| error | <code>function</code> | function which receives the error result |
| data | <code>function</code> | function which receives the data result |

<a name="optionsType"></a>

## optionsType : <code>object</code>
Expand All @@ -1951,15 +1932,3 @@ TeslaJS options parameter
| vehicleID | <code>string</code> | Tesla provided long vehicle id |
| [carIndex] | <code>int</code> | index of vehicle within vehicles JSON |

<a name="nodeBack"></a>

## nodeBack : <code>function</code>
Node-style callback function

**Kind**: global typedef

| Param | Type | Description |
| --- | --- | --- |
| error | <code>function</code> | function which receives the error result |
| data | <code>function</code> | function which receives the data result |

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a2fb674

Please sign in to comment.