active_shipping 1.4.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/CHANGELOG.md +7 -0
- data/active_shipping.gemspec +1 -1
- data/lib/active_shipping/rate_estimate.rb +12 -1
- data/lib/active_shipping/version.rb +1 -1
- data/test/remote/canada_post_pws_test.rb +4 -4
- data/test/remote/correios_test.rb +1 -0
- data/test/remote/kunaki_test.rb +2 -2
- data/test/unit/rate_estimate_test.rb +16 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b3295b8f3b9c02e215222e1dd99d8d6d737ebcb
|
4
|
+
data.tar.gz: d289e63eb64837d01c04327acc5c42748330d2ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0aab27caaa74f2ee41370ccc02359480ae24ab5fbf0257c490e43940f0b993102d122e5907a2052baa1c4573661b823cf714599703b4a2231a534b68aa538ee
|
7
|
+
data.tar.gz: 2533186f1064b90fa12521c1f7cb66870ab681fe53edab0201b4e8982ef990e28df4663543475a8ca45893d7ec30fb10bd4cec321b877abf5153117821afb211
|
data/.travis.yml
CHANGED
@@ -17,6 +17,9 @@ env:
|
|
17
17
|
global:
|
18
18
|
- ACTIVESHIPPING_NEW_ZEALAND_POST_KEY=4d9dc0f0-dda0-012e-066f-000c29b44ac0
|
19
19
|
- ACTIVESHIPPING_CANADA_POST_LOGIN=CPC_DEMO_XML
|
20
|
+
- ACTIVESHIPPING_CANADA_POST_PWS_CUSTOMER_NUMBER=2004381
|
21
|
+
- ACTIVESHIPPING_CANADA_POST_PWS_API_KEY=6e93d53968881714
|
22
|
+
- ACTIVESHIPPING_CANADA_POST_PWS_SECRET=0bfa9fcb9853d1f51ee57a
|
20
23
|
- ACTIVESHIPPING_USPS_LOGIN=677JADED7283
|
21
24
|
- ACTIVESHIPPING_UPS_LOGIN=shopifolk
|
22
25
|
- ACTIVESHIPPING_UPS_KEY=7CE85DED4C9D07AB
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# ActiveShipping CHANGELOG
|
2
2
|
|
3
|
+
### v1.5.0
|
4
|
+
- Fix Kunaki remote test
|
5
|
+
- Fix credentials for Canada Post PWS remote tests
|
6
|
+
- Add compare price to rate estimate options
|
7
|
+
- Add phone required to rate estimate options
|
8
|
+
- Update active_utils dependency to v3.1.0
|
9
|
+
|
3
10
|
### v1.4.3
|
4
11
|
|
5
12
|
- Fix UPS SurePost for < 1 pound packages
|
data/active_shipping.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.add_dependency('quantified', '~> 1.0.1')
|
18
18
|
s.add_dependency('activesupport', '>= 3.2', '< 5.0.0')
|
19
|
-
s.add_dependency('active_utils', '~> 3.
|
19
|
+
s.add_dependency('active_utils', '~> 3.1.0')
|
20
20
|
s.add_dependency('nokogiri', '>= 1.6')
|
21
21
|
|
22
22
|
s.add_development_dependency('minitest')
|
@@ -51,6 +51,14 @@ module ActiveShipping
|
|
51
51
|
# The negotiated rate in cents
|
52
52
|
# @return [Integer]
|
53
53
|
#
|
54
|
+
# @!attribute compare_price
|
55
|
+
# The comparable price in cents
|
56
|
+
# @return [Integer]
|
57
|
+
#
|
58
|
+
# @!attribute phone_required
|
59
|
+
# Specifies if a phone number is required for the shipping rate.
|
60
|
+
# @return [Boolean]
|
61
|
+
#
|
54
62
|
# @!attribute insurance_price
|
55
63
|
# The price of insurance in cents.
|
56
64
|
# @return [Integer]
|
@@ -59,7 +67,8 @@ module ActiveShipping
|
|
59
67
|
:carrier, :service_name, :service_code,
|
60
68
|
:shipping_date, :delivery_date, :delivery_range,
|
61
69
|
:currency, :negotiated_rate, :insurance_price,
|
62
|
-
:estimate_reference, :expires_at, :pickup_time
|
70
|
+
:estimate_reference, :expires_at, :pickup_time,
|
71
|
+
:compare_price, :phone_required
|
63
72
|
|
64
73
|
def initialize(origin, destination, carrier, service_name, options = {})
|
65
74
|
@origin, @destination, @carrier, @service_name = origin, destination, carrier, service_name
|
@@ -74,6 +83,8 @@ module ActiveShipping
|
|
74
83
|
end
|
75
84
|
@total_price = Package.cents_from(options[:total_price])
|
76
85
|
@negotiated_rate = options[:negotiated_rate] ? Package.cents_from(options[:negotiated_rate]) : nil
|
86
|
+
@compare_price = options[:compare_price] ? Package.cents_from(options[:compare_price]) : nil
|
87
|
+
@phone_required = !!options[:phone_required]
|
77
88
|
@currency = ActiveUtils::CurrencyCode.standardize(options[:currency])
|
78
89
|
@delivery_range = options[:delivery_range] ? options[:delivery_range].map { |date| date_for(date) }.compact : []
|
79
90
|
@shipping_date = date_for(options[:shipping_date])
|
@@ -121,7 +121,7 @@ class RemoteCanadaPostPWSTest < Minitest::Test
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def test_create_shipment
|
124
|
-
skip "Failing with 'Contract Number is a required field' after API change, skipping because no clue how to fix, might need different creds"
|
124
|
+
#skip "Failing with 'Contract Number is a required field' after API change, skipping because no clue how to fix, might need different creds"
|
125
125
|
opts = {:customer_number => @customer_number, :service => "DOM.XP"}
|
126
126
|
response = @cp.create_shipment(@home_params, @dom_params, @pkg1, @line_item1, opts)
|
127
127
|
assert_kind_of CPPWSShippingResponse, response
|
@@ -132,7 +132,7 @@ class RemoteCanadaPostPWSTest < Minitest::Test
|
|
132
132
|
end
|
133
133
|
|
134
134
|
def test_create_shipment_with_options
|
135
|
-
skip "Failing with 'Contract Number is a required field' after API change, skipping because no clue how to fix, might need different creds"
|
135
|
+
#skip "Failing with 'Contract Number is a required field' after API change, skipping because no clue how to fix, might need different creds"
|
136
136
|
opts = {:customer_number => @customer_number, :service => "USA.EP"}.merge(@shipping_opts1)
|
137
137
|
response = @cp.create_shipment(@home_params, @dest_params, @pkg1, @line_item1, opts)
|
138
138
|
|
@@ -144,7 +144,7 @@ class RemoteCanadaPostPWSTest < Minitest::Test
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def test_retrieve_shipping_label
|
147
|
-
skip "Failing with 'Contract Number is a required field' after API change, skipping because no clue how to fix, might need different creds"
|
147
|
+
#skip "Failing with 'Contract Number is a required field' after API change, skipping because no clue how to fix, might need different creds"
|
148
148
|
opts = {:customer_number => @customer_number, :service => "DOM.XP"}
|
149
149
|
shipping_response = @cp.create_shipment(@home_params, @dom_params, @pkg1, @line_item1, opts)
|
150
150
|
|
@@ -160,7 +160,7 @@ class RemoteCanadaPostPWSTest < Minitest::Test
|
|
160
160
|
end
|
161
161
|
|
162
162
|
def test_create_shipment_with_invalid_customer_raises_exception
|
163
|
-
skip "Failing with 'Contract Number is a required field' after API change, skipping because no clue how to fix, might need different creds"
|
163
|
+
#skip "Failing with 'Contract Number is a required field' after API change, skipping because no clue how to fix, might need different creds"
|
164
164
|
opts = {:customer_number => "0000000000", :service => "DOM.XP"}
|
165
165
|
assert_raises(ResponseError) do
|
166
166
|
@cp.create_shipment(@home_params, @dom_params, @pkg1, @line_item1, opts)
|
@@ -41,6 +41,7 @@ class RemoteCorreiosTest < Minitest::Test
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def test_book_request_with_specific_services
|
44
|
+
skip("Service unavailable for the informed route")
|
44
45
|
response = @carrier.find_rates(@saopaulo, @riodejaneiro, [@book], :services => [41106, 40010, 40215])
|
45
46
|
|
46
47
|
assert response.is_a?(RateResponse)
|
data/test/remote/kunaki_test.rb
CHANGED
@@ -19,8 +19,8 @@ class RemoteKunakiTest < Minitest::Test
|
|
19
19
|
)
|
20
20
|
|
21
21
|
assert response.success?
|
22
|
-
assert_equal
|
23
|
-
assert_equal ["UPS 2nd Day Air", "UPS Ground", "UPS Next Day Air Saver"
|
22
|
+
assert_equal 3, response.rates.size
|
23
|
+
assert_equal ["UPS 2nd Day Air", "UPS Ground", "UPS Next Day Air Saver"], response.rates.collect(&:service_name).sort
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_send_no_items
|
@@ -15,6 +15,17 @@ class RateEstimateTest < Minitest::Test
|
|
15
15
|
assert_nil @rate_estimate.send(:date_for, nil)
|
16
16
|
end
|
17
17
|
|
18
|
+
def test_phone_required
|
19
|
+
est = RateEstimate.new(@origin, @destination, @carrier, @service_name, @options.merge(phone_required: true))
|
20
|
+
assert_equal true, est.phone_required
|
21
|
+
|
22
|
+
est = RateEstimate.new(@origin, @destination, @carrier, @service_name, @options.merge(phone_required: nil))
|
23
|
+
assert_equal false, est.phone_required
|
24
|
+
|
25
|
+
est = RateEstimate.new(@origin, @destination, @carrier, @service_name, @options.merge(phone_required: false))
|
26
|
+
assert_equal false, est.phone_required
|
27
|
+
end
|
28
|
+
|
18
29
|
def test_date_for_invalid_string_in_ruby_19
|
19
30
|
assert_nil @rate_estimate.send(:date_for, "Up to 2 weeks") if RUBY_VERSION.include?('1.9')
|
20
31
|
end
|
@@ -35,4 +46,9 @@ class RateEstimateTest < Minitest::Test
|
|
35
46
|
|
36
47
|
assert_equal "somefakeref", est.estimate_reference
|
37
48
|
end
|
49
|
+
|
50
|
+
def test_compare_price_is_set
|
51
|
+
est = RateEstimate.new(@origin, @destination, @carrier, @service_name, @options.merge(compare_price: 10.0))
|
52
|
+
assert_equal 1000, est.compare_price
|
53
|
+
end
|
38
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_shipping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James MacAulay
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: quantified
|
@@ -53,14 +53,14 @@ dependencies:
|
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 3.
|
56
|
+
version: 3.1.0
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 3.
|
63
|
+
version: 3.1.0
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: nokogiri
|
66
66
|
requirement: !ruby/object:Gem::Requirement
|