Skip to content

Commit ca34f46

Browse files
committed
add changelog
1 parent 2d334d0 commit ca34f46

File tree

6 files changed

+46
-43
lines changed

6 files changed

+46
-43
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
Mapbox welcomes participation and contributions from everyone.
44

55
### main
6+
7+
### v6.6.0 - Jun 30, 2022
68
- Fixed `RouteOptions#toUrl` for a case when `RouteOptions` was deserialized from a json generated by an old version of mapbox-java. [#1447](https://github.com/mapbox/mapbox-java/pull/1447)
9+
- Added support for `Amenities` by exposing them as a part of `RestStop`. [#1454](https://github.com/mapbox/mapbox-java/pull/1454)
710

811
### v6.5.0 - May 25, 2022
912
- No additional changes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ repositories {
5454
}
5555
5656
dependencies {
57-
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:6.6.0-SNAPSHOT'
57+
implementation 'com.mapbox.mapboxsdk:mapbox-sdk-services:6.7.0-SNAPSHOT'
5858
}
5959
```
6060

services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/Amenities.java renamed to services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/Amenity.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Only available on the {@link DirectionsCriteria#PROFILE_DRIVING} profile.
1515
*/
1616
@AutoValue
17-
public abstract class Amenities extends DirectionsJsonObject {
17+
public abstract class Amenity extends DirectionsJsonObject {
1818

1919
/**
2020
* The type of amenities such as gas, restaurants, shopping, bank, atm etc.
@@ -36,32 +36,32 @@ public abstract class Amenities extends DirectionsJsonObject {
3636
public abstract String brand();
3737

3838
/**
39-
* Create a new instance of this class by using the {@link Amenities.Builder} class.
39+
* Create a new instance of this class by using the {@link Amenity.Builder} class.
4040
*
41-
* @return this classes {@link Amenities.Builder} for creating a new instance
41+
* @return this classes {@link Amenity.Builder} for creating a new instance
4242
*/
43-
public static Amenities.Builder builder() {
44-
return new AutoValue_Amenities.Builder();
43+
public static Amenity.Builder builder() {
44+
return new AutoValue_Amenity.Builder();
4545
}
4646

4747
/**
48-
* Convert the current {@link Amenities} to its builder holding the currently assigned
48+
* Convert the current {@link Amenity} to its builder holding the currently assigned
4949
* values. This allows you to modify a single property and then rebuild the object resulting in
50-
* an updated and modified {@link Amenities}.
50+
* an updated and modified {@link Amenity}.
5151
*
52-
* @return a {@link Amenities.Builder} with the same values set to match the ones
53-
* defined in this {@link Amenities}
52+
* @return a {@link Amenity.Builder} with the same values set to match the ones
53+
* defined in this {@link Amenity}
5454
*/
55-
public abstract Amenities.Builder toBuilder();
55+
public abstract Amenity.Builder toBuilder();
5656

5757
/**
5858
* Gson type adapter for parsing Gson to this class.
5959
*
6060
* @param gson the built {@link Gson} object
6161
* @return the type adapter for this class
6262
*/
63-
public static TypeAdapter<Amenities> typeAdapter(Gson gson) {
64-
return new AutoValue_Amenities.GsonTypeAdapter(gson);
63+
public static TypeAdapter<Amenity> typeAdapter(Gson gson) {
64+
return new AutoValue_Amenity.GsonTypeAdapter(gson);
6565
}
6666

6767
/**
@@ -70,17 +70,17 @@ public static TypeAdapter<Amenities> typeAdapter(Gson gson) {
7070
* @param json a formatted valid JSON string defining an Incident
7171
* @return a new instance of this class defined by the values passed in the method
7272
*/
73-
public static Amenities fromJson(String json) {
73+
public static Amenity fromJson(String json) {
7474
GsonBuilder gson = new GsonBuilder();
7575
gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create());
76-
return gson.create().fromJson(json, Amenities.class);
76+
return gson.create().fromJson(json, Amenity.class);
7777
}
7878

7979
/**
80-
* This builder can be used to set the values describing the {@link Amenities}.
80+
* This builder can be used to set the values describing the {@link Amenity}.
8181
*/
8282
@AutoValue.Builder
83-
public abstract static class Builder extends DirectionsJsonObject.Builder<Amenities.Builder> {
83+
public abstract static class Builder extends DirectionsJsonObject.Builder<Amenity.Builder> {
8484

8585
/**
8686
* The type of amenity, includes amenities such as gas, restaurants etc.
@@ -108,11 +108,11 @@ public abstract static class Builder extends DirectionsJsonObject.Builder<Amenit
108108
public abstract Builder brand(@Nullable String brand);
109109

110110
/**
111-
* Build a new {@link Amenities} object.
111+
* Build a new {@link Amenity} object.
112112
*
113-
* @return a new {@link Amenities} using the provided values in this builder
113+
* @return a new {@link Amenity} using the provided values in this builder
114114
*/
115115
@NonNull
116-
public abstract Amenities build();
116+
public abstract Amenity build();
117117
}
118118
}

services-directions-models/src/main/java/com/mapbox/api/directions/v5/models/RestStop.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public abstract class RestStop extends DirectionsJsonObject {
3737
* The list of amenities at the rest stop if available.
3838
*/
3939
@Nullable
40-
public abstract List<Amenities> amenities();
40+
public abstract List<Amenity> amenities();
4141

4242
/**
4343
* Create a new instance of this class by using the {@link Builder} class.
@@ -110,7 +110,7 @@ public abstract static class Builder extends DirectionsJsonObject.Builder<Builde
110110
* @param amenities list of amenities
111111
*/
112112
@NonNull
113-
public abstract Builder amenities(@Nullable List<Amenities> amenities);
113+
public abstract Builder amenities(@Nullable List<Amenity> amenities);
114114

115115
/**
116116
* Build a new {@link RestStop} object.

services-directions-models/src/test/java/com/mapbox/api/directions/v5/models/AmenitiesTest.java renamed to services-directions-models/src/test/java/com/mapbox/api/directions/v5/models/AmenityTest.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,46 @@
77
import static org.junit.Assert.assertNotNull;
88
import static org.junit.Assert.assertNull;
99

10-
public class AmenitiesTest extends TestUtils {
10+
public class AmenityTest extends TestUtils {
1111

1212
private static final String DIRECTIONS_V5_AMENITIES_FIXTURE = "directions_v5_amenities.json";
1313
@Test
1414
public void sanity(){
1515
assertNotNull(getDefault());
1616
}
1717

18-
private Amenities getDefault() {
19-
return Amenities.builder()
18+
private Amenity getDefault() {
19+
return Amenity.builder()
2020
.type("restaurant")
2121
.name("starbucks")
2222
.build();
2323
}
2424

2525
@Test
2626
public void serializableObject() throws Exception {
27-
Amenities expected = Amenities
27+
Amenity expected = Amenity
2828
.builder()
2929
.type("restaurant")
3030
.name("starbucks")
3131
.build();
3232

33-
Amenities actual = deserialize(
33+
Amenity actual = deserialize(
3434
TestUtils.serialize(expected),
35-
Amenities.class
35+
Amenity.class
3636
);
3737

3838
assertEquals(expected, actual);
3939
}
4040

4141
@Test
4242
public void toFromJson() {
43-
Amenities expected = Amenities
43+
Amenity expected = Amenity
4444
.builder()
4545
.type("restaurant")
4646
.name("starbucks")
4747
.build();
4848

49-
Amenities actual = Amenities.fromJson(expected.toJson());
49+
Amenity actual = Amenity.fromJson(expected.toJson());
5050

5151
assertEquals(expected, actual);
5252
}
@@ -57,16 +57,16 @@ public void fromJson_correctlyBuildsFromJson() throws Exception {
5757
DirectionsResponse response = DirectionsResponse.fromJson(json);
5858

5959
RestStop restStop = response.routes().get(0).legs().get(0).steps().get(1).intersections().get(0).restStop();
60-
Amenities amenities1 = restStop.amenities().get(0);
61-
Amenities amenities2 = restStop.amenities().get(1);
60+
Amenity amenity1 = restStop.amenities().get(0);
61+
Amenity amenity2 = restStop.amenities().get(1);
6262

63-
assertNotNull(amenities1);
64-
assertNotNull(amenities2);
65-
assertNull(amenities1.brand());
66-
assertEquals("restaurant", amenities1.type());
67-
assertEquals("Panda Express", amenities1.name());
68-
assertNull(amenities2.name());
69-
assertEquals("gas_station", amenities2.type());
70-
assertEquals("Shell", amenities2.brand());
63+
assertNotNull(amenity1);
64+
assertNotNull(amenity2);
65+
assertNull(amenity1.brand());
66+
assertEquals("restaurant", amenity1.type());
67+
assertEquals("Panda Express", amenity1.name());
68+
assertNull(amenity2.name());
69+
assertEquals("gas_station", amenity2.type());
70+
assertEquals("Shell", amenity2.brand());
7171
}
7272
}

services-directions-models/src/test/java/com/mapbox/api/directions/v5/models/RestStopTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void sanity() throws Exception {
1717
RestStop restStop = RestStop.builder()
1818
.name("ABCD")
1919
.type("service_area")
20-
.amenities(Collections.<Amenities>emptyList())
20+
.amenities(Collections.emptyList())
2121
.build();
2222
assertNotNull(restStop);
2323
}
@@ -28,7 +28,7 @@ public void serializableObject() throws Exception {
2828
.builder()
2929
.name("ABCD")
3030
.type("service_area")
31-
.amenities(Collections.<Amenities>emptyList())
31+
.amenities(Collections.emptyList())
3232
.build();
3333

3434
RestStop actual = deserialize(
@@ -45,7 +45,7 @@ public void toFromJson() {
4545
.builder()
4646
.name("ABCD")
4747
.type("service_area")
48-
.amenities(Collections.<Amenities>emptyList())
48+
.amenities(Collections.emptyList())
4949
.build();
5050

5151
RestStop actual = RestStop.fromJson(expected.toJson());

0 commit comments

Comments
 (0)