Class: HotelBeds::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/hotel_beds/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**config) ⇒ Client

Returns a new instance of Client.



14
15
16
17
18
# File 'lib/hotel_beds/client.rb', line 14

def initialize(**config)
  self.configuration = Configuration.new(**config)
  self.connection = Connection.new(configuration)
  freeze
end

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



11
12
13
# File 'lib/hotel_beds/client.rb', line 11

def configuration
  @configuration
end

Instance Method Details

#add_hotel_room_to_basket(*args) ⇒ Object



29
30
31
32
33
# File 'lib/hotel_beds/client.rb', line 29

def add_hotel_room_to_basket(*args)
  HotelBasketAdd::Operation.new(*args).perform(
    connection: connection
  )
end

#confirm_purchase(*args) ⇒ Object



35
36
37
38
39
# File 'lib/hotel_beds/client.rb', line 35

def confirm_purchase(*args)
  PurchaseConfirm::Operation.new(*args).perform(
    connection: connection
  )
end

#flush_purchase(*args) ⇒ Object



41
42
43
44
45
# File 'lib/hotel_beds/client.rb', line 41

def flush_purchase(*args)
  PurchaseFlush::Operation.new(*args).perform(
    connection: connection
  )
end

#perform_hotel_search(*args) ⇒ Object

each method returns an operation object which contains both the request and response objects.



23
24
25
26
27
# File 'lib/hotel_beds/client.rb', line 23

def perform_hotel_search(*args)
  HotelSearch::Operation.new(*args).perform(
    connection: connection
  )
end

#remove_service_from_basket(*args) ⇒ Object



47
48
49
50
51
# File 'lib/hotel_beds/client.rb', line 47

def remove_service_from_basket(*args)
  BasketRemove::Operation.new(*args).perform(
    connection: connection
  )
end