active_shipping 1.0.0.pre3 → 1.0.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +6 -1
- data/Rakefile +11 -7
- data/active_shipping.gemspec +1 -1
- data/lib/active_shipping/carriers/usps.rb +7 -13
- data/lib/active_shipping/version.rb +1 -1
- data/test/credentials.yml +49 -35
- data/test/fixtures/xml/usps/tracking_response_failure.xml +2 -3
- data/test/remote/canada_post_pws_platform_test.rb +3 -1
- data/test/remote/canada_post_pws_test.rb +3 -1
- data/test/remote/canada_post_test.rb +3 -1
- data/test/remote/fedex_test.rb +3 -1
- data/test/remote/new_zealand_post_test.rb +3 -1
- data/test/remote/shipwire_test.rb +2 -0
- data/test/remote/stamps_test.rb +3 -2
- data/test/remote/ups_test.rb +3 -1
- data/test/remote/usps_test.rb +6 -3
- data/test/test_helper.rb +12 -4
- data/test/unit/carriers/canada_post_pws_rating_test.rb +4 -4
- data/test/unit/carriers/canada_post_pws_register_test.rb +1 -2
- data/test/unit/carriers/canada_post_pws_shipping_test.rb +1 -2
- data/test/unit/carriers/canada_post_pws_tracking_test.rb +2 -2
- data/test/unit/carriers/canada_post_test.rb +2 -3
- data/test/unit/carriers/usps_test.rb +16 -13
- data/test/unit/rate_estimate_test.rb +1 -3
- metadata +2 -2
- metadata.gz.sig +1 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce37970d12bcb0e0ad9b464cdf4f772a69dc77b6
|
4
|
+
data.tar.gz: fbc3624b76f5ae90378d39bb6dcdd348466bafc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1326d49a7cd30d4c77473c479aa5fe0da42d6fa861bd061476ce90a63ccdd0360d5dac556fb28896fccdb73529fa9331e43925eb13f660842aaa0ae710d113cd
|
7
|
+
data.tar.gz: 409147bef83cc2e1b2296a96c410cbc03df24fa84bddf20d4612ee40f29789cd0355ff9629522a720a228cfa9b004cf6fc46b26ba0ff434dbf44a5bb3bc5ddce
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.travis.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
language: ruby
|
2
|
-
script: bundle exec rake
|
2
|
+
script: bundle exec rake test
|
3
3
|
sudo: false
|
4
4
|
|
5
5
|
rvm:
|
@@ -12,3 +12,8 @@ gemfile:
|
|
12
12
|
- Gemfile.activesupport40
|
13
13
|
- Gemfile.activesupport41
|
14
14
|
- Gemfile.activesupport42
|
15
|
+
|
16
|
+
env:
|
17
|
+
global:
|
18
|
+
- ACTIVESHIPPING_NEW_ZEALAND_POST_KEY=4d9dc0f0-dda0-012e-066f-000c29b44ac0
|
19
|
+
- ACTIVESHIPPING_CANADA_POST_LOGIN=CPC_DEMO_XML
|
data/Rakefile
CHANGED
@@ -1,14 +1,22 @@
|
|
1
|
-
require 'bundler'
|
2
1
|
require 'bundler/gem_tasks'
|
3
2
|
require 'rake/testtask'
|
4
3
|
|
4
|
+
desc "Run the unit and functioknal remote tests"
|
5
|
+
Rake::TestTask.new(:test) do |t|
|
6
|
+
t.libs << "test"
|
7
|
+
t.pattern = 'test/**/*_test.rb'
|
8
|
+
t.verbose = true
|
9
|
+
end
|
10
|
+
|
5
11
|
namespace :test do
|
6
|
-
|
12
|
+
desc "Run unit tests"
|
13
|
+
Rake::TestTask.new(:unit) do |t|
|
7
14
|
t.libs << "test"
|
8
15
|
t.pattern = 'test/unit/**/*_test.rb'
|
9
16
|
t.verbose = true
|
10
17
|
end
|
11
18
|
|
19
|
+
desc "Run functional remote tests"
|
12
20
|
Rake::TestTask.new(:remote) do |t|
|
13
21
|
t.libs << "test"
|
14
22
|
t.pattern = 'test/remote/*_test.rb'
|
@@ -16,8 +24,4 @@ namespace :test do
|
|
16
24
|
end
|
17
25
|
end
|
18
26
|
|
19
|
-
|
20
|
-
task :default => 'test:units'
|
21
|
-
|
22
|
-
desc "Run the unit and remote tests"
|
23
|
-
task :test => %w(test:units test:remote)
|
27
|
+
task :default => 'test'
|
data/active_shipping.gemspec
CHANGED
@@ -540,7 +540,12 @@ module ActiveShipping
|
|
540
540
|
tracking_details = xml.root.xpath('TrackInfo/TrackDetail')
|
541
541
|
|
542
542
|
tracking_summary = xml.root.at('TrackInfo/TrackSummary')
|
543
|
-
tracking_details
|
543
|
+
if tracking_details.length > 0
|
544
|
+
tracking_details << tracking_summary
|
545
|
+
else
|
546
|
+
success = false
|
547
|
+
message = tracking_summary.text
|
548
|
+
end
|
544
549
|
|
545
550
|
tracking_number = xml.root.at('TrackInfo').attributes['ID'].value
|
546
551
|
|
@@ -589,23 +594,12 @@ module ActiveShipping
|
|
589
594
|
!document.at('Error').nil?
|
590
595
|
end
|
591
596
|
|
592
|
-
def no_record?(document)
|
593
|
-
summary_node = track_summary_node(document)
|
594
|
-
if summary_node
|
595
|
-
summary = summary_node.text
|
596
|
-
RESPONSE_ERROR_MESSAGES.detect { |re| summary =~ re }
|
597
|
-
summary =~ /There is no record of that mail item/ || summary =~ /This Information has not been included in this Test Server\./
|
598
|
-
else
|
599
|
-
false
|
600
|
-
end
|
601
|
-
end
|
602
|
-
|
603
597
|
def tracking_info_error?(document)
|
604
598
|
!document.root.at('TrackInfo/Error').nil?
|
605
599
|
end
|
606
600
|
|
607
601
|
def response_success?(document)
|
608
|
-
!(has_error?(document) ||
|
602
|
+
!(has_error?(document) || tracking_info_error?(document))
|
609
603
|
end
|
610
604
|
|
611
605
|
def response_message(document)
|
data/test/credentials.yml
CHANGED
@@ -1,47 +1,61 @@
|
|
1
|
+
# The following file is used to specify credentials for the remote tests.
|
2
|
+
# In the CI environment, the environment are populated with proper values.
|
3
|
+
# If the values are not set, the remote tests will be skipped.
|
4
|
+
#
|
5
|
+
# If you want to run remote tests locally, you can set these environment
|
6
|
+
# variables, or you can create a file `~/.active_shipping/credentials.yml`,
|
7
|
+
# and set the values in there. This way you won't accidentially commit them
|
8
|
+
# to git.
|
9
|
+
|
1
10
|
usps:
|
2
|
-
login:
|
11
|
+
login: <%= ENV['ACTIVESHIPPING_USPS_LOGIN'] %>
|
12
|
+
|
3
13
|
ups:
|
4
|
-
key:
|
5
|
-
login:
|
6
|
-
password:
|
14
|
+
key: <%= ENV['ACTIVESHIPPING_UPS_LOGIN'] %>
|
15
|
+
login: <%= ENV['ACTIVESHIPPING_UPS_KEY'] %>
|
16
|
+
password: <%= ENV['ACTIVESHIPPING_UPS_PASSWORD'] %>
|
7
17
|
|
8
18
|
fedex:
|
9
|
-
account:
|
10
|
-
login:
|
11
|
-
password:
|
12
|
-
|
13
|
-
key: FedExDeveloperKey
|
14
|
-
|
15
|
-
fedex_freight:
|
16
|
-
account: FedExFreightAccountNumber
|
17
|
-
shipping_address1: FedExShippingAddress1
|
18
|
-
shipping_address2: FedExShippingAddress2
|
19
|
-
shipping_city: FedExShippingCity
|
20
|
-
shipping_postal_code: FedExShippingPostalCode
|
21
|
-
shipping_state: FedExShippingState
|
22
|
-
shipping_country: FedExShippingCountry
|
23
|
-
billing_address1: FedExBillingAddress1
|
24
|
-
billing_address2: FedExBillingAddress2
|
25
|
-
billing_city: FedExBillingCity
|
26
|
-
billing_postal_code: FedExBillingPostalCode
|
27
|
-
billing_state: FedExBillingState
|
28
|
-
billing_country: FedExBillingCountry
|
29
|
-
payment_type: SENDER
|
30
|
-
freight_class: CLASS_050
|
31
|
-
packaging: PALLET
|
32
|
-
role: SHIPPER
|
19
|
+
account: <%= ENV['ACTIVESHIPPING_FEDEX_ACCOUNT'] %>
|
20
|
+
login: <%= ENV['ACTIVESHIPPING_FEDEX_LOGIN'] %>
|
21
|
+
password: <%= ENV['ACTIVESHIPPING_FEDEX_PASSWORD'] %>
|
22
|
+
key: <%= ENV['ACTIVESHIPPING_FEDEX_KEY'] %>
|
33
23
|
|
34
24
|
shipwire:
|
35
|
-
login:
|
36
|
-
password:
|
25
|
+
login: <%= ENV['ACTIVESHIPPING_SHIPWIRE_LOGIN'] %>
|
26
|
+
password: <%= ENV['ACTIVESHIPPING_SHIPWITE_PASSWORD'] %>
|
37
27
|
|
38
28
|
canada_post:
|
39
|
-
login:
|
29
|
+
login: <%= ENV['ACTIVESHIPPING_CANADA_POST_LOGIN'] %>
|
40
30
|
|
41
31
|
new_zealand_post:
|
42
|
-
key: '
|
32
|
+
key: <%= ENV['ACTIVESHIPPING_NEW_ZEALAND_POST_KEY'] %>
|
43
33
|
|
44
34
|
canada_post_pws:
|
45
|
-
platform_id:
|
46
|
-
api_key:
|
47
|
-
secret:
|
35
|
+
platform_id: <%= ENV['ACTIVESHIPPING_CANADA_POST_PWS_PLATFORM_ID'] %>
|
36
|
+
api_key: <%= ENV['ACTIVESHIPPING_CANADA_POST_PWS_API_KEY'] %>
|
37
|
+
secret: <%= ENV['ACTIVESHIPPING_CANADA_POST_PWS_SECRET'] %>
|
38
|
+
|
39
|
+
stamps:
|
40
|
+
integration_id: <%= ENV['ACTIVESHIPPING_STAMPS_INTEGRATION_ID'] %>
|
41
|
+
username: <%= ENV['ACTIVESHIPPING_STAMPS_USERNAME'] %>
|
42
|
+
password: <%= ENV['ACTIVESHIPPING_STAMPS_PASSWORD'] %>
|
43
|
+
|
44
|
+
# fedex_freight:
|
45
|
+
# account: FedExFreightAccountNumber
|
46
|
+
# shipping_address1: FedExShippingAddress1
|
47
|
+
# shipping_address2: FedExShippingAddress2
|
48
|
+
# shipping_city: FedExShippingCity
|
49
|
+
# shipping_postal_code: FedExShippingPostalCode
|
50
|
+
# shipping_state: FedExShippingState
|
51
|
+
# shipping_country: FedExShippingCountry
|
52
|
+
# billing_address1: FedExBillingAddress1
|
53
|
+
# billing_address2: FedExBillingAddress2
|
54
|
+
# billing_city: FedExBillingCity
|
55
|
+
# billing_postal_code: FedExBillingPostalCode
|
56
|
+
# billing_state: FedExBillingState
|
57
|
+
# billing_country: FedExBillingCountry
|
58
|
+
# payment_type: SENDER
|
59
|
+
# freight_class: CLASS_050
|
60
|
+
# packaging: PALLET
|
61
|
+
# role: SHIPPER
|
@@ -1,3 +1,2 @@
|
|
1
|
-
<?xml version="1.0"?>
|
2
|
-
<TrackResponse><TrackInfo ID="
|
3
|
-
</TrackResponse>
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<TrackResponse><TrackInfo ID="abc123xyz"><TrackSummary>The Postal Service could not locate the tracking information for your request. Please verify your tracking number and try again later.</TrackSummary></TrackInfo></TrackResponse>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'test_helper'
|
4
4
|
|
5
5
|
# All remote tests require Canada Post development environment credentials
|
6
|
-
class
|
6
|
+
class RemoteCanadaPostPWSPlatformTest < Minitest::Test
|
7
7
|
include ActiveShipping::Test::Credentials
|
8
8
|
include ActiveShipping::Test::Fixtures
|
9
9
|
|
@@ -95,6 +95,8 @@ class CanadaPostPWSPlatformTest < Minitest::Test
|
|
95
95
|
@customer_number = @login[:customer_number]
|
96
96
|
@customer_api_key = @login[:customer_api_key]
|
97
97
|
@customer_secret = @login[:customer_secret]
|
98
|
+
rescue NoCredentialsFound => e
|
99
|
+
skip(e.message)
|
98
100
|
end
|
99
101
|
|
100
102
|
def build_options
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class RemoteCanadaPostPWSTest < Minitest::Test
|
4
4
|
# All remote tests require Canada Post development environment credentials
|
5
5
|
include ActiveShipping::Test::Credentials
|
6
6
|
include ActiveShipping::Test::Fixtures
|
@@ -84,6 +84,8 @@ class CanadaPostPWSTest < Minitest::Test
|
|
84
84
|
:tracking_number => "11111118901234",
|
85
85
|
:label_url => "https://ct.soa-gw.canadapost.ca/ers/artifact/#{@login[:api_key]}/20238/0"
|
86
86
|
}
|
87
|
+
rescue NoCredentialsFound => e
|
88
|
+
skip(e.message)
|
87
89
|
end
|
88
90
|
|
89
91
|
def test_rates
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class RemoteCanadaPostTest < Minitest::Test
|
4
4
|
include ActiveShipping::Test::Credentials
|
5
5
|
|
6
6
|
def setup
|
@@ -10,6 +10,8 @@ class CanadaPostTest < Minitest::Test
|
|
10
10
|
@origin = {:address1 => "61A York St", :city => "Ottawa", :province => "Ontario", :country => "Canada", :postal_code => "K1N 5T2"}
|
11
11
|
@destination = {:city => "Beverly Hills", :state => "CA", :country => "United States", :postal_code => "90210"}
|
12
12
|
@line_items = [Package.new(500, [2, 3, 4], :description => "a box full of stuff", :value => 25)]
|
13
|
+
rescue NoCredentialsFound => e
|
14
|
+
skip(e.message)
|
13
15
|
end
|
14
16
|
|
15
17
|
def test_valid_credentials
|
data/test/remote/fedex_test.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class RemoteFedExTest < Minitest::Test
|
4
4
|
include ActiveShipping::Test::Credentials
|
5
5
|
include ActiveShipping::Test::Fixtures
|
6
6
|
|
7
7
|
def setup
|
8
8
|
@carrier = FedEx.new(credentials(:fedex).merge(:test => true))
|
9
|
+
rescue NoCredentialsFound => e
|
10
|
+
skip(e.message)
|
9
11
|
end
|
10
12
|
|
11
13
|
def test_valid_credentials
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class RemoteNewZealandPostTest < Minitest::Test
|
4
4
|
include ActiveShipping::Test::Credentials
|
5
5
|
include ActiveShipping::Test::Fixtures
|
6
6
|
|
@@ -9,6 +9,8 @@ class NewZealandPostTest < Minitest::Test
|
|
9
9
|
@wellington = location_fixtures[:wellington]
|
10
10
|
@auckland = location_fixtures[:auckland]
|
11
11
|
@ottawa = location_fixtures[:ottawa]
|
12
|
+
rescue NoCredentialsFound => e
|
13
|
+
skip(e.message)
|
12
14
|
end
|
13
15
|
|
14
16
|
def test_valid_credentials
|
@@ -9,6 +9,8 @@ class RemoteShipwireTest < Minitest::Test
|
|
9
9
|
@item1 = { :sku => 'AF0001', :quantity => 2 }
|
10
10
|
@item2 = { :sku => 'AF0002', :quantity => 1 }
|
11
11
|
@items = [@item1, @item2]
|
12
|
+
rescue NoCredentialsFound => e
|
13
|
+
skip(e.message)
|
12
14
|
end
|
13
15
|
|
14
16
|
def test_successful_domestic_rates_request_for_single_line_item
|
data/test/remote/stamps_test.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class RemoteStampsTest < Minitest::Test
|
4
4
|
include ActiveShipping::Test::Credentials
|
5
|
-
include ActiveShipping::Test::Fixtures
|
6
5
|
|
7
6
|
def setup
|
8
7
|
@carrier = Stamps.new(credentials(:stamps).merge(test: true))
|
8
|
+
rescue NoCredentialsFound => e
|
9
|
+
skip(e.message)
|
9
10
|
end
|
10
11
|
|
11
12
|
def test_valid_credentials
|
data/test/remote/ups_test.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class RemoteUPSTest < Minitest::Test
|
4
4
|
include ActiveShipping::Test::Credentials
|
5
5
|
include ActiveShipping::Test::Fixtures
|
6
6
|
|
7
7
|
def setup
|
8
8
|
@options = credentials(:ups).merge(:test => true)
|
9
9
|
@carrier = UPS.new(@options)
|
10
|
+
rescue NoCredentialsFound => e
|
11
|
+
skip(e.message)
|
10
12
|
end
|
11
13
|
|
12
14
|
def test_tracking
|
data/test/remote/usps_test.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class RemoteUSPSTest < Minitest::Test
|
4
4
|
include ActiveShipping::Test::Credentials
|
5
5
|
include ActiveShipping::Test::Fixtures
|
6
6
|
|
7
7
|
def setup
|
8
|
-
@
|
8
|
+
@usps_credentials = credentials(:usps)
|
9
|
+
@carrier = USPS.new(@usps_credentials)
|
10
|
+
rescue NoCredentialsFound => e
|
11
|
+
skip(e.message)
|
9
12
|
end
|
10
13
|
|
11
14
|
def test_tracking
|
@@ -199,7 +202,7 @@ class USPSTest < Minitest::Test
|
|
199
202
|
end
|
200
203
|
|
201
204
|
def test_valid_credentials
|
202
|
-
assert USPS.new(
|
205
|
+
assert USPS.new(@usps_credentials.merge(:test => true)).valid_credentials?
|
203
206
|
end
|
204
207
|
|
205
208
|
def test_must_provide_login_creds_when_instantiating
|
data/test/test_helper.rb
CHANGED
@@ -5,9 +5,8 @@ require 'mocha/mini_test'
|
|
5
5
|
require 'timecop'
|
6
6
|
|
7
7
|
require 'active_shipping'
|
8
|
-
require 'nokogiri'
|
9
8
|
require 'logger'
|
10
|
-
|
9
|
+
require 'erb'
|
11
10
|
|
12
11
|
# This makes sure that Minitest::Test exists when an older version of Minitest
|
13
12
|
# (i.e. 4.x) is required by ActiveSupport.
|
@@ -22,11 +21,20 @@ end
|
|
22
21
|
|
23
22
|
module ActiveShipping::Test
|
24
23
|
module Credentials
|
24
|
+
class NoCredentialsFound < StandardError
|
25
|
+
def initialize(key)
|
26
|
+
super("No credentials were found for '#{key}'")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
25
30
|
LOCAL_CREDENTIALS = ENV['HOME'] + '/.active_shipping/credentials.yml'
|
26
31
|
DEFAULT_CREDENTIALS = File.dirname(__FILE__) + '/credentials.yml'
|
27
32
|
|
28
33
|
def credentials(key)
|
29
|
-
data = all_credentials[key]
|
34
|
+
data = all_credentials[key]
|
35
|
+
if data.nil? || data.all? { |k,v| v.nil? || v.empty? }
|
36
|
+
raise NoCredentialsFound.new(key)
|
37
|
+
end
|
30
38
|
data.symbolize_keys
|
31
39
|
end
|
32
40
|
|
@@ -36,7 +44,7 @@ module ActiveShipping::Test
|
|
36
44
|
@@all_credentials ||= begin
|
37
45
|
[DEFAULT_CREDENTIALS, LOCAL_CREDENTIALS].inject({}) do |credentials, file_name|
|
38
46
|
if File.exist?(file_name)
|
39
|
-
yaml_data = YAML.load(File.read(file_name)).symbolize_keys
|
47
|
+
yaml_data = YAML.load(ERB.new(File.read(file_name)).result(binding)).symbolize_keys
|
40
48
|
credentials.merge!(yaml_data)
|
41
49
|
end
|
42
50
|
credentials
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class CanadaPostPwsRatingTest < Minitest::Test
|
4
|
-
include ActiveShipping::Test::Credentials
|
5
4
|
include ActiveShipping::Test::Fixtures
|
6
5
|
|
7
6
|
def setup
|
@@ -38,10 +37,11 @@ class CanadaPostPwsRatingTest < Minitest::Test
|
|
38
37
|
|
39
38
|
@customer_number = '654321'
|
40
39
|
|
41
|
-
|
40
|
+
credentials = { platform_id: 123, api_key: '456', secret: '789' }
|
41
|
+
@cp = CanadaPostPWS.new(credentials)
|
42
42
|
@cp.logger = Logger.new(StringIO.new)
|
43
|
-
@french_cp = CanadaPostPWS.new(credentials
|
44
|
-
@cp_customer_number = CanadaPostPWS.new(credentials
|
43
|
+
@french_cp = CanadaPostPWS.new(credentials.merge(language: 'fr'))
|
44
|
+
@cp_customer_number = CanadaPostPWS.new(credentials.merge(customer_number: @customer_number))
|
45
45
|
|
46
46
|
@default_options = {:customer_number => '123456'}
|
47
47
|
end
|
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class CanadaPostPwsRegisterTest < Minitest::Test
|
4
|
-
include ActiveShipping::Test::Credentials
|
5
4
|
include ActiveShipping::Test::Fixtures
|
6
5
|
|
7
6
|
def setup
|
8
|
-
@cp = CanadaPostPWS.new(
|
7
|
+
@cp = CanadaPostPWS.new(platform_id: 123, api_key: '456', secret: '789')
|
9
8
|
end
|
10
9
|
|
11
10
|
def test_register_merchant
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
class CanadaPostPwsShippingTest < Minitest::Test
|
3
|
-
include ActiveShipping::Test::Credentials
|
4
3
|
include ActiveShipping::Test::Fixtures
|
5
4
|
|
6
5
|
def setup
|
@@ -71,7 +70,7 @@ class CanadaPostPwsShippingTest < Minitest::Test
|
|
71
70
|
:label_url => "https://ct.soa-gw.canadapost.ca/ers/artifact/c70da5ed5a0d2c32/20238/0"
|
72
71
|
}
|
73
72
|
|
74
|
-
@cp = CanadaPostPWS.new(
|
73
|
+
@cp = CanadaPostPWS.new(platform_id: 123, api_key: '456', secret: '789')
|
75
74
|
end
|
76
75
|
|
77
76
|
def test_build_shipment_customs_node
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
|
+
|
2
3
|
class CanadaPostPwsTrackingTest < Minitest::Test
|
3
|
-
include ActiveShipping::Test::Credentials
|
4
4
|
include ActiveShipping::Test::Fixtures
|
5
5
|
|
6
6
|
def setup
|
@@ -29,7 +29,7 @@ class CanadaPostPwsTrackingTest < Minitest::Test
|
|
29
29
|
:zip => '90210'
|
30
30
|
)
|
31
31
|
|
32
|
-
@cp = CanadaPostPWS.new(
|
32
|
+
@cp = CanadaPostPWS.new(platform_id: 123, api_key: '456', secret: '789')
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_find_tracking_info_with_valid_pin
|
@@ -1,14 +1,13 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class CanadaPostTest < Minitest::Test
|
4
|
-
include ActiveShipping::Test::Credentials
|
5
4
|
include ActiveShipping::Test::Fixtures
|
6
5
|
|
7
6
|
def setup
|
8
|
-
login =
|
7
|
+
login = { login: 'CPC_DEMO_XML' }
|
9
8
|
|
10
9
|
@carrier = CanadaPost.new(login)
|
11
|
-
@french_carrier = CanadaPost.new(login.merge(:
|
10
|
+
@french_carrier = CanadaPost.new(login.merge(french: true))
|
12
11
|
|
13
12
|
@request = xml_fixture('canadapost/example_request')
|
14
13
|
@response = xml_fixture('canadapost/example_response')
|
@@ -2,7 +2,6 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class USPSTest < Minitest::Test
|
4
4
|
include ActiveShipping::Test::Fixtures
|
5
|
-
include ActiveShipping::Test::Credentials
|
6
5
|
|
7
6
|
def setup
|
8
7
|
@carrier = USPS.new(:login => 'login')
|
@@ -365,12 +364,13 @@ class USPSTest < Minitest::Test
|
|
365
364
|
end
|
366
365
|
|
367
366
|
def test_domestic_commercial_base_rates
|
368
|
-
|
367
|
+
commercial_base_credentials = { key: "123", login: "user", password: "pass", commercial_base: true }
|
368
|
+
carrier = USPS.new(commercial_base_credentials)
|
369
369
|
|
370
370
|
mock_response = xml_fixture('usps/beverly_hills_to_new_york_book_commercial_base_rate_response')
|
371
|
-
|
371
|
+
carrier.expects(:commit).returns(mock_response)
|
372
372
|
|
373
|
-
response =
|
373
|
+
response = carrier.find_rates(
|
374
374
|
location_fixtures[:beverly_hills],
|
375
375
|
location_fixtures[:new_york],
|
376
376
|
package_fixtures.values_at(:book),
|
@@ -385,12 +385,13 @@ class USPSTest < Minitest::Test
|
|
385
385
|
end
|
386
386
|
|
387
387
|
def test_intl_commercial_base_rates
|
388
|
-
|
388
|
+
commercial_base_credentials = { key: "123", login: "user", password: "pass", commercial_base: true }
|
389
|
+
carrier = USPS.new(commercial_base_credentials)
|
389
390
|
|
390
391
|
mock_response = xml_fixture('usps/beverly_hills_to_ottawa_american_wii_commercial_base_rate_response')
|
391
|
-
|
392
|
+
carrier.expects(:commit).returns(mock_response)
|
392
393
|
|
393
|
-
response =
|
394
|
+
response = carrier.find_rates(
|
394
395
|
location_fixtures[:beverly_hills],
|
395
396
|
location_fixtures[:ottawa],
|
396
397
|
package_fixtures.values_at(:american_wii),
|
@@ -401,12 +402,13 @@ class USPSTest < Minitest::Test
|
|
401
402
|
end
|
402
403
|
|
403
404
|
def test_domestic_commercial_plus_rates
|
404
|
-
|
405
|
+
commercial_plus_credentials = { key: "123", login: "user", password: "pass", commercial_plus: true }
|
406
|
+
carrier = USPS.new(commercial_plus_credentials)
|
405
407
|
|
406
408
|
mock_response = xml_fixture('usps/beverly_hills_to_new_york_book_commercial_plus_rate_response')
|
407
|
-
|
409
|
+
carrier.expects(:commit).returns(mock_response)
|
408
410
|
|
409
|
-
response =
|
411
|
+
response = carrier.find_rates(
|
410
412
|
location_fixtures[:beverly_hills],
|
411
413
|
location_fixtures[:new_york],
|
412
414
|
package_fixtures.values_at(:book),
|
@@ -421,12 +423,13 @@ class USPSTest < Minitest::Test
|
|
421
423
|
end
|
422
424
|
|
423
425
|
def test_intl_commercial_plus_rates
|
424
|
-
|
426
|
+
commercial_plus_credentials = { key: "123", login: "user", password: "pass", commercial_plus: true }
|
427
|
+
carrier = USPS.new(commercial_plus_credentials)
|
425
428
|
|
426
429
|
mock_response = xml_fixture('usps/beverly_hills_to_ottawa_american_wii_commercial_plus_rate_response')
|
427
|
-
|
430
|
+
carrier.expects(:commit).returns(mock_response)
|
428
431
|
|
429
|
-
response =
|
432
|
+
response = carrier.find_rates(
|
430
433
|
location_fixtures[:beverly_hills],
|
431
434
|
location_fixtures[:ottawa],
|
432
435
|
package_fixtures.values_at(:american_wii),
|
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class RateEstimateTest < Minitest::Test
|
4
|
-
include ActiveShipping::Test::Credentials
|
5
|
-
|
6
4
|
def setup
|
7
5
|
@origin = {:address1 => "61A York St", :city => "Ottawa", :province => "ON", :country => "Canada", :postal_code => "K1N 5T2"}
|
8
6
|
@destination = {:city => "Beverly Hills", :state => "CA", :country => "United States", :postal_code => "90210"}
|
9
7
|
@line_items = [Package.new(500, [2, 3, 4], :description => "a box full of stuff", :value => 2500)]
|
10
|
-
@carrier = CanadaPost.new(
|
8
|
+
@carrier = CanadaPost.new(login: 'test')
|
11
9
|
@options = {:currency => 'USD'}
|
12
10
|
|
13
11
|
@rate_estimate = RateEstimate.new(@origin, @destination, @carrier, @service_name, @options)
|
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.0.0.
|
4
|
+
version: 1.0.0.pre4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James MacAulay
|
@@ -33,7 +33,7 @@ cert_chain:
|
|
33
33
|
fl3hbtVFTqbOlwL9vy1fudXcolIE/ZTcxQ+er07ZFZdKCXayR9PPs64heamfn0fp
|
34
34
|
TConQSX2BnZdhIEYW+cKzEC/bLc=
|
35
35
|
-----END CERTIFICATE-----
|
36
|
-
date: 2015-01-
|
36
|
+
date: 2015-01-29 00:00:00.000000000 Z
|
37
37
|
dependencies:
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: quantified
|
metadata.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
�xO�riڶ`{��pp0c��VV.�F�y[P�d��o�8�V1*����C@K�-#��C�4��"sƽ��7����M�&�O��9�� ]�t�nA�\U(G��D��u.��������Ej���mq.����0�Ma�b%3 4~�o���������J8Z�=�ذ����h����^��j����u��c���IU�E��U��.�U�`~�u�':GG�z�Y�+U��?h�%
|
1
|
+
X
|