active_shipping 1.13.3 → 1.13.4

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: f7ada26d664d2d94b53b1dcb1268109f8efadaa3
4
- data.tar.gz: 5b3ca7781a192d331afb9a5b780233a60181db02
3
+ metadata.gz: 053fd1f8bb1f8703c987c04bae54890113da7279
4
+ data.tar.gz: a13860a75c2feb3ea8ce4586473c3a560c3a800e
5
5
  SHA512:
6
- metadata.gz: 684c2b83d4c3d74159095d3d0d184f2023c2f42e2481efd16f8a923ec68199db61ded9dbf09529537f325ac7b0da37fb7943091b92ea9c039de3afe082486e5a
7
- data.tar.gz: e2b2e6cfca043f95987876b252f2059f20a5e62d1552e357c11e55ffeddbaf1d93fb92c8a7cca69a36f28c3191e189c9f2f36c620138d5ac3d83f22698b9906d
6
+ metadata.gz: cebea6659ce0cf9a316149886521fe07fc6563c894bdc6dd6ccc5b407c950118272d3cbcba0d35f00d63b5a5c02c4d5238eaa78223865d77d2cf73ef3cf02bb4
7
+ data.tar.gz: 69d7a363705c521bda896ead248d6605209815d7ee9b410c39be15ea4f53f0da4c955f02f7e594ae3acac0a049cdf6cb14a22161d538bfa81f30bef773688a23
data/.gitignore CHANGED
@@ -12,3 +12,4 @@ test/fixtures/live_credentials.yml
12
12
  doc/
13
13
  .idea
14
14
  .bundle
15
+ .byebug_history
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # ActiveShipping CHANGELOG
2
2
 
3
+ ### v1.13.4
4
+ - Upcase postal code for CanadaPostPWS
5
+ - Fix failing USPS test
6
+ - add .byebug_history to .gitignore
7
+
3
8
  ### v1.13.3
4
9
  - CanadaPostPWS no longer modifies locations passed to it
5
10
 
@@ -782,7 +782,8 @@ module ActiveShipping
782
782
  end
783
783
 
784
784
  def get_sanitized_postal_code(location)
785
- location.try(:postal_code).try(:gsub, /\s+/, '')
785
+ return nil if location.nil? || location.postal_code.nil?
786
+ location.postal_code.gsub(/\s+/, '').upcase
786
787
  end
787
788
 
788
789
  def sanitize_weight_kg(kg)
@@ -1,3 +1,3 @@
1
1
  module ActiveShipping
2
- VERSION = "1.13.3"
2
+ VERSION = "1.13.4"
3
3
  end
@@ -12,12 +12,12 @@ class RemoteUSPSTest < Minitest::Test
12
12
  end
13
13
 
14
14
  def test_tracking_with_attempted_delivery
15
- response = @carrier.find_tracking_info('CJ509046330US', test: false)
15
+ response = @carrier.find_tracking_info('LZ117228611US', test: false)
16
16
  assert response.success?, response.message
17
- assert_equal 10,response.shipment_events.size
17
+ assert_equal 15,response.shipment_events.size
18
18
  assert_equal 'DELIVERED', response.shipment_events.last.message
19
- assert_equal Time.parse('2016-04-21 13:46:00 UTC'), response.attempted_delivery_date
20
- assert_equal Time.parse('2016-04-25 17:13:00 UTC'), response.actual_delivery_date
19
+ assert_equal Time.parse('2017-03-31 11:37:00 UTC'), response.attempted_delivery_date
20
+ assert_equal Time.parse('2017-04-03 14:05:00 UTC'), response.actual_delivery_date
21
21
  end
22
22
 
23
23
  def test_tracking_with_bad_number
@@ -0,0 +1,59 @@
1
+ require 'test_helper'
2
+
3
+ class CanadaPostPwsTest < Minitest::Test
4
+
5
+ def setup
6
+ credentials = { platform_id: 123, api_key: '456', secret: '789' }
7
+ @cp = CanadaPostPWS.new(credentials)
8
+ end
9
+
10
+ def test_get_sanitized_postal_code_location_nil
11
+ postal_code = @cp.send(:get_sanitized_postal_code, nil)
12
+
13
+ assert_nil postal_code
14
+ end
15
+
16
+ def test_get_sanitized_postal_code_postal_code_nil
17
+ location = Location.new(name: 'Test test')
18
+
19
+ assert_nil location.postal_code
20
+
21
+ postal_code = @cp.send(:get_sanitized_postal_code, location)
22
+
23
+ assert_nil postal_code
24
+ end
25
+
26
+ def test_get_sanitized_postal_code_spaces
27
+ location = Location.new(postal_code: ' K2P 1L4 ')
28
+
29
+ postal_code = @cp.send(:get_sanitized_postal_code, location)
30
+
31
+ assert_equal 'K2P1L4', postal_code
32
+ end
33
+
34
+ def test_get_sanitized_postal_code_lowercase
35
+ location = Location.new(postal_code: 'k2p 1l4')
36
+
37
+ postal_code = @cp.send(:get_sanitized_postal_code, location)
38
+
39
+ assert_equal 'K2P1L4', postal_code
40
+ end
41
+
42
+ def test_get_sanitzied_postal_code_proper
43
+ location = Location.new(postal_code: 'K2P1L4')
44
+
45
+ postal_code = @cp.send(:get_sanitized_postal_code, location)
46
+
47
+ assert_equal 'K2P1L4', postal_code
48
+ end
49
+
50
+ def test_get_sanitzied_postal_code_does_not_alter_original
51
+ location = Location.new(postal_code: 'K2P 1l4')
52
+
53
+ assert_equal 'K2P 1l4', location.postal_code
54
+
55
+ @cp.send(:get_sanitized_postal_code, location)
56
+
57
+ assert_equal 'K2P 1l4', location.postal_code
58
+ end
59
+ end
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.13.3
4
+ version: 1.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-13 00:00:00.000000000 Z
11
+ date: 2017-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: quantified
@@ -411,6 +411,7 @@ files:
411
411
  - test/unit/carriers/canada_post_pws_rating_test.rb
412
412
  - test/unit/carriers/canada_post_pws_register_test.rb
413
413
  - test/unit/carriers/canada_post_pws_shipping_test.rb
414
+ - test/unit/carriers/canada_post_pws_test.rb
414
415
  - test/unit/carriers/canada_post_pws_tracking_test.rb
415
416
  - test/unit/carriers/canada_post_test.rb
416
417
  - test/unit/carriers/correios_test.rb
@@ -645,6 +646,7 @@ test_files:
645
646
  - test/unit/carriers/canada_post_pws_rating_test.rb
646
647
  - test/unit/carriers/canada_post_pws_register_test.rb
647
648
  - test/unit/carriers/canada_post_pws_shipping_test.rb
649
+ - test/unit/carriers/canada_post_pws_test.rb
648
650
  - test/unit/carriers/canada_post_pws_tracking_test.rb
649
651
  - test/unit/carriers/canada_post_test.rb
650
652
  - test/unit/carriers/correios_test.rb