expedia 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 82a206826af1246c33d6545072743ae69992bbf5
4
+ data.tar.gz: 944ccc177f55ff411ccc5c8ba1c32a251ba2ad8f
5
+ SHA512:
6
+ metadata.gz: bd8f0032d70ed2e778ab9f35557a40ab68d04c3489b02b54b41ab07e17e51b318998b2994325e4ca4649a3b3affdf97478ef6065c2aa70c5284c129f2ab2d93d
7
+ data.tar.gz: 0efba8100cb9330fef0b864f85b9c0befdfda06861d4388bb2b0c554fad286cb75d87be4412775c92cb1cf9b2eef5d1103a348894964eea8b8c7d30fc1ad11e3
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ *.sublime*
data/README.textile CHANGED
@@ -4,8 +4,9 @@ Expedia is a ruby wrapper for ["EAN - Expedia Affiliate Network":http://www.expe
4
4
 
5
5
  Other details of this gem are:
6
6
 
7
- * It uses the the latest verion of the EAN API. i.e ["Version 3":http://developer.ean.com/docs/read/hotels/version_3]
7
+ * It uses the the latest verion of the EAN API. i.e ["Version 3":http://developer.ean.com/docs/api-change-log]
8
8
  * Only REST API support (No XML or SOAP support)
9
+ * It uses Signature Pro method for Authentication. See ["Live API Key Authentication and Access":http://developer.ean.com/docs/getting-started/authentication/]
9
10
 
10
11
  h2. Installation
11
12
 
@@ -38,29 +39,29 @@ Expedia.currency_code = 'USD'
38
39
  Expedia.minor_rev = 13
39
40
  </pre>
40
41
 
41
- Or you can execute the following command to create an intializer:
42
+ Or you can execute the following command to create an intializer (if you are using rails)
42
43
 
43
44
  <pre>
44
- $ rake expedia:initialize
45
+ $ rails g expedia:initialize
45
46
  </pre>
46
47
 
47
48
  h2. Usage
48
49
 
49
- After configuring keys for your EAN application kyes, Default locale, currency and minor_rev use
50
+ After configuring keys, default locale, currency and minor_rev for EAN use
50
51
 
51
52
  <pre>
52
53
  # Instentiate api object
53
- api = Expedia::API.new
54
+ api = Expedia::Api.new
54
55
 
55
- # Method to search hotel. see http://developer.ean.com/docs/read/hotels/version_3/request_hotel_list
56
+ # Method to search for a hotel. see http://developer.ean.com/docs/hotel-list/
56
57
  response = api.get_list({:propertyName => 'Hotel Moa Berlin', :destinationString => 'berlin'})
58
+
59
+ # execute this method to know if there is any exception
60
+ response.exception? # false if success
57
61
  </pre>
58
62
 
59
63
  Following methods are expeosed by Expedia::API object
60
64
 
61
- Note: All method naming is done in correspondence with Expedia services and ruby conventions
62
- see "Hotel API Documentation - Services section":http://developer.ean.com/docs/read/hotels#.UMf_hiNDt0w
63
-
64
65
  <pre>
65
66
  get_list({})
66
67
  geo_search({})
@@ -77,8 +78,6 @@ get_ping({})
77
78
  get_static_reservation({}) # To test Reservation (Static Reservation)
78
79
  </pre>
79
80
 
80
- Every method accepts Hash of parameter specific to every API. see ["EAN Docs":http://developer.ean.com/docs/read/hotels/version_3] for more details.
81
-
82
81
  h3. Success
83
82
 
84
83
  if request is successfull you will get a Expedia::HTTPService::Response object in response.
@@ -86,7 +85,7 @@ and you can use
86
85
 
87
86
  <pre>
88
87
  response.status
89
- response.body
88
+ response.body # Returns Parsed body of response.
90
89
  response.headers
91
90
  </pre>
92
91
 
@@ -94,10 +93,10 @@ h3. Error
94
93
 
95
94
  In case of any error a Expedia::APIError object is returned.
96
95
 
97
- Note: Expedia responds with status of 200 even if there is an exception (most of the times). So no Exception is raised!
96
+ **Note**: Expedia responds with status of 200 even if there is an exception (most of the times). So no Exception is raised!
98
97
 
99
98
  <pre>
100
- # See http://developer.ean.com/docs/read/error_handling/Hotel_V3_Exception_Details
99
+ # See http://developer.ean.com/docs/error-handling/hotel-v3-exception-details/
101
100
 
102
101
  response.status # Response status
103
102
  response.error_body # Complete error body
@@ -109,19 +108,19 @@ response.handling # value indicating the severity of the exception and how it ma
109
108
 
110
109
  h3. Test Booking (Static Reservation)
111
110
 
112
- For Static reservation use get_static_reservation() method.
111
+ For Static reservation use @get_static_reservation()@ method.
113
112
 
114
- CAUTION: Do Not send adress and booking information (creditCardNumber, creditCardIdentifier, creditCardExpirationMonth, creditCardExpirationYear, address1) in parameters to the method. Especially do not pass address1 parameter They are already been taken care of. For more on Static booking see ["Static Test Booking Credit Card Information":http://developer.ean.com/docs/Test_Booking_Procedures]
113
+ **CAUTION**: Do Not send adress and booking information (creditCardNumber, creditCardIdentifier, creditCardExpirationMonth, creditCardExpirationYear, address1) in parameters to the method. Especially do not pass address1 parameter They are already been taken care of. For more on Static booking see ["Static Test Booking Credit Card Information":http://developer.ean.com/docs/Test_Booking_Procedures]
115
114
 
116
115
  A static Booking example.
117
116
 
118
117
  <pre>
119
118
  response = api.get_static_reservation({ :arrivalDate => "10/10/2013", :departureDate => "10/12/2013",
120
- :hotelID => 359433, :supplierType => "E", :rateKey => "084eab14-335e-46d6-aa2e-766fce6be32c",
121
- :roomTypeCode => 200007964, :rateCode => 200865704, :chargeableRate => "142.8",
122
- :room1 => "1", :room1FirstName => "test", :room1LastName => "testers", :room1BedTypeId => "15",
123
- :room1SmokingPreference => "NS", :email => "test@tesing.com", :city => 'Bellevue',
124
- :stateProvinceCode => 'WA', :countryCode => 'US', :postalCode => 98004 })
119
+ :hotelID => 359433, :supplierType => "E", :rateKey => "084eab14-335e-46d6-aa2e-766fce6be32c",
120
+ :roomTypeCode => 200007964, :rateCode => 200865704, :chargeableRate => "142.8",
121
+ :room1 => "1", :room1FirstName => "test", :room1LastName => "testers", :room1BedTypeId => "15",
122
+ :room1SmokingPreference => "NS", :email => "test@tesing.com", :city => 'Bellevue',
123
+ :stateProvinceCode => 'WA', :countryCode => 'US', :postalCode => 98004 })
125
124
  </pre>
126
125
 
127
126
  h3. Logging
data/expedia.gemspec CHANGED
@@ -6,8 +6,10 @@ require 'expedia/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "expedia"
8
8
  gem.version = Expedia::VERSION
9
+ gem.platform = Gem::Platform::RUBY
9
10
  gem.authors = ["Zaid Akram"]
10
11
  gem.email = ["zaidakrammughal@gmail.com"]
12
+ gem.licenses = ["MIT"]
11
13
  gem.description = "Expedia is a lightweight, flexible Ruby SDK for EAN. It allows read/write access to the EAN APIs."
12
14
  gem.summary = "Expedia is a ruby wrapper for 'EAN (Expedia Affiliate Network)'"
13
15
  gem.homepage = "https://github.com/zaidakram/expedia"
data/lib/expedia/api.rb CHANGED
@@ -1,69 +1,75 @@
1
1
  module Expedia
2
- class Api
3
-
4
- # All method naming is done in correspondence with Expedia services and ruby conventions
5
- # see http://developer.ean.com/docs/read/hotels#.UMf_hiNDt0w
6
-
7
- def get_list(args)
8
- services('/ean-services/rs/hotel/v3/list', args)
9
- end
10
-
11
- def geo_search(args)
12
- services('/ean-services/rs/hotel/v3/geoSearch', args)
13
- end
14
-
15
- def get_availability(args)
16
- services('/ean-services/rs/hotel/v3/avail', args)
17
- end
18
-
19
- def get_room_images(args)
20
- services('/ean-services/rs/hotel/v3/roomImages', args)
21
- end
22
-
23
- def get_information(args)
24
- services('/ean-services/rs/hotel/v3/info', args)
25
- end
26
-
27
- def get_rules(args)
28
- services('/ean-services/rs/hotel/v3/rules', args)
29
- end
30
-
31
- def get_itinerary(args)
32
- services('/ean-services/rs/hotel/v3/itin', args)
33
- end
34
-
35
- def get_alternate_properties(args)
36
- services('/ean-services/rs/hotel/v3/altProps', args)
37
- end
38
-
39
- def get_reservation(args)
40
- HTTPService.make_request('/ean-services/rs/hotel/v3/res', args, :post, { :reservation_api => true, :use_ssl => true })
41
- end
42
-
43
- def get_payment_info(args)
44
- services('/ean-services/rs/hotel/v3/paymentInfo', args)
45
- end
46
-
47
- def get_cancel(args)
48
- services('/ean-services/rs/hotel/v3/cancel', args)
49
- end
50
-
51
- def get_ping(args)
52
- services('/ean-services/rs/hotel/v3/ping', args)
53
- end
54
-
55
- def get_static_reservation(args)
56
- get_reservation(args.merge!({:firstName => "Test Booking", :lastName => "Test Booking", :creditCardType => "CA",
57
- :creditCardNumber => 5401999999999999, :creditCardIdentifier => 123,
58
- :creditCardExpirationMonth => 11, :creditCardExpirationYear => Time.now.year + 2,
59
- :address1 => 'travelnow' }))
60
- end
61
-
62
- private
63
-
64
- def services(path, args)
65
- HTTPService.make_request(path, args, :get)
66
- end
67
-
68
- end
69
- end
2
+ # All method naming is done in correspondence with Expedia services and ruby conventions
3
+ class Api
4
+
5
+
6
+ # @param args [Hash] All the params required for 'get_list' call
7
+ # @return [Expedia::HTTPService::Response] on success. A response object representing the results from Expedia
8
+ # @return [Expedia::APIError] on Error.
9
+ # @note A POST request is made instead of GET if 'numberOfResults' > 200
10
+ def get_list(args)
11
+ no_of_results = 'numberOfResults'
12
+ method = (args[no_of_results.to_sym].to_i > 200 || args[no_of_results].to_i > 200) ||
13
+ args[no_of_results.downcase.to_sym].to_i > 200 || args[no_of_results.downcase].to_i > 200 ? :post : :get
14
+ services('/ean-services/rs/hotel/v3/list', args, method)
15
+ end
16
+
17
+ def geo_search(args)
18
+ services('/ean-services/rs/hotel/v3/geoSearch', args)
19
+ end
20
+
21
+ def get_availability(args)
22
+ services('/ean-services/rs/hotel/v3/avail', args)
23
+ end
24
+
25
+ def get_room_images(args)
26
+ services('/ean-services/rs/hotel/v3/roomImages', args)
27
+ end
28
+
29
+ def get_information(args)
30
+ services('/ean-services/rs/hotel/v3/info', args)
31
+ end
32
+
33
+ def get_rules(args)
34
+ services('/ean-services/rs/hotel/v3/rules', args)
35
+ end
36
+
37
+ def get_itinerary(args)
38
+ services('/ean-services/rs/hotel/v3/itin', args)
39
+ end
40
+
41
+ def get_alternate_properties(args)
42
+ services('/ean-services/rs/hotel/v3/altProps', args)
43
+ end
44
+
45
+ def get_reservation(args)
46
+ HTTPService.make_request('/ean-services/rs/hotel/v3/res', args, :post, { :reservation_api => true, :use_ssl => true })
47
+ end
48
+
49
+ def get_payment_info(args)
50
+ services('/ean-services/rs/hotel/v3/paymentInfo', args)
51
+ end
52
+
53
+ def get_cancel(args)
54
+ services('/ean-services/rs/hotel/v3/cancel', args)
55
+ end
56
+
57
+ def get_ping(args)
58
+ services('/ean-services/rs/hotel/v3/ping', args)
59
+ end
60
+
61
+ def get_static_reservation(args)
62
+ get_reservation(args.merge!({:firstName => "Test Booking", :lastName => "Test Booking", :creditCardType => "CA",
63
+ :creditCardNumber => 5401999999999999, :creditCardIdentifier => 123,
64
+ :creditCardExpirationMonth => 11, :creditCardExpirationYear => Time.now.year + 2,
65
+ :address1 => 'travelnow' }))
66
+ end
67
+
68
+ private
69
+
70
+ def services(path, args, method=:get)
71
+ HTTPService.make_request(path, args, method)
72
+ end
73
+
74
+ end
75
+ end
@@ -4,7 +4,7 @@ module Expedia
4
4
 
5
5
  # Expedia respondes with status of 200 even if there is an exception (most of the time)
6
6
  class APIError < ::Expedia::ExpediaError
7
-
7
+
8
8
  # @status The HTTP status code of the response
9
9
  # @error_body The parsed response body
10
10
  # @error_info One of the following:
@@ -14,7 +14,7 @@ module Expedia
14
14
  # @handling value indicating the severity of the exception and how it may be handled
15
15
 
16
16
  attr_accessor :category, :presentation_message, :verbose_message,
17
- :status, :error_body, :handling
17
+ :status, :error_body, :handling
18
18
 
19
19
  # Create a new API Error
20
20
  # @return the newly created APIError
@@ -34,7 +34,7 @@ module Expedia
34
34
  @handling = error_body['handling']
35
35
  error_array = []
36
36
  end
37
-
37
+
38
38
  super(@verbose_message)
39
39
 
40
40
  end
@@ -49,4 +49,4 @@ module Expedia
49
49
  # A standard Error calss for Raising exception if [cid, shared_secret, api_key] are not provided.
50
50
  class AuthCredentialsError < ::Expedia::ExpediaError; end
51
51
 
52
- end
52
+ end
@@ -1,5 +1,5 @@
1
1
  module Expedia
2
-
2
+
3
3
  module HTTPService
4
4
 
5
5
  class Response
@@ -22,5 +22,5 @@ module Expedia
22
22
  end
23
23
 
24
24
  end
25
-
25
+
26
26
  end
@@ -4,9 +4,10 @@ require 'expedia/http_service/response'
4
4
  module Expedia
5
5
  module HTTPService
6
6
 
7
- API_SERVER = 'api.ean.com'
8
- RESERVATION_SERVER = 'book.api.ean.com'
9
-
7
+ API_SERVER = 'api.ean.com'
8
+ RESERVATION_SERVER = 'book.api.ean.com'
9
+ DEVELOPMENT_SERVER = 'dev.api.ean.com'
10
+
10
11
  class << self
11
12
 
12
13
 
@@ -18,7 +19,11 @@ module Expedia
18
19
  #
19
20
  # @return a complete server address with protocol
20
21
  def server(options = {})
21
- server = "#{options[:reservation_api] ? RESERVATION_SERVER : API_SERVER}"
22
+ if Expedia.cid == 55505
23
+ server = DEVELOPMENT_SERVER
24
+ else
25
+ server = options[:reservation_api] ? RESERVATION_SERVER : API_SERVER
26
+ end
22
27
  "#{options[:use_ssl] ? "https" : "http"}://#{server}"
23
28
  end
24
29
 
@@ -37,7 +42,7 @@ module Expedia
37
42
  # @return [Expedia::HTTPService::Response] on success. A response object representing the results from Expedia
38
43
  # @return [Expedia::APIError] on Error.
39
44
  def make_request(path, args, verb, options = {})
40
- args.merge!(add_common_parameters)
45
+ args = common_parameters.merge(args)
41
46
  # figure out our options for this request
42
47
  request_options = {:params => (verb == :get ? args : {})}
43
48
  # set up our Faraday connection
@@ -47,7 +52,7 @@ module Expedia
47
52
  # Log URL and params information
48
53
  Expedia::Utils.debug "\nExpedia [#{verb.upcase}] - #{server(options) + path} params: #{args.inspect} : #{response.status}\n"
49
54
  response = Expedia::HTTPService::Response.new(response.status.to_i, response.body, response.headers)
50
-
55
+
51
56
  # If there is an exception make a [Expedia::APIError] object to return
52
57
  if response.exception?
53
58
  Expedia::APIError.new(response.status, response.body)
@@ -68,14 +73,14 @@ module Expedia
68
73
  # Method currently not in use.
69
74
  def encode_params(param_hash)
70
75
  ((param_hash || {}).sort_by{|k, v| k.to_s}.collect do |key_and_value|
71
- key_and_value[1] = MultiJson.dump(key_and_value[1]) unless key_and_value[1].is_a? String
72
- "#{key_and_value[0].to_s}=#{CGI.escape key_and_value[1]}"
76
+ key_and_value[1] = MultiJson.dump(key_and_value[1]) unless key_and_value[1].is_a? String
77
+ "#{key_and_value[0].to_s}=#{CGI.escape key_and_value[1]}"
73
78
  end).join("&")
74
79
  end
75
80
 
76
81
 
77
82
  # Creates a Signature for Expedia using MD5 Checksum Auth.
78
- # Shared and Api keys are required for Signature along with the current utc time.
83
+ # Shared and Api keys are required for Signature along with the current utc time.
79
84
  def signature
80
85
  if Expedia.cid && Expedia.api_key && Expedia.shared_secret
81
86
  Digest::MD5.hexdigest(Expedia.api_key+Expedia.shared_secret+Time.now.utc.to_i.to_s)
@@ -85,13 +90,13 @@ module Expedia
85
90
  end
86
91
 
87
92
  # Common Parameters required for every Call to Expedia Server.
88
- #
89
- def add_common_parameters
93
+ #
94
+ def common_parameters
90
95
  { :cid => Expedia.cid, :sig => signature, :apiKey => Expedia.api_key, :minorRev => Expedia.minor_rev,
91
96
  :_type => 'json', :locale => Expedia.locale, :currencyCode => Expedia.currency_code }
92
97
  end
93
98
 
94
99
  end
95
-
100
+
96
101
  end
97
- end
102
+ end
@@ -3,10 +3,10 @@ require 'rails'
3
3
  module Expedia
4
4
  class Railtie < Rails::Railtie
5
5
 
6
- # Load rake tasks
6
+ # Load rake tasks
7
7
  rake_tasks do
8
8
  load "tasks/expedia.rake"
9
9
  end
10
10
 
11
11
  end
12
- end
12
+ end
data/lib/expedia/utils.rb CHANGED
@@ -17,7 +17,7 @@ module Expedia
17
17
  self.logger.level = Logger::ERROR
18
18
 
19
19
  # @private
20
- DEPRECATION_PREFIX = "EXPEDIA: Deprecation warning: "
20
+ DEPRECATION_PREFIX = "EXPEDIA: [Deprecation warning] "
21
21
 
22
22
  # Prints a deprecation message.
23
23
  # Each individual message will only be printed once to avoid spamming.
@@ -1,3 +1,3 @@
1
1
  module Expedia
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/expedia.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  require 'digest/md5'
3
3
  require 'multi_json'
4
4
 
5
- # include koala modules
5
+ # include expedia modules
6
6
  require 'expedia/errors'
7
7
  require 'expedia/api'
8
8
 
@@ -12,25 +12,29 @@ require 'expedia/http_service'
12
12
  # miscellaneous
13
13
  require 'expedia/utils'
14
14
  require 'expedia/version'
15
- require 'expedia/railtie' if defined?(Rails)
15
+
16
+ if defined?(Rails)
17
+ require 'expedia/railtie'
18
+ require 'generators/expedia/initialize_generator'
19
+ end
16
20
 
17
21
  module Expedia
18
22
 
19
- class << self
23
+ class << self
24
+
25
+ attr_accessor :cid, :api_key, :shared_secret, :format, :locale,
26
+ :currency_code, :minor_rev
20
27
 
21
- attr_accessor :cid, :api_key, :shared_secret, :format, :locale,
22
- :currency_code, :minor_rev
28
+ # Default way to setup Expedia. Run rake task to create
29
+ # a fresh initializer with all configuration values.
30
+ def setup
31
+ yield self
32
+ end
23
33
 
24
- # Default way to setup Devise. Run generator to create
25
- # a fresh initializer with all configuration values.
26
- def setup
27
- yield self
28
- end
34
+ def root_path
35
+ Gem::Specification.find_by_name("expedia").gem_dir
36
+ end
29
37
 
30
- def root_path
31
- Gem::Specification.find_by_name("expedia").gem_dir
32
- end
38
+ end
33
39
 
34
- end
35
-
36
40
  end
@@ -0,0 +1,13 @@
1
+ require 'rails/generators'
2
+
3
+ module Expedia
4
+ class InitializeGenerator < Rails::Generators::Base
5
+
6
+ source_root File.expand_path("../../templates", __FILE__)
7
+
8
+ def copy_initializer_file
9
+ copy_file "expedia.txt", "config/initializers/expedia.rb"
10
+ end
11
+
12
+ end
13
+ end
File without changes
@@ -4,8 +4,9 @@ namespace :expedia do
4
4
 
5
5
  desc "It creates an Expedia initializer"
6
6
  task :initialize do
7
+ puts "EXPEDIA: [Deprecation warning] 'rake expedia:initialize' is deprecated and will be removed in a future version; please use 'rails g expedia:initialize' instead."
7
8
  # Copy the template to the applicaion's initializers folder.
8
- cp "#{Expedia.root_path}/lib/templates/expedia.txt", "config/initializers/expedia.rb"
9
+ cp "#{Expedia.root_path}/lib/generators/templates/expedia.txt", "config/initializers/expedia.rb"
9
10
  # Shashka: Colorize output.
10
11
  puts "#{'create: '.colorize(:green)} config/initializers/expedia.rb"
11
12
  end
@@ -2,55 +2,64 @@ require 'spec_helper'
2
2
 
3
3
  describe "Expedia::HTTPService" do
4
4
 
5
- it "has an API_SERVER Constant" do
6
- Expedia::HTTPService.constants.should include(:API_SERVER)
7
- end
5
+ it "has an DEVELOPMENT_SERVER Constant" do
6
+ Expedia::HTTPService.constants.should include(:DEVELOPMENT_SERVER)
7
+ end
8
8
 
9
- it "has an RESERVATION_SERVER Constant" do
10
- Expedia::HTTPService.constants.should include(:RESERVATION_SERVER)
11
- end
9
+ it "has an API_SERVER Constant" do
10
+ Expedia::HTTPService.constants.should include(:API_SERVER)
11
+ end
12
12
 
13
- describe "server" do
14
-
15
- it "return API server when no options are provided" do
16
- Expedia::HTTPService.server.should =~ Regexp.new(Expedia::HTTPService::API_SERVER)
17
- end
13
+ it "has an RESERVATION_SERVER Constant" do
14
+ Expedia::HTTPService.constants.should include(:RESERVATION_SERVER)
15
+ end
18
16
 
19
- it "return server with http when options[:use_ssl] are not provided" do
20
- Expedia::HTTPService.server.should eql "http://#{Expedia::HTTPService::API_SERVER}"
21
- end
17
+ describe "server" do
22
18
 
23
- it "return RESERVATION server when options[:reservation_api]" do
24
- Expedia::HTTPService.server({ :reservation_api => true }).should =~ Regexp.new(Expedia::HTTPService::RESERVATION_SERVER)
25
- end
19
+ it "return API server when no options are provided" do
20
+ Expedia::HTTPService.server.should =~ Regexp.new(Expedia::HTTPService::API_SERVER)
21
+ end
26
22
 
27
- it "return server with https when options[:use_ssl]" do
28
- Expedia::HTTPService.server( {:use_ssl => true }).should eql "https://#{Expedia::HTTPService::API_SERVER}"
29
- end
23
+ it "return server with http when options[:use_ssl] are not provided" do
24
+ Expedia::HTTPService.server.should eql "http://#{Expedia::HTTPService::API_SERVER}"
25
+ end
30
26
 
31
- end
27
+ it "return RESERVATION server when options[:reservation_api]" do
28
+ Expedia::HTTPService.server({ :reservation_api => true }).should =~ Regexp.new(Expedia::HTTPService::RESERVATION_SERVER)
29
+ end
32
30
 
33
- describe "signature and add_common_parameters" do
31
+ it "return server with https when options[:use_ssl]" do
32
+ Expedia::HTTPService.server( {:use_ssl => true }).should eql "https://#{Expedia::HTTPService::API_SERVER}"
33
+ end
34
34
 
35
- before :each do
36
- Expedia.cid = ''
37
- Expedia.api_key =''
38
- Expedia.shared_secret = ''
35
+ it "return DEVELOPMENT_SERVER server when cid is 55505" do
36
+ Expedia.stub(:cid).and_return(55505)
37
+ Expedia::HTTPService.server.should =~ Regexp.new(Expedia::HTTPService::DEVELOPMENT_SERVER)
38
+ end
39
39
 
40
- end
40
+ end
41
41
 
42
+ describe "signature and common_parameters" do
42
43
 
43
- it "returns a ligit MD5 checksum" do
44
- Expedia::HTTPService.signature.should_not eql nil
45
- Expedia::HTTPService.signature.should_not eql ''
46
- end
44
+ before :each do
45
+ Expedia.cid = ''
46
+ Expedia.api_key =''
47
+ Expedia.shared_secret = ''
47
48
 
48
- it "returns a hash containing common params" do
49
- Expedia::HTTPService.add_common_parameters.keys.should include(:cid)
50
- Expedia::HTTPService.add_common_parameters.keys.should include(:apiKey)
51
- Expedia::HTTPService.add_common_parameters.keys.should include(:sig)
52
- Expedia::HTTPService.add_common_parameters.keys.should include(:_type)
53
- end
54
- end
49
+ end
55
50
 
56
- end
51
+
52
+ it "returns a ligit MD5 checksum" do
53
+ Expedia::HTTPService.signature.should_not eql nil
54
+ Expedia::HTTPService.signature.should_not eql ''
55
+ end
56
+
57
+ it "returns a hash containing common params" do
58
+ Expedia::HTTPService.common_parameters.keys.should include(:cid)
59
+ Expedia::HTTPService.common_parameters.keys.should include(:apiKey)
60
+ Expedia::HTTPService.common_parameters.keys.should include(:sig)
61
+ Expedia::HTTPService.common_parameters.keys.should include(:_type)
62
+ end
63
+ end
64
+
65
+ end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expedia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Zaid Akram
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-13 00:00:00.000000000 Z
11
+ date: 2014-04-16 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: multi_json
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: faraday
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: colorize
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: addressable
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rake
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ~>
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ~>
108
95
  - !ruby/object:Gem::Version
@@ -130,33 +117,34 @@ files:
130
117
  - lib/expedia/railtie.rb
131
118
  - lib/expedia/utils.rb
132
119
  - lib/expedia/version.rb
120
+ - lib/generators/expedia/initialize_generator.rb
121
+ - lib/generators/templates/expedia.txt
133
122
  - lib/tasks/expedia.rake
134
- - lib/templates/expedia.txt
135
123
  - spec/http_service_spec.rb
136
124
  - spec/spec_helper.rb
137
125
  homepage: https://github.com/zaidakram/expedia
138
- licenses: []
126
+ licenses:
127
+ - MIT
128
+ metadata: {}
139
129
  post_install_message:
140
130
  rdoc_options: []
141
131
  require_paths:
142
132
  - lib
143
133
  required_ruby_version: !ruby/object:Gem::Requirement
144
- none: false
145
134
  requirements:
146
- - - ! '>='
135
+ - - '>='
147
136
  - !ruby/object:Gem::Version
148
137
  version: '0'
149
138
  required_rubygems_version: !ruby/object:Gem::Requirement
150
- none: false
151
139
  requirements:
152
- - - ! '>='
140
+ - - '>='
153
141
  - !ruby/object:Gem::Version
154
142
  version: '0'
155
143
  requirements: []
156
144
  rubyforge_project:
157
- rubygems_version: 1.8.24
145
+ rubygems_version: 2.1.11
158
146
  signing_key:
159
- specification_version: 3
147
+ specification_version: 4
160
148
  summary: Expedia is a ruby wrapper for 'EAN (Expedia Affiliate Network)'
161
149
  test_files:
162
150
  - spec/http_service_spec.rb