active_shipping 0.12.4 → 0.12.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/active_shipping.rb +2 -1
  3. data/lib/active_shipping/shipping/base.rb +2 -2
  4. data/lib/active_shipping/shipping/carrier.rb +16 -13
  5. data/lib/active_shipping/shipping/carriers/benchmark_carrier.rb +3 -4
  6. data/lib/active_shipping/shipping/carriers/bogus_carrier.rb +1 -3
  7. data/lib/active_shipping/shipping/carriers/canada_post.rb +33 -44
  8. data/lib/active_shipping/shipping/carriers/canada_post_pws.rb +72 -81
  9. data/lib/active_shipping/shipping/carriers/fedex.rb +118 -109
  10. data/lib/active_shipping/shipping/carriers/kunaki.rb +33 -32
  11. data/lib/active_shipping/shipping/carriers/new_zealand_post.rb +9 -16
  12. data/lib/active_shipping/shipping/carriers/shipwire.rb +36 -35
  13. data/lib/active_shipping/shipping/carriers/stamps.rb +39 -51
  14. data/lib/active_shipping/shipping/carriers/ups.rb +280 -116
  15. data/lib/active_shipping/shipping/carriers/ups.rb.orig +456 -0
  16. data/lib/active_shipping/shipping/carriers/usps.rb +145 -100
  17. data/lib/active_shipping/shipping/carriers/usps.rb.orig +616 -0
  18. data/lib/active_shipping/shipping/errors.rb +1 -1
  19. data/lib/active_shipping/shipping/label_response.rb +25 -0
  20. data/lib/active_shipping/shipping/location.rb +18 -16
  21. data/lib/active_shipping/shipping/package.rb +51 -54
  22. data/lib/active_shipping/shipping/rate_estimate.rb +10 -12
  23. data/lib/active_shipping/shipping/rate_response.rb +3 -7
  24. data/lib/active_shipping/shipping/response.rb +6 -9
  25. data/lib/active_shipping/shipping/shipment_event.rb +2 -4
  26. data/lib/active_shipping/shipping/shipment_packer.rb +32 -17
  27. data/lib/active_shipping/shipping/shipping_response.rb +2 -4
  28. data/lib/active_shipping/shipping/tracking_response.rb +3 -5
  29. data/lib/active_shipping/version.rb +1 -1
  30. data/lib/vendor/quantified/lib/quantified/attribute.rb +79 -80
  31. data/lib/vendor/quantified/lib/quantified/length.rb +5 -5
  32. data/lib/vendor/quantified/lib/quantified/mass.rb +4 -4
  33. data/lib/vendor/quantified/test/length_test.rb +19 -15
  34. data/lib/vendor/quantified/test/mass_test.rb +14 -14
  35. data/lib/vendor/quantified/test/test_helper.rb +1 -2
  36. data/lib/vendor/test_helper.rb +0 -1
  37. data/lib/vendor/xml_node/benchmark/bench_generation.rb +2 -4
  38. data/lib/vendor/xml_node/lib/xml_node.rb +54 -55
  39. data/lib/vendor/xml_node/test/test_generating.rb +23 -28
  40. data/lib/vendor/xml_node/test/test_parsing.rb +5 -8
  41. metadata +6 -25
  42. checksums.yaml.gz.sig +0 -1
  43. data.tar.gz.sig +0 -0
  44. metadata.gz.sig +0 -0
@@ -4,14 +4,14 @@ module ActiveMerchant
4
4
  module Shipping
5
5
  class Kunaki < Carrier
6
6
  self.retry_safe = true
7
-
7
+
8
8
  cattr_reader :name
9
9
  @@name = "Kunaki"
10
-
10
+
11
11
  URL = 'https://Kunaki.com/XMLService.ASP'
