easypost 2.1.3 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b30fd7e0120c21f8145e2ccea9536d09909383b2
4
- data.tar.gz: c6349910d929dd9148d585b103d902d771e78c33
3
+ metadata.gz: eb1fd9b143d731f928003c3e8d5b7c9148c6a2e0
4
+ data.tar.gz: 87ab4ab775c449fd77c4bb1ef00c8a4319235016
5
5
  SHA512:
6
- metadata.gz: 340ad016b0f85b18570faf9131c732139efc47325636ce4a54b96fdd73e6b3c285ef1be62aef311bbeefd143dc886d868780cbd6a3fe8c962c28ef8578f024bb
7
- data.tar.gz: e88f8d45fdb15c63adbcd1e6ba1a2dd2af32905f863feef3d400e30c6604a20d3a656716fec70fcef3e78683c4a079b5fc64e850a9d1dbc32176e4dd619eec2a
6
+ metadata.gz: d4f1f8bcb1ba006d7c503efded834fcb02f65fb3378ce401c54df501b4d73d9270669a37f86f6223811f69b1f6117e7bd97638981e9a69aec790d2a045595e4c
7
+ data.tar.gz: a5e2a9f7c11378ec681da69edb05e7a701d8a666fb15182abf10691c7ea3c9bcabc255e709718d0921b2d0f77dcc217dd91379f028c5b667b3e3f78044586b9b
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ === 2.1.4 2015-06-03
2
+
3
+ * Add Printer and PrintJob resources.
4
+
5
+
1
6
  === 2.1.3 2015-04-30
2
7
 
3
8
  * Bux fix, EasyPost::Errors no longer break with a nil json body.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.3
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.0'
25
+ spec.add_development_dependency 'rspec', '~> 2.13'
26
26
  end
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/printer'
30
+ require 'easypost/print_job'
29
31
  require 'easypost/carrier_account'
30
32
  require 'easypost/user'
31
33
 
@@ -0,0 +1,6 @@
1
+ module EasyPost
2
+ class PrintJob < Resource
3
+ end
4
+ end
5
+
6
+
@@ -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
+
@@ -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 international order out of two shipments' do
35
-
34
+ it 'creates and buys an order using magic' do
36
35
  order = EasyPost::Order.create(
37
- to_address: ADDRESS[:california],
38
- from_address: ADDRESS[:missouri],
39
- customs_info: EasyPost::CustomsInfo.create(CUSTOMS_INFO[:shirt]),
40
- shipments: [{
41
- parcel: {length: 8, width: 6, height: 4, weight: 12}
42
- },{
43
- parcel: {length: 8, width: 6, height: 4, weight: 24}
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
- order.buy(carrier: "usps", service: "ParcelSelect")
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
@@ -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.3
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-04-30 00:00:00.000000000 Z
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.0
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.0
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