Skip to content

Commit

Permalink
removed helper for flexibility
Browse files Browse the repository at this point in the history
  • Loading branch information
minjikarin committed Jun 20, 2024
1 parent b997ff1 commit 804bcb8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
11 changes: 1 addition & 10 deletions spec/amadeus/namespaces.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,16 +452,7 @@ describe('Namespaces', () => {
amadeus.client.post = jest.fn();
amadeus.booking.hotelOrders.post();
expect(amadeus.client.post)
.toHaveBeenCalledWith('/v2/booking/hotel-orders', JSON.stringify({
data: {
type: 'hotel-order',
guests: [],
travelAgent: {},
roomAssociations: [],
payment: {},
arrivalInformation: {}
}
}));
.toHaveBeenCalledWith('/v2/booking/hotel-orders', {});
});

it('.amadeus.eReputation.hotelSentiments.get', () => {
Expand Down
16 changes: 3 additions & 13 deletions src/amadeus/namespaces/booking/hotel_orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,16 @@ class HotelOrders {
* ```js
* amadeus.booking.hotelOrders.post({
* 'guests': [],
* 'travel_agent: {},
* 'room_associations: [],
* 'travelAgent: {},
* 'roomAssociations: [],
* 'payment': {},
* 'arrivalInformation': {}
* });
* ```
*/
post(params = {}) {
const body = {
data: {
type: 'hotel-order',
guests: params.guests || [],
travelAgent: params.travelAgent || {},
roomAssociations: params.roomAssociations || [],
payment: params.payment || {},
arrivalInformation: params.arrivalInformation || {}
}
};

return this.client.post('/v2/booking/hotel-orders', JSON.stringify(body));
return this.client.post('/v2/booking/hotel-orders', params);
}
}

Expand Down

0 comments on commit 804bcb8

Please sign in to comment.