Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/modify end point #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions lib/expedia/http_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
module Expedia
module HTTPService

API_SERVER = 'api.eancdn.com'
# The development api server is not reliable. Often gives 400...
# DEVELOPMENT_API_SERVER = 'dev.api.ean.com'
DEVELOPMENT_API_SERVER = 'api.ean.com'
API_SERVER = 'api.ean.com'
RESERVATION_SERVER = 'book.api.ean.com'

class << self
Expand All @@ -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

Expand Down
14 changes: 1 addition & 13 deletions spec/http_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down