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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 808b4e362862ea498efd345aa0de09fca5d433f7
4
- data.tar.gz: b7140ca89302622158d297b31b01e71b3a385a49
3
+ metadata.gz: 113ead84b4c3eba315055d26c60640074400a858
4
+ data.tar.gz: 2adbf22fca33615e8940f166a5bfcc4f258f1da9
5
5
  SHA512:
6
- metadata.gz: 3d72d6aee658b3c86626e01f3b747298c1630a3dca056fc924530702ab8ac24f36c138d961749642e79a705b0adfd659f488c98039c8ecb1e206d22f9c878cb9
7
- data.tar.gz: 405a7f7888047a4e5cdee382b19730d226153db37d6d2f3840f7fcfc037a598fa3b0d9477aa94d4054f08a7156e2f696ecb1701702fff3047de37bf8cb6c0419
6
+ metadata.gz: b93034f2efb452af346cf72d580f3fc26fd8a987a3632ee6df414ec98e95aac63791d2bde2070ef8e51600010f2546689db540c6220d440bc487d3609fc1a700
7
+ data.tar.gz: 7ee9c54af892c26e8f99215b9418659b50a029bc5899a9e5488d687efc5b322c40b99139e8f5ad7f7fea11980e9f94f96ddd47374fd857470317163952721a27
@@ -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
@@ -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
 
@@ -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. Ofthen gives 400...
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, :sig => signature, :apiKey => Expedia.api_key, :minorRev => Expedia.minor_rev,
97
- :_type => 'json', :locale => Expedia.locale, :currencyCode => Expedia.currency_code }
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
@@ -1,3 +1,3 @@
1
1
  module Expedia
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -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
@@ -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.6
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-07-06 00:00:00.000000000 Z
11
+ date: 2015-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json