easypost 2.0.7 → 2.0.8
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 +4 -4
- data/VERSION +1 -1
- data/spec/address_spec.rb +3 -3
- data/spec/batch_spec.rb +67 -58
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ca93c7b6808dc40c294f24f9fa37abf2e51c0634
|
|
4
|
+
data.tar.gz: f2cad79d7c574be0627202df58787a8f44a016b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ede873b849ab0ae4977a060ee6ec78e55b035d6330bfd2fcd764ee1edbe86e6cd8a56929587f484e3a082ba7aa2b9eb8b13de75ed46b0a8547b4377b47059c6a
|
|
7
|
+
data.tar.gz: 2dda0396555f845862a52660598a4e5a32ac6815d4cf73bf788f68cd8719377b45a1dedfd764d96a5f3e2c2c66071fb0ea0c35a21d287038639b66377ee906ca
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0.
|
|
1
|
+
2.0.8
|
data/spec/address_spec.rb
CHANGED
|
@@ -34,7 +34,7 @@ describe EasyPost::Address do
|
|
|
34
34
|
|
|
35
35
|
verified_address = address.verify()
|
|
36
36
|
expect(verified_address).to be_an_instance_of(EasyPost::Address)
|
|
37
|
-
expect(verified_address[:message].length).to be > 0
|
|
37
|
+
expect(verified_address[:message].length).to be > 0
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
it 'verifies an address without message' do
|
|
@@ -56,7 +56,7 @@ describe EasyPost::Address do
|
|
|
56
56
|
|
|
57
57
|
verified_address = address.verify()
|
|
58
58
|
expect(verified_address).to be_an_instance_of(EasyPost::Address)
|
|
59
|
-
expect(verified_address[:message]).to
|
|
59
|
+
expect(verified_address[:message]).to be_nil
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
it 'is not able to verify address' do
|
|
@@ -72,4 +72,4 @@ describe EasyPost::Address do
|
|
|
72
72
|
expect { verified_address = address.verify() }.to raise_error(EasyPost::Error, /Address Not Found./)
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
|
-
end
|
|
75
|
+
end
|
data/spec/batch_spec.rb
CHANGED
|
@@ -4,80 +4,89 @@ describe EasyPost::Batch do
|
|
|
4
4
|
|
|
5
5
|
describe '#create' do
|
|
6
6
|
it 'creates a batch object' do
|
|
7
|
-
from_address = EasyPost::Address.create(
|
|
8
|
-
:name => "Benchmark Merchandising",
|
|
9
|
-
:street1 => "329 W 18th Street",
|
|
10
|
-
:city => "Chicago",
|
|
11
|
-
:state => "IL",
|
|
12
|
-
:zip => "60616"
|
|
13
|
-
)
|
|
14
|
-
to_address = EasyPost::Address.create(
|
|
15
|
-
:street1 => "902 Broadway 4th Floor",
|
|
16
|
-
:city => "New York",
|
|
17
|
-
:state => "NY",
|
|
18
|
-
:zip => "10010"
|
|
19
|
-
)
|
|
20
|
-
parcel = EasyPost::Parcel.create(
|
|
21
|
-
:weight => 7.2,
|
|
22
|
-
:height => 2,
|
|
23
|
-
:width => 7.5,
|
|
24
|
-
:length => 10.5
|
|
7
|
+
from_address = EasyPost::Address.create(
|
|
8
|
+
:name => "Benchmark Merchandising",
|
|
9
|
+
:street1 => "329 W 18th Street",
|
|
10
|
+
:city => "Chicago",
|
|
11
|
+
:state => "IL",
|
|
12
|
+
:zip => "60616"
|
|
25
13
|
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
14
|
+
to_address = EasyPost::Address.create(
|
|
15
|
+
:street1 => "902 Broadway 4th Floor",
|
|
16
|
+
:city => "New York",
|
|
17
|
+
:state => "NY",
|
|
18
|
+
:zip => "10010"
|
|
19
|
+
)
|
|
20
|
+
parcel = EasyPost::Parcel.create(
|
|
21
|
+
:weight => 7.2,
|
|
22
|
+
:height => 2,
|
|
23
|
+
:width => 7.5,
|
|
24
|
+
:length => 10.5
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
batch = EasyPost::Batch.create({
|
|
28
|
+
:shipment => [{
|
|
29
|
+
:from_address => from_address,
|
|
30
|
+
:to_address => to_address,
|
|
31
|
+
:parcel => parcel
|
|
32
|
+
}, {
|
|
33
|
+
:from_address => from_address,
|
|
34
|
+
:to_address => to_address,
|
|
35
|
+
:parcel => parcel,
|
|
36
|
+
:reference => 'refnum9173'
|
|
37
|
+
}],
|
|
38
|
+
:reference => "abc-123"
|
|
39
|
+
})
|
|
42
40
|
expect(batch).to be_an_instance_of(EasyPost::Batch)
|
|
43
|
-
expect(batch.
|
|
44
|
-
expect(batch.
|
|
41
|
+
expect(batch.num_shipments).to eq(2)
|
|
42
|
+
expect(batch.reference).to eq("abc-123")
|
|
43
|
+
expect(batch.state).to eq("creating")
|
|
44
|
+
|
|
45
|
+
# sleeps_left = 10
|
|
46
|
+
# while (batch.state == "creating" && sleeps_left > 0) do
|
|
47
|
+
# sleep(3)
|
|
48
|
+
# batch.refresh
|
|
49
|
+
# sleeps_left -= 1
|
|
50
|
+
# end
|
|
51
|
+
|
|
52
|
+
# expect(batch.state).to equal("created")
|
|
53
|
+
# expect(batch.status[:created]).to equal(2)
|
|
45
54
|
end
|
|
46
55
|
end
|
|
47
56
|
|
|
48
57
|
describe '#create_and_buy' do
|
|
49
58
|
it 'creates a batch object and delayed jobs for purchasing the postage_labels' do
|
|
50
|
-
from_address = EasyPost::Address.create(
|
|
51
|
-
:name => "Benchmark Merchandising",
|
|
52
|
-
:street1 => "329 W 18th Street",
|
|
53
|
-
:city => "Chicago",
|
|
54
|
-
:state => "IL",
|
|
55
|
-
:zip => "60616"
|
|
56
|
-
)
|
|
59
|
+
from_address = EasyPost::Address.create(
|
|
60
|
+
:name => "Benchmark Merchandising",
|
|
61
|
+
:street1 => "329 W 18th Street",
|
|
62
|
+
:city => "Chicago",
|
|
63
|
+
:state => "IL",
|
|
64
|
+
:zip => "60616"
|
|
65
|
+
)
|
|
57
66
|
to_address = EasyPost::Address.create(
|
|
58
67
|
:name => "Don Juan",
|
|
59
|
-
:street1 => "902 Broadway 4th Floor",
|
|
60
|
-
:city => "New York",
|
|
61
|
-
:state => "NY",
|
|
62
|
-
:zip => "10010"
|
|
63
|
-
)
|
|
64
|
-
parcel = EasyPost::Parcel.create(
|
|
65
|
-
:weight => 7.2,
|
|
66
|
-
:height => 2,
|
|
67
|
-
:width => 7.5,
|
|
68
|
-
:length => 10.5
|
|
68
|
+
:street1 => "902 Broadway 4th Floor",
|
|
69
|
+
:city => "New York",
|
|
70
|
+
:state => "NY",
|
|
71
|
+
:zip => "10010"
|
|
69
72
|
)
|
|
70
|
-
|
|
73
|
+
parcel = EasyPost::Parcel.create(
|
|
74
|
+
:weight => 7.2,
|
|
75
|
+
:height => 2,
|
|
76
|
+
:width => 7.5,
|
|
77
|
+
:length => 10.5
|
|
78
|
+
)
|
|
79
|
+
|
|
71
80
|
batch = EasyPost::Batch.create_and_buy({:shipment =>
|
|
72
81
|
[
|
|
73
|
-
{
|
|
82
|
+
{
|
|
74
83
|
:from_address => from_address,
|
|
75
84
|
:to_address => to_address,
|
|
76
85
|
:parcel => parcel,
|
|
77
86
|
:carrier => 'USPS',
|
|
78
87
|
:service => 'Priority'
|
|
79
88
|
},
|
|
80
|
-
{
|
|
89
|
+
{
|
|
81
90
|
:from_address => from_address,
|
|
82
91
|
:to_address => to_address,
|
|
83
92
|
:parcel => parcel,
|
|
@@ -88,8 +97,8 @@ describe EasyPost::Batch do
|
|
|
88
97
|
]
|
|
89
98
|
})
|
|
90
99
|
expect(batch).to be_an_instance_of(EasyPost::Batch)
|
|
91
|
-
expect(batch.
|
|
92
|
-
expect(batch.
|
|
100
|
+
expect(batch.state).to eq("creating")
|
|
101
|
+
expect(batch.num_shipments).to eq(2)
|
|
93
102
|
end
|
|
94
103
|
end
|
|
95
104
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: easypost
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jon Calhoun
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-09-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rest-client
|