Skip to content

Commit

Permalink
[Gradle Release Plugin] - pre tag commit: 'v0.5.2'.
Browse files Browse the repository at this point in the history
  • Loading branch information
tyvsmith committed Jul 11, 2016
1 parent 80e497b commit 2066ff0
Show file tree
Hide file tree
Showing 27 changed files with 729 additions and 212 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
v0.5.2 - TBD
v0.5.2 - 7/11/2016
------------
### Added
- [Issue #22](https://github.com/uber/rides-java-sdk/issues/22) Support for Uber Pool

v0.5.1 - 6/7/2016
-----------------
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ This SDK helps your Java App make HTTP requests to the Uber Rides API.
### Installing

#### Before you begin
Register your app in the [Uber developer dashboard](https://developer.uber.com/dashboard). Notice that the app gets a client ID, secret, and server token required for authenticating with the API.
Register your app in the [Uber developer dashboard](https://developer.uber.com/dashboard). Notice that the app gets a client ID, secret, and server token required for authenticating with the API.

Note: Using Android? Be sure to checkout the [Uber Android SDK](github.com/uber/rides-android-sdk) in addition, which has native authentication mechanisms.

#### Gradle
If using Gradle, add this to your project’s `build.gradle` file:
```gradle
dependencies {
compile 'com.uber.sdk:rides:0.5.1'
compile 'com.uber.sdk:rides:0.5.2'
}
```

Expand All @@ -24,7 +24,7 @@ If using Maven, add this to your project's `pom.xml` file:
<dependency>
<groupId>com.uber.sdk</groupId>
<artifactId>rides</artifactId>
<version>0.5.1</version>
<version>0.5.2</version>
</dependency>
```

Expand All @@ -44,7 +44,7 @@ ServerTokenSession session = new ServerTokenSession(config));
```
#### Create a session using the OAuth 2 flow
In an OAuth session, the app first asks the user to authorize and then exchanges the authorization code for an access token from Uber.
Note: Make sure the redirect URI matches the callback URI in the developer dashboard for the app.
Note: Make sure the redirect URI matches the callback URI in the developer dashboard for the app.

**Step 1**. Create an OAuth2Credentials object with your client ID, client secret, scopes, and a redirect callback URI to capture the user’s authorization code.
```java
Expand All @@ -54,13 +54,13 @@ SessionConfiguration config = new SessionConfiguration.Builder()
.setScopes(yourScopes)
.setRedirectUri(redirectUri)
.build();

OAuth2Credentials credentials = new OAuth2Credentials.Builder()
.setSessionConfiguration(config)
.build();

```
**Step 2**. Navigate the user to the authorization URL from the OAuth2Credentials object.
**Step 2**. Navigate the user to the authorization URL from the OAuth2Credentials object.
```java
String authorizationUrl = credentials.getAuthorizationUrl();
```
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ group=com.uber.sdk
groupId=com.uber.sdk
artifactId=rides
githubDownloadPrefix=https://github.com/uber/rides-java-sdk/releases/download/
version=0.5.2-SNAPSHOT
version=0.5.2
3 changes: 1 addition & 2 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ dependencies {
testCompile 'org.assertj:assertj-core:1.7.1'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.mockito:mockito-core:1.10.8'
testCompile 'com.squareup.okhttp:mockwebserver:2.5.0'

testCompile 'com.github.tomakehurst:wiremock:1.57'
testCompile 'com.github.tomakehurst:wiremock:2.1.0-beta'
}
8 changes: 3 additions & 5 deletions sdk/src/main/java/com/uber/sdk/rides/client/UberRidesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@

import com.squareup.moshi.Moshi;
import com.uber.sdk.rides.client.internal.ApiInterceptor;
import com.uber.sdk.rides.client.internal.PrimitiveAdapter;
import com.uber.sdk.rides.client.internal.RefreshAuthenticator;
import com.uber.sdk.rides.client.services.RidesService;

import javax.annotation.Nonnull;

import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.moshi.MoshiConverterFactory;

import javax.annotation.Nonnull;

public class UberRidesApi {

private final Retrofit retrofit;
Expand Down Expand Up @@ -128,7 +126,7 @@ OkHttpClient createClient(OkHttpClient client,
}

Retrofit createRetrofit(OkHttpClient client, Session session) {
Moshi moshi = new Moshi.Builder().add(new PrimitiveAdapter()).build();
Moshi moshi = new Moshi.Builder().build();

return new Retrofit.Builder()
.addConverterFactory(MoshiConverterFactory.create(moshi))
Expand Down

This file was deleted.

10 changes: 8 additions & 2 deletions sdk/src/main/java/com/uber/sdk/rides/client/model/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@

package com.uber.sdk.rides.client.model;

import javax.annotation.Nullable;

/**
* The vehicle's driver.
*/
public class Driver {

private String phone_number;
private float rating;
@Nullable
private Float rating;
@Nullable
private String picture_url;
private String name;

Expand All @@ -42,13 +46,15 @@ public String getPhoneNumber() {
/**
* The driver's star rating out of 5 stars.
*/
public float getRating() {
@Nullable
public Float getRating() {
return rating;
}

/**
* The URL to the photo of the driver.
*/
@Nullable
public String getPictureUrl() {
return picture_url;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public class Location {

private float latitude;
private float longitude;
@Nullable private Integer bearing;
@Nullable
private Integer bearing;

/**
* Location must be created with a non-null latitude and longitude.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@

package com.uber.sdk.rides.client.model;

import javax.annotation.Nullable;

/**
* A user's Payment Method. See
* <a href="https://developer.uber.com/docs/v1-payment-methods-details">Payment Methods</a>
* <a href="https://developer.uber.com/docs/rides/api/v1-payment-methods">Payment Methods</a>
* for more information.
*/
public class PaymentMethod {

private String payment_method_id;
private String type;
@Nullable
private String description;

/**
Expand All @@ -52,6 +55,7 @@ public String getType() {
/**
* Gets the description of a Payment Method.
*/
@Nullable
public String getDescription() {
return description;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,29 @@

package com.uber.sdk.rides.client.model;

import javax.annotation.Nullable;

/**
* An estimated price for a product on the Uber platform. See
* <a href="https://developer.uber.com/v1/endpoints/#price-estimates">Price Estimates</a>
* <a href="https://developer.uber.com/docs/rides/api/v1-estimates-price">Price Estimates</a>
* for more information.
*/
public class PriceEstimate {

private String product_id;
@Nullable
private String currency_code;
private String display_name;
private String estimate;
private int low_estimate;
private int high_estimate;
@Nullable
private Integer low_estimate;
@Nullable
private Integer high_estimate;
private float surge_multiplier;
private int duration;
private float distance;
@Nullable
private Integer duration;
@Nullable
private Float distance;

/**
* Unique identifier representing a specific product for a given latitude &amp; longitude. For
Expand All @@ -50,6 +57,7 @@ public String getProductId() {
/**
* ISO 4217 currency code.
*/
@Nullable
public String getCurrencyCode() {
return currency_code;
}
Expand All @@ -72,14 +80,16 @@ public String getEstimate() {
/**
* Lower bound of the estimated price.
*/
public int getLowEstimate() {
@Nullable
public Integer getLowEstimate() {
return low_estimate;
}

/**
* Upper bound of the estimated price.
*/
public int getHighEstimate() {
@Nullable
public Integer getHighEstimate() {
return high_estimate;
}

Expand All @@ -94,14 +104,16 @@ public float getSurgeMultiplier() {
/**
* Expected activity duration (in seconds). Always show duration in minutes.
*/
public int getDuration() {
@Nullable
public Integer getDuration() {
return duration;
}

/**
* Expected activity distance (in miles).
*/
public float getDistance() {
@Nullable
public Float getDistance() {
return distance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class Product {
private String description;
private int capacity;
private String image;
private boolean shared;

/**
* A unique identifier representing a specific product for a given latitude &amp; longitude. For
Expand Down Expand Up @@ -70,5 +71,9 @@ public int getCapacity() {
public String getImage() {
return image;
}

public boolean isShared() {
return shared;
}
}

22 changes: 21 additions & 1 deletion sdk/src/main/java/com/uber/sdk/rides/client/model/Ride.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package com.uber.sdk.rides.client.model;

import javax.annotation.Nullable;

/**
* An ongoing or completed ride. See
* <a href="https://developer.uber.com/v1/endpoints/#request-details">Requests</a>
Expand All @@ -32,10 +34,13 @@ public class Ride {
private String request_id;
private String status;
private Driver driver;
private int eta;
@Nullable
private Integer eta;
private float surge_multiplier;
private Location location;
private Vehicle vehicle;
private String product_id;
private boolean shared;

/**
* The unique ID of the ride.
Expand All @@ -61,6 +66,7 @@ public Driver getDriver() {
/**
* The estimated time of vehicle arrival in minutes.
*/
@Nullable
public Integer getEta() {
return eta;
}
Expand All @@ -86,4 +92,18 @@ public Vehicle getVehicle() {
public Float getSurgeMultiplier() {
return surge_multiplier;
}

/**
* The product ID associated to the Ride.
*/
public String getProductId() {
return product_id;
}

/**
* Indicates whether the ride is a shared ride or not. UberPool is an example of a shared ride.
*/
public boolean isShared() {
return shared;
}
}

0 comments on commit 2066ff0

Please sign in to comment.