Class: DiscountNetwork::Booking

Inherits:
Base
  • Object
show all
Defined in:
lib/discountnetwork/booking.rb

Instance Method Summary collapse

Methods inherited from Base

method_missing

Instance Method Details

#create(search_id:, hotel_id:, travellers:, properties:, **attrs) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/discountnetwork/booking.rb', line 9

def create(search_id:, hotel_id:, travellers:, properties:, **attrs)
  attributes = attrs.merge(
    search_id: search_id,
    travellers_attributes: build_array_params(travellers),
    properties_attributes: build_array_params(
      properties.merge(property_id: hotel_id)
    )
  )

  DiscountNetwork.post_resource(
    "bookings", booking: attributes
  ).travel_request
end

#find(booking_id) ⇒ Object



3
4
5
6
7
# File 'lib/discountnetwork/booking.rb', line 3

def find(booking_id)
  DiscountNetwork.get_resource(
    ["bookings", booking_id].join("/")
  ).travel_request
end