Class: Easytobookr
- Inherits:
-
Object
- Object
- Easytobookr
- Defined in:
- lib/easytobookr/request_methods.rb,
lib/easytobookr.rb,
lib/easytobookr/config.rb,
lib/easytobookr/version.rb
Overview
These are a collection of convenience methods injected as Easytobookr class methods. These are low-level API requests that map 1-1 with the public API and return an Easytobookr::Request object
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
-
.all_facilities(language = :en) ⇒ Object
Returns the request object for the GetAllFacilities API call.
-
.cancel_booking ⇒ Object
Command: returns the request object for the CancelBooking API call.
-
.city_availability(city_id, start_date, end_date, rating = nil, people = 2, currency = 'USD', customer_ip = '127.0.0.1', language = :en) ⇒ Object
Returns the request object for the SearchCityAvailability API call.
-
.city_cheapest_room_availability(city_id, start_date, end_date, people = 2, currency = 'USD', customer_ip = '127.0.0.1') ⇒ Object
Returns the request object for the SearchHotelCheapestRoomInCity API call.
-
.city_hotel_info(city_id, language = :en) ⇒ Object
Returns the request object for the HotelInformationInCity API call.
-
.city_hotel_list(city_id, language = :en) ⇒ Object
Returns the request object for the GetCityHotelList API call.
-
.city_info(city_id) ⇒ Object
Returns the request object for the GetCityInfo API call.
-
.city_list ⇒ Object
Returns the request object for the GetCityList API call.
- .config ⇒ Object
-
.create_booking ⇒ Object
Command: returns the request object for the CreateBooking API call.
-
.hotel_availability(hotel_id, start_date, end_date, people = 2, rooms = 1, currency = 'USD', customer_ip = '127.0.0.1', show_non_availability = false, language = :en) ⇒ Object
Returns the request object for the GetHotelAvailability API call.
-
.hotel_facilities(hotel_id, language = :en) ⇒ Object
Returns the request object for the GetHotelFacilities API call.
-
.hotel_photos(hotel_id) ⇒ Object
Returns the request object for the GetHotelPhotos API call.
-
.retrieve_booking ⇒ Object
Returns the request object for the RetrieveBooking API call.
-
.room_facilities(room_id, language = :en) ⇒ Object
Returns the request object for the GetRoomFacilities API call.
- .setup(&block) ⇒ Object
Class Method Details
.all_facilities(language = :en) ⇒ Object
Returns the request object for the GetAllFacilities API call.
55 56 57 |
# File 'lib/easytobookr/request_methods.rb', line 55 def all_facilities(language=:en) Request.new(:GetAllFacilities, { :Language => language }) end |
.cancel_booking ⇒ Object
Command: returns the request object for the CancelBooking API call.
87 88 89 |
# File 'lib/easytobookr/request_methods.rb', line 87 def cancel_booking raise "nyi" end |
.city_availability(city_id, start_date, end_date, rating = nil, people = 2, currency = 'USD', customer_ip = '127.0.0.1', language = :en) ⇒ Object
Returns the request object for the SearchCityAvailability API call.
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/easytobookr/request_methods.rb', line 70 def city_availability(city_id,start_date,end_date,=nil,people=2,currency='USD',customer_ip='127.0.0.1',language=:en) params = { :Cityid => city_id, :Startdate => start_date, :Enddate => end_date, :Rating => , :Noofpersons => people, :Currency => currency, :CustomerIP => customer_ip, :Language => language } Request.new(:SearchCityAvailability, params) end |
.city_cheapest_room_availability(city_id, start_date, end_date, people = 2, currency = 'USD', customer_ip = '127.0.0.1') ⇒ Object
Returns the request object for the SearchHotelCheapestRoomInCity API call.
40 41 42 43 44 45 46 47 |
# File 'lib/easytobookr/request_methods.rb', line 40 def city_cheapest_room_availability(city_id,start_date,end_date,people=2,currency='USD',customer_ip='127.0.0.1') params = { :Cityid => city_id, :Startdate => start_date, :Enddate => end_date, :Noofpersons => people, :Currency => currency, :CustomerIP => customer_ip } Request.new(:SearchHotelCheapestRoomInCity, params) end |
.city_hotel_info(city_id, language = :en) ⇒ Object
Returns the request object for the HotelInformationInCity API call.
23 24 25 |
# File 'lib/easytobookr/request_methods.rb', line 23 def city_hotel_info(city_id,language=:en) Request.new(:HotelInformationInCity, { :Cityid => city_id, :Language => language }) end |
.city_hotel_list(city_id, language = :en) ⇒ Object
Returns the request object for the GetCityHotelList API call.
18 19 20 |
# File 'lib/easytobookr/request_methods.rb', line 18 def city_hotel_list(city_id,language=:en) Request.new(:GetCityHotelList, { :Cityid => city_id, :Language => language }) end |
.city_info(city_id) ⇒ Object
Returns the request object for the GetCityInfo API call.
13 14 15 |
# File 'lib/easytobookr/request_methods.rb', line 13 def city_info(city_id) Request.new(:GetCityInfo, { :Cityid => city_id }) end |
.city_list ⇒ Object
Returns the request object for the GetCityList API call.
8 9 10 |
# File 'lib/easytobookr/request_methods.rb', line 8 def city_list Request.new(:GetCityList) end |
.config ⇒ Object
42 43 44 |
# File 'lib/easytobookr/config.rb', line 42 def config @@config ||= Config.new end |
.create_booking ⇒ Object
Command: returns the request object for the CreateBooking API call.
82 83 84 |
# File 'lib/easytobookr/request_methods.rb', line 82 def create_booking raise "nyi" end |
.hotel_availability(hotel_id, start_date, end_date, people = 2, rooms = 1, currency = 'USD', customer_ip = '127.0.0.1', show_non_availability = false, language = :en) ⇒ Object
Returns the request object for the GetHotelAvailability API call.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/easytobookr/request_methods.rb', line 28 def hotel_availability(hotel_id,start_date,end_date,people=2,rooms=1,currency='USD',customer_ip='127.0.0.1',show_non_availability=false,language=:en) params = { :Hotelid => hotel_id, :Startdate => start_date, :Enddate => end_date, :Language => language, :Noofpersons => people, :Noofrooms => rooms, :Shownoavailrooms => show_non_availability ? 1 : 0, :Currency => currency, :CustomerIP => customer_ip } Request.new(:GetHotelAvailability, params) end |
.hotel_facilities(hotel_id, language = :en) ⇒ Object
Returns the request object for the GetHotelFacilities API call.
60 61 62 |
# File 'lib/easytobookr/request_methods.rb', line 60 def hotel_facilities(hotel_id,language=:en) Request.new(:GetHotelFacilities, { :Hotelid => hotel_id, :Language => language }) end |
.hotel_photos(hotel_id) ⇒ Object
Returns the request object for the GetHotelPhotos API call.
50 51 52 |
# File 'lib/easytobookr/request_methods.rb', line 50 def hotel_photos(hotel_id) Request.new(:GetHotelPhotos, { :Hotelid => hotel_id }) end |
.retrieve_booking ⇒ Object
Returns the request object for the RetrieveBooking API call.
92 93 94 |
# File 'lib/easytobookr/request_methods.rb', line 92 def retrieve_booking raise "nyi" end |
.room_facilities(room_id, language = :en) ⇒ Object
Returns the request object for the GetRoomFacilities API call.
65 66 67 |
# File 'lib/easytobookr/request_methods.rb', line 65 def room_facilities(room_id,language=:en) Request.new(:GetRoomFacilities, { :Roomid => room_id, :Language => language }) end |
.setup(&block) ⇒ Object
46 47 48 |
# File 'lib/easytobookr/config.rb', line 46 def setup(&block) block.call(config) if block_given? end |