expedia 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.textile +8 -2
- data/lib/expedia/http_service.rb +4 -4
- data/lib/expedia/version.rb +1 -1
- data/lib/generators/templates/expedia.txt +6 -6
- data/spec/http_service_spec.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef9941b825c7c44fd9d94d2792b5de054a1cd3d5
|
4
|
+
data.tar.gz: 7541edfa4b0f0b54726d1362e62f41ff79f92f15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cf56f350a820c89940885a8c37e1789bd2fe92cd16a01775c4d9737e8ae324691e8921a7805d17ea80fc215bd7811beb3abde6f2952f6e5704b2bdb1f85d8c8
|
7
|
+
data.tar.gz: e0769a065f51870c8ae0b0a289b9c8ab5ab0be246b7962dafe41e2c805f71638a0521192cedcf350f742556ba9a1f946d2f3e3ec6ef2478be9f583c9c4954df9
|
data/README.textile
CHANGED
@@ -37,6 +37,9 @@ Expedia.shared_secret = 'your_shared_secret'
|
|
37
37
|
Expedia.locale = 'en_US'
|
38
38
|
Expedia.currency_code = 'USD'
|
39
39
|
Expedia.minor_rev = 13
|
40
|
+
# Optional configuration...
|
41
|
+
Expedia.timeout = 1 # read timeout in sec
|
42
|
+
Expedia.open_timeout = 1 # connection timeout in sec
|
40
43
|
</pre>
|
41
44
|
|
42
45
|
Or you can execute the following command to create an intializer (if you are using rails)
|
@@ -54,7 +57,7 @@ After configuring keys, default locale, currency and minor_rev for EAN use
|
|
54
57
|
api = Expedia::Api.new
|
55
58
|
|
56
59
|
# Method to search for a hotel. see http://developer.ean.com/docs/hotel-list/
|
57
|
-
response = api.get_list({:propertyName => 'Hotel Moa
|
60
|
+
response = api.get_list({:propertyName => 'Hotel Moa', :destinationString => 'berlin'})
|
58
61
|
|
59
62
|
# execute this method to know if there is any exception
|
60
63
|
response.exception? # false if success
|
@@ -125,13 +128,16 @@ response = api.get_static_reservation({ :arrivalDate => "10/10/2013", :departure
|
|
125
128
|
|
126
129
|
h3. Logging
|
127
130
|
|
128
|
-
Expedia::Utils.logger points to STDOUT by default. You can use it to Log in Rails
|
131
|
+
Expedia::Utils.logger points to STDOUT by default. You can use it to Log in Rails applications.
|
129
132
|
|
130
133
|
<pre>
|
131
134
|
Expedia::Utils.logger = Rails.logger
|
132
135
|
|
133
136
|
# And loggig methods available
|
134
137
|
[:debug, :info, :warn, :error, :fatal]
|
138
|
+
|
139
|
+
# Default logger level is Logger::ERROR. You can change it by setting
|
140
|
+
Expedia.logger.level = Logger::DEBUG # Or whatever level you want...
|
135
141
|
</pre>
|
136
142
|
|
137
143
|
|
data/lib/expedia/http_service.rb
CHANGED
@@ -5,8 +5,8 @@ module Expedia
|
|
5
5
|
module HTTPService
|
6
6
|
|
7
7
|
API_SERVER = 'api.eancdn.com'
|
8
|
+
DEVELOPMENT_API_SERVER = 'dev.api.ean.com'
|
8
9
|
RESERVATION_SERVER = 'book.api.ean.com'
|
9
|
-
DEVELOPMENT_SERVER = 'dev.api.ean.com'
|
10
10
|
|
11
11
|
class << self
|
12
12
|
|
@@ -20,7 +20,7 @@ module Expedia
|
|
20
20
|
# @return a complete server address with protocol
|
21
21
|
def server(options = {})
|
22
22
|
if Expedia.cid.to_i == 55505 && !options[:reservation_api]
|
23
|
-
server =
|
23
|
+
server = DEVELOPMENT_API_SERVER
|
24
24
|
else
|
25
25
|
server = options[:reservation_api] ? RESERVATION_SERVER : API_SERVER
|
26
26
|
end
|
@@ -37,8 +37,8 @@ module Expedia
|
|
37
37
|
# @return the connection obj with the timeouts set if they have been initialized
|
38
38
|
def add_timeouts(conn, options)
|
39
39
|
if !options[:ignore_timeout]
|
40
|
-
conn.options.timeout = Expedia.timeout.to_i if Expedia.timeout
|
41
|
-
conn.options.open_timeout = Expedia.open_timeout.to_i if Expedia.open_timeout
|
40
|
+
conn.options.timeout = Expedia.timeout.to_i if Expedia.timeout
|
41
|
+
conn.options.open_timeout = Expedia.open_timeout.to_i if Expedia.open_timeout
|
42
42
|
end
|
43
43
|
conn
|
44
44
|
end
|
data/lib/expedia/version.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Expedia.setup do |config|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
config.cid = 55505 # your cid once you go live.
|
3
|
+
config.api_key = 'your_api_key'
|
4
|
+
config.shared_secret = 'your_shared_secret'
|
5
|
+
config.locale = 'en_US' # For Example 'de_DE'. Default is 'en_US'
|
6
|
+
config.currency_code = 'USD' # For Example 'EUR'. Default is 'USD'
|
7
|
+
config.minor_rev = 28 # between 4-28 as of Jan 2015. If not set, 4 is used by EAN.
|
8
8
|
# optional configurations...
|
9
9
|
config.timeout = 1 # read timeout in sec
|
10
10
|
config.open_timeout = 1 # connection timeout in sec
|
data/spec/http_service_spec.rb
CHANGED
@@ -2,8 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "Expedia::HTTPService" do
|
4
4
|
|
5
|
-
it "has an
|
6
|
-
Expedia::HTTPService.constants.should include(:
|
5
|
+
it "has an DEVELOPMENT_API_SERVER Constant" do
|
6
|
+
Expedia::HTTPService.constants.should include(:DEVELOPMENT_API_SERVER)
|
7
7
|
end
|
8
8
|
|
9
9
|
it "has an API_SERVER Constant" do
|
@@ -32,12 +32,12 @@ describe "Expedia::HTTPService" do
|
|
32
32
|
Expedia::HTTPService.server( {:use_ssl => true }).should eql "https://#{Expedia::HTTPService::API_SERVER}"
|
33
33
|
end
|
34
34
|
|
35
|
-
it "return
|
35
|
+
it "return DEVELOPMENT_API_SERVER server when cid is 55505" do
|
36
36
|
Expedia.stub(:cid).and_return(55505)
|
37
|
-
Expedia::HTTPService.server.should =~ Regexp.new(Expedia::HTTPService::
|
37
|
+
Expedia::HTTPService.server.should =~ Regexp.new(Expedia::HTTPService::DEVELOPMENT_API_SERVER)
|
38
38
|
|
39
39
|
Expedia.stub(:cid).and_return("55505")
|
40
|
-
Expedia::HTTPService.server.should =~ Regexp.new(Expedia::HTTPService::
|
40
|
+
Expedia::HTTPService.server.should =~ Regexp.new(Expedia::HTTPService::DEVELOPMENT_API_SERVER)
|
41
41
|
end
|
42
42
|
|
43
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expedia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zaid Akram
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|