-
Notifications
You must be signed in to change notification settings - Fork 82
Add Support for Hotel Booking V2 #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.