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
-
#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(tour, 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 |
# 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" end |
Instance Method Details
#api_rate_limit_status(channel = 0) ⇒ Object
11 12 13 |
# File 'lib/tour_cms/connection.rb', line 11 def api_rate_limit_status(channel = 0) request("/api/rate_limit_status.xml", channel) end |
#list_channels ⇒ Object
15 16 17 |
# File 'lib/tour_cms/connection.rb', line 15 def list_channels request("/p/channels/list.xml") end |
#list_tour_images(channel = 0) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/tour_cms/connection.rb', line 55 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
47 48 49 50 51 52 53 |
# File 'lib/tour_cms/connection.rb', line 47 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
31 32 33 34 35 36 37 |
# File 'lib/tour_cms/connection.rb', line 31 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
39 40 41 42 43 44 45 |
# File 'lib/tour_cms/connection.rb', line 39 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
23 24 25 26 27 28 29 |
# File 'lib/tour_cms/connection.rb', line 23 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
19 20 21 |
# File 'lib/tour_cms/connection.rb', line 19 def show_channel(channel) request("/c/channel/show.xml", channel) end |
#show_tour(tour, channel) ⇒ Object
63 64 65 |
# File 'lib/tour_cms/connection.rb', line 63 def show_tour(tour, channel) request("/c/tour/show.xml", channel, {"id" => tour}) end |
#show_tour_departures(tour, channel) ⇒ Object
67 68 69 |
# File 'lib/tour_cms/connection.rb', line 67 def show_tour_departures(tour, channel) request("/c/tour/datesprices/dep/show.xml", channel, {"id" => tour}) end |
#show_tour_freesale(tour, channel) ⇒ Object
71 72 73 |
# File 'lib/tour_cms/connection.rb', line 71 def show_tour_freesale(tour, channel) request("/c/tour/datesprices/freesale/show.xml", channel, {"id" => tour}) end |