Skip to content

Commit

Permalink
feat: Smartcar exception v2 (#91)
Browse files Browse the repository at this point in the history
This release adds support for v2.0 of Smartcar's API by introducing the `smartcar.setApiVersion` method.

We have also introduced a `SmartcarExceptionV2` class whose fields match the error fields returned by v2.0 of the API as documented on the [API Reference](https://smartcar.com/docs/api/?version=v2.0#errors). This class extends the `SmartcarException` class to ease the migration process.

For a detailed breakdown of the changes and how to migrate see our [API Changelog for v2.0](https://smartcar.com/docs/changelog/v2.0/) and our [v2.0 Error Guides](https://smartcar.com/docs/errors/v2.0/billing).
  • Loading branch information
rsimari authored Apr 24, 2021
1 parent 6697af5 commit 62a8843
Show file tree
Hide file tree
Showing 63 changed files with 1,282 additions and 167 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
deploy:
- provider: script
skip_cleanup: true
script: echo -e "machine github.com\n login $CI_USER_TOKEN" >> ~/.netrc && git push origin "v${SDK_VERSION}"
script: echo -e "machine github.com\n login $GH_TOKEN" >> ~/.netrc && git push origin "v${SDK_VERSION}"
- stage: publish
jdk: openjdk8
script: skip
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ The recommended method for obtaining the SDK is via Gradle or Maven through the

### Gradle
```groovy
compile "com.smartcar.sdk:java-sdk:2.7.7"
compile "com.smartcar.sdk:java-sdk:2.8.0"
```

### Maven
```xml
<dependency>
<groupId>com.smartcar.sdk</groupId>
<artifactId>java-sdk</artifactId>
<version>2.7.7</version>
<version>2.8.0</version>
</dependency>
```

### Jar Direct Download
* [java-sdk-2.7.7.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/2.7.7/java-sdk-2.7.7.jar)
* [java-sdk-2.7.7-sources.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/2.7.7/java-sdk-2.7.7-sources.jar)
* [java-sdk-2.7.7-javadoc.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/2.7.7/java-sdk-2.7.7-javadoc.jar)
* [java-sdk-2.8.0.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/2.8.0/java-sdk-2.8.0.jar)
* [java-sdk-2.8.0-sources.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/2.8.0/java-sdk-2.8.0-sources.jar)
* [java-sdk-2.8.0-javadoc.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/2.8.0/java-sdk-2.8.0-javadoc.jar)

Signatures and other downloads available at [Maven Central](https://search.maven.org/artifact/com.smartcar.sdk/java-sdk/2.7.7/jar).
Signatures and other downloads available at [Maven Central](https://search.maven.org/artifact/com.smartcar.sdk/java-sdk/2.8.0/jar).

## Usage

Expand Down Expand Up @@ -129,5 +129,5 @@ start making requests to vehicles.
[ci-url]: https://travis-ci.com/smartcar/java-sdk
[coverage-image]: https://codecov.io/gh/smartcar/java-sdk/branch/master/graph/badge.svg?token=nZAITx7w3X
[coverage-url]: https://codecov.io/gh/smartcar/java-sdk
[javadoc-image]: https://img.shields.io/badge/javadoc-2.7.7-brightgreen.svg
[javadoc-image]: https://img.shields.io/badge/javadoc-2.8.0-brightgreen.svg
[javadoc-url]: https://smartcar.github.io/java-sdk
3 changes: 2 additions & 1 deletion docs/allclasses-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>All Classes (java-sdk - 2.7.7)</title>
<title>All Classes (java-sdk - 2.8.0)</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
Expand All @@ -24,6 +24,7 @@ <h1 class="bar">All&nbsp;Classes</h1>
<li><a href="com/smartcar/sdk/data/RequestPaging.html" title="class in com.smartcar.sdk.data" target="classFrame">RequestPaging</a></li>
<li><a href="com/smartcar/sdk/data/ResponsePaging.html" title="class in com.smartcar.sdk.data" target="classFrame">ResponsePaging</a></li>
<li><a href="com/smartcar/sdk/SmartcarException.html" title="class in com.smartcar.sdk" target="classFrame">SmartcarException</a></li>
<li><a href="com/smartcar/sdk/SmartcarExceptionV2.html" title="class in com.smartcar.sdk" target="classFrame">SmartcarExceptionV2</a></li>
<li><a href="com/smartcar/sdk/data/SmartcarResponse.html" title="class in com.smartcar.sdk.data" target="classFrame">SmartcarResponse</a></li>
<li><a href="com/smartcar/sdk/Vehicle.html" title="class in com.smartcar.sdk" target="classFrame">Vehicle</a></li>
<li><a href="com/smartcar/sdk/Vehicle.UnitSystem.html" title="enum in com.smartcar.sdk" target="classFrame">Vehicle.UnitSystem</a></li>
Expand Down
3 changes: 2 additions & 1 deletion docs/allclasses-noframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>All Classes (java-sdk - 2.7.7)</title>
<title>All Classes (java-sdk - 2.8.0)</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
Expand All @@ -24,6 +24,7 @@ <h1 class="bar">All&nbsp;Classes</h1>
<li><a href="com/smartcar/sdk/data/RequestPaging.html" title="class in com.smartcar.sdk.data">RequestPaging</a></li>
<li><a href="com/smartcar/sdk/data/ResponsePaging.html" title="class in com.smartcar.sdk.data">ResponsePaging</a></li>
<li><a href="com/smartcar/sdk/SmartcarException.html" title="class in com.smartcar.sdk">SmartcarException</a></li>
<li><a href="com/smartcar/sdk/SmartcarExceptionV2.html" title="class in com.smartcar.sdk">SmartcarExceptionV2</a></li>
<li><a href="com/smartcar/sdk/data/SmartcarResponse.html" title="class in com.smartcar.sdk.data">SmartcarResponse</a></li>
<li><a href="com/smartcar/sdk/Vehicle.html" title="class in com.smartcar.sdk">Vehicle</a></li>
<li><a href="com/smartcar/sdk/Vehicle.UnitSystem.html" title="enum in com.smartcar.sdk">Vehicle.UnitSystem</a></li>
Expand Down
4 changes: 2 additions & 2 deletions docs/com/smartcar/sdk/AuthClient.AuthUrlBuilder.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>AuthClient.AuthUrlBuilder (java-sdk - 2.7.7)</title>
<title>AuthClient.AuthUrlBuilder (java-sdk - 2.8.0)</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AuthClient.AuthUrlBuilder (java-sdk - 2.7.7)";
parent.document.title="AuthClient.AuthUrlBuilder (java-sdk - 2.8.0)";
}
}
catch(err) {
Expand Down
4 changes: 2 additions & 2 deletions docs/com/smartcar/sdk/AuthClient.AuthVehicleInfo.Builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>AuthClient.AuthVehicleInfo.Builder (java-sdk - 2.7.7)</title>
<title>AuthClient.AuthVehicleInfo.Builder (java-sdk - 2.8.0)</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AuthClient.AuthVehicleInfo.Builder (java-sdk - 2.7.7)";
parent.document.title="AuthClient.AuthVehicleInfo.Builder (java-sdk - 2.8.0)";
}
}
catch(err) {
Expand Down
4 changes: 2 additions & 2 deletions docs/com/smartcar/sdk/AuthClient.AuthVehicleInfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>AuthClient.AuthVehicleInfo (java-sdk - 2.7.7)</title>
<title>AuthClient.AuthVehicleInfo (java-sdk - 2.8.0)</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AuthClient.AuthVehicleInfo (java-sdk - 2.7.7)";
parent.document.title="AuthClient.AuthVehicleInfo (java-sdk - 2.8.0)";
}
}
catch(err) {
Expand Down
43 changes: 25 additions & 18 deletions docs/com/smartcar/sdk/AuthClient.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>AuthClient (java-sdk - 2.7.7)</title>
<title>AuthClient (java-sdk - 2.8.0)</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AuthClient (java-sdk - 2.7.7)";
parent.document.title="AuthClient (java-sdk - 2.8.0)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":9,"i4":9,"i5":42,"i6":42,"i7":42,"i8":42,"i9":42,"i10":42,"i11":42,"i12":42,"i13":9,"i14":9,"i15":9,"i16":10,"i17":10,"i18":9};
var methods = {"i0":10,"i1":10,"i2":10,"i3":9,"i4":9,"i5":42,"i6":42,"i7":42,"i8":42,"i9":42,"i10":42,"i11":42,"i12":42,"i13":9,"i14":9,"i15":9,"i16":10,"i17":10,"i18":9,"i19":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
Expand Down Expand Up @@ -174,14 +174,10 @@ <h3>Field Summary</h3>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/smartcar/sdk/AuthClient.html#urlAccessToken">urlAccessToken</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/smartcar/sdk/AuthClient.html#urlApi">urlApi</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/smartcar/sdk/AuthClient.html#urlAuthorize">urlAuthorize</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<tr class="altColor">
<td class="colFirst"><code>protected static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/smartcar/sdk/AuthClient.html#USER_AGENT">USER_AGENT</a></span></code>&nbsp;</td>
</tr>
Expand Down Expand Up @@ -404,6 +400,12 @@ <h3>Method Summary</h3>
<div class="block">Convenience method for determining if an auth token expiration has passed.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/smartcar/sdk/AuthClient.html#setApiVersion-java.lang.String-">setApiVersion</a></span>(java.lang.String&nbsp;version)</code>
<div class="block">Sets the API version</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
Expand Down Expand Up @@ -469,21 +471,12 @@ <h4>URL_API</h4>
<a name="USER_AGENT">
<!-- -->
</a>
<ul class="blockList">
<ul class="blockListLast">
<li class="blockList">
<h4>USER_AGENT</h4>
<pre>protected static final&nbsp;java.lang.String USER_AGENT</pre>
</li>
</ul>
<a name="urlApi">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>urlApi</h4>
<pre>public static&nbsp;java.lang.String urlApi</pre>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
Expand Down Expand Up @@ -941,6 +934,20 @@ <h4>isCompatible</h4>
</dl>
</li>
</ul>
<a name="setApiVersion-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setApiVersion</h4>
<pre>public&nbsp;void&nbsp;setApiVersion(java.lang.String&nbsp;version)</pre>
<div class="block">Sets the API version</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>version</code> - API version to set</dd>
</dl>
</li>
</ul>
<a name="execute-okhttp3.Request-">
<!-- -->
</a>
Expand Down
23 changes: 19 additions & 4 deletions docs/com/smartcar/sdk/BatchResponseMissingException.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>BatchResponseMissingException (java-sdk - 2.7.7)</title>
<title>BatchResponseMissingException (java-sdk - 2.8.0)</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="BatchResponseMissingException (java-sdk - 2.7.7)";
parent.document.title="BatchResponseMissingException (java-sdk - 2.8.0)";
}
}
catch(err) {
Expand Down Expand Up @@ -68,7 +68,7 @@
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.com.smartcar.sdk.SmartcarException">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#methods.inherited.from.class.com.smartcar.sdk.SmartcarException">Method</a></li>
</ul>
Expand Down Expand Up @@ -134,6 +134,21 @@ <h2 title="Class BatchResponseMissingException" class="title">Class BatchRespons
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.com.smartcar.sdk.SmartcarException">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;com.smartcar.sdk.<a href="../../../com/smartcar/sdk/SmartcarException.html" title="class in com.smartcar.sdk">SmartcarException</a></h3>
<code><a href="../../../com/smartcar/sdk/SmartcarException.html#code">code</a>, <a href="../../../com/smartcar/sdk/SmartcarException.html#requestId">requestId</a>, <a href="../../../com/smartcar/sdk/SmartcarException.html#statusCode">statusCode</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
Expand Down Expand Up @@ -262,7 +277,7 @@ <h4>BatchResponseMissingException</h4>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.com.smartcar.sdk.SmartcarException">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#methods.inherited.from.class.com.smartcar.sdk.SmartcarException">Method</a></li>
</ul>
Expand Down
Loading

0 comments on commit 62a8843

Please sign in to comment.