Sha256: 781668696f494a8587a28a9690c007254bd6170c80f1c8707e044688bbc6f1d7

Contents?: true

Size: 1.45 KB

Versions: 8

Compression:

Stored size: 1.45 KB

Contents

module Tourico
  class Api

    def initialize

    end

    def get_list(args)
      services(:search_hotels, args)
    end

    def get_list_by_hotel(args)
      services(:search_hotels_by_id, args)
    end

    def get_hotel_details(args)
      services(:get_hotel_details_v3,args)
    end

    def get_cancellation_policy(args)
      services(:get_cancellation_policies, args)
    end

    def book_hotel_v3(args)
      services(:book_hotel_v3,args)
    end

    def get_cancellation_fee_for_reservation(args)
      services(:get_cancellation_fee, args)
    end

    def cancel_reservation(args)
      services(:cancel_reservation,args)
    end

    def check_availability_and_prices(args)
      services(:check_availability_and_prices,args)
    end

    ## - not working
    def get_previous_reservations(args)
      services(:get_previous_RG, args)
    end

    def cost_amend(args)

    end

    def do_amend(args)

    end



    private

    def services (action, args)
      reservations_services = [:get_cancellation_policies, :get_previous_RG,:get_cancellation_fee,:cancel_reservation]
      hotel_services = [:search_hotels,:search_hotels_by_id,:get_hotel_details_v3,:book_hotel_v3, :check_availability_and_prices]

      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

    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tourico-0.0.7.3 lib/tourico/api.rb
tourico-0.0.7.2 lib/tourico/api.rb
tourico-0.0.7.1 lib/tourico/api.rb
tourico-0.0.7 lib/tourico/api.rb
tourico-0.0.6 lib/tourico/api.rb
tourico-0.0.5 lib/tourico/api.rb
tourico-0.0.4 lib/tourico/api.rb
tourico-0.0.3 lib/tourico/api.rb