easypost 2.1.0 → 2.1.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 +5 -13
- data/.gitignore +2 -1
- data/CHANGELOG +24 -0
- data/README.md +3 -0
- data/VERSION +1 -1
- data/lib/easypost.rb +4 -1
- data/lib/easypost/address.rb +10 -3
- data/lib/easypost/carrier_account.rb +8 -0
- data/lib/easypost/object.rb +36 -7
- data/lib/easypost/resource.rb +11 -1
- data/lib/easypost/user.rb +42 -0
- data/lib/easypost/util.rb +9 -5
- data/spec/address_spec.rb +7 -7
- data/spec/batch_spec.rb +20 -33
- data/spec/carrier_account_spec.rb +116 -0
- data/spec/container_spec.rb +0 -11
- data/spec/order_spec.rb +2 -70
- data/spec/pickup_spec.rb +13 -14
- data/spec/shipment_spec.rb +38 -23
- data/spec/spec_helper.rb +6 -92
- data/spec/support/constant.rb +87 -0
- data/spec/tracker_spec.rb +20 -0
- data/spec/user_spec.rb +72 -0
- metadata +27 -31
- data/spec/fedex/domestic_spec.rb +0 -180
- data/spec/fedex/international_spec.rb +0 -64
- data/spec/ups/domestic_spec.rb +0 -79
- data/spec/ups/international_spec.rb +0 -64
- data/spec/usps/domestic_spec.rb +0 -66
- data/spec/usps/electronic_merchandise_returns.rb +0 -94
- data/spec/usps/merchant_returns.rb +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZTcxNzNjN2ZhMzYxODA3NmFhMGY5NzQ4NTg2ZTk5NmNjOTAwODI5ZA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1d1cc5a734e2706f3cbeba923df0240405b0e0df
|
4
|
+
data.tar.gz: fe44d1b81b62583f286e045e385cbdeab0818581
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
OTQ2NjE0YjQwMzcyZmY4ZTkyMzcwYjMxODBjM2I3Y2ZhMmQ0NzAzMThhOWNm
|
11
|
-
OTEzYjVkNzMzNmFmZTMyNmMyODBjNjJiYzRkZmM3N2Q0NDcxNjU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NjNlMmY0ZmI5MDdjNWI1ODM0MDBkZTBhMjQ0OTk3NDhkMjIxNTNlMTZhOWQ0
|
14
|
-
OGVlYjVlYjRkMjhkMThiMDZlMmRhZmM4NTIxMWJmMWI4NTc1ODRmMDNjMzk1
|
15
|
-
ODExMzE1MmE0OWMxOTY4ZWRmMTg3YThiOWE4NGE2NWY1Mzk5ZGU=
|
6
|
+
metadata.gz: 4afc2b2702cf588aed58d28413cd6b31ea74ce1ca08a8e1527f1ebc71f7299ca596af96bdc2020542c625fd1809d99d144becff5d26c80a1688d73374ea8c9fc
|
7
|
+
data.tar.gz: d5f90684e2740529028f2e32431c882f939db7ea788849d6e0054865078a2dfb4d9dcdeb74010ad99a1576ca068a64bf797bb0fa5d4387c029c8095634d39156
|
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
=== 2.1.1 2015-04-15
|
2
|
+
|
3
|
+
* CarrierAccount will now correctly save in-place modifications to credentials
|
4
|
+
* Nested variables should now be saved correctly across all models
|
5
|
+
* Fixed version numbering confusion (the previous version was 2.0.15, not 2.1.0)
|
6
|
+
|
7
|
+
|
8
|
+
=== 2.0.15 2015-04-15
|
9
|
+
|
10
|
+
* Added tracker to shipment buy response
|
11
|
+
* Updated tracker tests
|
12
|
+
|
13
|
+
|
14
|
+
=== 2.0.14 2015-04-15
|
15
|
+
|
16
|
+
* Added User and CarrierAccount models with CRUD functionality
|
17
|
+
|
18
|
+
|
19
|
+
=== 2.0.13 2014-10-30
|
20
|
+
|
21
|
+
* Added Pickup, PickupRate resources.
|
22
|
+
* Added ability to pass api_key to a few resources that were missing it.
|
23
|
+
|
24
|
+
|
1
25
|
=== 2.0.12 2014-07-07
|
2
26
|
|
3
27
|
* Added Item, Container, and Order resources.
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# EasyPost Ruby Client Library
|
2
2
|
|
3
|
+
[<img src="https://circleci.com/gh/EasyPost/easypost-ruby.png?circle-token=80adb5236ed1fdce20810b055af79c63c3d5796b">](https://circleci.com/gh/EasyPost/easypost-ruby)
|
4
|
+
|
5
|
+
|
3
6
|
EasyPost is a simple shipping API. You can sign up for an account at https://easypost.com
|
4
7
|
|
5
8
|
Installation
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.1
|
data/lib/easypost.rb
CHANGED
@@ -26,6 +26,8 @@ require 'easypost/container'
|
|
26
26
|
require 'easypost/order'
|
27
27
|
require 'easypost/pickup'
|
28
28
|
require 'easypost/pickup_rate'
|
29
|
+
require 'easypost/carrier_account'
|
30
|
+
require 'easypost/user'
|
29
31
|
|
30
32
|
require 'easypost/error'
|
31
33
|
|
@@ -68,7 +70,8 @@ module EasyPost
|
|
68
70
|
@@http_config ||= {
|
69
71
|
timeout: 60,
|
70
72
|
open_timeout: 30,
|
71
|
-
verify_ssl: false
|
73
|
+
verify_ssl: false,
|
74
|
+
ssl_version: "TLSv1",
|
72
75
|
}
|
73
76
|
end
|
74
77
|
|
data/lib/easypost/address.rb
CHANGED
@@ -14,12 +14,16 @@ module EasyPost
|
|
14
14
|
verified_address = EasyPost::Util::convert_to_easypost_object(response[:address], api_key)
|
15
15
|
return verified_address
|
16
16
|
else
|
17
|
-
|
17
|
+
raise_verification_failure
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
def verify(params={}, carrier=nil)
|
22
|
-
|
22
|
+
begin
|
23
|
+
response, api_key = EasyPost.request(:get, url + '/verify?carrier=' + String(carrier), @api_key, params)
|
24
|
+
rescue
|
25
|
+
raise_verification_failure
|
26
|
+
end
|
23
27
|
|
24
28
|
if response.has_key?(:address)
|
25
29
|
if response.has_key?(:message)
|
@@ -28,11 +32,14 @@ module EasyPost
|
|
28
32
|
verified_address = EasyPost::Util::convert_to_easypost_object(response[:address], api_key)
|
29
33
|
return verified_address
|
30
34
|
else
|
31
|
-
|
35
|
+
raise_verification_failure
|
32
36
|
end
|
33
37
|
|
34
38
|
return self
|
35
39
|
end
|
36
40
|
|
41
|
+
def raise_verification_failure
|
42
|
+
raise Error.new("Unable to verify address.")
|
43
|
+
end
|
37
44
|
end
|
38
45
|
end
|
data/lib/easypost/object.rb
CHANGED
@@ -2,19 +2,21 @@ module EasyPost
|
|
2
2
|
class EasyPostObject
|
3
3
|
include Enumerable
|
4
4
|
|
5
|
-
attr_accessor :api_key
|
5
|
+
attr_accessor :parent, :name, :api_key, :unsaved_values
|
6
6
|
@@immutable_values = Set.new([:api_key, :id])
|
7
7
|
|
8
|
-
def initialize(id=nil, api_key=nil)
|
8
|
+
def initialize(id=nil, api_key=nil, parent=nil, name=nil)
|
9
9
|
@api_key = api_key
|
10
10
|
@values = {}
|
11
11
|
@unsaved_values = Set.new
|
12
12
|
@transient_values = Set.new
|
13
|
+
@parent = parent
|
14
|
+
@name = name
|
13
15
|
self.id = id if id
|
14
16
|
end
|
15
17
|
|
16
|
-
def self.construct_from(values, api_key=nil)
|
17
|
-
obj = self.new(values[:id], api_key)
|
18
|
+
def self.construct_from(values, api_key=nil, parent=nil, name=nil)
|
19
|
+
obj = self.new(values[:id], api_key, parent, name)
|
18
20
|
obj.refresh_from(values, api_key)
|
19
21
|
obj
|
20
22
|
end
|
@@ -32,13 +34,13 @@ module EasyPost
|
|
32
34
|
@api_key = api_key
|
33
35
|
|
34
36
|
added = Set.new(values.keys - @values.keys)
|
35
|
-
|
37
|
+
|
36
38
|
instance_eval do
|
37
39
|
add_accessors(added)
|
38
40
|
end
|
39
|
-
|
41
|
+
|
40
42
|
values.each do |k, v|
|
41
|
-
@values[k] = Util.convert_to_easypost_object(v, api_key)
|
43
|
+
@values[k] = Util.convert_to_easypost_object(v, api_key, self, k)
|
42
44
|
@transient_values.delete(k)
|
43
45
|
@unsaved_values.delete(k)
|
44
46
|
end
|
@@ -87,6 +89,21 @@ module EasyPost
|
|
87
89
|
|
88
90
|
protected
|
89
91
|
|
92
|
+
def flatten_unsaved
|
93
|
+
values = {}
|
94
|
+
for key in @unsaved_values
|
95
|
+
value = @values[key]
|
96
|
+
|
97
|
+
values[key] = value
|
98
|
+
|
99
|
+
if value.is_a?(EasyPost::EasyPostObject)
|
100
|
+
values[key] = flatten_unsaved(value)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
return values
|
105
|
+
end
|
106
|
+
|
90
107
|
def metaclass
|
91
108
|
class << self; self; end
|
92
109
|
end
|
@@ -111,6 +128,18 @@ module EasyPost
|
|
111
128
|
define_method(k_eq) do |v|
|
112
129
|
@values[k] = v
|
113
130
|
@unsaved_values.add(k)
|
131
|
+
|
132
|
+
cur = self
|
133
|
+
cur_parent = self.parent
|
134
|
+
param = {}
|
135
|
+
while cur_parent
|
136
|
+
if cur.name
|
137
|
+
cur_parent.unsaved_values.add(cur.name)
|
138
|
+
end
|
139
|
+
|
140
|
+
cur = cur_parent
|
141
|
+
cur_parent = cur.parent
|
142
|
+
end
|
114
143
|
end
|
115
144
|
end
|
116
145
|
end
|
data/lib/easypost/resource.rb
CHANGED
@@ -58,7 +58,17 @@ module EasyPost
|
|
58
58
|
if @unsaved_values.length > 0
|
59
59
|
values = {}
|
60
60
|
@unsaved_values.each { |k| values[k] = @values[k] }
|
61
|
-
|
61
|
+
|
62
|
+
for key in @unsaved_values
|
63
|
+
value = values[key]
|
64
|
+
if value.is_a?(EasyPost::EasyPostObject)
|
65
|
+
values[key] = value.flatten_unsaved
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
wrapped_params = {self.class.class_name => values}
|
70
|
+
|
71
|
+
response, api_key = EasyPost.request(:put, url, @api_key, wrapped_params)
|
62
72
|
refresh_from(response, api_key)
|
63
73
|
end
|
64
74
|
return self
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module EasyPost
|
2
|
+
class User < Resource
|
3
|
+
def save
|
4
|
+
if @unsaved_values.length > 0
|
5
|
+
values = {}
|
6
|
+
@unsaved_values.each { |k| values[k] = @values[k] }
|
7
|
+
|
8
|
+
wrapped_params = {user: values}
|
9
|
+
|
10
|
+
response, api_key = EasyPost.request(:put, url, @api_key, wrapped_params)
|
11
|
+
refresh_from(response, api_key)
|
12
|
+
end
|
13
|
+
return self
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.retrieve_me
|
17
|
+
self.all
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.all_api_keys
|
21
|
+
response, api_key = EasyPost.request(:get, "/api_keys", @api_key)
|
22
|
+
return Util.convert_to_easypost_object(response, api_key)
|
23
|
+
end
|
24
|
+
|
25
|
+
def api_keys
|
26
|
+
api_keys = EasyPost::User.all_api_keys
|
27
|
+
|
28
|
+
if api_keys.id == self.id
|
29
|
+
my_api_keys = api_keys.keys
|
30
|
+
else
|
31
|
+
for child in api_keys.children
|
32
|
+
if child.id == self.id
|
33
|
+
my_api_keys = child.keys
|
34
|
+
break
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
my_api_keys
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/easypost/util.rb
CHANGED
@@ -15,7 +15,7 @@ module EasyPost
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.convert_to_easypost_object(response, api_key)
|
18
|
+
def self.convert_to_easypost_object(response, api_key, parent=nil, name=nil)
|
19
19
|
types = { 'Address' => Address,
|
20
20
|
'ScanForm' => ScanForm,
|
21
21
|
'CustomsItem' => CustomsItem,
|
@@ -32,7 +32,9 @@ module EasyPost
|
|
32
32
|
'Order' => Order,
|
33
33
|
'Pickup' => Pickup,
|
34
34
|
'PickupRate' => PickupRate,
|
35
|
-
'PostageLabel' => PostageLabel
|
35
|
+
'PostageLabel' => PostageLabel,
|
36
|
+
'CarrierAccount' => CarrierAccount,
|
37
|
+
'User' => User }
|
36
38
|
|
37
39
|
prefixes = { 'adr' => Address,
|
38
40
|
'sf' => ScanForm,
|
@@ -50,11 +52,13 @@ module EasyPost
|
|
50
52
|
'order' => Order,
|
51
53
|
'pickup' => Pickup,
|
52
54
|
'pickuprate' => PickupRate,
|
53
|
-
'pl' => PostageLabel
|
55
|
+
'pl' => PostageLabel,
|
56
|
+
'ca' => CarrierAccount,
|
57
|
+
'user' => User }
|
54
58
|
|
55
59
|
case response
|
56
60
|
when Array
|
57
|
-
return response.map { |i| convert_to_easypost_object(i, api_key) }
|
61
|
+
return response.map { |i| convert_to_easypost_object(i, api_key, parent) }
|
58
62
|
when Hash
|
59
63
|
if cls_name = response[:object]
|
60
64
|
cls = types[cls_name]
|
@@ -65,7 +69,7 @@ module EasyPost
|
|
65
69
|
end
|
66
70
|
|
67
71
|
cls ||= EasyPostObject
|
68
|
-
return cls.construct_from(response, api_key)
|
72
|
+
return cls.construct_from(response, api_key, parent, name)
|
69
73
|
else
|
70
74
|
return response
|
71
75
|
end
|
data/spec/address_spec.rb
CHANGED
@@ -55,15 +55,15 @@ describe EasyPost::Address do
|
|
55
55
|
|
56
56
|
it 'is not able to verify address' do
|
57
57
|
address = EasyPost::Address.create(
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
58
|
+
company: 'Simpler Postage Inc',
|
59
|
+
street1: '388 Junk Teerts',
|
60
|
+
street2: 'Apt 20',
|
61
|
+
city: 'San Francisco',
|
62
|
+
state: 'CA',
|
63
|
+
zip: '941abc07'
|
64
64
|
)
|
65
65
|
|
66
|
-
expect { verified_address = address.verify() }.to raise_error(EasyPost::Error, /Unable to verify
|
66
|
+
expect { verified_address = address.verify() }.to raise_error(EasyPost::Error, /Unable to verify addres/)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
data/spec/batch_spec.rb
CHANGED
@@ -1,61 +1,48 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe EasyPost::Batch do
|
4
|
-
|
5
4
|
describe '#create' do
|
6
5
|
it 'creates a batch object' do
|
7
6
|
batch = EasyPost::Batch.create({
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
7
|
+
shipment: [{
|
8
|
+
from_address: ADDRESS[:california],
|
9
|
+
to_address: EasyPost::Address.create(ADDRESS[:missouri]),
|
10
|
+
parcel: EasyPost::Parcel.create(PARCEL[:dimensions])
|
12
11
|
}, {
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
12
|
+
from_address: ADDRESS[:california],
|
13
|
+
to_address: EasyPost::Address.create(ADDRESS[:canada]),
|
14
|
+
parcel: EasyPost::Parcel.create(PARCEL[:dimensions]),
|
16
15
|
}],
|
17
|
-
:
|
16
|
+
reference: "batch123456789"
|
18
17
|
})
|
19
18
|
expect(batch).to be_an_instance_of(EasyPost::Batch)
|
20
19
|
expect(batch.num_shipments).to eq(2)
|
21
20
|
expect(batch.reference).to eq("batch123456789")
|
22
21
|
expect(batch.state).to eq("creating")
|
23
|
-
|
24
|
-
# sleeps_left = 10
|
25
|
-
# while (batch.state == "creating" && sleeps_left > 0) do
|
26
|
-
# sleep(3)
|
27
|
-
# batch.refresh
|
28
|
-
# sleeps_left -= 1
|
29
|
-
# end
|
30
|
-
|
31
|
-
# expect(batch.state).to equal("created")
|
32
|
-
# expect(batch.status[:created]).to equal(2)
|
33
|
-
|
34
22
|
end
|
35
23
|
end
|
36
24
|
|
37
25
|
describe '#create_and_buy' do
|
38
26
|
it 'creates a batch object and delayed jobs for purchasing the postage_labels' do
|
39
27
|
batch = EasyPost::Batch.create({
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
28
|
+
shipment: [{
|
29
|
+
from_address: ADDRESS[:california],
|
30
|
+
to_address: EasyPost::Address.create(ADDRESS[:missouri]),
|
31
|
+
parcel: EasyPost::Parcel.create(PARCEL[:dimensions]),
|
32
|
+
carrier: "usps",
|
33
|
+
service: "priority"
|
46
34
|
}, {
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
35
|
+
from_address: ADDRESS[:california],
|
36
|
+
to_address: EasyPost::Address.create(ADDRESS[:canada]),
|
37
|
+
parcel: EasyPost::Parcel.create(PARCEL[:dimensions]),
|
38
|
+
carrier: "usps",
|
39
|
+
service: "prioritymailinternational"
|
52
40
|
}],
|
53
|
-
:
|
41
|
+
reference: "batch123456789"
|
54
42
|
})
|
55
43
|
expect(batch).to be_an_instance_of(EasyPost::Batch)
|
56
44
|
expect(batch.state).to eq("creating")
|
57
45
|
expect(batch.num_shipments).to eq(2)
|
58
46
|
end
|
59
47
|
end
|
60
|
-
|
61
48
|
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EasyPost::CarrierAccount do
|
4
|
+
it 'performs retrieve on a carrier account' do
|
5
|
+
id = 'ca_r8hLl9jS'
|
6
|
+
ca = EasyPost::CarrierAccount.retrieve(id)
|
7
|
+
|
8
|
+
expect(ca.id).to eq(id)
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'perform CRUD functions' do
|
12
|
+
it 'performs all basic CRUD actions on a CarrierAccount' do
|
13
|
+
original_num_cas = EasyPost::CarrierAccount.all.count
|
14
|
+
|
15
|
+
description = "A test Ups Account"
|
16
|
+
reference = "RubyClientUpsTestAccount"
|
17
|
+
|
18
|
+
created_ca = EasyPost::CarrierAccount.create(
|
19
|
+
type: "UpsAccount",
|
20
|
+
description: description,
|
21
|
+
reference: reference,
|
22
|
+
credentials: {
|
23
|
+
account_number: "A1A1A1",
|
24
|
+
user_id: "UPSDOTCOM_USERNAME",
|
25
|
+
password: "UPSDOTCOM_PASSWORD",
|
26
|
+
access_license_number: "UPS_ACCESS_LICENSE_NUMBER"
|
27
|
+
}
|
28
|
+
)
|
29
|
+
|
30
|
+
id = created_ca["id"]
|
31
|
+
|
32
|
+
interm_num_cas = EasyPost::CarrierAccount.all.count
|
33
|
+
expect(interm_num_cas).to eq(original_num_cas + 1)
|
34
|
+
|
35
|
+
retrieved_ca = EasyPost::CarrierAccount.retrieve(id)
|
36
|
+
|
37
|
+
expect(retrieved_ca["id"]).to eq(created_ca["id"])
|
38
|
+
expect(retrieved_ca["description"]).to eq(description)
|
39
|
+
expect(retrieved_ca["reference"]).to eq(reference)
|
40
|
+
|
41
|
+
updated_description = "An updated description for a test Ups Account"
|
42
|
+
updated_account_number = "B2B2B2B2"
|
43
|
+
retrieved_ca.description = updated_description
|
44
|
+
retrieved_ca.credentials = {
|
45
|
+
account_number: updated_account_number,
|
46
|
+
user_id: "UPSDOTCOM_USERNAME",
|
47
|
+
password: "UPSDOTCOM_PASSWORD",
|
48
|
+
access_license_number: "UPS_ACCESS_LICENSE_NUMBER"
|
49
|
+
}
|
50
|
+
retrieved_ca.save
|
51
|
+
|
52
|
+
updated_ca = EasyPost::CarrierAccount.retrieve(id)
|
53
|
+
expect(updated_ca["id"]).to eq(created_ca["id"])
|
54
|
+
expect(updated_ca["description"]).to eq(updated_description)
|
55
|
+
expect(updated_ca["credentials"]["account_number"]).to eq(updated_account_number)
|
56
|
+
|
57
|
+
reupdated_account_number = "C3C3C3C3C3"
|
58
|
+
updated_user_id = "A_NEW_UPS_USERNAME"
|
59
|
+
updated_ca.credentials[:account_number] = reupdated_account_number
|
60
|
+
updated_ca.credentials[:user_id] = updated_user_id
|
61
|
+
updated_ca.save
|
62
|
+
|
63
|
+
reupdated_ca = EasyPost::CarrierAccount.retrieve(id)
|
64
|
+
expect(reupdated_ca["id"]).to eq(created_ca["id"])
|
65
|
+
expect(reupdated_ca["credentials"]["account_number"]).to eq(reupdated_account_number)
|
66
|
+
expect(reupdated_ca["credentials"]["user_id"]).to eq(updated_user_id)
|
67
|
+
|
68
|
+
final_ca = reupdated_ca.save
|
69
|
+
expect(final_ca["id"]).to eq(created_ca["id"])
|
70
|
+
expect(final_ca["credentials"]["account_number"]).to eq(reupdated_account_number)
|
71
|
+
expect(final_ca["credentials"]["user_id"]).to eq(updated_user_id)
|
72
|
+
|
73
|
+
final_ca.delete
|
74
|
+
|
75
|
+
final_num_cas = EasyPost::CarrierAccount.all.count
|
76
|
+
expect(final_num_cas).to eq(original_num_cas)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#types' do
|
81
|
+
let(:carrier_account_types) { [
|
82
|
+
"AsendiaAccount",
|
83
|
+
"AustraliaPostAccount",
|
84
|
+
"CanadaPostAccount",
|
85
|
+
"CanparAccount",
|
86
|
+
"ColisPriveAccount",
|
87
|
+
"DhlExpressAccount",
|
88
|
+
"DhlGlobalMailAccount",
|
89
|
+
"FastwayAccount",
|
90
|
+
"FedexAccount",
|
91
|
+
"FedexSmartpostAccount",
|
92
|
+
"GsoAccount",
|
93
|
+
"LasershipAccount",
|
94
|
+
"LsoAccount",
|
95
|
+
"NorcoAccount",
|
96
|
+
"NzpostAccount",
|
97
|
+
"OntracAccount",
|
98
|
+
"PurolatorAccount",
|
99
|
+
"RoyalMailAccount",
|
100
|
+
"SpeedeeAccount",
|
101
|
+
"TntExpressAccount",
|
102
|
+
"UpsAccount",
|
103
|
+
"UpsMailInnovationsAccount",
|
104
|
+
"UpsSurepostAccount"
|
105
|
+
] }
|
106
|
+
|
107
|
+
it 'returns the expected list of types' do
|
108
|
+
types = EasyPost::CarrierAccount.types
|
109
|
+
account_types = types.map(&:type)
|
110
|
+
|
111
|
+
for account_type in carrier_account_types
|
112
|
+
expect(account_types).to include(account_type)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|