-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #212 from siddydutta/hotel-orders
Add Support for Hotel Booking V2
- Loading branch information
Showing
6 changed files
with
93 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from ._flight_orders import FlightOrders | ||
from ._flight_order import FlightOrder | ||
from ._hotel_bookings import HotelBookings | ||
from ._hotel_orders import HotelOrders | ||
|
||
__all__ = ['FlightOrders', 'FlightOrder', 'HotelBookings'] | ||
__all__ = ['FlightOrders', 'FlightOrder', 'HotelBookings', 'HotelOrders'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from amadeus.client.decorator import Decorator | ||
|
||
|
||
class HotelOrders(Decorator, object): | ||
def post(self, | ||
guests, | ||
travel_agent, | ||
room_associations=[], | ||
payment={}, | ||
arrival_information={}): | ||
''' | ||
Book hotel(s) via Hotel Booking API V2 | ||
.. code-block:: python | ||
amadeus.booking.hotel_orders.post(guests, | ||
travel_agent, | ||
room_associations, | ||
payment, | ||
arrival_information) | ||
The parameters guests and room_associations can be passed as dictionary | ||
or list of dictionaries. If they are dictionary in this method they are | ||
converted to a list of dictionaries. | ||
:rtype: amadeus.Response | ||
:raises amadeus.ResponseError: if the request could not be completed | ||
''' | ||
guests_info = [] | ||
room_associations_info = [] | ||
if not isinstance(guests, list): | ||
guests_info.append(guests) | ||
else: | ||
guests_info.extend(guests) | ||
if not isinstance(room_associations, list): | ||
room_associations_info.append(room_associations) | ||
else: | ||
room_associations_info.extend(room_associations) | ||
body = {'data': {'type': 'hotel-order', | ||
'guests': guests_info, | ||
'travelAgent': travel_agent, | ||
'roomAssociations': room_associations_info, | ||
'arrivalInformation': arrival_information, | ||
'payment': payment}} | ||
return self.client.post('/v2/booking/hotel-orders', body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters