From 18e948c54d5573abef7cb9cd0906193715d1e996 Mon Sep 17 00:00:00 2001 From: Josh Burton Date: Sun, 25 May 2014 09:46:11 +1200 Subject: [PATCH] added display service - parking locations and scheduled works --- README.md | 1 + lib/src/androidTest/java/api/TATDisplays.java | 44 +++--- lib/src/androidTest/java/api/TATRealtime.java | 7 +- .../com/atapiwrapper/library/api/AtApi.java | 16 ++- .../api/model/display/ParkingLocation.java | 80 +++++++++++ .../api/model/display/ScheduledWork.java | 132 ++++++++++++++++++ .../library/api/model/geometry/Geometry.java | 20 +++ .../model/geometry/GeometryDeserializer.java | 36 +++++ .../api/model/geometry/LineGeometry.java | 9 ++ .../model/geometry/MultiLineBaseGeometry.java | 14 ++ .../geometry/MultiLineEncodedGeometry.java | 9 ++ .../api/model/geometry/MultiLineGeometry.java | 10 ++ .../api/model/geometry/PointGeometry.java | 9 ++ .../api/model/geometry/PolygonGeometry.java | 9 ++ .../library/api/service/DisplayService.java | 58 ++++++++ .../library/api/service/DisplaysService.java | 5 - .../library/api/service/RealtimeService.java | 12 +- .../VehicleLocationListFragment.java | 2 +- 18 files changed, 427 insertions(+), 46 deletions(-) create mode 100644 lib/src/main/java/com/atapiwrapper/library/api/model/display/ParkingLocation.java create mode 100644 lib/src/main/java/com/atapiwrapper/library/api/model/display/ScheduledWork.java create mode 100644 lib/src/main/java/com/atapiwrapper/library/api/model/geometry/Geometry.java create mode 100644 lib/src/main/java/com/atapiwrapper/library/api/model/geometry/GeometryDeserializer.java create mode 100644 lib/src/main/java/com/atapiwrapper/library/api/model/geometry/LineGeometry.java create mode 100644 lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineBaseGeometry.java create mode 100644 lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineEncodedGeometry.java create mode 100644 lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineGeometry.java create mode 100644 lib/src/main/java/com/atapiwrapper/library/api/model/geometry/PointGeometry.java create mode 100644 lib/src/main/java/com/atapiwrapper/library/api/model/geometry/PolygonGeometry.java create mode 100644 lib/src/main/java/com/atapiwrapper/library/api/service/DisplayService.java delete mode 100644 lib/src/main/java/com/atapiwrapper/library/api/service/DisplaysService.java diff --git a/README.md b/README.md index eb5878f..2703ced 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ I reccommend having a read through the [Retrofit docs](http://square.github.io/r * Realtime * GTFS +* Display (Parking Locations, Scheduled Works) ##How to use diff --git a/lib/src/androidTest/java/api/TATDisplays.java b/lib/src/androidTest/java/api/TATDisplays.java index d0d171c..792a660 100644 --- a/lib/src/androidTest/java/api/TATDisplays.java +++ b/lib/src/androidTest/java/api/TATDisplays.java @@ -1,14 +1,18 @@ package api; -import retrofit.RestAdapter; -import util.Util; import android.test.AndroidTestCase; import com.atapiwrapper.library.BuildConfig; import com.atapiwrapper.library.api.AtApi; import com.atapiwrapper.library.api.model.ServerResponse; -import com.atapiwrapper.library.api.model.realtime.vehiclelocations.VehicleLocationResponse; -import com.atapiwrapper.library.api.service.RealtimeService; +import com.atapiwrapper.library.api.model.display.ParkingLocation; +import com.atapiwrapper.library.api.model.display.ScheduledWork; +import com.atapiwrapper.library.api.service.DisplayService; + +import java.util.List; + +import retrofit.RestAdapter; +import util.Util; /** * Tests the realtime api requests and responses @@ -16,53 +20,37 @@ public class TATDisplays extends AndroidTestCase { private RestAdapter mRestAdapter; - private RealtimeService mRealtimeService; + private DisplayService mDisplayService; @Override protected void setUp() throws Exception { super.setUp(); AtApi api = new AtApi(BuildConfig.API_KEY); mRestAdapter = api.getRestAdapter(Util.getClient()); - mRealtimeService = mRestAdapter.create(RealtimeService.class); + mDisplayService = mRestAdapter.create(DisplayService.class); } - public void testVehicleLocations() { + public void testParkingLocations() { - ServerResponse result = mRealtimeService.vehiclelocations(); + ServerResponse> result = mDisplayService.parkingLocations(); //make sure we have content assertNotNull(result); assertNotNull(result.getStatus()); assertEquals(result.getStatus(), ServerResponse.STATUS_OK); assertNotNull(result.getResponse()); - assertNotNull(result.getResponse().getVehicleLocations()); - assertTrue(result.getResponse().getVehicleLocations().size() > 0); + assertTrue(result.getResponse().size() > 0); } - public void testVehicleLocationsByTripId() { - - ServerResponse result = mRealtimeService.vehiclelocationsByTripId("2212GW582020451266647"); - - //make sure we have content - assertNotNull(result); - assertNotNull(result.getStatus()); - assertEquals(result.getStatus(), ServerResponse.STATUS_OK); - assertNotNull(result.getResponse()); - assertNotNull(result.getResponse().getVehicleLocations()); - assertTrue(result.getResponse().getVehicleLocations().size() == 1); - } - - public void testVehicleLocationsByVehicleId() { - ServerResponse result = mRealtimeService.vehiclelocationsByTripId( - "4f9abf121ddd83f8eeed3a42ac2e159615fe5b3800333d0b9ca51f38700d1678"); + public void testScheduledWorks() { + ServerResponse> result = mDisplayService.scheduledWorks(); //make sure we have content assertNotNull(result); assertNotNull(result.getStatus()); assertEquals(result.getStatus(), ServerResponse.STATUS_OK); assertNotNull(result.getResponse()); - assertNotNull(result.getResponse().getVehicleLocations()); - assertTrue(result.getResponse().getVehicleLocations().size() == 1); + assertTrue(result.getResponse().size() > 0); } } diff --git a/lib/src/androidTest/java/api/TATRealtime.java b/lib/src/androidTest/java/api/TATRealtime.java index 9b75780..dcf082e 100644 --- a/lib/src/androidTest/java/api/TATRealtime.java +++ b/lib/src/androidTest/java/api/TATRealtime.java @@ -29,7 +29,7 @@ public class TATRealtime extends AndroidTestCase { public void testVehicleLocations() { - ServerResponse result = mRealtimeService.vehiclelocations(); + ServerResponse result = mRealtimeService.vehicleLocations(); //make sure we have content assertNotNull(result); @@ -41,7 +41,7 @@ public void testVehicleLocations() { } public void testVehicleLocationsByTripId() { - ServerResponse result = mRealtimeService.vehiclelocationsByTripId("2212GW582020451266647"); + ServerResponse result = mRealtimeService.vehicleLocationsByTripId("2212GW582020451266647"); //make sure we have content assertNotNull(result); @@ -54,7 +54,8 @@ public void testVehicleLocationsByTripId() { public void testVehicleLocationsByVehicleId() { - ServerResponse result = mRealtimeService.vehiclelocationsByTripId("4f9abf121ddd83f8eeed3a42ac2e159615fe5b3800333d0b9ca51f38700d1678"); + ServerResponse result = mRealtimeService.vehicleLocationsByTripId( + "4f9abf121ddd83f8eeed3a42ac2e159615fe5b3800333d0b9ca51f38700d1678"); //make sure we have content assertNotNull(result); diff --git a/lib/src/main/java/com/atapiwrapper/library/api/AtApi.java b/lib/src/main/java/com/atapiwrapper/library/api/AtApi.java index 5526490..afa7837 100644 --- a/lib/src/main/java/com/atapiwrapper/library/api/AtApi.java +++ b/lib/src/main/java/com/atapiwrapper/library/api/AtApi.java @@ -1,10 +1,14 @@ package com.atapiwrapper.library.api; -import com.atapiwrapper.library.api.service.DisplaysService; +import com.atapiwrapper.library.api.model.geometry.Geometry; +import com.atapiwrapper.library.api.model.geometry.GeometryDeserializer; +import com.atapiwrapper.library.api.service.DisplayService; import com.atapiwrapper.library.api.service.GtfsService; import com.atapiwrapper.library.api.service.RealtimeService; import com.atapiwrapper.library.core.ATConstants; +import com.fasterxml.jackson.core.Version; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; import com.squareup.okhttp.OkHttpClient; import retrofit.RequestInterceptor; @@ -46,6 +50,12 @@ public RestAdapter getRestAdapter() { public RestAdapter getRestAdapter(OkHttpClient client) { //setup mapper which uses custom deserializer final ObjectMapper mapper = new ObjectMapper(); + + //setup custom deserializer module to handle geometry + SimpleModule module = new SimpleModule("GeometryDeserializerModule", new Version(1, 0, 0, null)); + module.addDeserializer(Geometry.class, new GeometryDeserializer()); + mapper.registerModule(module); + JacksonConverter converter = new JacksonConverter(mapper); //request interceptor that will add an api key to every request @@ -73,9 +83,9 @@ public GtfsService getGtfsService() { return mRestAdapter.create(GtfsService.class); } - public DisplaysService getDisplaysService() { + public DisplayService getDisplaysService() { if (null == mRestAdapter) mRestAdapter = getRestAdapter(); - return mRestAdapter.create(DisplaysService.class); + return mRestAdapter.create(DisplayService.class); } } diff --git a/lib/src/main/java/com/atapiwrapper/library/api/model/display/ParkingLocation.java b/lib/src/main/java/com/atapiwrapper/library/api/model/display/ParkingLocation.java new file mode 100644 index 0000000..31320c2 --- /dev/null +++ b/lib/src/main/java/com/atapiwrapper/library/api/model/display/ParkingLocation.java @@ -0,0 +1,80 @@ +package com.atapiwrapper.library.api.model.display; + +import android.os.Parcel; +import android.os.Parcelable; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ParkingLocation implements Parcelable { + @JsonProperty("id") private Integer id; + @JsonProperty("address") private String address; + @JsonProperty("mobilitySpaces") private Integer mobilitySpaces; + @JsonProperty("name") private String name; + @JsonProperty("longitude") private Double longitude; + @JsonProperty("latitude") private Double latitude; + @JsonProperty("type") private String type; + + public Integer getId() { + return id; + } + + public String getAddress() { + return address; + } + + public Integer getMobilitySpaces() { + return mobilitySpaces; + } + + public String getName() { + return name; + } + + public Double getLongitude() { + return longitude; + } + + public Double getLatitude() { + return latitude; + } + + public String getType() { + return type; + } + + @Override public int describeContents() { + return 0; + } + + @Override public void writeToParcel(Parcel dest, int flags) { + dest.writeValue(this.id); + dest.writeString(this.address); + dest.writeValue(this.mobilitySpaces); + dest.writeString(this.name); + dest.writeValue(this.longitude); + dest.writeValue(this.latitude); + dest.writeString(this.type); + } + + public ParkingLocation() {} + + private ParkingLocation(Parcel in) { + this.id = (Integer) in.readValue(Integer.class.getClassLoader()); + this.address = in.readString(); + this.mobilitySpaces = (Integer) in.readValue(Integer.class.getClassLoader()); + this.name = in.readString(); + this.longitude = (Double) in.readValue(Double.class.getClassLoader()); + this.latitude = (Double) in.readValue(Double.class.getClassLoader()); + this.type = in.readString(); + } + + public static Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ParkingLocation createFromParcel(Parcel source) { + return new ParkingLocation(source); + } + + public ParkingLocation[] newArray(int size) { + return new ParkingLocation[size]; + } + }; +} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/model/display/ScheduledWork.java b/lib/src/main/java/com/atapiwrapper/library/api/model/display/ScheduledWork.java new file mode 100644 index 0000000..d00ac89 --- /dev/null +++ b/lib/src/main/java/com/atapiwrapper/library/api/model/display/ScheduledWork.java @@ -0,0 +1,132 @@ +package com.atapiwrapper.library.api.model.display; + +import android.os.Parcel; +import android.os.Parcelable; + +import com.atapiwrapper.library.api.model.geometry.Geometry; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ScheduledWork implements Parcelable { + @JsonProperty("region") private String region; + @JsonProperty("startDate") private String startDate; + @JsonProperty("lastUpdated") private String lastUpdated; + @JsonProperty("endDate") private String endDate; + @JsonProperty("code") private String code; + @JsonProperty("type") private String type; + @JsonProperty("geometry") private Geometry geometry; + @JsonProperty("id") private Integer id; + @JsonProperty("contractorCompany") private String contractorCompany; + @JsonProperty("suburb") private String suburb; + @JsonProperty("address") private String address; + @JsonProperty("description") private String description; + @JsonProperty("name") private String name; + @JsonProperty("longitude") private Double longitude; + @JsonProperty("latitude") private Double latitude; + + public String getRegion() { + return region; + } + + public String getStartDate() { + return startDate; + } + + public String getLastUpdated() { + return lastUpdated; + } + + public String getEndDate() { + return endDate; + } + + public String getCode() { + return code; + } + + public String getType() { + return type; + } + + public Geometry getGeometry() { + return geometry; + } + + public Integer getId() { + return id; + } + + public String getContractorCompany() { + return contractorCompany; + } + + public String getSuburb() { + return suburb; + } + + public String getAddress() { + return address; + } + + public String getDescription() { + return description; + } + + public String getName() { + return name; + } + + public Double getLongitude() { + return longitude; + } + + public Double getLatitude() { + return latitude; + } + + + @Override public int describeContents() { return 0; } + + @Override public void writeToParcel(Parcel dest, int flags) { + dest.writeString(this.region); + dest.writeString(this.startDate); + dest.writeString(this.lastUpdated); + dest.writeString(this.endDate); + dest.writeString(this.code); + dest.writeString(this.type); +// dest.writeParcelable(this.geometry, flags); + dest.writeValue(this.id); + dest.writeString(this.contractorCompany); + dest.writeString(this.suburb); + dest.writeString(this.address); + dest.writeString(this.description); + dest.writeString(this.name); + dest.writeValue(this.longitude); + dest.writeValue(this.latitude); + } + + public ScheduledWork() {} + + private ScheduledWork(Parcel in) { + this.region = in.readString(); + this.startDate = in.readString(); + this.lastUpdated = in.readString(); + this.endDate = in.readString(); + this.code = in.readString(); + this.type = in.readString(); +// this.geometry = in.readParcelable(Geometry.class.getClassLoader()); + this.id = (Integer) in.readValue(Integer.class.getClassLoader()); + this.contractorCompany = in.readString(); + this.suburb = in.readString(); + this.address = in.readString(); + this.description = in.readString(); + this.name = in.readString(); + this.longitude = (Double) in.readValue(Double.class.getClassLoader()); + this.latitude = (Double) in.readValue(Double.class.getClassLoader()); + } + + public static Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ScheduledWork createFromParcel(Parcel source) {return new ScheduledWork(source);} + + public ScheduledWork[] newArray(int size) {return new ScheduledWork[size];} + }; +} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/Geometry.java b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/Geometry.java new file mode 100644 index 0000000..e708152 --- /dev/null +++ b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/Geometry.java @@ -0,0 +1,20 @@ +package com.atapiwrapper.library.api.model.geometry; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Geometry returned by the server can be of different types determined by the type attribute. This is handled by a custom deserializerin + * {@link com.atapiwrapper.library.api.AtApi} + */ +public abstract class Geometry { + @JsonProperty("encoded") protected boolean encoded; + @JsonProperty("type") protected String type; + + public boolean isEncoded() { + return encoded; + } + + public String getType() { + return type; + } +} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/GeometryDeserializer.java b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/GeometryDeserializer.java new file mode 100644 index 0000000..28cb043 --- /dev/null +++ b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/GeometryDeserializer.java @@ -0,0 +1,36 @@ +package com.atapiwrapper.library.api.model.geometry; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; + +import java.io.IOException; + +public class GeometryDeserializer extends JsonDeserializer { + + @Override public Geometry deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { + + ObjectCodec oc = jsonParser.getCodec(); + JsonNode node = oc.readTree(jsonParser); + + String type = node.path("type").asText(); + boolean encoded = node.path("encoded").asBoolean(); + + switch (type) { + case "line": + return oc.treeToValue(node, LineGeometry.class); + case "polygon": + return oc.treeToValue(node, PolygonGeometry.class); + case "point": + return oc.treeToValue(node, PointGeometry.class); + case "multiline": + if (encoded) return oc.treeToValue(node, MultiLineEncodedGeometry.class); + else return oc.treeToValue(node, MultiLineGeometry.class); + default: + throw new IllegalArgumentException("Unknown geometry type"); + } + + } +} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/LineGeometry.java b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/LineGeometry.java new file mode 100644 index 0000000..2c48a17 --- /dev/null +++ b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/LineGeometry.java @@ -0,0 +1,9 @@ +package com.atapiwrapper.library.api.model.geometry; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class LineGeometry extends Geometry{ + @JsonProperty("coordinates") private List> data; +} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineBaseGeometry.java b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineBaseGeometry.java new file mode 100644 index 0000000..643d530 --- /dev/null +++ b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineBaseGeometry.java @@ -0,0 +1,14 @@ +package com.atapiwrapper.library.api.model.geometry; + +////@formatter:off +//@JsonTypeInfo( +// use = JsonTypeInfo.Id.NAME, +// include = JsonTypeInfo.As.PROPERTY, +// property = "encoded") +//@JsonSubTypes({ +// @JsonSubTypes.Type(value = MultiLineGeometry.class, name = "false"), +// @JsonSubTypes.Type(value = MultiLineEncodedGeometry.class, name = "true")}) +////@formatter:on +//@JsonIgnoreProperties(ignoreUnknown=true) +public class MultiLineBaseGeometry extends Geometry{ +} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineEncodedGeometry.java b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineEncodedGeometry.java new file mode 100644 index 0000000..fe88082 --- /dev/null +++ b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineEncodedGeometry.java @@ -0,0 +1,9 @@ +package com.atapiwrapper.library.api.model.geometry; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class MultiLineEncodedGeometry extends Geometry{ + @JsonProperty("coordinates") private List data; +} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineGeometry.java b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineGeometry.java new file mode 100644 index 0000000..42402e9 --- /dev/null +++ b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/MultiLineGeometry.java @@ -0,0 +1,10 @@ +package com.atapiwrapper.library.api.model.geometry; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +//@JsonIgnoreProperties(ignoreUnknown=true) +public class MultiLineGeometry extends Geometry{ + @JsonProperty("coordinates") private List>> data; +} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/PointGeometry.java b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/PointGeometry.java new file mode 100644 index 0000000..864e0f6 --- /dev/null +++ b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/PointGeometry.java @@ -0,0 +1,9 @@ +package com.atapiwrapper.library.api.model.geometry; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class PointGeometry extends Geometry{ + @JsonProperty("coordinates") private List data; +} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/PolygonGeometry.java b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/PolygonGeometry.java new file mode 100644 index 0000000..7b93937 --- /dev/null +++ b/lib/src/main/java/com/atapiwrapper/library/api/model/geometry/PolygonGeometry.java @@ -0,0 +1,9 @@ +package com.atapiwrapper.library.api.model.geometry; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class PolygonGeometry extends Geometry { + @JsonProperty("coordinates") private List> data; +} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/service/DisplayService.java b/lib/src/main/java/com/atapiwrapper/library/api/service/DisplayService.java new file mode 100644 index 0000000..72eff89 --- /dev/null +++ b/lib/src/main/java/com/atapiwrapper/library/api/service/DisplayService.java @@ -0,0 +1,58 @@ +package com.atapiwrapper.library.api.service; + +import com.atapiwrapper.library.api.model.ServerResponse; +import com.atapiwrapper.library.api.model.display.ParkingLocation; +import com.atapiwrapper.library.api.model.display.ScheduledWork; + +import java.util.List; + +import retrofit.Callback; +import retrofit.http.GET; + +public interface DisplayService { + + //--------------------------------------- + // Parking Locations + //--------------------------------------- + + /** + * + * Returns parking locations in the Auckland region + * + * @return {@link com.atapiwrapper.library.api.model.ServerResponse} + */ + + @GET("/public/display/parkinglocations") ServerResponse> parkingLocations(); + + /** + * + * Returns parking locations in the Auckland region + * + * @return {@link com.atapiwrapper.library.api.model.ServerResponse} + * @param cb The callback that will be called when the request completes + */ + @GET("/public/display/parkinglocations") void parkingLocations(Callback>> cb); + + //--------------------------------------- + // Scheduled Works + //--------------------------------------- + + /** + * + * Returns scheduled works in the Auckland region. e.g. road works + * + * @return {@link com.atapiwrapper.library.api.model.ServerResponse} + */ + + @GET("/public/display/scheduledworks") ServerResponse> scheduledWorks(); + + /** + * + * Returns scheduled works in the Auckland region. e.g. road works + * + * @return {@link com.atapiwrapper.library.api.model.ServerResponse} + * @param cb The callback that will be called when the request completes + */ + @GET("/public/display/scheduledworks") void scheduledWorks(Callback>> cb); + +} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/service/DisplaysService.java b/lib/src/main/java/com/atapiwrapper/library/api/service/DisplaysService.java deleted file mode 100644 index a3cea0c..0000000 --- a/lib/src/main/java/com/atapiwrapper/library/api/service/DisplaysService.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.atapiwrapper.library.api.service; - -public interface DisplaysService { - -} diff --git a/lib/src/main/java/com/atapiwrapper/library/api/service/RealtimeService.java b/lib/src/main/java/com/atapiwrapper/library/api/service/RealtimeService.java index 94abbcd..bde87cc 100644 --- a/lib/src/main/java/com/atapiwrapper/library/api/service/RealtimeService.java +++ b/lib/src/main/java/com/atapiwrapper/library/api/service/RealtimeService.java @@ -20,7 +20,7 @@ public interface RealtimeService { * @return {@link com.atapiwrapper.library.api.model.ServerResponse} */ - @GET("/public/realtime/vehiclelocations") ServerResponse vehiclelocations(); + @GET("/public/realtime/vehiclelocations") ServerResponse vehicleLocations(); /** * Returns real-time GTFS vehicle locations in the Auckland region. Returns a 30 second window of results otherwise returns results for @@ -29,7 +29,7 @@ public interface RealtimeService { * @return {@link com.atapiwrapper.library.api.model.ServerResponse} * @param cb The callback that will be called when the request completes */ - @GET("/public/realtime/vehiclelocations") void vehiclelocations(Callback> cb); + @GET("/public/realtime/vehiclelocations") void vehicleLocations(Callback> cb); //--------------------------------------- // Vehicle Locations - Trip id filter @@ -41,7 +41,7 @@ public interface RealtimeService { * @param tripId a comma separated list of trip ids * @return {@link com.atapiwrapper.library.api.model.ServerResponse} */ - @GET("/public/realtime/vehiclelocations") ServerResponse vehiclelocationsByTripId( + @GET("/public/realtime/vehiclelocations") ServerResponse vehicleLocationsByTripId( @Query("tripid") String tripId); /** @@ -51,7 +51,7 @@ public interface RealtimeService { * @param cb The callback that will be called when the request completes * @return {@link com.atapiwrapper.library.api.model.ServerResponse} */ - @GET("/public/realtime/vehiclelocations") void vehiclelocationsByTripId(@Query("tripid") String tripId, + @GET("/public/realtime/vehiclelocations") void vehicleLocationsByTripId(@Query("tripid") String tripId, Callback> cb); //--------------------------------------- @@ -64,7 +64,7 @@ public interface RealtimeService { * @param vehicleId a comma separated list of vehicle ids * @return {@link com.atapiwrapper.library.api.model.ServerResponse} */ - @GET("/public/realtime/vehiclelocations") ServerResponse vehiclelocationsByVehicleId( + @GET("/public/realtime/vehiclelocations") ServerResponse vehicleLocationsByVehicleId( @Query("vehicleid") String vehicleId); /** @@ -74,7 +74,7 @@ public interface RealtimeService { * @param cb The callback that will be called when the request completes * @return {@link com.atapiwrapper.library.api.model.ServerResponse} */ - @GET("/public/realtime/vehiclelocations") void vehiclelocationsByVehicleId(@Query("vehicleid") String vehicleId, + @GET("/public/realtime/vehiclelocations") void vehicleLocationsByVehicleId(@Query("vehicleid") String vehicleId, Callback> cb); } diff --git a/sample/src/main/java/com/atapiwrapper/sample/fragments/VehicleLocationListFragment.java b/sample/src/main/java/com/atapiwrapper/sample/fragments/VehicleLocationListFragment.java index 605eb85..f049bb5 100644 --- a/sample/src/main/java/com/atapiwrapper/sample/fragments/VehicleLocationListFragment.java +++ b/sample/src/main/java/com/atapiwrapper/sample/fragments/VehicleLocationListFragment.java @@ -81,7 +81,7 @@ private VehicleLocationAsyncTask() {} AtApi api = new AtApi(apiKey);//construct api object with our api key RealtimeService realtimeService = api.getRealtimeService(); //get the realtime service - return realtimeService.vehiclelocations();//get vehicle locations synchronously + return realtimeService.vehicleLocations();//get vehicle locations synchronously } @Override protected void onPostExecute(ServerResponse response) {