Class: Amadeus::Namespaces::Booking::HotelBookings
- Inherits:
-
Client::Decorator
- Object
- Client::Decorator
- Amadeus::Namespaces::Booking::HotelBookings
- Defined in:
- lib/amadeus/namespaces/booking/hotel_bookings.rb
Overview
Instance Method Summary collapse
-
#post(hotel_offer_id, guests, payments) ⇒ Amadeus:Response
Book a specific room.
- #prepare_body(hotel_offer_id, guests, payments) ⇒ Object
Instance Method Details
#post(hotel_offer_id, guests, payments) ⇒ Amadeus:Response
Book a specific room
The parameters guests and payments can be passed as dictionary or list of dictionaries. If they are dictionary in this method they are converted to a list of dictionaries.
29 30 31 32 33 |
# File 'lib/amadeus/namespaces/booking/hotel_bookings.rb', line 29 def post(hotel_offer_id, guests, payments) body = prepare_body(hotel_offer_id, guests, payments) client.post('/v1/booking/hotel-bookings', body.to_json) end |
#prepare_body(hotel_offer_id, guests, payments) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/amadeus/namespaces/booking/hotel_bookings.rb', line 35 def prepare_body(hotel_offer_id, guests, payments) guests_info = [], pay_info = [] guests.is_a?(Array) ? guests_info.push(guests).flatten! : guests_info.push(guests) payments.is_a?(Array) ? pay_info.push(payments).flatten! : pay_info.push(payments) { 'data' => { 'offerId' => hotel_offer_id, 'guests' => guests_info, 'payments' => pay_info } } end |