active_shipping 1.14.0 → 1.14.1

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: cd3f080f7ff848e61dd530d4c4562c8010e76a01
4
- data.tar.gz: 7b97efd00ca16978a0bf77b1a20c6244bf454de7
3
+ metadata.gz: b52cb7b75be25e1f18dd9fcb5cc212c2c590f79d
4
+ data.tar.gz: 493af87b593907f1ab99e5e1b9437d897ec128d0
5
5
  SHA512:
6
- metadata.gz: 9d3acc9f7ed6d393ef7ad013e4f207a1dcdacf50b7ef1d06f5ba206575a2f8cea0bda68b02e02cea4b25635dd5932700186218d0aaf8bf3ac27623d421058a13
7
- data.tar.gz: b4765b284a95d26de362fbbd4f0385a770a08a259e290d36e4d3443a3ea31f058f7c6547db74fa1ddd9fa0033d0f0253a9f74d09bd2299b38b3e1e156df13907
6
+ metadata.gz: c0a112df52dce5215b518506f3244b5bdb767d04581eb976ea3a8f97ec13bba9c8ab2f18e21405cb2929cd4e0c820925386e841dce84aaa6023288f145c939e7
7
+ data.tar.gz: c28eac1c26d272baf2116144b92e2b18d2fa15ae8090ef79fa8439a9b5a01a50c7ab87780e040445428750c7d53a2085ca0126f95f1aad557d3ceb4b1abe7f6d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # ActiveShipping CHANGELOG
2
2
 
3
+ ### v1.14.1
4
+ - Fix parsing of CanadaPostPWS service options response.
5
+
3
6
  ### v1.14.0
4
7
  - Update Correios default services list.
5
8
  - Fix CanadaPostPWS from generating an empty options tag.
@@ -214,14 +214,14 @@ module ActiveShipping
214
214
  restrictions_node = doc.root.at('restrictions')
215
215
  dimensions_node = restrictions_node.at('dimensional-restrictions')
216
216
  restrictions = {
217
- :min_weight => restrictions_node.at("weight-restriction").attributes['min'].value.to_i,
218
- :max_weight => restrictions_node.at("weight-restriction").attributes['max'].value.to_i,
219
- :min_length => dimensions_node.at("length").attributes['min'].value.to_f,
220
- :max_length => dimensions_node.at("length").attributes['max'].value.to_f,
221
- :min_height => dimensions_node.at("height").attributes['min'].value.to_f,
222
- :max_height => dimensions_node.at("height").attributes['max'].value.to_f,
223
- :min_width => dimensions_node.at("width").attributes['min'].value.to_f,
224
- :max_width => dimensions_node.at("width").attributes['max'].value.to_f
217
+ :min_weight => restrictions_node.at("weight-restriction").attributes['min'].try(:value).to_i,
218
+ :max_weight => restrictions_node.at("weight-restriction").attributes['max'].try(:value).to_i,
219
+ :min_length => dimensions_node.at("length").attributes['min'].try(:value).to_f,
220
+ :max_length => dimensions_node.at("length").attributes['max'].try(:value).to_f,
221
+ :min_height => dimensions_node.at("height").attributes['min'].try(:value).to_f,
222
+ :max_height => dimensions_node.at("height").attributes['max'].try(:value).to_f,
223
+ :min_width => dimensions_node.at("width").attributes['min'].try(:value).to_f,
224
+ :max_width => dimensions_node.at("width").attributes['max'].try(:value).to_f
225
225
  }
226
226
 
