Class: TourCMS::Connection
- Inherits:
-
Object
- Object
- TourCMS::Connection
- Defined in:
- lib/tour_cms/connection.rb
Instance Method Summary collapse
- #api_rate_limit_status(channel = 0) ⇒ Object
- #booking_cancel(body = '', channel) ⇒ Object
- #booking_commit_new(body = '', channel) ⇒ Object
- #booking_send_email(body = '', channel) ⇒ Object
- #booking_show(params, channel) ⇒ Object
- #booking_start_new(body = '', channel) ⇒ Object
- #check_tour_availability(params, channel) ⇒ Object
-
#initialize(marketp_id, private_key, result_type = "raw") ⇒ Connection
constructor
A new instance of Connection.
- #list_channels ⇒ Object
- #list_tour_images(channel = 0) ⇒ Object
- #list_tours(channel = 0) ⇒ Object
- #search_hotels_range(params = {}, tour = "", channel = 0) ⇒ Object
- #search_hotels_specific(params = {}, tour = "", channel = 0) ⇒ Object
- #search_tours(params = {}, channel = 0) ⇒ Object
- #show_channel(channel) ⇒ Object
- #show_tour(tour, channel) ⇒ Object
- #show_tour_departures(params, channel) ⇒ Object
- #show_tour_freesale(tour, channel) ⇒ Object
Constructor Details
#initialize(marketp_id, private_key, result_type = "raw") ⇒ Connection
Returns a new instance of Connection.
3 4 5 6 7 8 9 10 |
# File 'lib/tour_cms/connection.rb', line 3 def initialize(marketp_id, private_key, result_type = "raw") Integer(marketp_id) rescue raise ArgumentError, "Marketplace ID must be an Integer" @marketp_id = marketp_id @private_key = private_key @result_type = result_type @base_url = "https://api.tourcms.com" @body = '' end |
Instance Method Details
#api_rate_limit_status(channel = 0) ⇒ Object
12 13 14 |
# File 'lib/tour_cms/connection.rb', line 12 def api_rate_limit_status(channel = 0) request("/api/rate_limit_status.xml", channel) end |
#booking_cancel(body = '', channel) ⇒ Object
94 95 96 97 |
# File 'lib/tour_cms/connection.rb', line 94 def booking_cancel(body = '', channel) @body = body request("/c/booking/cancel.xml", channel, {}, "POST") end |
#booking_commit_new(body = '', channel) ⇒ Object
85 86 87 88 |
# File 'lib/tour_cms/connection.rb', line 85 def booking_commit_new(body = '', channel) @body = body request("/c/booking/new/commit.xml", channel, {}, "POST") end |
#booking_send_email(body = '', channel) ⇒ Object
99 100 101 102 |
# File 'lib/tour_cms/connection.rb', line 99 def booking_send_email(body = '', channel) @body = body request("/c/booking/email/send.xml", channel, {}, "POST") end |
#booking_show(params, channel) ⇒ Object
90 91 92 |
# File 'lib/tour_cms/connection.rb', line 90 def booking_show(params, channel) request("/c/booking/show.xml", channel, params) end |
#booking_start_new(body = '', channel) ⇒ Object
80 81 82 83 |
# File 'lib/tour_cms/connection.rb', line 80 def booking_start_new(body = '', channel) @body = body request("/c/booking/new/start.xml", channel, {}, "POST") end |
#check_tour_availability(params, channel) ⇒ Object
76 77 78 |
# File 'lib/tour_cms/connection.rb', line 76 def check_tour_availability(params, channel) request("/c/tour/datesprices/checkavail.xml", channel, params) end |
#list_channels ⇒ Object
16 17 18 |
# File 'lib/tour_cms/connection.rb', line 16 def list_channels request("/p/channels/list.xml") end |
#list_tour_images(channel = 0) ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/tour_cms/connection.rb', line 56 def list_tour_images(channel = 0) if channel == 0 request("/p/tours/images/list.xml") else request("/c/tours/images/list.xml", channel) end end |
#list_tours(channel = 0) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/tour_cms/connection.rb', line 48 def list_tours(channel = 0) if channel == 0 request("/p/tours/list.xml") else request("/c/tours/list.xml", channel) end end |
#search_hotels_range(params = {}, tour = "", channel = 0) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/tour_cms/connection.rb', line 32 def search_hotels_range(params = {}, tour = "", channel = 0) if channel == 0 request("/p/hotels/search_range.xml", 0, params.merge({"single_tour_id" => tour})) else request("/c/hotels/search_range.xml", channel, params.merge({"single_tour_id" => tour})) end end |
#search_hotels_specific(params = {}, tour = "", channel = 0) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/tour_cms/connection.rb', line 40 def search_hotels_specific(params = {}, tour = "", channel = 0) if channel == 0 request("/p/hotels/search-avail.xml", 0, params.merge({"single_tour_id" => tour})) else request("/c/hotels/search-avail.xml", channel, params.merge({"single_tour_id" => tour})) end end |
#search_tours(params = {}, channel = 0) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/tour_cms/connection.rb', line 24 def search_tours(params = {}, channel = 0) if channel == 0 request("/p/tours/search.xml", 0, params) else request("/c/tours/search.xml", channel, params) end end |
#show_channel(channel) ⇒ Object
20 21 22 |
# File 'lib/tour_cms/connection.rb', line 20 def show_channel(channel) request("/c/channel/show.xml", channel) end |
#show_tour(tour, channel) ⇒ Object
64 65 66 |
# File 'lib/tour_cms/connection.rb', line 64 def show_tour(tour, channel) request("/c/tour/show.xml", channel, {"id" => tour}) end |
#show_tour_departures(params, channel) ⇒ Object
68 69 70 |
# File 'lib/tour_cms/connection.rb', line 68 def show_tour_departures(params, channel) request("/c/tour/datesprices/dep/show.xml", channel, params) end |
#show_tour_freesale(tour, channel) ⇒ Object
72 73 74 |
# File 'lib/tour_cms/connection.rb', line 72 def show_tour_freesale(tour, channel) request("/c/tour/datesprices/freesale/show.xml", channel, {"id" => tour}) end |