class Tourico::Api

Public Class Methods

new() click to toggle source
# File lib/tourico/api.rb, line 4
def initialize
end

Public Instance Methods

book_hotel_v3(args) click to toggle source
# File lib/tourico/api.rb, line 23
def book_hotel_v3(args)
  services(:book_hotel_v3,args)
end
book_hotel_v3_with_retry(args,try_count = 1) click to toggle source
# File lib/tourico/api.rb, line 27
def book_hotel_v3_with_retry(args,try_count = 1)
  supplier_response = ''
  try_count.times do
    supplier_response = book_hotel_v3(args)
    itinerary_id = supplier_response[:book_hotel_v3_response][:book_hotel_v3_result][:res_group][:@rg_id] rescue ''
    if !itinerary_id.blank?
      break
    end
  end
  supplier_response
end
cancel_reservation(args) click to toggle source
# File lib/tourico/api.rb, line 43
def cancel_reservation(args)
  services(:cancel_reservation,args)
end
check_availability_and_prices(args) click to toggle source
# File lib/tourico/api.rb, line 47
def check_availability_and_prices(args)
  services(:check_availability_and_prices,args)
end
cost_amend(args) click to toggle source
# File lib/tourico/api.rb, line 56
def cost_amend(args)

end
do_amend(args) click to toggle source
# File lib/tourico/api.rb, line 60
def do_amend(args)

end
get_cancellation_fee_for_reservation(args) click to toggle source
# File lib/tourico/api.rb, line 39
def get_cancellation_fee_for_reservation(args)
  services(:get_cancellation_fee, args)
end
get_cancellation_policy(args) click to toggle source
# File lib/tourico/api.rb, line 19
def get_cancellation_policy(args)
  services(:get_cancellation_policies, args)
end
get_hotel_details(args) click to toggle source
# File lib/tourico/api.rb, line 15
def get_hotel_details(args)
  services(:get_hotel_details_v3,args)
end
get_hotels_by_destination(args) click to toggle source
# File lib/tourico/api.rb, line 64
def get_hotels_by_destination(args)
  services(:get_hotels_by_destination, args)
end
get_list(args) click to toggle source
# File lib/tourico/api.rb, line 7
def get_list(args)
  services(:search_hotels, args)
end
get_list_by_hotel(args) click to toggle source
# File lib/tourico/api.rb, line 11
def get_list_by_hotel(args)
  services(:search_hotels_by_id, args)
end
get_previous_reservations(args) click to toggle source
  • not working

# File lib/tourico/api.rb, line 52
def get_previous_reservations(args)
  services(:get_previous_RG, args)
end

Private Instance Methods

services(action, args) click to toggle source
# File lib/tourico/api.rb, line 70
def services (action, args)
  reservations_services = [:get_previous_RG, :cancel_reservation]
  hotel_services = [:search_hotels,:search_hotels_by_id,:get_hotel_details_v3,:book_hotel_v3, :check_availability_and_prices,:get_cancellation_policies,:get_cancellation_fee]
  destination_services = [:get_hotels_by_destination]

  if reservations_services.include?(action)
    return HTTPService.make_request_reservation_service(action, args)
  end

  if hotel_services.include?(action)
    return HTTPService.make_request(action, args)
  end

  if destination_services.include?(action)
    return HTTPService.make_request_destination_service(action, args)
  end

end