Class: Parsec::Request::Hotel
- Inherits:
-
Base
- Object
- Base
- Parsec::Request::Hotel
show all
- Defined in:
- lib/parsec/request/hotel.rb
Constant Summary
Constants inherited
from Base
Base::DATE_FORMAT, Base::NAMESPACE, Base::RESOURCES
Instance Method Summary
collapse
Methods inherited from Base
#client, #error, #initialize
Instance Method Details
#by_city(city_code) ⇒ Object
24
25
26
27
|
# File 'lib/parsec/request/hotel.rb', line 24
def by_city(city_code)
hotels = hotel_search_request(hotel_ref: { '@HotelCityCode' => city_code })
hotels.map { |h| Parsec::Hotel.build(h) }
end
|
#by_country(country_iso_code) ⇒ Object
19
20
21
22
|
# File 'lib/parsec/request/hotel.rb', line 19
def by_country(country_iso_code)
hotels = hotel_search_request(ref_point: { '@CountryCode' => country_iso_code })
hotels.map { |h| Parsec::Hotel.build(h) }
end
|
#details(code) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/parsec/request/hotel.rb', line 6
def details(code)
message = { hotel_descriptive_infos: { '@LangRequested' => 'EN', hotel_descriptive_info: { '@HotelCode' => code } } }
response = client(:hotel_info).call('OTA_HotelDescriptiveInfoRQ', message: message)
hotel = Parsec::Hotel.new(code: code)
hotel.add_details(response.body[:ota_hotel_descriptive_info_rs][:hotel_descriptive_contents][:hotel_descriptive_content])
hotel.add_details_with_nokogiri(response.doc)
hotel
rescue Savon::Error => e
Xlog.and_raise_error(e)
end
|
#fetch(hotel_code) ⇒ Object
29
30
31
32
|
# File 'lib/parsec/request/hotel.rb', line 29
def fetch(hotel_code)
hotels = hotel_search_request(hotel_ref: { '@HotelCode' => hotel_code })
Parsec::Hotel.build(hotels.first)
end
|