Class: BookingApi::Client

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

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



4
5
6
# File 'lib/booking_api/client.rb', line 4

def initialize
  @http_service = HttpService.new
end

Instance Method Details

#get_hotel_availabillity(request_parameters: {}) ⇒ Object

checks for the given parameters if the hotel is available



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

def get_hotel_availabillity(request_parameters: {})
  default_parameters = {
    room1: "A,A",
  }
  http_service.request_post("/json/getHotelAvailabilityV2", default_parameters.merge(request_parameters))
end

#get_hotel_description_translations(request_parameters: {}) ⇒ Object

gets detailed descriptions for the given hotels



31
32
33
34
# File 'lib/booking_api/client.rb', line 31

def get_hotel_description_translations(request_parameters: {})
  default_parameters = {}
  http_service.request_post("/json/bookings.getHotelDescriptionTranslations", default_parameters.merge(request_parameters))
end

#get_hotel_overviews(hotel_ids: [], request_parameters: {}) ⇒ Object

gets an overview of the data for the given hotel ids.



37
38
39
40
41
# File 'lib/booking_api/client.rb', line 37

def get_hotel_overviews(hotel_ids: [], request_parameters: {})
  default_parameters = {}
  default_parameters[:hotel_ids] = hotel_ids.join(",") if hotel_ids.any?
  http_service.request_post("/json/bookings.getHotels", default_parameters.merge(request_parameters))
end

#hotel_description_photos(hotel_ids: [], request_parameters: {}) ⇒ Object

gets hotel photos for the given hotel ids

Raises:

  • (ArgumentError)


21
22
23
24
25
26
27
28
# File 'lib/booking_api/client.rb', line 21

def hotel_description_photos(hotel_ids: [], request_parameters: {})
  raise ArgumentError if hotel_ids.empty?
  default_parameters = {
    hotel_ids: hotel_ids.join(",")
  }
  response = http_service.request_post("/json/bookings.getHotelDescriptionPhotos", default_parameters.merge(request_parameters))
  Images::ResponseList.new(response)
end

#http_serviceObject



8
9
10
# File 'lib/booking_api/client.rb', line 8

def http_service
  @http_service
end