easypost 2.1.3 → 2.1.4
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/CHANGELOG +5 -0
- data/VERSION +1 -1
- data/easypost.gemspec +1 -1
- data/lib/easypost.rb +2 -0
- data/lib/easypost/print_job.rb +6 -0
- data/lib/easypost/printer.rb +28 -0
- data/lib/easypost/shipment.rb +7 -0
- data/lib/easypost/util.rb +4 -0
- data/spec/order_spec.rb +16 -12
- data/spec/support/constant.rb +10 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb1fd9b143d731f928003c3e8d5b7c9148c6a2e0
|
4
|
+
data.tar.gz: 87ab4ab775c449fd77c4bb1ef00c8a4319235016
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4f1f8bcb1ba006d7c503efded834fcb02f65fb3378ce401c54df501b4d73d9270669a37f86f6223811f69b1f6117e7bd97638981e9a69aec790d2a045595e4c
|
7
|
+
data.tar.gz: a5e2a9f7c11378ec681da69edb05e7a701d8a666fb15182abf10691c7ea3c9bcabc255e709718d0921b2d0f77dcc217dd91379f028c5b667b3e3f78044586b9b
|
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.4
|
data/easypost.gemspec
CHANGED
@@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency 'multi_json', '>= 1.0.4', '< 2'
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
-
spec.add_development_dependency 'rspec', '~> 2.13
|
25
|
+
spec.add_development_dependency 'rspec', '~> 2.13'
|
26
26
|
end
|
data/lib/easypost.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
module EasyPost
|
2
|
+
class Printer < Resource
|
3
|
+
|
4
|
+
def job
|
5
|
+
response, api_key = EasyPost.request(
|
6
|
+
:get, url + '/jobs', @api_key
|
7
|
+
)
|
8
|
+
return EasyPost::Util::convert_to_easypost_object(response, api_key)
|
9
|
+
end
|
10
|
+
|
11
|
+
def print(params={})
|
12
|
+
if params.instance_of?(EasyPost::PostageLabel)
|
13
|
+
temp = params.clone
|
14
|
+
params = {}
|
15
|
+
params[:postage_label] = temp
|
16
|
+
end
|
17
|
+
|
18
|
+
response, api_key = EasyPost.request(
|
19
|
+
:post, url + '/print_postage_label', @api_key, params
|
20
|
+
)
|
21
|
+
return true
|
22
|
+
rescue
|
23
|
+
return false
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
data/lib/easypost/shipment.rb
CHANGED
@@ -41,6 +41,13 @@ module EasyPost
|
|
41
41
|
return self
|
42
42
|
end
|
43
43
|
|
44
|
+
def print(params={})
|
45
|
+
if params.instance_of?(EasyPost::Printer)
|
46
|
+
return params.print(self.postage_label)
|
47
|
+
end
|
48
|
+
return false
|
49
|
+
end
|
50
|
+
|
44
51
|
def label(params={})
|
45
52
|
if params.is_a?(String)
|
46
53
|
temp = params.clone
|
data/lib/easypost/util.rb
CHANGED
@@ -33,6 +33,8 @@ module EasyPost
|
|
33
33
|
'Pickup' => Pickup,
|
34
34
|
'PickupRate' => PickupRate,
|
35
35
|
'PostageLabel' => PostageLabel,
|
36
|
+
'Printer' => Printer,
|
37
|
+
'PrintJob' => PrintJob,
|
36
38
|
'CarrierAccount' => CarrierAccount,
|
37
39
|
'User' => User }
|
38
40
|
|
@@ -53,6 +55,8 @@ module EasyPost
|
|
53
55
|
'pickup' => Pickup,
|
54
56
|
'pickuprate' => PickupRate,
|
55
57
|
'pl' => PostageLabel,
|
58
|
+
'printer' => Printer,
|
59
|
+
'printjob' => PrintJob,
|
56
60
|
'ca' => CarrierAccount,
|
57
61
|
'user' => User }
|
58
62
|
|
data/spec/order_spec.rb
CHANGED
@@ -16,10 +16,10 @@ describe EasyPost::Order do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'creates an order out of two shipments' do
|
19
|
-
|
20
19
|
order = EasyPost::Order.create(
|
21
20
|
to_address: ADDRESS[:california],
|
22
21
|
from_address: ADDRESS[:missouri],
|
22
|
+
carrier_accounts: [{id: "ca_12345678"}],
|
23
23
|
shipments: [{
|
24
24
|
parcel: {length: 8, width: 6, height: 4, weight: 12}
|
25
25
|
},{
|
@@ -31,22 +31,26 @@ describe EasyPost::Order do
|
|
31
31
|
expect(order.shipments.first).to be_an_instance_of(EasyPost::Shipment)
|
32
32
|
end
|
33
33
|
|
34
|
-
it 'creates and buys an
|
35
|
-
|
34
|
+
it 'creates and buys an order using magic' do
|
36
35
|
order = EasyPost::Order.create(
|
37
|
-
to_address: ADDRESS[:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
}]
|
36
|
+
to_address: ADDRESS[:canada],
|
37
|
+
customs_info: CUSTOMS_INFO[:merchandise],
|
38
|
+
containers: "*",
|
39
|
+
items: [{sku: "V4C3D5R2Z6", value: 89.65}],
|
40
|
+
#items: ["item_12345678"],
|
41
|
+
# auto_pack: false,
|
42
|
+
# auto_buy: false
|
45
43
|
)
|
46
|
-
|
44
|
+
|
45
|
+
order.pack
|
46
|
+
order.buy(max_delivery_days: 2)
|
47
|
+
# order.rates[0].buy
|
48
|
+
# order.fulfill if order.is_fulfillable # fulfilled by easypost
|
47
49
|
|
48
50
|
expect(order).to be_an_instance_of(EasyPost::Order)
|
49
51
|
expect(order.shipments.first).to be_an_instance_of(EasyPost::Shipment)
|
50
52
|
end
|
53
|
+
|
51
54
|
end
|
55
|
+
|
52
56
|
end
|
data/spec/support/constant.rb
CHANGED
@@ -84,4 +84,14 @@ CUSTOMS_INFO = {
|
|
84
84
|
hs_tariff_number: 123456
|
85
85
|
}]
|
86
86
|
}
|
87
|
+
merchandise: {
|
88
|
+
customs_certify: true,
|
89
|
+
customs_signer: 'Dr. Pepper',
|
90
|
+
contents_type: 'merchandise',
|
91
|
+
contents_explanation: '', # only required when contents_type: 'other'
|
92
|
+
eel_pfc: 'NOEEI 30.37(a)',
|
93
|
+
non_delivery_option: 'abandon',
|
94
|
+
restriction_type: 'none',
|
95
|
+
restriction_comments: ''
|
96
|
+
}
|
87
97
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easypost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sawyer Bateman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 2.13
|
81
|
+
version: '2.13'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 2.13
|
88
|
+
version: '2.13'
|
89
89
|
description: Client library for accessing the EasyPost shipping API via Ruby.
|
90
90
|
email: contact@easypost.com
|
91
91
|
executables:
|
@@ -118,6 +118,8 @@ files:
|
|
118
118
|
- lib/easypost/pickup.rb
|
119
119
|
- lib/easypost/pickup_rate.rb
|
120
120
|
- lib/easypost/postage_label.rb
|
121
|
+
- lib/easypost/print_job.rb
|
122
|
+
- lib/easypost/printer.rb
|
121
123
|
- lib/easypost/rate.rb
|
122
124
|
- lib/easypost/refund.rb
|
123
125
|
- lib/easypost/resource.rb
|