File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed
main/java/com/uber/sdk/rides/client/model
test/java/com/uber/sdk/rides/client/services Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change 2222
2323package com .uber .sdk .rides .client .model ;
2424
25+ import com .squareup .moshi .Json ;
26+
2527import javax .annotation .Nullable ;
2628
2729/**
3133 */
3234public class Ride {
3335
36+ /**
37+ * Represents all possible Ride statuses
38+ */
39+ public enum Status {
40+ @ Json (name = "processing" ) PROCESSING ("processing" ),
41+ @ Json (name = "no_drivers_available" ) NO_DRIVERS_AVAILABLE ("no_drivers_available" ),
42+ @ Json (name = "accepted" ) ACCEPTED ("accepted" ),
43+ @ Json (name = "arriving" ) ARRIVING ("arriving" ),
44+ @ Json (name = "in_progress" ) IN_PROGRESS ("in_progress" ),
45+ @ Json (name = "driver_canceled" ) DRIVER_CANCELED ("driver_canceled" ),
46+ @ Json (name = "rider_canceled" ) RIDER_CANCELED ("rider_canceled" ),
47+ @ Json (name = "completed" ) COMPLETED ("completed" );
48+
49+ private String value ;
50+
51+ Status (String value ) {
52+ this .value = value ;
53+ }
54+ }
55+
3456 private String request_id ;
35- private String status ;
57+ private Status status ;
3658 private Driver driver ;
3759 @ Nullable
3860 private Integer eta ;
@@ -52,7 +74,7 @@ public String getRideId() {
5274 /**
5375 * The status of the ride indicating state.
5476 */
55- public String getStatus () {
77+ public Status getStatus () {
5678 return status ;
5779 }
5880
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ public void testRequestRide_withoutProductId() throws Exception {
135135
136136 final Ride ride = service .requestRide (createRideRequest ()).execute ().body ();
137137
138- assertThat (ride .getStatus ()).isEqualTo ("processing" );
138+ assertThat (ride .getStatus ()).isEqualTo (Ride . Status . PROCESSING );
139139 assertThat (ride .getProductId ()).isEqualTo (UBER_X_PRODUCT_ID );
140140 assertThat (ride .getRideId ()).isNotEmpty ();
141141 assertThat (ride .isShared ()).isFalse ();
@@ -149,7 +149,7 @@ public void testRequestRide_withUberPoolProductId() throws Exception {
149149 .willReturn (aResponse ().withBodyFile ("requests_current_UberPool.json" )));
150150
151151 final Ride ride = service .requestRide (createUberPoolRideRequest ()).execute ().body ();
152- assertThat (ride .getStatus ()).isEqualTo ("processing" );
152+ assertThat (ride .getStatus ()).isEqualTo (Ride . Status . PROCESSING );
153153
154154 assertThat (ride .getProductId ()).isEqualTo (UBER_POOL_PRODUCT_ID );
155155 assertThat (ride .getRideId ()).isNotEmpty ();
You can’t perform that action at this time.
0 commit comments