From 725e8b4576bb4bf93a99d337dc553204e5ace386 Mon Sep 17 00:00:00 2001 From: maru0101 Date: Tue, 15 Aug 2017 18:34:27 +0900 Subject: [PATCH 1/2] Change endpoint url because of old version --- lib/expedia/http_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/expedia/http_service.rb b/lib/expedia/http_service.rb index 98ba036..bfe0599 100644 --- a/lib/expedia/http_service.rb +++ b/lib/expedia/http_service.rb @@ -4,7 +4,7 @@ module Expedia module HTTPService - API_SERVER = 'api.eancdn.com' + API_SERVER = 'api.ean.com' # The development api server is not reliable. Often gives 400... # DEVELOPMENT_API_SERVER = 'dev.api.ean.com' DEVELOPMENT_API_SERVER = 'api.ean.com' From b10dde910f4157349428b3ca9f5aef32f8c2efef Mon Sep 17 00:00:00 2001 From: maru0101 Date: Tue, 15 Aug 2017 18:46:15 +0900 Subject: [PATCH 2/2] Delete unused constant --- lib/expedia/http_service.rb | 9 +-------- spec/http_service_spec.rb | 14 +------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/lib/expedia/http_service.rb b/lib/expedia/http_service.rb index bfe0599..289fd9f 100644 --- a/lib/expedia/http_service.rb +++ b/lib/expedia/http_service.rb @@ -5,9 +5,6 @@ module Expedia module HTTPService API_SERVER = 'api.ean.com' - # The development api server is not reliable. Often gives 400... - # DEVELOPMENT_API_SERVER = 'dev.api.ean.com' - DEVELOPMENT_API_SERVER = 'api.ean.com' RESERVATION_SERVER = 'book.api.ean.com' class << self @@ -21,11 +18,7 @@ class << self # # @return a complete server address with protocol def server(options = {}) - if Expedia.cid.to_i == 55505 && !options[:reservation_api] - server = DEVELOPMENT_API_SERVER - else - server = options[:reservation_api] ? RESERVATION_SERVER : API_SERVER - end + server = options[:reservation_api] ? RESERVATION_SERVER : API_SERVER "#{options[:use_ssl] ? "https" : "http"}://#{server}" end diff --git a/spec/http_service_spec.rb b/spec/http_service_spec.rb index 582cfc5..f6372d4 100644 --- a/spec/http_service_spec.rb +++ b/spec/http_service_spec.rb @@ -2,10 +2,6 @@ describe "Expedia::HTTPService" do - it "has an DEVELOPMENT_API_SERVER Constant" do - Expedia::HTTPService.constants.should include(:DEVELOPMENT_API_SERVER) - end - it "has an API_SERVER Constant" do Expedia::HTTPService.constants.should include(:API_SERVER) end @@ -32,14 +28,6 @@ Expedia::HTTPService.server( {:use_ssl => true }).should eql "https://#{Expedia::HTTPService::API_SERVER}" end - it "return DEVELOPMENT_API_SERVER server when cid is 55505" do - Expedia.stub(:cid).and_return(55505) - Expedia::HTTPService.server.should =~ Regexp.new(Expedia::HTTPService::DEVELOPMENT_API_SERVER) - - Expedia.stub(:cid).and_return("55505") - Expedia::HTTPService.server.should =~ Regexp.new(Expedia::HTTPService::DEVELOPMENT_API_SERVER) - end - end describe "signature and common_parameters" do @@ -64,7 +52,7 @@ Expedia::HTTPService.common_parameters.keys.should include(:sig) Expedia::HTTPService.common_parameters.keys.should include(:_type) end - + it "checks to see if sig is removed from parameters" do Expedia.use_signature = false Expedia::HTTPService.common_parameters.keys.should_not include(:sig)