active_shipping 1.13.3 → 1.13.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +5 -0
- data/lib/active_shipping/carriers/canada_post_pws.rb +2 -1
- data/lib/active_shipping/version.rb +1 -1
- data/test/remote/usps_test.rb +4 -4
- data/test/unit/carriers/canada_post_pws_test.rb +59 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 053fd1f8bb1f8703c987c04bae54890113da7279
|
4
|
+
data.tar.gz: a13860a75c2feb3ea8ce4586473c3a560c3a800e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cebea6659ce0cf9a316149886521fe07fc6563c894bdc6dd6ccc5b407c950118272d3cbcba0d35f00d63b5a5c02c4d5238eaa78223865d77d2cf73ef3cf02bb4
|
7
|
+
data.tar.gz: 69d7a363705c521bda896ead248d6605209815d7ee9b410c39be15ea4f53f0da4c955f02f7e594ae3acac0a049cdf6cb14a22161d538bfa81f30bef773688a23
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -782,7 +782,8 @@ module ActiveShipping
|
|
782
782
|
end
|
783
783
|
|
784
784
|
def get_sanitized_postal_code(location)
|
785
|
-
location.
|
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)
|
data/test/remote/usps_test.rb
CHANGED
@@ -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('
|
15
|
+
response = @carrier.find_tracking_info('LZ117228611US', test: false)
|
16
16
|
assert response.success?, response.message
|
17
|
-
assert_equal
|
17
|
+
assert_equal 15,response.shipment_events.size
|
18
18
|
assert_equal 'DELIVERED', response.shipment_events.last.message
|
19
|
-
assert_equal Time.parse('
|
20
|
-
assert_equal Time.parse('
|
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.
|
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-
|
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
|