expedia 0.0.6 → 0.0.7
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 +1 -0
- data/lib/expedia.rb +2 -1
- data/lib/expedia/http_service.rb +4 -3
- data/lib/expedia/version.rb +1 -1
- data/lib/generators/templates/expedia.txt +1 -0
- data/spec/http_service_spec.rb +6 -0
- 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: 113ead84b4c3eba315055d26c60640074400a858
|
4
|
+
data.tar.gz: 2adbf22fca33615e8940f166a5bfcc4f258f1da9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b93034f2efb452af346cf72d580f3fc26fd8a987a3632ee6df414ec98e95aac63791d2bde2070ef8e51600010f2546689db540c6220d440bc487d3609fc1a700
|
7
|
+
data.tar.gz: 7ee9c54af892c26e8f99215b9418659b50a029bc5899a9e5488d687efc5b322c40b99139e8f5ad7f7fea11980e9f94f96ddd47374fd857470317163952721a27
|
data/README.textile
CHANGED
@@ -37,6 +37,7 @@ 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
|
+
Expedia.use_signature = true # must be false if using ip whitelisting instead of signature
|
40
41
|
# Optional configuration...
|
41
42
|
Expedia.timeout = 1 # read timeout in sec
|
42
43
|
Expedia.open_timeout = 1 # connection timeout in sec
|
data/lib/expedia.rb
CHANGED
@@ -23,11 +23,12 @@ module Expedia
|
|
23
23
|
class << self
|
24
24
|
|
25
25
|
attr_accessor :cid, :api_key, :shared_secret, :format, :locale,
|
26
|
-
:currency_code, :minor_rev, :timeout, :open_timeout
|
26
|
+
:currency_code, :minor_rev, :timeout, :open_timeout, :use_signature
|
27
27
|
|
28
28
|
# Default way to setup Expedia. Run generator to create
|
29
29
|
# a fresh initializer with all configuration values.
|
30
30
|
def setup
|
31
|
+
Expedia.use_signature = true #default
|
31
32
|
yield self
|
32
33
|
end
|
33
34
|
|
data/lib/expedia/http_service.rb
CHANGED
@@ -5,7 +5,7 @@ module Expedia
|
|
5
5
|
module HTTPService
|
6
6
|
|
7
7
|
API_SERVER = 'api.eancdn.com'
|
8
|
-
# The development api server is not reliable.
|
8
|
+
# The development api server is not reliable. Often gives 400...
|
9
9
|
# DEVELOPMENT_API_SERVER = 'dev.api.ean.com'
|
10
10
|
DEVELOPMENT_API_SERVER = 'api.ean.com'
|
11
11
|
RESERVATION_SERVER = 'book.api.ean.com'
|
@@ -93,8 +93,9 @@ module Expedia
|
|
93
93
|
# Common Parameters required for every Call to Expedia Server.
|
94
94
|
# @return [Hash] of all common parameters.
|
95
95
|
def common_parameters
|
96
|
-
{ :cid => Expedia.cid, :
|
97
|
-
|
96
|
+
params = { :cid => Expedia.cid, :apiKey => Expedia.api_key, :minorRev => Expedia.minor_rev, :_type => 'json', :locale => Expedia.locale, :currencyCode => Expedia.currency_code }
|
97
|
+
params.merge!(:sig => signature) if Expedia.use_signature
|
98
|
+
return params
|
98
99
|
end
|
99
100
|
|
100
101
|
end
|
data/lib/expedia/version.rb
CHANGED
@@ -5,6 +5,7 @@ Expedia.setup do |config|
|
|
5
5
|
config.locale = 'en_US' # For Example 'de_DE'. Default is 'en_US'
|
6
6
|
config.currency_code = 'USD' # For Example 'EUR'. Default is 'USD'
|
7
7
|
config.minor_rev = 28 # between 4-28 as of Jan 2015. If not set, 4 is used by EAN.
|
8
|
+
config.use_signature = true # An encoded signature is not required if ip whitelisting is used
|
8
9
|
# optional configurations...
|
9
10
|
config.timeout = 1 # read timeout in sec
|
10
11
|
config.open_timeout = 1 # connection timeout in sec
|
data/spec/http_service_spec.rb
CHANGED
@@ -48,6 +48,7 @@ describe "Expedia::HTTPService" do
|
|
48
48
|
Expedia.cid = ''
|
49
49
|
Expedia.api_key =''
|
50
50
|
Expedia.shared_secret = ''
|
51
|
+
Expedia.use_signature = true
|
51
52
|
|
52
53
|
end
|
53
54
|
|
@@ -63,6 +64,11 @@ describe "Expedia::HTTPService" do
|
|
63
64
|
Expedia::HTTPService.common_parameters.keys.should include(:sig)
|
64
65
|
Expedia::HTTPService.common_parameters.keys.should include(:_type)
|
65
66
|
end
|
67
|
+
|
68
|
+
it "checks to see if sig is removed from parameters" do
|
69
|
+
Expedia.use_signature = false
|
70
|
+
Expedia::HTTPService.common_parameters.keys.should_not include(:sig)
|
71
|
+
end
|
66
72
|
end
|
67
73
|
|
68
74
|
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.7
|
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-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|