Skip to content

Commit 5a61dd3

Browse files
committed
add literals
1 parent f8df1da commit 5a61dd3

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

src/main/java/com/amadeus/shopping/SeatMaps.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525
public class SeatMaps {
2626
private Amadeus client;
27+
private final String seatMapUrl = "/v1/shopping/seatmaps";
2728

2829
/**
2930
* Constructor.
@@ -48,7 +49,7 @@ public SeatMaps(Amadeus client) {
4849
* @throws ResponseException when an exception occurs
4950
*/
5051
public SeatMap[] get(Params params) throws ResponseException {
51-
Response response = client.get("/v1/shopping/seatmaps", params);
52+
Response response = client.get(seatMapUrl, params);
5253
return (SeatMap[]) Resource.fromArray(response, SeatMap[].class);
5354
}
5455

@@ -75,7 +76,7 @@ public SeatMap[] get() throws ResponseException {
7576
* @throws ResponseException when an exception occurs
7677
*/
7778
public SeatMap[] post(JsonObject body) throws ResponseException {
78-
Response response = client.post("/v1/shopping/seatmaps", body);
79+
Response response = client.post(seatMapUrl, body);
7980
return (SeatMap[]) Resource.fromArray(response, SeatMap[].class);
8081
}
8182

@@ -94,7 +95,7 @@ public SeatMap[] post(JsonObject body) throws ResponseException {
9495
* @throws ResponseException when an exception occurs
9596
*/
9697
public SeatMap[] post(String body) throws ResponseException {
97-
Response response = client.post("/v1/shopping/seatmaps", body);
98+
Response response = client.post(seatMapUrl, body);
9899
return (SeatMap[]) Resource.fromArray(response, SeatMap[].class);
99100
}
100101

src/main/java/com/amadeus/shopping/flightOffers/Pricing.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
public class Pricing {
3232

3333
private Amadeus client;
34+
private final String pricingUrl = "/v1/shopping/flight-offers/pricing";
3435

3536
/**
3637
* Constructor.
@@ -89,7 +90,7 @@ private JsonArray buildPaymentJSON(FlightPayment flightPayment) {
8990
* @throws ResponseException when an exception occurs
9091
*/
9192
public FlightPrice post(JsonObject body, Params params) throws ResponseException {
92-
Response response = client.post("/v1/shopping/flight-offers/pricing", params, body);
93+
Response response = client.post(pricingUrl, params, body);
9394
return (FlightPrice) Resource.fromObject(response, FlightPrice.class);
9495
}
9596

@@ -110,7 +111,7 @@ public FlightPrice post(JsonObject body, Params params) throws ResponseException
110111
* @throws ResponseException when an exception occurs
111112
*/
112113
public FlightPrice post(String body, Params params) throws ResponseException {
113-
Response response = client.post("/v1/shopping/flight-offers/pricing", params, body);
114+
Response response = client.post(pricingUrl, params, body);
114115
return (FlightPrice) Resource.fromObject(response, FlightPrice.class);
115116
}
116117

@@ -130,7 +131,7 @@ public FlightPrice post(String body, Params params) throws ResponseException {
130131
* @throws ResponseException when an exception occurs
131132
*/
132133
public FlightPrice post(JsonObject body) throws ResponseException {
133-
Response response = client.post("/v1/shopping/flight-offers/pricing", body);
134+
Response response = client.post(pricingUrl, body);
134135
return (FlightPrice) Resource.fromObject(response, FlightPrice.class);
135136
}
136137

@@ -150,7 +151,7 @@ public FlightPrice post(JsonObject body) throws ResponseException {
150151
* @throws ResponseException when an exception occurs
151152
*/
152153
public FlightPrice post(String body) throws ResponseException {
153-
Response response = client.post("/v1/shopping/flight-offers/pricing", body);
154+
Response response = client.post(pricingUrl, body);
154155
return (FlightPrice) Resource.fromObject(response, FlightPrice.class);
155156
}
156157

@@ -227,9 +228,9 @@ public FlightPrice post(FlightOfferSearch[] flightOffersSearches,
227228
// Is it a call with param or without param?
228229
if (params != null) {
229230
response = client.post(
230-
"/v1/shopping/flight-offers/pricing", params, jsonObject);
231+
"pricingUrl", params, jsonObject);
231232
} else {
232-
response = client.post("/v1/shopping/flight-offers/pricing", jsonObject);
233+
response = client.post("pricingUrl", jsonObject);
233234
}
234235
return (FlightPrice) Resource.fromObject(response, FlightPrice.class);
235236
}
@@ -287,7 +288,7 @@ public FlightPrice post(FlightOfferSearch[] flightOffersSearches,
287288
JsonObject jsonObject = new JsonObject();
288289
jsonObject.add("data", typeObject);
289290

290-
Response response = client.post("/v1/shopping/flight-offers/pricing", jsonObject);
291+
Response response = client.post("pricingUrl", jsonObject);
291292
return (FlightPrice) Resource.fromObject(response, FlightPrice.class);
292293
}
293294

src/main/java/com/amadeus/travel/TripParser.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828
public class TripParser {
2929
private Amadeus client;
30+
private final String tripParserUrl = "/v3/travel/trip-parser";
3031

3132
/**
3233
* Constructor.
@@ -51,7 +52,7 @@ public TripParser(Amadeus client) {
5152
* @throws ResponseException when an exception occurs
5253
*/
5354
public TripDetail post(JsonObject body) throws ResponseException {
54-
Response response = client.post("/v3/travel/trip-parser", body);
55+
Response response = client.post(tripParserUrl, body);
5556
return (TripDetail) Resource.fromObject(response, TripDetail.class);
5657
}
5758

@@ -69,7 +70,7 @@ public TripDetail post(JsonObject body) throws ResponseException {
6970
* @throws ResponseException when an exception occurs
7071
*/
7172
public TripDetail post(String body) throws ResponseException {
72-
Response response = client.post("/v3/travel/trip-parser", body);
73+
Response response = client.post(tripParserUrl, body);
7374
return (TripDetail) Resource.fromObject(response, TripDetail.class);
7475
}
7576

@@ -98,7 +99,7 @@ public TripDetail post(File file) throws ResponseException, IOException {
9899
body.addProperty("payload", encodedFile);
99100
count = count + fileInputStreamReader.read(bytes);
100101

101-
Response response = client.post("/v3/travel/trip-parser", body);
102+
Response response = client.post(tripParserUrl, body);
102103
return (TripDetail) Resource.fromObject(response, TripDetail.class);
103104
}
104105
}

0 commit comments

Comments
 (0)