12
-
13
- CARRIERS = [ "UPS", "USPS", "FedEx", "Royal Mail", "Parcelforce", "Pharos", "Eurotrux", "Canada Post", "DHL" ]
14
-
12
+
13
+ CARRIERS = ["UPS", "USPS", "FedEx", "Royal Mail", "Parcelforce", "Pharos", "Eurotrux", "Canada Post", "DHL"]
14
+
15
15
  COUNTRIES = {
16
16
  'AR' => 'Argentina',
17
17
  'AU' => 'Australia',
@@ -65,30 +65,31 @@ module ActiveMerchant
65
65
  'RS' => 'Yugoslavia',
66
66
  'ME' => 'Yugoslavia'
67
67
  }
68
-
68
+
69
69
  def find_rates(origin, destination, packages, options = {})
70
70
  requires!(options, :items)
71
71
  commit(origin, destination, options)
72
72
  end
73
-
73
+
74
74
  def valid_credentials?
75
75
  true
76
76
  end
77
-
78
- private
77
+
78
+ private
79
+
79
80
  def build_request(destination, options)
80
81
  xml = Builder::XmlMarkup.new
81
82
  xml.instruct!
82
83
  xml.tag! 'ShippingOptions' do
83
84
  xml.tag! 'AddressInfo' do
84
85
  xml.tag! 'Country', COUNTRIES[destination.country_code]
85
-
86
- state = ['US', 'CA'].include?(destination.country_code.to_s) ? destination.state : ''
87
-
86
+
87
+ state = %w(US CA).include?(destination.country_code.to_s) ? destination.state : ''
88
+
88
89
  xml.tag! 'State_Province', state
89
90
  xml.tag! 'PostalCode', destination.zip
90
91
  end
91
-
92
+
92
93
  options[:items].each do |item|
93
94
  xml.tag! 'Product' do
94
95
  xml.tag! 'ProductId', item[:sku]
@@ -98,39 +99,39 @@ module ActiveMerchant
98
99
  end
99
100
  xml.target!
100
101
  end
101
-
102
+
102
103
  def commit(origin, destination, options)
103
104
  request = build_request(destination, options)
104
-
105
+
105
106
  response = parse( ssl_post(URL, request, "Content-Type" => "text/xml") )
