easypost 1.1.3 → 2.0.0
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.
- data/.gitignore +27 -0
- data/CHANGELOG +0 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +30 -0
- data/LICENSE +21 -0
- data/README.md +99 -0
- data/Rakefile +0 -0
- data/VERSION +1 -0
- data/bin/easypost-irb +7 -0
- data/easypost.gemspec +24 -0
- data/lib/easypost.rb +105 -34
- data/lib/easypost/address.rb +14 -7
- data/lib/easypost/batch.rb +34 -0
- data/lib/easypost/customs_info.rb +4 -0
- data/lib/easypost/customs_item.rb +4 -0
- data/lib/easypost/{errors/easypost_error.rb → error.rb} +10 -1
- data/lib/easypost/object.rb +120 -0
- data/lib/easypost/parcel.rb +4 -0
- data/lib/easypost/postage_label.rb +4 -0
- data/lib/easypost/rate.rb +4 -0
- data/lib/easypost/refund.rb +4 -0
- data/lib/easypost/resource.rb +67 -0
- data/lib/easypost/scan_form.rb +4 -0
- data/lib/easypost/shipment.rb +82 -0
- data/lib/easypost/util.rb +102 -0
- data/lib/easypost/version.rb +3 -0
- data/spec/address_spec.rb +75 -0
- data/spec/batch_spec.rb +96 -0
- data/spec/refund_spec.rb +65 -0
- data/spec/scan_form_spec.rb +63 -0
- data/spec/shipment_spec.rb +141 -0
- data/spec/spec_helper.rb +84 -0
- metadata +66 -15
- data/lib/easypost/errors/authentication_error.rb +0 -4
- data/lib/easypost/postage.rb +0 -52
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'easypost'
|
2
|
+
EasyPost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
|
3
|
+
|
4
|
+
describe EasyPost::Address do
|
5
|
+
describe '#create' do
|
6
|
+
it 'creates an address object' do
|
7
|
+
address = EasyPost::Address.create(
|
8
|
+
:name => 'Sawyer Bateman',
|
9
|
+
:street1 => '1A Larkspur Cres.',
|
10
|
+
:city => 'St. Albert',
|
11
|
+
:state => 'AB',
|
12
|
+
:zip => 't8n2m4',
|
13
|
+
:country => 'CA'
|
14
|
+
)
|
15
|
+
expect(address).to be_an_instance_of(EasyPost::Address)
|
16
|
+
expect(address.name).to eq('Sawyer Bateman')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
describe '#verify' do
|
20
|
+
it 'verifies an address with message' do
|
21
|
+
address = EasyPost::Address.create(
|
22
|
+
:company => 'Simpler Postage Inc',
|
23
|
+
:street1 => '388 Townsend Street',
|
24
|
+
:city => 'San Francisco',
|
25
|
+
:state => 'CA',
|
26
|
+
:zip => '94107'
|
27
|
+
)
|
28
|
+
expect(address.company).to eq('Simpler Postage Inc')
|
29
|
+
expect(address.street1).to eq('388 Townsend Street')
|
30
|
+
expect(address.city).to eq('San Francisco')
|
31
|
+
expect(address.state).to eq('CA')
|
32
|
+
expect(address.zip).to eq('94107')
|
33
|
+
expect(address.country).to eq('US')
|
34
|
+
|
35
|
+
verified_address = address.verify()
|
36
|
+
expect(verified_address).to be_an_instance_of(EasyPost::Address)
|
37
|
+
expect(verified_address[:message].length).to be > 0
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'verifies an address without message' do
|
41
|
+
address = EasyPost::Address.create(
|
42
|
+
:company => 'Simpler Postage Inc',
|
43
|
+
:street1 => '388 Townsend Street',
|
44
|
+
:street2 => 'Apt 20',
|
45
|
+
:city => 'San Francisco',
|
46
|
+
:state => 'CA',
|
47
|
+
:zip => '94107'
|
48
|
+
)
|
49
|
+
expect(address.company).to eq('Simpler Postage Inc')
|
50
|
+
expect(address.street1).to eq('388 Townsend Street')
|
51
|
+
expect(address.street2).to eq('Apt 20')
|
52
|
+
expect(address.city).to eq('San Francisco')
|
53
|
+
expect(address.state).to eq('CA')
|
54
|
+
expect(address.zip).to eq('94107')
|
55
|
+
expect(address.country).to eq('US')
|
56
|
+
|
57
|
+
verified_address = address.verify()
|
58
|
+
expect(verified_address).to be_an_instance_of(EasyPost::Address)
|
59
|
+
expect(verified_address[:message]).to raise_error(NoMethodError)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'is not able to verify address' do
|
63
|
+
address = EasyPost::Address.create(
|
64
|
+
:company => 'Simpler Postage Inc',
|
65
|
+
:street1 => '388 Junk Teerts',
|
66
|
+
:street2 => 'Apt 20',
|
67
|
+
:city => 'San Francisco',
|
68
|
+
:state => 'CA',
|
69
|
+
:zip => '941abc07'
|
70
|
+
)
|
71
|
+
|
72
|
+
expect { verified_address = address.verify() }.to raise_error(EasyPost::Error, /Address Not Found./)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/spec/batch_spec.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EasyPost::Batch do
|
4
|
+
|
5
|
+
describe '#create' do
|
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
|
25
|
+
)
|
26
|
+
|
27
|
+
batch = EasyPost::Batch.create({:shipment =>
|
28
|
+
[
|
29
|
+
{
|
30
|
+
:from_address => from_address,
|
31
|
+
:to_address => to_address,
|
32
|
+
:parcel => parcel
|
33
|
+
},
|
34
|
+
{
|
35
|
+
:from_address => from_address,
|
36
|
+
:to_address => to_address,
|
37
|
+
:parcel => parcel,
|
38
|
+
:reference => 'refnum9173'
|
39
|
+
}
|
40
|
+
]
|
41
|
+
})
|
42
|
+
expect(batch).to be_an_instance_of(EasyPost::Batch)
|
43
|
+
expect(batch.status[:created]).to equal(2)
|
44
|
+
expect(batch.shipments.length).to equal(2)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#create_and_buy' do
|
49
|
+
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
|
+
)
|
57
|
+
to_address = EasyPost::Address.create(
|
58
|
+
: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
|
69
|
+
)
|
70
|
+
|
71
|
+
batch = EasyPost::Batch.create_and_buy({:shipment =>
|
72
|
+
[
|
73
|
+
{
|
74
|
+
:from_address => from_address,
|
75
|
+
:to_address => to_address,
|
76
|
+
:parcel => parcel,
|
77
|
+
:carrier => 'USPS',
|
78
|
+
:service => 'Priority'
|
79
|
+
},
|
80
|
+
{
|
81
|
+
:from_address => from_address,
|
82
|
+
:to_address => to_address,
|
83
|
+
:parcel => parcel,
|
84
|
+
:reference => 'refnum9173',
|
85
|
+
:carrier => 'UPS',
|
86
|
+
:service => '2ndDayAir'
|
87
|
+
}
|
88
|
+
]
|
89
|
+
})
|
90
|
+
expect(batch).to be_an_instance_of(EasyPost::Batch)
|
91
|
+
expect(batch.status[:created]).to equal(2)
|
92
|
+
expect(batch.shipments.length).to equal(2)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
data/spec/refund_spec.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EasyPost::Refund do
|
4
|
+
describe '#create' do
|
5
|
+
context 'tracking code string' do
|
6
|
+
before :all do
|
7
|
+
@tracking_codes = '12345, 39474, 26547, 18373'
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'creates Refunds' do
|
11
|
+
refunds = EasyPost::Refund.create(
|
12
|
+
:carrier => 'USPS',
|
13
|
+
:tracking_codes => @tracking_codes
|
14
|
+
)
|
15
|
+
expect(refunds).to be_an_instance_of(Array)
|
16
|
+
expect(refunds.size).to eq(4)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
context 'tracking code array' do
|
20
|
+
before :all do
|
21
|
+
@tracking_codes = ['12345', '39474, 26547', 18373, '22479']
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'creates Refunds' do
|
25
|
+
refunds = EasyPost::Refund.create(
|
26
|
+
:carrier => 'USPS',
|
27
|
+
:tracking_codes => @tracking_codes
|
28
|
+
)
|
29
|
+
expect(refunds).to be_an_instance_of(Array)
|
30
|
+
expect(refunds.size).to eq(5)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'fails to create without tracking codes' do
|
34
|
+
expect{EasyPost::Refund.create()}.to raise_error(EasyPost::Error)
|
35
|
+
|
36
|
+
begin
|
37
|
+
EasyPost::Refund.create()
|
38
|
+
rescue EasyPost::Error => e
|
39
|
+
expect(e.message).to eq('Invalid or missing param: tracking_codes')
|
40
|
+
expect(e.param).to eq('tracking_codes')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#retrieve' do
|
47
|
+
before :all do
|
48
|
+
@tracking_codes = '12345, 39474, 26547, 18373'
|
49
|
+
end
|
50
|
+
it 'retrieves refund' do
|
51
|
+
refunds = EasyPost::Refund.create(
|
52
|
+
:carrier => 'USPS',
|
53
|
+
:tracking_codes => @tracking_codes
|
54
|
+
)
|
55
|
+
refunds.each do |refund|
|
56
|
+
if refund.id
|
57
|
+
retrieved_refund = EasyPost::Refund.retrieve(refund.id)
|
58
|
+
expect(retrieved_refund).to be_an_instance_of(EasyPost::Refund)
|
59
|
+
break
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EasyPost::ScanForm do
|
4
|
+
describe '#create' do
|
5
|
+
context 'tracking code string' do
|
6
|
+
before :all do
|
7
|
+
@tracking_codes = '12345, 39474, 26547, 18373'
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'creates a ScanForm' do
|
11
|
+
scan_form = EasyPost::ScanForm.create(
|
12
|
+
:from_address => address_california,
|
13
|
+
:tracking_codes => @tracking_codes
|
14
|
+
)
|
15
|
+
expect(scan_form).to be_an_instance_of(EasyPost::ScanForm)
|
16
|
+
expect(scan_form.tracking_codes).to be_an_instance_of(Array)
|
17
|
+
expect(scan_form.tracking_codes.size).to eq(4)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
context 'tracking code array' do
|
21
|
+
before :all do
|
22
|
+
@tracking_codes = ['12345', '39474, 26547', 18373, '22479']
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'creates a ScanForm' do
|
26
|
+
scan_form = EasyPost::ScanForm.create(
|
27
|
+
:from_address => address_missouri,
|
28
|
+
:tracking_codes => @tracking_codes
|
29
|
+
)
|
30
|
+
expect(scan_form).to be_an_instance_of(EasyPost::ScanForm)
|
31
|
+
expect(scan_form.tracking_codes).to be_an_instance_of(Array)
|
32
|
+
expect(scan_form.tracking_codes.size).to eq(5)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'fails to create without tracking codes' do
|
36
|
+
expect{EasyPost::ScanForm.create()}.to raise_error(EasyPost::Error)
|
37
|
+
|
38
|
+
begin
|
39
|
+
EasyPost::ScanForm.create()
|
40
|
+
rescue EasyPost::Error => e
|
41
|
+
#puts e.inspect
|
42
|
+
expect(e.message).to eq('Invalid or missing param: tracking_codes')
|
43
|
+
expect(e.param).to eq('tracking_codes')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#retrieve' do
|
50
|
+
before :all do
|
51
|
+
@tracking_codes = '12345, 39474, 26547, 18373'
|
52
|
+
end
|
53
|
+
it 'retrieves scan_form' do
|
54
|
+
scan_form = EasyPost::ScanForm.create(
|
55
|
+
:from_address => address_california,
|
56
|
+
:tracking_codes => @tracking_codes
|
57
|
+
)
|
58
|
+
retrieved_scan_form = EasyPost::ScanForm.retrieve(scan_form.id)
|
59
|
+
|
60
|
+
expect(retrieved_scan_form).to be_an_instance_of(EasyPost::ScanForm)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EasyPost::Shipment do
|
4
|
+
|
5
|
+
describe '#create' do
|
6
|
+
it 'creates a shipment 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
|
25
|
+
)
|
26
|
+
|
27
|
+
shipment = EasyPost::Shipment.create(
|
28
|
+
:to_address => to_address,
|
29
|
+
:from_address => from_address,
|
30
|
+
:parcel => parcel
|
31
|
+
)
|
32
|
+
expect(shipment).to be_an_instance_of(EasyPost::Shipment)
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#buy' do
|
38
|
+
it 'purchases postage for an international shipment' do
|
39
|
+
to_address = address_canada
|
40
|
+
from_address = address_california
|
41
|
+
expect(to_address).to be_an_instance_of(EasyPost::Address)
|
42
|
+
expect(from_address).to be_an_instance_of(EasyPost::Address)
|
43
|
+
|
44
|
+
parcel = parcel_dimensions
|
45
|
+
expect(parcel).to be_an_instance_of(EasyPost::Parcel)
|
46
|
+
|
47
|
+
customs_info = customs_info_poor
|
48
|
+
expect(customs_info).to be_an_instance_of(EasyPost::CustomsInfo)
|
49
|
+
|
50
|
+
shipment = EasyPost::Shipment.create(
|
51
|
+
:to_address => to_address,
|
52
|
+
:from_address => from_address,
|
53
|
+
:parcel => parcel,
|
54
|
+
:customs_info => customs_info
|
55
|
+
)
|
56
|
+
expect(shipment).to be_an_instance_of(EasyPost::Shipment)
|
57
|
+
|
58
|
+
shipment.buy(
|
59
|
+
:rate => shipment.lowest_rate('usps')
|
60
|
+
)
|
61
|
+
expect(shipment.postage_label.label_url.length).to be > 0
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'purchases postage for a domestic shipment' do
|
65
|
+
to_address = address_california
|
66
|
+
from_address = address_missouri
|
67
|
+
expect(to_address).to be_an_instance_of(EasyPost::Address)
|
68
|
+
expect(from_address).to be_an_instance_of(EasyPost::Address)
|
69
|
+
|
70
|
+
parcel = parcel_dimensions
|
71
|
+
expect(parcel).to be_an_instance_of(EasyPost::Parcel)
|
72
|
+
|
73
|
+
shipment = EasyPost::Shipment.create(
|
74
|
+
:to_address => to_address,
|
75
|
+
:from_address => from_address,
|
76
|
+
:parcel => parcel
|
77
|
+
)
|
78
|
+
expect(shipment).to be_an_instance_of(EasyPost::Shipment)
|
79
|
+
|
80
|
+
shipment.buy(
|
81
|
+
:rate => shipment.lowest_rate
|
82
|
+
)
|
83
|
+
expect(shipment.postage_label.label_url.length).to be > 0
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe '#stamp' do
|
88
|
+
it 'returns a stamp for a domestic shipment' do
|
89
|
+
to_address = address_california
|
90
|
+
from_address = address_missouri
|
91
|
+
expect(to_address).to be_an_instance_of(EasyPost::Address)
|
92
|
+
expect(from_address).to be_an_instance_of(EasyPost::Address)
|
93
|
+
|
94
|
+
parcel = parcel_dimensions
|
95
|
+
expect(parcel).to be_an_instance_of(EasyPost::Parcel)
|
96
|
+
|
97
|
+
shipment = EasyPost::Shipment.create(
|
98
|
+
:to_address => to_address,
|
99
|
+
:from_address => from_address,
|
100
|
+
:parcel => parcel
|
101
|
+
)
|
102
|
+
expect(shipment).to be_an_instance_of(EasyPost::Shipment)
|
103
|
+
|
104
|
+
shipment.buy(
|
105
|
+
:rate => shipment.lowest_rate(['USPS', 'UPS'], 'priority, express')
|
106
|
+
)
|
107
|
+
|
108
|
+
stamp_url = shipment.stamp
|
109
|
+
|
110
|
+
expect(stamp_url.length).to be > 0
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe '#barcode' do
|
115
|
+
it 'returns a barcode for a domestic shipment' do
|
116
|
+
to_address = address_california
|
117
|
+
from_address = address_missouri
|
118
|
+
expect(to_address).to be_an_instance_of(EasyPost::Address)
|
119
|
+
expect(from_address).to be_an_instance_of(EasyPost::Address)
|
120
|
+
|
121
|
+
parcel = parcel_dimensions
|
122
|
+
expect(parcel).to be_an_instance_of(EasyPost::Parcel)
|
123
|
+
|
124
|
+
shipment = EasyPost::Shipment.create(
|
125
|
+
:to_address => to_address,
|
126
|
+
:from_address => from_address,
|
127
|
+
:parcel => parcel
|
128
|
+
)
|
129
|
+
expect(shipment).to be_an_instance_of(EasyPost::Shipment)
|
130
|
+
|
131
|
+
shipment.buy(
|
132
|
+
:rate => shipment.lowest_rate('usps', ['Priority'])
|
133
|
+
)
|
134
|
+
|
135
|
+
barcode_url = shipment.barcode
|
136
|
+
|
137
|
+
expect(barcode_url.length).to be > 0
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'easypost'
|
2
|
+
EasyPost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
|
3
|
+
# EasyPost.api_base = 'http://localhost:5000/v2'
|
4
|
+
|
5
|
+
def address_canada
|
6
|
+
address = EasyPost::Address.create(
|
7
|
+
:name => 'Sawyer Bateman',
|
8
|
+
:street1 => '1A Larkspur Cres.',
|
9
|
+
:city => 'St. Albert',
|
10
|
+
:state => 'AB',
|
11
|
+
:zip => 't8n2m4',
|
12
|
+
:country => 'CA',
|
13
|
+
:phone => '780-273-8374'
|
14
|
+
)
|
15
|
+
return address
|
16
|
+
end
|
17
|
+
|
18
|
+
def address_california
|
19
|
+
address = EasyPost::Address.create(
|
20
|
+
:company => 'Simpler Postage Inc',
|
21
|
+
:street1 => '388 Townsend Street',
|
22
|
+
:street2 => 'Apt 20',
|
23
|
+
:city => 'San Francisco',
|
24
|
+
:state => 'CA',
|
25
|
+
:zip => '94107',
|
26
|
+
:phone => '415-456-7890'
|
27
|
+
)
|
28
|
+
return address
|
29
|
+
end
|
30
|
+
|
31
|
+
def address_missouri
|
32
|
+
address = EasyPost::Address.create(
|
33
|
+
:company => 'Airport Shipping',
|
34
|
+
:street1 => '601 Brasilia Avenue',
|
35
|
+
:city => 'Kansas City',
|
36
|
+
:state => 'MO',
|
37
|
+
:zip => '64153',
|
38
|
+
:phone => '314-924-0383',
|
39
|
+
:email => 'kansas_shipping@example.com'
|
40
|
+
)
|
41
|
+
return address
|
42
|
+
end
|
43
|
+
|
44
|
+
def parcel_dimensions
|
45
|
+
parcel = EasyPost::Parcel.create(
|
46
|
+
:width => 15.2,
|
47
|
+
:length => 18,
|
48
|
+
:height => 9.5,
|
49
|
+
:weight => 35.1
|
50
|
+
)
|
51
|
+
return parcel
|
52
|
+
end
|
53
|
+
|
54
|
+
def parcel_package
|
55
|
+
parcel = EasyPost::Parcel.create(
|
56
|
+
:predefined_package => 'MediumFlatRateBox',
|
57
|
+
:weight => 17
|
58
|
+
)
|
59
|
+
return parcel
|
60
|
+
end
|
61
|
+
|
62
|
+
def customs_info_poor
|
63
|
+
customs_item = EasyPost::CustomsItem.create(
|
64
|
+
:description => 'EasyPost T-shirts',
|
65
|
+
:quantity => 2,
|
66
|
+
:value => 23.56,
|
67
|
+
:weight => 33,
|
68
|
+
:origin_country => 'us',
|
69
|
+
:hs_tariff_number => 123456
|
70
|
+
)
|
71
|
+
customs_info = EasyPost::CustomsInfo.create(
|
72
|
+
:integrated_form_type => 'form_2976',
|
73
|
+
:customs_certify => true,
|
74
|
+
:customs_signer => 'Dr. Pepper',
|
75
|
+
:contents_type => 'gift',
|
76
|
+
:contents_explanation => '', # only required when contents_type => 'other'
|
77
|
+
:eel_pfc => 'NOEEI 30.37(a)',
|
78
|
+
:non_delivery_option => 'abandon',
|
79
|
+
:restriction_type => 'none',
|
80
|
+
:restriction_comments => '',
|
81
|
+
:customs_items => [customs_item]
|
82
|
+
)
|
83
|
+
return customs_info
|
84
|
+
end
|