diff --git a/spec/amadeus/namespaces.test.js b/spec/amadeus/namespaces.test.js index b8d794c..cd7741d 100644 --- a/spec/amadeus/namespaces.test.js +++ b/spec/amadeus/namespaces.test.js @@ -310,7 +310,7 @@ describe('Namespaces', () => { amadeus.client.post = jest.fn(); amadeus.travel.tripParser.post(); expect(amadeus.client.post) - .toHaveBeenCalledWith('/v3/travel/trip-parser', {}); + .toHaveBeenCalledWith('/v3/travel/trip-parser', JSON.stringify({})); }); it('.amadeus.travel.tripParser.fromFile', () => { @@ -344,14 +344,14 @@ describe('Namespaces', () => { amadeus.client.post = jest.fn(); amadeus.booking.flightOrders.post(); expect(amadeus.client.post) - .toHaveBeenCalledWith('/v1/booking/flight-orders', {}); + .toHaveBeenCalledWith('/v1/booking/flight-orders', JSON.stringify({})); }); it('.amadeus.shopping.flightOffers.pricing.post', () => { amadeus.client.post = jest.fn(); amadeus.shopping.flightOffers.pricing.post(); expect(amadeus.client.post) - .toHaveBeenCalledWith('/v1/shopping/flight-offers/pricing', {}); + .toHaveBeenCalledWith('/v1/shopping/flight-offers/pricing', JSON.stringify({})); }); it('.amadeus.shopping.flightOffersSearch.get', () => { @@ -365,7 +365,7 @@ describe('Namespaces', () => { amadeus.client.post = jest.fn(); amadeus.shopping.flightOffersSearch.post(); expect(amadeus.client.post) - .toHaveBeenCalledWith('/v2/shopping/flight-offers', {}); + .toHaveBeenCalledWith('/v2/shopping/flight-offers', JSON.stringify({})); }); it('.amadeus.shopping.seatmaps.get', () => { @@ -379,7 +379,7 @@ describe('Namespaces', () => { amadeus.client.post = jest.fn(); amadeus.shopping.seatmaps.post(); expect(amadeus.client.post) - .toHaveBeenCalledWith('/v1/shopping/seatmaps', {}); + .toHaveBeenCalledWith('/v1/shopping/seatmaps', JSON.stringify({})); }); it('.amadeus.shopping.hotelOfferSearch().get', () => { @@ -494,14 +494,14 @@ describe('Namespaces', () => { amadeus.client.post = jest.fn(); amadeus.shopping.availability.flightAvailabilities.post(); expect(amadeus.client.post) - .toHaveBeenCalledWith('/v1/shopping/availability/flight-availabilities', {}); + .toHaveBeenCalledWith('/v1/shopping/availability/flight-availabilities', JSON.stringify({})); }); it('.amadeus.shopping.flight_offers.upselling.post', () => { amadeus.client.post = jest.fn(); amadeus.shopping.flightOffers.upselling.post(); expect(amadeus.client.post) - .toHaveBeenCalledWith('/v1/shopping/flight-offers/upselling', {}); + .toHaveBeenCalledWith('/v1/shopping/flight-offers/upselling', JSON.stringify({})); }); it('.amadeus.airline.destinations.get', () => { @@ -515,21 +515,21 @@ describe('Namespaces', () => { amadeus.client.post = jest.fn(); amadeus.shopping.transferOffers.post(); expect(amadeus.client.post) - .toHaveBeenCalledWith('/v1/shopping/transfer-offers', {}); + .toHaveBeenCalledWith('/v1/shopping/transfer-offers', JSON.stringify({})); }); it('.amadeus.ordering.transferOrders.post', () => { amadeus.client.post = jest.fn(); amadeus.ordering.transferOrders.post({}, '1234123123'); expect(amadeus.client.post) - .toHaveBeenCalledWith('/v1/ordering/transfer-orders?offerId=1234123123', {}); + .toHaveBeenCalledWith('/v1/ordering/transfer-orders?offerId=1234123123', JSON.stringify({})); }); it('.amadeus.ordering.transferOrders().transfers.cancellation.post', () => { amadeus.client.post = jest.fn(); amadeus.ordering.transferOrder('XXX').transfers.cancellation.post({}, 12345); expect(amadeus.client.post) - .toHaveBeenCalledWith('/v1/ordering/transfer-orders/XXX/transfers/cancellation?confirmNbr=12345', {}); + .toHaveBeenCalledWith('/v1/ordering/transfer-orders/XXX/transfers/cancellation?confirmNbr=12345', JSON.stringify({})); }); }); diff --git a/src/amadeus/namespaces/booking/flight_orders.js b/src/amadeus/namespaces/booking/flight_orders.js index 886883c..b13d01e 100644 --- a/src/amadeus/namespaces/booking/flight_orders.js +++ b/src/amadeus/namespaces/booking/flight_orders.js @@ -33,7 +33,7 @@ class FlightOrders { * ``` */ post(params = {}) { - return this.client.post('/v1/booking/flight-orders', params); + return this.client.post('/v1/booking/flight-orders', JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/ordering/transfer_orders.js b/src/amadeus/namespaces/ordering/transfer_orders.js index ff4871f..9d73c1f 100644 --- a/src/amadeus/namespaces/ordering/transfer_orders.js +++ b/src/amadeus/namespaces/ordering/transfer_orders.js @@ -25,11 +25,11 @@ class TransferOrders { * To book the transfer-offer(s) suggested by transferOffers and create a transfer-order * * ```js - * amadeus.ordering.transferOrders.post(body, '2094123123');; + * amadeus.ordering.transferOrders.post(body, '2094123123'); * ``` */ post(body, offerId) { - return this.client.post(`/v1/ordering/transfer-orders?offerId=${offerId}`, body); + return this.client.post(`/v1/ordering/transfer-orders?offerId=${offerId}`, JSON.stringify(body)); } } diff --git a/src/amadeus/namespaces/ordering/transfer_orders/transfers/cancellation.js b/src/amadeus/namespaces/ordering/transfer_orders/transfers/cancellation.js index 64a1952..73776e6 100644 --- a/src/amadeus/namespaces/ordering/transfer_orders/transfers/cancellation.js +++ b/src/amadeus/namespaces/ordering/transfer_orders/transfers/cancellation.js @@ -24,12 +24,12 @@ class Cancellation { * To cancel a transfer order with ID 'XXX' and confirmation number '12345' * * ```js - * amadeus.ordering.transferOrder('XXX').transfers.cancellation.post(JSON.stringify({}), '12345');; + * amadeus.ordering.transferOrder('XXX').transfers.cancellation.post({}, '12345');; * ``` */ post(body, confirmNbr) { return this.client.post( - `/v1/ordering/transfer-orders/${this.orderId}/transfers/cancellation?confirmNbr=${confirmNbr}`, body); + `/v1/ordering/transfer-orders/${this.orderId}/transfers/cancellation?confirmNbr=${confirmNbr}`, JSON.stringify(body)); } } diff --git a/src/amadeus/namespaces/shopping/availability/flight_availabilities.js b/src/amadeus/namespaces/shopping/availability/flight_availabilities.js index 8b41300..59e6da5 100644 --- a/src/amadeus/namespaces/shopping/availability/flight_availabilities.js +++ b/src/amadeus/namespaces/shopping/availability/flight_availabilities.js @@ -27,7 +27,7 @@ class FlightAvailabilities { * ``` */ post(params = {}) { - return this.client.post('/v1/shopping/availability/flight-availabilities', params); + return this.client.post('/v1/shopping/availability/flight-availabilities', JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/shopping/flight_offers/pricing.js b/src/amadeus/namespaces/shopping/flight_offers/pricing.js index 3d8db6e..68b47bc 100644 --- a/src/amadeus/namespaces/shopping/flight_offers/pricing.js +++ b/src/amadeus/namespaces/shopping/flight_offers/pricing.js @@ -48,7 +48,7 @@ class Pricing { url += '?' + queryString; } - return this.client.post(url, params); + return this.client.post(url, JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/shopping/flight_offers/upselling.js b/src/amadeus/namespaces/shopping/flight_offers/upselling.js index 258816b..393f993 100644 --- a/src/amadeus/namespaces/shopping/flight_offers/upselling.js +++ b/src/amadeus/namespaces/shopping/flight_offers/upselling.js @@ -27,7 +27,7 @@ class Upselling { * ``` */ post(params = {}) { - return this.client.post('/v1/shopping/flight-offers/upselling', params); + return this.client.post('/v1/shopping/flight-offers/upselling', JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/shopping/flight_offers_search.js b/src/amadeus/namespaces/shopping/flight_offers_search.js index d2198d6..0aaf2ef 100644 --- a/src/amadeus/namespaces/shopping/flight_offers_search.js +++ b/src/amadeus/namespaces/shopping/flight_offers_search.js @@ -52,7 +52,7 @@ class FlightOffersSearch { * To do a customized search with given options. * * ```js - * amadeus.shopping.flightOffersSearch.post (JSON.stringify({ + * amadeus.shopping.flightOffersSearch.post({ "currencyCode": "USD", "originDestinations": [ { @@ -114,11 +114,11 @@ class FlightOffersSearch { } } } - })) + }); * ``` */ post(params = {}) { - return this.client.post('/v2/shopping/flight-offers', params); + return this.client.post('/v2/shopping/flight-offers', JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/shopping/seatmaps.js b/src/amadeus/namespaces/shopping/seatmaps.js index 749d180..7b8f61a 100644 --- a/src/amadeus/namespaces/shopping/seatmaps.js +++ b/src/amadeus/namespaces/shopping/seatmaps.js @@ -59,7 +59,7 @@ class Seatmaps { * ``` */ post(params = {}) { - return this.client.post('/v1/shopping/seatmaps', params); + return this.client.post('/v1/shopping/seatmaps', JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/shopping/transfer_offers.js b/src/amadeus/namespaces/shopping/transfer_offers.js index 951a462..f3d3c55 100644 --- a/src/amadeus/namespaces/shopping/transfer_offers.js +++ b/src/amadeus/namespaces/shopping/transfer_offers.js @@ -31,7 +31,7 @@ class TransferOffers { * ``` */ post(params = {}) { - return this.client.post('/v1/shopping/transfer-offers', params); + return this.client.post('/v1/shopping/transfer-offers', JSON.stringify(params)); } } diff --git a/src/amadeus/namespaces/travel/trip_parser.js b/src/amadeus/namespaces/travel/trip_parser.js index 382a8a1..660cd5b 100644 --- a/src/amadeus/namespaces/travel/trip_parser.js +++ b/src/amadeus/namespaces/travel/trip_parser.js @@ -29,7 +29,7 @@ class TripParser { * ``` */ post(params = {}) { - return this.client.post('/v3/travel/trip-parser', params); + return this.client.post('/v3/travel/trip-parser', JSON.stringify(params)); } /** * Helper method to convert file contents in UTF-8 encoded string