From b517ed0a54bf71ea99402741db691218bdcb7e4f Mon Sep 17 00:00:00 2001 From: Martijn Bleeker Date: Wed, 10 Sep 2014 10:01:28 +0200 Subject: [PATCH] Updated condition for request method type for get_list numberOfResults acceptable values are 0 < val < 200, according to expedia API documentation. Instead a POST request should be made if a 'long' hotelIdList is provided. The boundaries for length of a long list are not specified in the documentation. --- lib/expedia/api.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/expedia/api.rb b/lib/expedia/api.rb index ca7863a..5dad20a 100644 --- a/lib/expedia/api.rb +++ b/lib/expedia/api.rb @@ -6,11 +6,9 @@ class Api # @param args [Hash] All the params required for 'get_list' call # @return [Expedia::HTTPService::Response] on success. A response object representing the results from Expedia # @return [Expedia::APIError] on Error. - # @note A POST request is made instead of GET if 'numberOfResults' > 200 + # @note A POST request is made instead of GET if 'hotelIdList' length > 200 def get_list(args) - no_of_results = 'numberOfResults' - method = (args[no_of_results.to_sym].to_i > 200 || args[no_of_results].to_i > 200) || - args[no_of_results.downcase.to_sym].to_i > 200 || args[no_of_results.downcase].to_i > 200 ? :post : :get + method = (args[:hotelIdList] || args["hotelIdList"] || []).length > 200 ? :post : :get services('/ean-services/rs/hotel/v3/list', args, method) end