Skip to content

Commit df5e685

Browse files
authored
2.0.0 Release of the Android SDK. (#20)
* [Deeplink] Change Deeplink parameter for ride type into an enum. (#13) * Add RideType enum for Deeplinks * Update ride type names for button enum * Remove button's enum * Fix tests * Fix NPE * [Networking] Check and reject responses returned with partial data (#14) * Add interface * Update response models * Implement null check converter * Update riderequest response models * Implement methods to disallow null checking * Remove dead links * Update documentation * Address PR comments (ApiFactory) * Address PR comments (ICompleteData -> Validatable) * [SDK] Update Gradle Dependency Versions (#16) * Update Gradle + Android Gradle Plugin * Update dependency versions * Unused cleanup * RxJava -> RxJava 2 * Bump Lyft SDK version * Fix Lint * Update travis * [Networking] Remove User API. (#17) * Remove UserApi * Remove user access token * Remove related models * LyftPublicApi -> LyftApi * LyftPublicApiRx -> LyftApiRx * Factory method renames * [Networking] Document nullable fields in network responses (#18) * CostEstimate documentation * Eta documentation * Nearby Drivers * Pricing Detail * Ride types * Update Cost * Fix Mock API * Update CHANGELOG * [Ride Type] Fix enum string values to reflect correct server rend… (#19) * Fix Lux SUV enum * Update ride type display names to match endpoints values * Stamp release date in CHANGELOG * Update README
1 parent c063c1e commit df5e685

File tree

60 files changed

+612
-980
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+612
-980
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ android:
55
components:
66
- platform-tools
77
- tools
8-
- build-tools-23.0.3
9-
- android-23
8+
- build-tools-28.0.3
9+
- android-28
1010
- extra-android-m2repository
1111
- extra-google-m2repository
1212

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
Version 2.0.0 *(2019-07-12)*
2+
----------------------------
3+
* Update Gradle version from `2.14.1` to `4.10.1`, and Android Gradle Plugin from `2.2.2` to `3.3.2`
4+
* The compile SDK target for Android has been bumped to API 28.
5+
* The following dependencies have been updated:
6+
* Android Build Tools `23.0.3` -> `28.0.3`
7+
* Android Support Libraries `23.4.0` -> `28.0.0`
8+
* Google Play Services `9.4.0` -> `17.0.0`
9+
* Mockito `1.10.19` -> `2.25.0`
10+
* Retrofit `2.1.0` -> `2.6.0`
11+
* `LyftUserApi`, `LyftUserApiRx` and all endpoints that require a Lyft User OAuth token **have been removed**. External clients will no longer have access to features that require user information.
12+
* `LyftPublicApi` and `LyftPublicApiRx` have been renamed to `LyftApi` and `LyftApiRx` respectively, to reflect new changes regarding the UserApi client.
13+
* The RxJava call adapter for Retrofit has been updated to RxJava2. Users of the RxJava Retrofit interface will have to update their codebase to take RxJava2 Observables.
14+
* All models returned by network calls have been documented with JetBrain `@Nullable` and `@NotNull` annotations.
15+
* `LyftApiFactory` now by default generates a `LyftApi` that **throws a `PartialResponseException`** when the server response doesn't abide by the `@Nullable` and `@NotNull` annotations of the parsed model. The client must be able to handle a `PartialResponseException` when calling for Lyft endpoints.
16+
* If the client wishes to handle null checking manually, call `LyftApiFactory#getUncheckedLyftApi` to get a Retrofit client that does not massage responses.
17+
* `RideTypeEnum` has been moved from the Lyft Button module to the Deeplink module, with the following changes:
18+
* `toString()` is no longer valid when fetching for a ride type key. Use `RideTypeEnum#getRideTypeKey()` instead.
19+
* `getDisplayName()` is still valid for fetching human readable text for each ride type.
20+
* `RideTypeEnum` has been updated to reflect the current ride offerings provided by Lyft:
21+
* `LINE` has been replaced by `SHARED`
22+
* `CLASSIC` has been replaced by `STANDARD`
23+
* `PLUS` has been replaced by `XL`
24+
* `LUX`, `LUX_BLACK`, `LUX_BLACK_XL` has been added into `RideTypeEnum`
25+
* `null` can be used in place of `RideTypeEnum.ALL` in existing usages
26+
* `DeepLinkParams` and its builder now takes in `RideTypeEnum` to specify a ride type, instead of a `String`.
27+
128
Version 1.0.3 *(2017-02-21)*
229
----------------------------
330
Rename couponCode to promoCode

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ repositories {
1919
}
2020
2121
dependencies {
22-
compile 'com.lyft:lyft-android-sdk:1.0.3'
22+
compile 'com.lyft:lyft-android-sdk:2.0.0'
2323
}
2424
```
2525

2626
If you only want to use the [Lyft API Wrapper](https://github.com/lyft/lyft-android-sdk#lyft-api-wrapper) or [Deeplink](https://github.com/lyft/lyft-android-sdk#deeplinking) portion of the SDK, you can pull them individually.
2727
```gradle
28-
compile 'com.lyft:lyft-android-sdk-networking:1.0.3' // Lyft API Wrapper
29-
compile 'com.lyft:lyft-android-sdk-deeplink:1.0.3' // Deeplink
28+
compile 'com.lyft:lyft-android-sdk-networking:2.0.0' // Lyft API Wrapper
29+
compile 'com.lyft:lyft-android-sdk-deeplink:2.0.0' // Deeplink
3030
```
3131

3232
### Maven:
3333
```xml
3434
<dependency>
3535
<groupId>com.lyft</groupId>
3636
<artifactId>lyft-android-sdk</artifactId>
37-
<version>1.0.3</version>
37+
<version>2.0.0</version>
3838
<type>aar</type>
3939
</dependency>
4040
```
@@ -66,7 +66,7 @@ lyftButton.setApiConfig(apiConfig);
6666
RideParams.Builder rideParamsBuilder = new RideParams.Builder()
6767
.setPickupLocation(37.7766048, -122.3943576)
6868
.setDropoffLocation(37.759234, -122.4135125);
69-
rideParamsBuilder.setRideTypeEnum(RideTypeEnum.CLASSIC);
69+
rideParamsBuilder.setRideTypeEnum(RideTypeEnum.STANDARD);
7070

7171
lyftButton.setRideParams(rideParamsBuilder.build());
7272
lyftButton.load();
@@ -80,7 +80,7 @@ RideParams.Builder rideParamsBuilder = new RideParams.Builder()
8080
```
8181

8282
### Ride types
83-
Lyft is growing very quickly and is currently available in [these cities](https://www.lyft.com/cities). Please keep in mind that some ride types (such as Lyft Line) are not yet available in all Lyft cities. If you set the ride type of the button and it happens to be unavailable, the button will default to the Lyft Classic ride type. You can utilize the [`/v1/ridetypes`](https://developer.lyft.com/docs/availability-ride-types) endpoint to get a list of the available ride types in an area.
83+
Lyft is growing very quickly and is currently available in [these cities](https://www.lyft.com/cities). Please keep in mind that some ride types (such as Lyft Line) are not yet available in all Lyft cities. If you set the ride type of the button and it happens to be unavailable, the button will default to the Lyft Standard ride type. You can utilize the [`/v1/ridetypes`](https://developer.lyft.com/docs/availability-ride-types) endpoint to get a list of the available ride types in an area.
8484

8585
### Button styles
8686
To specify the button style via XML, use the `lyft:lyftStyle` attribute or set it programmatically:
@@ -95,10 +95,10 @@ There are 5 styles to pick from:
9595
## Lyft API Wrapper
9696
The SDK provides wrapper methods around Lyft's REST APIs - this can be helpful when you want to build a more custom integration with the Lyft platform vs making HTTP requests directly.
9797

98-
The SDK uses Square's [Retrofit 2](http://square.github.io/retrofit/) networking library. For each [Lyft Public API endpoint](http://petstore.swagger.io/?url=https://api.lyft.com/v1/spec#!/Public/), there is a corresponding Java method. The return type is a `Call` object which can be executed synchronously or asynchronously. See [LyftPublicApi.java](https://github.com/lyft/lyft-android-sdk/blob/master/networking/src/main/java/com/lyft/networking/apis/LyftPublicApi.java) for all the API methods.
98+
The SDK uses Square's [Retrofit 2](http://square.github.io/retrofit/) networking library. For each Lyft API endpoint, there is a corresponding Java method. The return type is a `Call` object which can be executed synchronously or asynchronously. See [LyftApi.java](https://github.com/lyft/lyft-android-sdk/blob/master/networking/src/main/java/com/lyft/networking/apis/LyftApi.java) for all the API methods.
9999

100100
```java
101-
LyftPublicApi lyftPublicApi = new LyftApiFactory(apiConfig).getLyftPublicApi();
101+
LyftApi lyftPublicApi = new LyftApiFactory(apiConfig).getLyftApi();
102102
Call<EtaEstimateResponse> etaCall = lyftPublicApi.getEtas(37.7766048, -122.3943576, "lyft");
103103
```
104104
Asynchronous:
@@ -124,7 +124,7 @@ Eta eta = etaEstimateResponse.eta_estimates.get(0);
124124
```
125125

126126
### RxJava Observables
127-
If you already use RxJava (your app must have it as a dependency), then you can obtain an `Observable` instead of a `Call` object. Simply use [LyftPublicApiRx](https://github.com/lyft/lyft-android-sdk/blob/master/networking/src/main/java/com/lyft/networking/apis/LyftPublicApiRx.java) instead of LyftPublicApi.
127+
If you already use RxJava (your app must have it as a dependency), then you can obtain an `Observable` instead of a `Call` object. Simply use [LyftApiRx](https://github.com/lyft/lyft-android-sdk/blob/master/networking/src/main/java/com/lyft/networking/apis/LyftApiRx.java) instead of LyftApi.
128128

129129
```java
130130
LyftPublicApiRx lyftPublicApiRx = new LyftApiFactory(apiConfig).getLyftPublicApiRx();
@@ -139,7 +139,7 @@ The SDK provides direct [deeplinking](https://developer.lyft.com/docs/deeplinkin
139139
```java
140140
DeepLinkParams deepLinkParams = new DeepLinkParams.Builder()
141141
.setClientId("your_client_id")
142-
.setRideType("lyft_line")
142+
.setRideType(RideTypeEnum.SHARED)
143143
.setPickupLocation(37.7766048, -122.3943576)
144144
.setDropoffLocation(37.759234, -122.4135125)
145145
.build();

build.gradle

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
buildscript {
44
repositories {
55
jcenter()
6+
google()
67
}
78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.2'
9+
classpath 'com.android.tools.build:gradle:3.3.2'
910
}
1011
}
1112

1213
allprojects {
1314
repositories {
1415
jcenter()
16+
google()
1517
}
1618
}
1719

@@ -29,19 +31,19 @@ subprojects { subProject ->
2931
}
3032

3133
subprojects {
32-
ext.androidBuildToolsVersion = "23.0.3"
33-
ext.androidCompileSDK = 23
34+
ext.androidBuildToolsVersion = "28.0.3"
35+
ext.androidCompileSDK = 28
3436
ext.androidMinSdk = 15
35-
ext.androidSupportLibrariesVersion = '23.4.0'
37+
ext.androidSupportLibrariesVersion = '28.0.0'
3638
ext.androidTargetSDK = 23
37-
ext.googlePlayVersion = '9.4.0'
39+
ext.googlePlayVersion = '17.0.0'
3840
ext.jetbrainsVersion = '15.0'
3941
ext.junitVersion = '4.12'
40-
ext.lyftSdkVersionCode = 1
42+
ext.lyftSdkVersionCode = 2
4143
ext.lyftSdkVersionName = VERSION_NAME
42-
ext.mockitoVersion = '1.10.19'
44+
ext.mockitoVersion = '2.25.0'
4345
ext.okhttpVersion = '3.3.1'
44-
ext.retrofitVersion = '2.1.0'
46+
ext.retrofitVersion = '2.6.0'
4547
}
4648

4749
task clean(type: Delete) {

deeplink/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ android {
1919
}
2020

2121
dependencies {
22-
compile 'org.jetbrains:annotations-java5:' + jetbrainsVersion
23-
testCompile 'junit:junit:' + junitVersion
22+
implementation 'org.jetbrains:annotations-java5:' + jetbrainsVersion
23+
testImplementation 'junit:junit:' + junitVersion
2424
}
2525

2626
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')

deeplink/src/main/java/com/lyft/deeplink/DeepLink.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public class DeepLink {
1010

1111
private static final String LYFT_PACKAGE_NAME = "me.lyft.android";
12-
private static final String SDK_VERSION = "1.0.3";
12+
private static final String SDK_VERSION = "2.0.0";
1313

1414
/**
1515
* @return true if Lyft app is installed on the device.
@@ -63,7 +63,12 @@ public static boolean launchLyftApp(Context context, DeepLinkParams deepLinkPara
6363
static String createDeepLinkString(DeepLinkParams deepLinkParams) {
6464
StringBuilder sb = new StringBuilder();
6565
sb.append("lyft://ridetype?id=");
66-
sb.append(deepLinkParams.getRideType());
66+
67+
if (deepLinkParams.isRideTypeSet()) {
68+
sb.append(deepLinkParams.getRideTypeEnum().getRideTypeKey());
69+
} else {
70+
sb.append(RideTypeEnum.STANDARD.getRideTypeKey());
71+
}
6772

6873
if (deepLinkParams.isPickupLatLngSet()) {
6974
sb.append("&pickup[latitude]=");

deeplink/src/main/java/com/lyft/deeplink/DeepLinkParams.java

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
public class DeepLinkParams {
66

77
private final String clientId;
8-
private final String rideType;
8+
private final RideTypeEnum rideTypeEnum;
99
private final String promoCode;
1010
private final String pickupAddr;
1111
private final Double pickupLat;
@@ -14,10 +14,17 @@ public class DeepLinkParams {
1414
private final Double dropoffLat;
1515
private final Double dropoffLng;
1616

17-
private DeepLinkParams(String clientId, String rideType, String promoCode, String pickupAddr, Double pickupLat, Double pickupLng,
18-
String dropoffAddr, Double dropoffLat, Double dropoffLng) {
17+
private DeepLinkParams(String clientId,
18+
RideTypeEnum rideTypeEnum,
19+
String promoCode,
20+
String pickupAddr,
21+
Double pickupLat,
22+
Double pickupLng,
23+
String dropoffAddr,
24+
Double dropoffLat,
25+
Double dropoffLng) {
1926
this.clientId = clientId;
20-
this.rideType = rideType;
27+
this.rideTypeEnum = rideTypeEnum;
2128
this.promoCode = promoCode;
2229
this.pickupAddr = pickupAddr;
2330
this.pickupLat = pickupLat;
@@ -32,9 +39,8 @@ public String getClientId() {
3239
return clientId;
3340
}
3441

35-
@Nullable
36-
public String getRideType() {
37-
return rideType;
42+
public RideTypeEnum getRideTypeEnum() {
43+
return rideTypeEnum;
3844
}
3945

4046
@Nullable
@@ -72,6 +78,10 @@ public Double getDropoffLng() {
7278
return dropoffLng;
7379
}
7480

81+
public boolean isRideTypeSet() {
82+
return rideTypeEnum != null;
83+
}
84+
7585
public boolean isPickupLatLngSet() {
7686
return pickupLat != null && pickupLng != null;
7787
}
@@ -91,7 +101,7 @@ public boolean isDropoffAddressSet() {
91101
public static class Builder {
92102

93103
private String clientId;
94-
private String rideType = "lyft";
104+
private RideTypeEnum rideTypeEnum = RideTypeEnum.STANDARD;
95105
private String promoCode;
96106
private String pickupAddr;
97107
private Double pickupLat;
@@ -101,16 +111,16 @@ public static class Builder {
101111
private Double dropoffLng;
102112

103113
public DeepLinkParams build() {
104-
return new DeepLinkParams(clientId, rideType, promoCode, pickupAddr, pickupLat, pickupLng, dropoffAddr, dropoffLat, dropoffLng);
114+
return new DeepLinkParams(clientId, rideTypeEnum, promoCode, pickupAddr, pickupLat, pickupLng, dropoffAddr, dropoffLat, dropoffLng);
105115
}
106116

107117
public Builder setClientId(String clientId) {
108118
this.clientId = clientId;
109119
return this;
110120
}
111121

112-
public Builder setRideType(String rideType) {
113-
this.rideType = rideType;
122+
public Builder setRideTypeEnum(RideTypeEnum rideTypeEnum) {
123+
this.rideTypeEnum = rideTypeEnum;
114124
return this;
115125
}
116126

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.lyft.deeplink;
2+
3+
public enum RideTypeEnum {
4+
SHARED("lyft_line", "Shared"),
5+
STANDARD("lyft", "Lyft"),
6+
XL("lyft_plus", "Lyft XL"),
7+
LUX("lyft_premier", "Lux"),
8+
LUX_BLACK("lyft_lux", "Lux Black"),
9+
LUX_BLACK_XL("lyft_luxsuv", "Lux Black XL");
10+
11+
private String rideTypeKey;
12+
private String displayName;
13+
14+
RideTypeEnum(String rideTypeKey, String displayName) {
15+
this.rideTypeKey = rideTypeKey;
16+
this.displayName = displayName;
17+
}
18+
19+
public String getRideTypeKey() {
20+
return rideTypeKey;
21+
}
22+
23+
public String getDisplayName() {
24+
return displayName;
25+
}
26+
}
27+

deeplink/src/test/java/com/lyft/deeplink/DeepLinkTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
public class DeepLinkTest {
88

99
private static final String CLIENT_ID = "clientId";
10-
private static final String RIDETYPE = "ridetype";
10+
private static final RideTypeEnum RIDETYPE = RideTypeEnum.STANDARD;
1111
private static final Double PICKUP_LAT = 1.0;
1212
private static final Double PICKUP_LNG = 2.0;
1313
private static final Double DROPOFF_LAT = 3.0;
@@ -20,7 +20,7 @@ public class DeepLinkTest {
2020
public void createDeepLinkStringTest_full() {
2121
DeepLinkParams deepLinkParams = new DeepLinkParams.Builder()
2222
.setClientId(CLIENT_ID)
23-
.setRideType(RIDETYPE)
23+
.setRideTypeEnum(RIDETYPE)
2424
.setPickupLocation(PICKUP_LAT, PICKUP_LNG)
2525
.setDropoffLocation(DROPOFF_LAT, DROPOFF_LNG)
2626
.setPickupAddress(PICKUP_ADDR)
@@ -29,7 +29,7 @@ public void createDeepLinkStringTest_full() {
2929
.build();
3030

3131
String deeplinkString = DeepLink.createDeepLinkString(deepLinkParams);
32-
assertEquals("lyft://ridetype?id=" + RIDETYPE + "&pickup[latitude]=" + PICKUP_LAT + "&pickup[longitude]=" +
32+
assertEquals("lyft://ridetype?id=" + RIDETYPE.getRideTypeKey() + "&pickup[latitude]=" + PICKUP_LAT + "&pickup[longitude]=" +
3333
PICKUP_LNG + "&pickup[address]=" + PICKUP_ADDR + "&destination[latitude]=" + DROPOFF_LAT +
3434
"&destination[longitude]=" + DROPOFF_LNG + "&destination[address]=" + DROPOFF_ADDR + "&partner=" + CLIENT_ID +
3535
"&credits=" + PROMO_CODE,
@@ -39,41 +39,41 @@ public void createDeepLinkStringTest_full() {
3939
@Test
4040
public void createDeepLinkStringTest_noClientId() {
4141
DeepLinkParams deepLinkParams = new DeepLinkParams.Builder()
42-
.setRideType(RIDETYPE)
42+
.setRideTypeEnum(RIDETYPE)
4343
.setPickupLocation(PICKUP_LAT, PICKUP_LNG)
4444
.setDropoffLocation(DROPOFF_LAT, DROPOFF_LNG)
4545
.build();
4646

4747
String deeplinkString = DeepLink.createDeepLinkString(deepLinkParams);
48-
assertEquals("lyft://ridetype?id=" + RIDETYPE + "&pickup[latitude]=" + PICKUP_LAT + "&pickup[longitude]=" + PICKUP_LNG
48+
assertEquals("lyft://ridetype?id=" + RIDETYPE.getRideTypeKey() + "&pickup[latitude]=" + PICKUP_LAT + "&pickup[longitude]=" + PICKUP_LNG
4949
+ "&destination[latitude]=" + DROPOFF_LAT + "&destination[longitude]=" + DROPOFF_LNG,
5050
deeplinkString);
5151
}
5252

5353
@Test
5454
public void createDeepLinkStringTest_noPickupLocation() {
5555
DeepLinkParams deepLinkParams = new DeepLinkParams.Builder()
56-
.setRideType(RIDETYPE)
56+
.setRideTypeEnum(RIDETYPE)
5757
.setPickupLocation(PICKUP_LAT, null)
5858
.setDropoffLocation(DROPOFF_LAT, DROPOFF_LNG)
5959
.build();
6060

6161
String deeplinkString = DeepLink.createDeepLinkString(deepLinkParams);
62-
assertEquals("lyft://ridetype?id=" + RIDETYPE + "&destination[latitude]=" + DROPOFF_LAT + "&destination[longitude]=" + DROPOFF_LNG,
62+
assertEquals("lyft://ridetype?id=" + RIDETYPE.getRideTypeKey() + "&destination[latitude]=" + DROPOFF_LAT + "&destination[longitude]=" + DROPOFF_LNG,
6363
deeplinkString);
6464
}
6565

6666
@Test
6767
public void createDeepLinkStringTest_addressOnly() {
6868
DeepLinkParams deepLinkParams = new DeepLinkParams.Builder()
6969
.setClientId(CLIENT_ID)
70-
.setRideType(RIDETYPE)
70+
.setRideTypeEnum(RIDETYPE)
7171
.setPickupAddress(PICKUP_ADDR)
7272
.setDropoffAddress(DROPOFF_ADDR)
7373
.build();
7474

7575
String deeplinkString = DeepLink.createDeepLinkString(deepLinkParams);
76-
assertEquals("lyft://ridetype?id=" + RIDETYPE + "&pickup[address]=" + PICKUP_ADDR +
76+
assertEquals("lyft://ridetype?id=" + RIDETYPE.getRideTypeKey() + "&pickup[address]=" + PICKUP_ADDR +
7777
"&destination[address]=" + DROPOFF_ADDR + "&partner=" + CLIENT_ID,
7878
deeplinkString);
7979
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GROUP=com.lyft
2-
VERSION_NAME=1.0.4-SNAPSHOT
2+
VERSION_NAME=2.0.0
33

44
POM_DESCRIPTION=Lyft Android SDK
55

0 commit comments

Comments
 (0)