227
227
  {
@@ -1,3 +1,3 @@
1
1
  module ActiveShipping
2
- VERSION = "1.14.0"
2
+ VERSION = "1.14.1"
3
3
  end
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <service>
3
+ <service-code>USA.PW.ENV</service-code>
4
+ <service-name>Priority Worldwide envelope USA</service-name>
5
+ <options>
6
+ <option>
7
+ <option-code>SO</option-code>
8
+ <option-name>Signature option</option-name>
9
+ <link rel="option" href="https://soa-gw.canadapost.ca/rs/ship/option/SO" media-type="application/vnd.cpc.ship.rate+xml"/>
10
+ <mandatory>true</mandatory>
11
+ <qualifier-required>false</qualifier-required>
12
+ </option>
13
+ <option>
14
+ <option-code>COV</option-code>
15
+ <option-name>Coverage</option-name>
16
+ <link rel="option" href="https://soa-gw.canadapost.ca/rs/ship/option/COV" media-type="application/vnd.cpc.ship.rate+xml"/>
17
+ <mandatory>false</mandatory>
18
+ <qualifier-required>true</qualifier-required>
19
+ <qualifier-max>100</qualifier-max>
20
+ </option>
21
+ <option>
22
+ <option-code>DC</option-code>
23
+ <option-name>Delivery confirmation</option-name>
24
+ <link rel="option" href="https://soa-gw.canadapost.ca/rs/ship/option/DC" media-type="application/vnd.cpc.ship.rate+xml"/>
25
+ <mandatory>true</mandatory>
26
+ <qualifier-required>false</qualifier-required>
27
+ </option>
28
+ </options>
29
+ <restrictions>
30
+ <weight-restriction/>
31
+ <dimensional-restrictions>
32
+ <length />
33
+ <width />
34
+ <height />
35
+ <length-plus-girth-max>300</length-plus-girth-max>
36
+ </dimensional-restrictions>
37
+ <can-ship-in-mailing-tube>false</can-ship-in-mailing-tube>
38
+ <can-ship-unpackaged>false</can-ship-unpackaged>
39
+ <allowed-as-return-service>false</allowed-as-return-service>
40
+ </restrictions>
41
+ </service>
@@ -343,6 +343,20 @@ class CanadaPostPwsRatingTest < Minitest::Test
343
343
  assert_equal 150, response[:restrictions][:max_width]
344
344
  end
345
345
 
346
+ def test_parse_find_service_options_response
347
+ body = xml_fixture('canadapost_pws/service_options_response_priority_worldwide')
348
+ response = @cp.parse_service_options_response(body)
349
+ assert_equal 3, response[:options].size
350
+ assert_equal 0, response[:restrictions][:min_weight]
351
+ assert_equal 0, response[:restrictions][:max_weight]
352
+ assert_equal 0, response[:restrictions][:min_length]
353
+ assert_equal 0, response[:restrictions][:min_height]
354
+ assert_equal 0, response[:restrictions][:min_width]
355
+ assert_equal 0, response[:restrictions][:max_length]
356
+ assert_equal 0, response[:restrictions][:max_height]
357
+ assert_equal 0, response[:restrictions][:max_width]
358
+ end
359
+
346
360
  def test_parse_find_option_response
347
361
  body = xml_fixture('canadapost_pws/option_response')
348
362
  response = @cp.parse_option_response(body)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_shipping
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-15 00:00:00.000000000 Z
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: quantified
@@ -266,6 +266,7 @@ files:
266
266
  - test/fixtures/xml/canadapost_pws/register_token_error.xml
267
267
  - test/fixtures/xml/canadapost_pws/register_token_response.xml
268
268
  - test/fixtures/xml/canadapost_pws/service_options_response.xml
269
+ - test/fixtures/xml/canadapost_pws/service_options_response_priority_worldwide.xml
269
270
  - test/fixtures/xml/canadapost_pws/services_error.xml
270
271
  - test/fixtures/xml/canadapost_pws/services_response.xml
271
272
  - test/fixtures/xml/canadapost_pws/shipment_domestic.xml
@@ -502,6 +503,7 @@ test_files:
502
503
  - test/fixtures/xml/canadapost_pws/register_token_error.xml
503
504
  - test/fixtures/xml/canadapost_pws/register_token_response.xml
504
505
  - test/fixtures/xml/canadapost_pws/service_options_response.xml
506
+ - test/fixtures/xml/canadapost_pws/service_options_response_priority_worldwide.xml
505
507
  - test/fixtures/xml/canadapost_pws/services_error.xml
506
508
  - test/fixtures/xml/canadapost_pws/services_response.xml
507
509
  - test/fixtures/xml/canadapost_pws/shipment_domestic.xml