106
-
107
- RateResponse.new(success?(response), message_from(response), response,
108
- :rates => build_rate_estimates(response, origin, destination)
107
+
108
+ RateResponse.new(success?(response), message_from(response), response,
109
+ :rates => build_rate_estimates(response, origin, destination)
109
110
  )
110
111
  end
111
-
112
+
112
113
  def build_rate_estimates(response, origin, destination)
113
114
  response["Options"].collect do |quote|
114
115
  RateEstimate.new(origin, destination, carrier_for(quote["Description"]), quote["Description"],
115
- :total_price => quote["Price"],
116
- :currency => "USD"
116
+ :total_price => quote["Price"],
117
+ :currency => "USD"
117
118
  )
118
119
  end
119
120
  end
120
-
121
+
121
122
  def carrier_for(service)
122
- CARRIERS.dup.find{ |carrier| service.to_s =~ /^#{carrier}/i } || service.to_s.split(" ").first
123
+ CARRIERS.dup.find { |carrier| service.to_s =~ /^#{carrier}/i } || service.to_s.split(" ").first
123
124
  end
124
-
125
+
125
126
  def parse(xml)
126
127
  response = {}
127
128
  response["Options"] = []
128
-
129
+
129
130
  document = REXML::Document.new(sanitize(xml))
130
-
131
+
131
132
  response["ErrorCode"] = parse_child_text(document.root, "ErrorCode")
132
133
  response["ErrorText"] = parse_child_text(document.root, "ErrorText")
133
-
134
+
134
135
  document.root.elements.each("Option") do |e|
135
136
  rate = {}
136
137
  rate["Description"] = parse_child_text(e, "Description")
@@ -139,27 +140,27 @@ module ActiveMerchant
139
140
  end
140
141
  response
141
142
  end
142
-
143
+
143
144
  def sanitize(response)
144
145
  result = response.to_s
145
146
  result.gsub!("\r\n", "")
146
147
  result.gsub!(/<(\/)?(BODY|HTML)>/, '')
147
148
  result
148
149
  end
149
-
150
+
150
151
  def parse_child_text(parent, name)
151
152
  if element = parent.elements[name]
152
153
  element.text
153
154
  end
154
155
  end
155
-
156
+
156
157
  def success?(response)
157
158
  response["ErrorCode"] == "0"
158
159
  end
159
-
160
+
160
161
  def message_from(response)
161
162
  response["ErrorText"]
162
163
  end
163
164
  end
164
165
  end
165
- end
166
+ end
@@ -1,7 +1,6 @@
1
1
  module ActiveMerchant
2
2
  module Shipping
3
3
  class NewZealandPost < Carrier
4
-
5
4
  cattr_reader :name
6
5
  @@name = "New Zealand Post"
7
6
 
@@ -25,17 +24,16 @@ module ActiveMerchant
25
24
  end
26
25
 
27
26
  def self.default_location
28
- Location.new({
27
+ Location.new(
29
28
  :country => "NZ",
30
29
  :city => "Wellington",
31
30
  :address1 => "22 Waterloo Quay",
32
31
  :address2 => "Pipitea",
33
32
  :postal_code => "6011"
34
- })
33
+ )
35
34
  end
36
35
 
37
36
  class NewZealandPostRateResponse < RateResponse
38
-
39
37
  attr_reader :raw_responses
40
38
 
41
39
  def initialize(success, message, params = {}, options = {})
@@ -45,7 +43,6 @@ module ActiveMerchant
45
43
  end
46
44
 
47
45
  class RateRequest
48
-
49
46
  attr_reader :urls
50
47
  attr_writer :raw_responses
51
48
 
@@ -78,7 +75,7 @@ module ActiveMerchant
78
75
  protected
79
76
 
80
77
  def self.new_zealand?(location)
81
- [ 'NZ', nil ].include?(Location.from(location).country_code)
78
+ ['NZ', nil].include?(Location.from(location).country_code)
82
79
  end
83
80
 
84
81
  def self.domestic?(locations)
@@ -113,7 +110,7 @@ module ActiveMerchant
113
110
  end
114
111
 
115
112
  def rates_hash
116
- products_hash.select { |service, products| products.size == @packages.size }
113
+ products_hash.select { |_service, products| products.size == @packages.size }
117
114
  end
118
115
 
119
116
  def products_hash
@@ -142,14 +139,13 @@ module ActiveMerchant
142
139
  def params(package)
143
140
  @params.merge(api_params).merge(package.params)
144
141
  end
145
-
146
142
  end
147
143
 
148
144
  class Domestic < RateRequest
149
145
  def service_name(product)
150
- [ product["service_group_description"], product["description"] ].join(" ")
146
+ [product["service_group_description"], product["description"]].join(" ")
151
147
  end
152
-
148
+
153
149
  def api
154
150
  :domestic
155
151
  end
@@ -168,16 +164,15 @@ module ActiveMerchant
168
164
  end
169
165
 
170
166
  class International < RateRequest
171
-
172
167
  def rates
173
168
  raise "New Zealand Post packages must originate in New Zealand" unless new_zealand_origin?
174
169
  super
175
170
  end
176
171
 
177
172
  def service_name(product)
178
- [ product["group"], product["name"] ].join(" ")
173
+ [product["group"], product["name"]].join(" ")
179
174
  end
180
-
175
+
181
176
  def api
182
177
  :international
183
178
  end
@@ -185,14 +180,13 @@ module ActiveMerchant
185
180
  def api_params
186
181
  { :country_code => @destination.country_code }
187
182
  end
188
-
183
+
189
184
  def price(product)
190
185
  product["price"].to_f
191
186
  end
192
187
  end
193
188
 
194
189
  class NewZealandPostPackage
195
-
196
190
  def initialize(package, api)
197
191
  @package = package
198
192
  @api = api
@@ -262,7 +256,6 @@ module ActiveMerchant
262
256
  def currency
263
257
  @package.currency || "NZD"
264
258
  end
265
-
266
259
  end
267
260
  end
268
261
  end
@@ -5,12 +5,12 @@ module ActiveMerchant
5
5
  module Shipping
6
6
  class Shipwire < Carrier
7
7
  self.retry_safe = true
8
-
8
+
9
9
  cattr_reader :name
10
10
  @@name = "Shipwire"
11
-
11
+
12
12
  URL = 'https://api.shipwire.com/exec/RateServices.php'
13
- SCHEMA_URL = 'http://www.shipwire.com/exec/download/RateRequest.dtd'
13
+ SCHEMA_URL = 'http://www.shipwire.com/exec/download/RateRequest.dtd'
14
14
  WAREHOUSES = { 'CHI' => 'Chicago',
15
15
  'LAX' => 'Los Angeles',
16
16
  'REN' => 'Reno',
@@ -18,46 +18,47 @@ module ActiveMerchant
18
18
  'TOR' => 'Toronto',
19
19
  'UK' => 'United Kingdom'
20
20
  }
21
-
22
- CARRIERS = [ "UPS", "USPS", "FedEx", "Royal Mail", "Parcelforce", "Pharos", "Eurotrux", "Canada Post", "DHL" ]
23
-
21
+
22
+ CARRIERS = ["UPS", "USPS", "FedEx", "Royal Mail", "Parcelforce", "Pharos", "Eurotrux", "Canada Post", "DHL"]
23
+
24
24
  SUCCESS = "OK"
25
25
  SUCCESS_MESSAGE = "Successfully received the shipping rates"
26
26
  NO_RATES_MESSAGE = "No shipping rates could be found for the destination address"
27
27
  REQUIRED_OPTIONS = [:login, :password].freeze
28
-
28
+
29
29
  def find_rates(origin, destination, packages, options = {})
30
30
  requires!(options, :items)
31
31
  commit(origin, destination, options)
32
32
  end
33
-
33
+
34
34
  def valid_credentials?
35
35
  location = self.class.default_location
36
- find_rates(location, location, Package.new(100, [5,15,30]),
37
- :items => [ { :sku => '', :quantity => 1 } ]
36
+ find_rates(location, location, Package.new(100, [5, 15, 30]),
37
+ :items => [{ :sku => '', :quantity => 1 }]
38
38
  )
39
39
  rescue ActiveMerchant::Shipping::ResponseError
40
40
  true
41
41
  rescue ActiveMerchant::ResponseError => e
42
42
  e.response.code != '401'
43
43
  end
44
-
44
+
45
45
  private
46
+
46
47
  def requirements
47
48
  REQUIRED_OPTIONS
48
49
  end
49
-
50
+
50
51
  def build_request(destination, options)
51
52
  xml = Builder::XmlMarkup.new
52
53
  xml.instruct!
53
54
  xml.declare! :DOCTYPE, :RateRequest, :SYSTEM, SCHEMA_URL
54
55
  xml.tag! 'RateRequest' do
55
56
  add_credentials(xml)
56
- add_order(xml, destination, options)
57
+ add_order(xml, destination, options)
57
58
  end
58
59
  xml.target!
59
60
  end
60
-
61
+
61
62
  def add_credentials(xml)
62
63
  xml.tag! 'EmailAddress', @options[:login]
63
64
  xml.tag! 'Password', @options[:password]
@@ -91,8 +92,8 @@ module ActiveMerchant
91
92
  xml.tag! 'Zip', destination.zip unless destination.zip.blank?
92
93
  end
93
94
  end
94
-
95
- # Code is limited to 12 characters
95
+
96
+ # Code is limited to 12 characters
96
97
  def add_item(xml, item, index)
97
98
  xml.tag! 'Item', :num => index do
98
99
  xml.tag! 'Code', item[:sku]
@@ -103,30 +104,30 @@ module ActiveMerchant
103
104
  def commit(origin, destination, options)
104
105
  request = build_request(destination, options)
105
106
  save_request(request)
106
-
107
+
107
108
  response = parse( ssl_post(URL, "RateRequestXML=#{CGI.escape(request)}") )
108
-
109
- RateResponse.new(response["success"], response["message"], response,
110
- :xml => response,
111
- :rates => build_rate_estimates(response, origin, destination),
112
- :request => last_request
109
+
110
+ RateResponse.new(response["success"], response["message"], response,
111
+ :xml => response,
112
+ :rates => build_rate_estimates(response, origin, destination),
113
+ :request => last_request
113
114
  )
114
115
  end
115
-
116
+
116
117
  def build_rate_estimates(response, origin, destination)
117
118
  response["rates"].collect do |quote|
118
119
  RateEstimate.new(origin, destination, carrier_for(quote["service"]), quote["service"],
119
- :service_code => quote["method"],
120
- :total_price => quote["cost"],
121
- :currency => quote["currency"],
122
- :delivery_range => [ timestamp_from_business_day(quote["delivery_min"]),
123
- timestamp_from_business_day(quote["delivery_max"]) ]
120
+ :service_code => quote["method"],
121
+ :total_price => quote["cost"],
122
+ :currency => quote["currency"],
123
+ :delivery_range => [timestamp_from_business_day(quote["delivery_min"]),
124
+ timestamp_from_business_day(quote["delivery_max"])]
124
125
  )
125
126
  end
126
127
  end
127
-
128
+
128
129
  def carrier_for(service)
129
- CARRIERS.dup.find{ |carrier| service.to_s =~ /^#{carrier}/i } || service.to_s.split(" ").first
130
+ CARRIERS.dup.find { |carrier| service.to_s =~ /^#{carrier}/i } || service.to_s.split(" ").first
130
131
  end
131
132
 
132
133
  def parse(xml)
@@ -134,9 +135,9 @@ module ActiveMerchant
134
135
  response["rates"] = []
135
136
 
136
137
  document = REXML::Document.new(xml)
137
-
138
+
138
139
  response["status"] = parse_child_text(document.root, "Status")
139
-
140
+
140
141
  document.root.elements.each("Order/Quotes/Quote") do |e|
141
142
  rate = {}
142
143
  rate["method"] = e.attributes["method"]
@@ -161,18 +162,18 @@ module ActiveMerchant
161
162
  response["success"] = false
162
163
  response["message"] = parse_child_text(document.root, "ErrorMessage")
163
164
  end
164
-
165
+
165
166
  response
166
167
  rescue NoMethodError => e
167
168
  raise ActiveMerchant::Shipping::ResponseContentError.new(e, xml)
168
169
  end
169
-
170
+
170
171
  def parse_child_text(parent, name)
171
172
  if element = parent.elements[name]
172
173
  element.text
173
174
  end
174
175
  end
175
-
176
+
176
177
  def parse_child_attribute(parent, name, attribute)
177
178
  if element = parent.elements[name]
178
179
  element.attributes[attribute]
@@ -3,7 +3,6 @@ require 'builder'
3
3
 
4
4
  module ActiveMerchant
5
5
  module Shipping
6
-
7
6
  # Stamps.com integration for rating, tracking, address validation, and label generation
8
7
  # Integration ID can be requested from Stamps.com
9
8
 
@@ -15,6 +14,7 @@ module ActiveMerchant
15
14
 
16
15
  attr_reader :last_swsim_method
17
16
 
17
+ # TODO: Update to latest API. Documentation for the latest WSDL version is available here: http://support.stamps.com/outgoing/swsimv39doc.zip
18
18
  LIVE_URL = 'https://swsim.stamps.com/swsim/swsimv34.asmx'
19
19
  TEST_URL = 'https://swsim.testing.stamps.com/swsim/swsimv34.asmx'
20
20
  NAMESPACE = 'http://stamps.com/xml/namespace/2014/01/swsim/swsimv34'
@@ -22,25 +22,25 @@ module ActiveMerchant
22
22
  REQUIRED_OPTIONS = [:integration_id, :username, :password].freeze
23
23
 
24
24
  PACKAGE = [
25
- 'Postcard',
26
- 'Letter',
27
- 'Large Envelope or Flat',
28
- 'Thick Envelope',
29
- 'Package',
30
- 'Flat Rate Box',
31
- 'Small Flat Rate Box',
32
- 'Large Flat Rate Box',
33
- 'Flat Rate Envelope',
34
- 'Flat Rate Padded Envelope',
35
- 'Large Package',
36
- 'Oversized Package',
37
- 'Regional Rate Box A',
38
- 'Regional Rate Box B',
39
- 'Regional Rate Box C',
40
- 'Legal Flat Rate Envelope'
41
- ].freeze
42
-
43
- US_POSSESSIONS = ["AS", "FM", "GU", "MH", "MP", "PW", "PR", "VI"]
25
+ 'Postcard',
26
+ 'Letter',
27
+ 'Large Envelope or Flat',
28
+ 'Thick Envelope',
29
+ 'Package',
30
+ 'Flat Rate Box',
31
+ 'Small Flat Rate Box',
32
+ 'Large Flat Rate Box',
33
+ 'Flat Rate Envelope',
34
+ 'Flat Rate Padded Envelope',
35
+ 'Large Package',
36
+ 'Oversized Package',
37
+ 'Regional Rate Box A',
38
+ 'Regional Rate Box B',
39
+ 'Regional Rate Box C',
40
+ 'Legal Flat Rate Envelope'
41
+ ].freeze
42
+
43
+ US_POSSESSIONS = %w(AS FM GU MH MP PW PR VI)
44
44
 
45
45
  SERVICE_TYPES = {
46
46
  'US-FC' => 'USPS First-Class Mail',
@@ -131,57 +131,46 @@ module ActiveMerchant
131
131
  'EnvelopeGreeting'
132
132
  ]
133
133
 
134
- IMAGE_TYPE = [
135
- 'Auto',
136
- 'Epl',
137
- 'Gif',
138
- 'Jpg',
139
- 'Pdf',
140
- 'Png',
141
- 'Zpl'
142
- ]
134
+ IMAGE_TYPE = %w(Auto Epl Gif Jpg Pdf Png Zpl)
143
135
 
144
136
  def account_info
145
137
  request = build_get_account_info_request
146
- response = commit(:GetAccountInfo, request)
138
+ commit(:GetAccountInfo, request)
147
139
  end
148
140
 
149
141
  def purchase_postage(purchase_amount, control_total)
150
142
  request = build_purchase_postage_request(purchase_amount, control_total)
151
- response = commit(:PurchasePostage, request)
143
+ commit(:PurchasePostage, request)
152
144
  end
153
145
 
154
146
  def purchase_status(transaction_id)
155
147
  request = build_get_purchase_status(transaction_id)
156
- response = commit(:GetPurchaseStatus, request)
148
+ commit(:GetPurchaseStatus, request)
157
149
  end
158
150
 
159
151
  def validate_address(address, options = {})
160
152
  address = standardize_address(address)
161
-
162
153
  request = build_cleanse_address_request(address)
163
- response = commit(:CleanseAddress, request)
154
+ commit(:CleanseAddress, request)
164
155
  end
165
156
 
166
157
  def find_rates(origin, destination, package, options = {})
167
158
  origin = standardize_address(origin)
168
159
  destination = standardize_address(destination)
169
-
170
160
  request = build_rate_request(origin, destination, package, options)
171
- response = commit(:GetRates, request)
161
+ commit(:GetRates, request)
172
162
  end
173
163
 
174
164
  def create_shipment(origin, destination, package, line_items = [], options = {})
175
165
  origin = standardize_address(origin)
176
166
  destination = standardize_address(destination)
177
-
178
167
  request = build_create_indicium_request(origin, destination, package, line_items, options)
179
- response = commit(:CreateIndicium, request)
168
+ commit(:CreateIndicium, request)
180
169
  end
181
170
 
182
171
  def find_tracking_info(shipment_id, options = {})
183
172
  request = build_track_shipment_request(shipment_id, options)
184
- response = commit(:TrackShipment, request)
173
+ commit(:TrackShipment, request)
185
174
  end
186
175
 
187
176
  def namespace
@@ -234,18 +223,18 @@ module ActiveMerchant
234
223
 
235
224
  def get_authenticator
236
225
  request = build_authenticate_user_request
237
- response = commit(:AuthenticateUser, request)
226
+ commit(:AuthenticateUser, request)
238
227
  end
239
228
 
240
229
  def build_header
241
230
  xml = Builder::XmlMarkup.new
242
231
  xml.instruct!
243
- xml.soap(:Envelope, {
244
- 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/',
245
- 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
246
- 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
247
- 'xmlns:tns' => 'http://stamps.com/xml/namespace/2014/01/swsim/swsimv34'
248
- }) do
232
+ xml.soap(:Envelope,
233
+ 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/',
234
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
235
+ 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
236
+ 'xmlns:tns' => 'http://stamps.com/xml/namespace/2014/01/swsim/swsimv34'
237
+ ) do
249
238
  xml.soap :Body do
250
239
  yield(xml)
251
240
  end
@@ -361,7 +350,7 @@ module ActiveMerchant
361
350
 
362
351
  xml.tns(:NonMachinable, true) unless machinable
363
352
 
364
- xml.tns(:RectangularShaped, ! package.cylinder?)
353
+ xml.tns(:RectangularShaped, !package.cylinder?)
365
354
  xml.tns(:GEMNotes, options[:gem_notes]) unless options[:gem_notes].blank?
366
355
 
367
356
  add_ons = Array(options[:add_ons])
@@ -684,7 +673,7 @@ module ActiveMerchant
684
673
  add_on_details[:missing_data] = add_on.get_text('MissingData').to_s if add_on.get_text('MissingData')
685
674
  add_on_details[:amount] = add_on.get_text('Amount').to_s if add_on.get_text('Amount')
686
675
 
687
- prohibited_with = add_on.get_elements('ProhibitedWithAnyOf/AddOnTypeV5').map { |p| p.text }
676
+ prohibited_with = add_on.get_elements('ProhibitedWithAnyOf/AddOnTypeV5').map(&:text)
688
677
  add_on_details[:prohibited_with] = prohibited_with unless prohibited_with.empty?
689
678
 
690
679
  add_ons[add_on_type] = add_on_details
@@ -696,7 +685,7 @@ module ActiveMerchant
696
685
  def parse_package(rate)
697
686
  weight = rate.get_text('WeightOz').to_s.to_f
698
687
 
699
- dimensions = ['Length', 'Width', 'Height'].map do |dim|
688
+ dimensions = %w(Length Width Height).map do |dim|
700
689
  rate.get_text(dim) ? rate.get_text(dim).to_s.to_f : nil
701
690
  end
702
691
  dimensions.compact!
@@ -840,7 +829,7 @@ module ActiveMerchant
840
829
  class StampsRateEstimate < RateEstimate
841
830
  attr_reader :add_ons
842
831
 
843
- def initialize(origin, destination, carrier, service_name, options={})
832
+ def initialize(origin, destination, carrier, service_name, options = {})
844
833
  super
845
834
  @add_ons = options[:add_ons]
846
835
  end
@@ -851,7 +840,6 @@ module ActiveMerchant
851
840
  end
852
841
 
853
842
  class StampsShippingResponse < ShippingResponse
854
-
855
843
  include PostsData
856
844
 
857
845
  self.ssl_version = :SSLv3