easypost 3.1.5 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +22 -0
- data/{CHANGELOG → CHANGELOG.md} +77 -40
- data/README.md +22 -16
- data/VERSION +1 -1
- data/easypost.gemspec +1 -1
- data/lib/easypost/api_key.rb +2 -0
- data/lib/easypost/brand.rb +9 -0
- data/lib/easypost/carrier_account.rb +1 -2
- data/lib/easypost/carrier_type.rb +2 -0
- data/lib/easypost/object.rb +4 -0
- data/lib/easypost/shipment.rb +13 -0
- data/lib/easypost/tax_identifier.rb +2 -0
- data/lib/easypost/tracker.rb +0 -6
- data/lib/easypost/user.rb +21 -10
- data/lib/easypost/util.rb +28 -29
- data/lib/easypost.rb +21 -18
- metadata +13 -10
- data/.travis.yml +0 -9
- data/lib/easypost/item.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61c0e0c8eb25bf4d96db43cd812a71df8648e2b1a77f2eef5d651bb4c1275cbf
|
4
|
+
data.tar.gz: ac36be5df27407e988d4fcc50c93a312fe8e1465cba96e85c8120d36acdfcf65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd011f19406e4f5187f6daac73c490621052605610160992ce4ec42db0b9a4e1b3f64f90123f2b8a7399f32f3b54c7d6515e03c882e01acbc913d611dce9f0a2
|
7
|
+
data.tar.gz: 3bb63bfce116fa8e1504cde77b38019c68bd4269770246e78aad8916b3e04e29877926550ddaf17fe5fa8489e071069a5e2b0e1432a0fdb52bc0f55e4a981af5
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: 'CI'
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request: ~
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
run-tests:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
rubyversion: ['2.4', '2.5', '2.6', '2.7', '3.0']
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: set up ruby
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.rubyversion }}
|
20
|
+
bundler-cache: true
|
21
|
+
- name: run tests
|
22
|
+
run: bundle exec rspec
|
data/{CHANGELOG → CHANGELOG.md}
RENAMED
@@ -1,211 +1,248 @@
|
|
1
|
-
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
|
4
|
+
## 3.5.0 2021-12-06
|
5
|
+
|
6
|
+
* Adds the `update_brand` method to the user object (closes #122)
|
7
|
+
|
8
|
+
|
9
|
+
## 3.4.0 2021-07-13
|
10
|
+
|
11
|
+
* Removed deprecated `Item` object
|
12
|
+
* Sorted EasyPost Resources list
|
13
|
+
* Remove 2015-vintage experimental `all_updated` method on Tracker
|
14
|
+
* Fixes API key retrieval (#120, thanks @andychongyz)
|
15
|
+
* Adds `regenerate_rates` method for new rerate API
|
16
|
+
* Adds `deconstruct_keys` method to allow for pattern matching on EasyPost objects
|
17
|
+
|
18
|
+
|
19
|
+
## 3.3.0 2021-06-10
|
20
|
+
|
21
|
+
* Adds `SmartRate` functionality to the `Shipments` object (available by calling `get_smartrates` on a shipment)
|
22
|
+
* Fix bug where `EasyPost::CarrierAccount.types` was hitting the wrong endpoint
|
23
|
+
|
24
|
+
|
25
|
+
## 3.2.0 2021-01-14
|
26
|
+
|
27
|
+
* Replace Travis CI with Github Actions
|
28
|
+
* Add Ruby 3.0 to supported platforms (#110; thanks @maxwell)
|
29
|
+
|
30
|
+
|
31
|
+
## 3.1.5 2020-12-16
|
2
32
|
|
3
33
|
* Fix attribute lookup when manually constructing objects (#105; thanks @drewtempelmeyer)
|
4
34
|
* Flatten class names and clean up some other style issues
|
5
35
|
* Fix `EasyPost::Address.create_and_verify`, broken since 3.1.0 (#108; thanks @rajbirverma)
|
6
36
|
|
7
|
-
|
37
|
+
|
38
|
+
## 3.1.4 2020-09-29
|
8
39
|
|
9
40
|
* Don't modify params passed into Address#create (#78; thanks @TheRusskiy)
|
10
41
|
* Don't modify `carriers` and `services` parameters to `Shipment.lowest_rate` (#71 / #103, thanks @vladvinnikov and @jurisgalang)
|
11
42
|
* When constructing an easypost object, convert the key to a string (#102; thanks @Geesu)
|
12
43
|
* Expose the raw HTTP response as `#http_body` on `EasyPost::Error` objects (#101; thanks @Geesu)
|
13
44
|
|
14
|
-
|
45
|
+
|
46
|
+
## 3.1.3 2020-06-26
|
15
47
|
|
16
48
|
* Fix bug causing Authorization header to be included in User-Agent header. All users must upgrade.
|
17
49
|
|
18
|
-
|
50
|
+
|
51
|
+
## 3.1.2 2020-06-24
|
19
52
|
|
20
53
|
* Bad gem push. New version required.
|
21
54
|
|
22
|
-
|
55
|
+
|
56
|
+
## 3.1.1 2020-06-23
|
23
57
|
|
24
58
|
* Fix bug where EasyPost.http_config was invalid when not explicitly initialized.
|
25
59
|
|
26
|
-
|
60
|
+
|
61
|
+
## 3.1.0 2020-06-23
|
27
62
|
|
28
63
|
* Add Shipment Invoice and Refund Report
|
29
64
|
* Remove dependencies on `RestClient` and `MultiJson`
|
30
65
|
* Remove some deprecated endpoints
|
31
66
|
|
32
|
-
|
67
|
+
|
68
|
+
## 3.0.1 2018-05-17
|
33
69
|
|
34
70
|
* Enforce TLS certificate validity by default
|
35
71
|
|
36
|
-
|
72
|
+
|
73
|
+
## 3.0.0 2018-02-15
|
37
74
|
|
38
75
|
* Require use of ruby ~> 2.0 and TLSv1.2
|
39
76
|
|
40
77
|
|
41
|
-
|
78
|
+
## 2.7.3 2018-02-05
|
42
79
|
|
43
80
|
* Fix bug with introduced around certain JSON objects with IDs (thanks vladvinnikov!)
|
44
81
|
|
45
82
|
|
46
|
-
|
83
|
+
## 2.7.2 2018-02-01
|
47
84
|
|
48
85
|
* Removed unused and unsupported code paths for Container model
|
49
86
|
* Removed unused and unsupported code path for Stamp and Barcode methods on the Shipment model
|
50
87
|
* Fixed a bug with non-model JSON object with an "id" key being treated as models and raising errors
|
51
88
|
|
52
89
|
|
53
|
-
|
90
|
+
## 2.7.1 2017-05-25
|
54
91
|
|
55
92
|
* Allow reports to be retrieved without passing a type
|
56
93
|
|
57
94
|
|
58
|
-
|
95
|
+
## 2.7.0 2017-04-04
|
59
96
|
|
60
97
|
* Changed Report CRUD signatures. requires report type to be passed
|
61
98
|
|
62
99
|
|
63
|
-
|
100
|
+
## 2.6.2 2017-02-14
|
64
101
|
|
65
102
|
* Added get_rates method for Orders
|
66
103
|
|
67
104
|
|
68
|
-
|
105
|
+
## 2.6.1 2017-01-19
|
69
106
|
|
70
107
|
* Updated create method for ScanForms
|
71
108
|
|
72
109
|
|
73
|
-
|
110
|
+
## 2.6.0 2017-01-17
|
74
111
|
|
75
112
|
* Add basic CRUD methods for Webhooks
|
76
113
|
|
77
114
|
|
78
|
-
|
115
|
+
## 2.5.0 2016-12-19
|
79
116
|
|
80
117
|
* Add prefixes to report in utils
|
81
118
|
|
82
119
|
|
83
|
-
|
120
|
+
## 2.4.0 2016-12-08
|
84
121
|
|
85
122
|
* Add report resource to ruby client
|
86
123
|
|
87
124
|
|
88
|
-
|
125
|
+
## 2.3.0 2016-11-25
|
89
126
|
|
90
127
|
* Updated dependencies to allow rest-client 2.0.0 and above
|
91
128
|
|
92
129
|
|
93
|
-
|
130
|
+
## 2.2.0 2016-07-26
|
94
131
|
|
95
132
|
* Added standalone Insurance model
|
96
133
|
|
97
134
|
|
98
|
-
|
135
|
+
## 2.1.11 2016-02-04
|
99
136
|
|
100
137
|
* Allowed user creation for top-level users
|
101
138
|
|
102
139
|
|
103
|
-
|
140
|
+
## 2.1.10 2015-12-23
|
104
141
|
|
105
142
|
* Added verify and verify_strict params to Address.create
|
106
143
|
* Added Tracker.create_list and Tracker.all_updated for working with large
|
107
144
|
numbers of Trackers.
|
108
145
|
|
109
146
|
|
110
|
-
|
147
|
+
## 2.1.9 2015-11-04
|
111
148
|
|
112
149
|
* Added new tests for Tracker.all
|
113
150
|
* Updated some old examples
|
114
151
|
|
115
152
|
|
116
|
-
|
153
|
+
## 2.1.8 2015-10-21
|
117
154
|
|
118
155
|
* Added Cancel method for Pickups (thanks Ramie Blatt!)
|
119
156
|
|
120
157
|
|
121
|
-
|
158
|
+
## 2.1.7 2015-10-05
|
122
159
|
|
123
160
|
* Fixed Address.create_and_verify and changed how errors are raised (thanks Dimitri Roche!)
|
124
161
|
* Require newer version of the multi_json package
|
125
162
|
|
126
163
|
|
127
|
-
|
164
|
+
## 2.1.6 2015-06-10
|
128
165
|
|
129
166
|
* Added Address message accessor for backwards compatability
|
130
167
|
|
131
168
|
|
132
|
-
|
169
|
+
## 2.1.5 2015-06-10
|
133
170
|
|
134
171
|
* Removed Address.message
|
135
172
|
|
136
173
|
|
137
|
-
|
174
|
+
## 2.1.4 2015-06-03
|
138
175
|
|
139
176
|
* Add Printer and PrintJob resources.
|
140
177
|
|
141
178
|
|
142
|
-
|
179
|
+
## 2.1.3 2015-04-30
|
143
180
|
|
144
181
|
* Bux fix, EasyPost::Errors no longer break with a nil json body.
|
145
182
|
|
146
183
|
|
147
|
-
|
184
|
+
## 2.1.2 2015-04-29
|
148
185
|
|
149
186
|
* EasyPost::Errors now correctly parse field errors and error codes.
|
150
187
|
|
151
188
|
|
152
|
-
|
189
|
+
## 2.1.1 2015-04-15
|
153
190
|
|
154
191
|
* CarrierAccount will now correctly save in-place modifications to credentials
|
155
192
|
* Nested variables should now be saved correctly across all models
|
156
193
|
* Fixed version numbering confusion (the previous version was 2.0.15, not 2.1.0)
|
157
194
|
|
158
195
|
|
159
|
-
|
196
|
+
## 2.0.15 2015-04-15
|
160
197
|
|
161
198
|
* Added tracker to shipment buy response
|
162
199
|
* Updated tracker tests
|
163
200
|
|
164
201
|
|
165
|
-
|
202
|
+
## 2.0.14 2015-04-15
|
166
203
|
|
167
204
|
* Added User and CarrierAccount models with CRUD functionality
|
168
205
|
|
169
206
|
|
170
|
-
|
207
|
+
## 2.0.13 2014-10-30
|
171
208
|
|
172
209
|
* Added Pickup, PickupRate resources.
|
173
210
|
* Added ability to pass api_key to a few resources that were missing it.
|
174
211
|
|
175
212
|
|
176
|
-
|
213
|
+
## 2.0.12 2014-07-07
|
177
214
|
|
178
215
|
* Added Item, Container, and Order resources.
|
179
216
|
* Fixed and added a lot of tests.
|
180
217
|
|
181
218
|
|
182
|
-
|
219
|
+
## 2.0.11 2013-12-16
|
183
220
|
|
184
221
|
* Added Event.receive method for parsing events sent by webhook.
|
185
222
|
* Fixed tests to account for the tracking code returning and array of details instead of a Hash
|
186
223
|
|
187
224
|
|
188
|
-
|
225
|
+
## 2.0.10 2013-10-03
|
189
226
|
|
190
227
|
* API Addition: Event resource added for webhook consumption.
|
191
228
|
|
192
229
|
|
193
|
-
|
230
|
+
## 2.0.9 2013-09-19
|
194
231
|
|
195
232
|
* Interface Change: Changed batch.scan_form to batch.create_scan_form to support the ability to refer to scan forms associated to batches.
|
196
233
|
|
197
234
|
|
198
|
-
|
235
|
+
## 2.0.3 2013-07-31
|
199
236
|
|
200
237
|
* API Addition: Tracker resource added. Trackers can be used to register any tracking code with EasyPost webhooks.
|
201
238
|
|
202
239
|
|
203
|
-
|
240
|
+
## 2.0.2 2013-07-23
|
204
241
|
|
205
242
|
* API Addition: Shipment.track_with_code returns tracking details for any tracking code.
|
206
243
|
|
207
244
|
|
208
|
-
|
245
|
+
## 2.0.1 2013-07-07
|
209
246
|
|
210
247
|
* API Addition: Address.create_and_verify returns a verified address in one step.
|
211
248
|
* API Addition: Shipment.label forces the creation of additional label formats (pdf, epl2, zpl).
|
data/README.md
CHANGED
@@ -1,32 +1,30 @@
|
|
1
1
|
# EasyPost Ruby Client Library
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://github.com/EasyPost/easypost-ruby/workflows/CI/badge.svg)](https://github.com/EasyPost/easypost-ruby/actions?query=workflow%3ACI)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/easypost.svg)](https://badge.fury.io/rb/easypost)
|
5
5
|
|
6
6
|
|
7
|
-
EasyPost is a simple shipping API. You can sign up for an account at https://easypost.com
|
7
|
+
EasyPost is a simple shipping API. You can sign up for an account at https://easypost.com.
|
8
8
|
|
9
|
-
Installation
|
10
|
-
---------------
|
9
|
+
## Installation
|
11
10
|
|
12
11
|
Install the gem:
|
13
12
|
|
14
|
-
```
|
13
|
+
```bash
|
15
14
|
gem install easypost
|
16
15
|
```
|
17
16
|
|
18
17
|
Import the EasyPost client in your application:
|
19
18
|
|
20
|
-
```
|
19
|
+
```ruby
|
21
20
|
require 'easypost'
|
22
21
|
```
|
23
22
|
|
24
|
-
Example
|
25
|
-
------------------
|
23
|
+
## Example
|
26
24
|
|
27
25
|
```ruby
|
28
26
|
require 'easypost'
|
29
|
-
EasyPost.api_key = '
|
27
|
+
EasyPost.api_key = 'API_KEY'
|
30
28
|
|
31
29
|
to_address = EasyPost::Address.create(
|
32
30
|
:name => 'Dr. Steve Brule',
|
@@ -37,6 +35,7 @@ to_address = EasyPost::Address.create(
|
|
37
35
|
:country => 'US',
|
38
36
|
:phone => '310-808-5243'
|
39
37
|
)
|
38
|
+
|
40
39
|
from_address = EasyPost::Address.create(
|
41
40
|
:company => 'EasyPost',
|
42
41
|
:street1 => '118 2nd Street',
|
@@ -62,6 +61,7 @@ customs_item = EasyPost::CustomsItem.create(
|
|
62
61
|
:origin_country => 'us',
|
63
62
|
:hs_tariff_number => 123456
|
64
63
|
)
|
64
|
+
|
65
65
|
customs_info = EasyPost::CustomsInfo.create(
|
66
66
|
:integrated_form_type => 'form_2976',
|
67
67
|
:customs_certify => true,
|
@@ -91,17 +91,23 @@ shipment.insure(amount: 100)
|
|
91
91
|
puts shipment.insurance
|
92
92
|
|
93
93
|
puts shipment.postage_label.label_url
|
94
|
-
|
95
94
|
```
|
96
95
|
|
97
|
-
Documentation
|
98
|
-
--------------------
|
96
|
+
## Documentation
|
99
97
|
|
100
98
|
Up-to-date documentation at: https://easypost.com/docs
|
101
99
|
|
102
|
-
|
103
|
-
--------------------
|
100
|
+
## Development
|
104
101
|
|
102
|
+
```bash
|
103
|
+
# Run tests
|
104
|
+
API_KEY=123... bundle exec rspec
|
105
105
|
```
|
106
|
-
|
107
|
-
|
106
|
+
|
107
|
+
## Releasing
|
108
|
+
|
109
|
+
1. Update the version in `VERSION`
|
110
|
+
1. Update the `CHANGELOG`
|
111
|
+
1. Tag a release on GitHub
|
112
|
+
1. Build the Gem `gem build easypost.gemspec`
|
113
|
+
1. Publish the Gem `gem push easypost-X.X.X.gem` (replace `X.X.X` with the version being released)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.5.0
|
data/easypost.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
23
|
spec.require_paths = ["lib"]
|
24
|
-
spec.required_ruby_version = "
|
24
|
+
spec.required_ruby_version = ">= 2.2"
|
25
25
|
|
26
26
|
spec.add_development_dependency "pry", "~> 0.13"
|
27
27
|
spec.add_development_dependency "rake", "~> 13.0"
|
data/lib/easypost/object.rb
CHANGED
data/lib/easypost/shipment.rb
CHANGED
@@ -6,6 +6,19 @@ class EasyPost::Shipment < EasyPost::Resource
|
|
6
6
|
return self
|
7
7
|
end
|
8
8
|
|
9
|
+
def regenerate_rates(params={})
|
10
|
+
response = EasyPost.make_request(:post, url + '/rerate', @api_key, params)
|
11
|
+
self.refresh_from(response, @api_key, true)
|
12
|
+
|
13
|
+
return self
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_smartrates
|
17
|
+
response = EasyPost.make_request(:get, url + '/smartrate', @api_key)
|
18
|
+
|
19
|
+
return response.fetch('result', [])
|
20
|
+
end
|
21
|
+
|
9
22
|
def buy(params={})
|
10
23
|
if params.instance_of?(EasyPost::Rate)
|
11
24
|
temp = params.clone
|
data/lib/easypost/tracker.rb
CHANGED
@@ -4,10 +4,4 @@ class EasyPost::Tracker < EasyPost::Resource
|
|
4
4
|
response = EasyPost.make_request(:post, url, api_key, params)
|
5
5
|
return true
|
6
6
|
end
|
7
|
-
|
8
|
-
def self.all_updated(params={}, api_key=nil)
|
9
|
-
url = self.url + '/all_updated'
|
10
|
-
response = EasyPost.make_request(:get, url, api_key, params)
|
11
|
-
return EasyPost::Util.convert_to_easypost_object(response, api_key)
|
12
|
-
end
|
13
7
|
end
|
data/lib/easypost/user.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class EasyPost::User < EasyPost::Resource
|
2
|
-
def self.create(params={}, api_key=nil)
|
3
|
-
response = EasyPost.make_request(:post,
|
4
|
-
|
2
|
+
def self.create(params = {}, api_key = nil)
|
3
|
+
response = EasyPost.make_request(:post, url, api_key, {class_name.to_sym => params})
|
4
|
+
EasyPost::Util.convert_to_easypost_object(response, api_key)
|
5
5
|
end
|
6
6
|
|
7
7
|
def save
|
@@ -14,26 +14,25 @@ class EasyPost::User < EasyPost::Resource
|
|
14
14
|
response = EasyPost.make_request(:put, url, @api_key, wrapped_params)
|
15
15
|
refresh_from(response, api_key)
|
16
16
|
end
|
17
|
-
|
17
|
+
self
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.retrieve_me
|
21
|
-
|
21
|
+
all
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.all_api_keys
|
25
|
-
|
26
|
-
return EasyPost::Util.convert_to_easypost_object(response, api_key)
|
25
|
+
EasyPost::ApiKey.all
|
27
26
|
end
|
28
27
|
|
29
28
|
def api_keys
|
30
29
|
api_keys = EasyPost::User.all_api_keys
|
31
30
|
|
32
|
-
if api_keys.id ==
|
31
|
+
if api_keys.id == id
|
33
32
|
my_api_keys = api_keys.keys
|
34
33
|
else
|
35
|
-
|
36
|
-
if child.id ==
|
34
|
+
api_keys.children.each do |child|
|
35
|
+
if child.id == id
|
37
36
|
my_api_keys = child.keys
|
38
37
|
break
|
39
38
|
end
|
@@ -42,4 +41,16 @@ class EasyPost::User < EasyPost::Resource
|
|
42
41
|
|
43
42
|
my_api_keys
|
44
43
|
end
|
44
|
+
|
45
|
+
def update_brand(**attrs)
|
46
|
+
brand = EasyPost::Brand.new
|
47
|
+
data = {object: "Brand", user_id: id, **attrs}
|
48
|
+
# Add accessors manually because there's no API to retrieve a brand
|
49
|
+
brand.add_accessors(data.keys)
|
50
|
+
# Assigning values with accessors defined above
|
51
|
+
data.each do |key, val|
|
52
|
+
brand.send("#{key}=", val)
|
53
|
+
end
|
54
|
+
brand.save
|
55
|
+
end
|
45
56
|
end
|
data/lib/easypost/util.rb
CHANGED
@@ -22,63 +22,62 @@ module EasyPost::Util
|
|
22
22
|
def self.convert_to_easypost_object(response, api_key, parent=nil, name=nil)
|
23
23
|
types = {
|
24
24
|
'Address' => EasyPost::Address,
|
25
|
-
'
|
26
|
-
'
|
25
|
+
'Batch' => EasyPost::Batch,
|
26
|
+
'CarrierAccount' => EasyPost::CarrierAccount,
|
27
27
|
'CustomsInfo' => EasyPost::CustomsInfo,
|
28
|
-
'
|
29
|
-
'Shipment' => EasyPost::Shipment,
|
30
|
-
'Rate' => EasyPost::Rate,
|
31
|
-
'Refund' => EasyPost::Refund,
|
28
|
+
'CustomsItem' => EasyPost::CustomsItem,
|
32
29
|
'Event' => EasyPost::Event,
|
33
|
-
'Batch' => EasyPost::Batch,
|
34
|
-
'Tracker' => EasyPost::Tracker,
|
35
|
-
'Item' => EasyPost::Item,
|
36
30
|
'Insurance' => EasyPost::Insurance,
|
37
31
|
'Order' => EasyPost::Order,
|
32
|
+
'Parcel' => EasyPost::Parcel,
|
33
|
+
'PaymentLogReport' => EasyPost::Report,
|
38
34
|
'Pickup' => EasyPost::Pickup,
|
39
35
|
'PickupRate' => EasyPost::PickupRate,
|
40
36
|
'PostageLabel' => EasyPost::PostageLabel,
|
41
37
|
'Printer' => EasyPost::Printer,
|
42
38
|
'PrintJob' => EasyPost::PrintJob,
|
43
|
-
'
|
44
|
-
'
|
39
|
+
'Rate' => EasyPost::Rate,
|
40
|
+
'Refund' => EasyPost::Refund,
|
41
|
+
'RefundReport' => EasyPost::Report,
|
45
42
|
'Report' => EasyPost::Report,
|
43
|
+
'ScanForm' => EasyPost::ScanForm,
|
44
|
+
'Shipment' => EasyPost::Shipment,
|
45
|
+
'TaxIdentifier' => EasyPost::TaxIdentifier,
|
46
|
+
'ShipmentInvoiceReport' => EasyPost::Report,
|
46
47
|
'ShipmentReport' => EasyPost::Report,
|
47
|
-
'
|
48
|
+
'Tracker' => EasyPost::Tracker,
|
48
49
|
'TrackerReport' => EasyPost::Report,
|
49
|
-
'
|
50
|
-
'ShipmentInvoiceReport' => EasyPost::Report,
|
50
|
+
'User' => EasyPost::User,
|
51
51
|
'Webhook' => EasyPost::Webhook
|
52
52
|
}
|
53
53
|
|
54
54
|
prefixes = {
|
55
55
|
'adr' => EasyPost::Address,
|
56
|
-
'
|
57
|
-
'
|
56
|
+
'batch' => EasyPost::Batch,
|
57
|
+
'ca' => EasyPost::CarrierAccount,
|
58
58
|
'cstinfo' => EasyPost::CustomsInfo,
|
59
|
-
'
|
60
|
-
'shp' => EasyPost::Shipment,
|
61
|
-
'rate' => EasyPost::Rate,
|
62
|
-
'rfnd' => EasyPost::Refund,
|
59
|
+
'cstitem' => EasyPost::CustomsItem,
|
63
60
|
'evt' => EasyPost::Event,
|
64
|
-
'
|
65
|
-
'trk' => EasyPost::Tracker,
|
66
|
-
'item' => EasyPost::Item,
|
61
|
+
'hook' => EasyPost::Webhook,
|
67
62
|
'ins' => EasyPost::Insurance,
|
68
63
|
'order' => EasyPost::Order,
|
69
64
|
'pickup' => EasyPost::Pickup,
|
70
65
|
'pickuprate' => EasyPost::PickupRate,
|
71
66
|
'pl' => EasyPost::PostageLabel,
|
67
|
+
'plrep' => EasyPost::Report,
|
68
|
+
'prcl' => EasyPost::Parcel,
|
72
69
|
'printer' => EasyPost::Printer,
|
73
70
|
'printjob' => EasyPost::PrintJob,
|
74
|
-
'
|
75
|
-
'user' => EasyPost::User,
|
76
|
-
'shprep' => EasyPost::Report,
|
77
|
-
'plrep' => EasyPost::Report,
|
78
|
-
'trkrep' => EasyPost::Report,
|
71
|
+
'rate' => EasyPost::Rate,
|
79
72
|
'refrep' => EasyPost::Report,
|
73
|
+
'rfnd' => EasyPost::Refund,
|
74
|
+
'sf' => EasyPost::ScanForm,
|
75
|
+
'shp' => EasyPost::Shipment,
|
80
76
|
'shpinvrep' => EasyPost::Report,
|
81
|
-
'
|
77
|
+
'shprep' => EasyPost::Report,
|
78
|
+
'trk' => EasyPost::Tracker,
|
79
|
+
'trkrep' => EasyPost::Report,
|
80
|
+
'user' => EasyPost::User
|
82
81
|
}
|
83
82
|
|
84
83
|
case response
|
data/lib/easypost.rb
CHANGED
@@ -2,37 +2,40 @@ require "base64"
|
|
2
2
|
require "cgi"
|
3
3
|
require "net/http"
|
4
4
|
|
5
|
-
# Resources
|
6
5
|
require "easypost/version"
|
7
6
|
require "easypost/util"
|
8
7
|
require "easypost/object"
|
9
8
|
require "easypost/resource"
|
9
|
+
require "easypost/error"
|
10
|
+
|
11
|
+
# Resources
|
10
12
|
require "easypost/address"
|
11
|
-
require "easypost/
|
12
|
-
require "easypost/
|
13
|
+
require "easypost/api_key"
|
14
|
+
require "easypost/batch"
|
15
|
+
require "easypost/brand"
|
16
|
+
require "easypost/carrier_account"
|
17
|
+
require "easypost/carrier_type"
|
13
18
|
require "easypost/customs_info"
|
14
|
-
require "easypost/
|
15
|
-
require "easypost/rate"
|
16
|
-
require "easypost/postage_label"
|
17
|
-
require "easypost/scan_form"
|
18
|
-
require "easypost/refund"
|
19
|
-
require "easypost/insurance"
|
19
|
+
require "easypost/customs_item"
|
20
20
|
require "easypost/event"
|
21
|
-
require "easypost/
|
22
|
-
require "easypost/tracker"
|
23
|
-
require "easypost/item"
|
21
|
+
require "easypost/insurance"
|
24
22
|
require "easypost/order"
|
25
|
-
require "easypost/
|
23
|
+
require "easypost/parcel"
|
26
24
|
require "easypost/pickup_rate"
|
27
|
-
require "easypost/
|
25
|
+
require "easypost/pickup"
|
26
|
+
require "easypost/postage_label"
|
28
27
|
require "easypost/print_job"
|
29
|
-
require "easypost/
|
30
|
-
require "easypost/
|
28
|
+
require "easypost/printer"
|
29
|
+
require "easypost/rate"
|
30
|
+
require "easypost/refund"
|
31
31
|
require "easypost/report"
|
32
|
+
require "easypost/scan_form"
|
33
|
+
require "easypost/shipment"
|
34
|
+
require "easypost/tax_identifier"
|
35
|
+
require "easypost/tracker"
|
36
|
+
require "easypost/user"
|
32
37
|
require "easypost/webhook"
|
33
38
|
|
34
|
-
require "easypost/error"
|
35
|
-
|
36
39
|
module EasyPost
|
37
40
|
@api_key = nil
|
38
41
|
@api_base = "https://api.easypost.com"
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easypost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Epstein
|
8
8
|
- Andrew Tribone
|
9
9
|
- James Brown
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-12-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pry
|
@@ -89,9 +89,9 @@ executables:
|
|
89
89
|
extensions: []
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
|
+
- ".github/workflows/ci.yml"
|
92
93
|
- ".gitignore"
|
93
|
-
-
|
94
|
-
- CHANGELOG
|
94
|
+
- CHANGELOG.md
|
95
95
|
- Gemfile
|
96
96
|
- LICENSE
|
97
97
|
- README.md
|
@@ -101,14 +101,16 @@ files:
|
|
101
101
|
- easypost.gemspec
|
102
102
|
- lib/easypost.rb
|
103
103
|
- lib/easypost/address.rb
|
104
|
+
- lib/easypost/api_key.rb
|
104
105
|
- lib/easypost/batch.rb
|
106
|
+
- lib/easypost/brand.rb
|
105
107
|
- lib/easypost/carrier_account.rb
|
108
|
+
- lib/easypost/carrier_type.rb
|
106
109
|
- lib/easypost/customs_info.rb
|
107
110
|
- lib/easypost/customs_item.rb
|
108
111
|
- lib/easypost/error.rb
|
109
112
|
- lib/easypost/event.rb
|
110
113
|
- lib/easypost/insurance.rb
|
111
|
-
- lib/easypost/item.rb
|
112
114
|
- lib/easypost/object.rb
|
113
115
|
- lib/easypost/order.rb
|
114
116
|
- lib/easypost/parcel.rb
|
@@ -123,6 +125,7 @@ files:
|
|
123
125
|
- lib/easypost/resource.rb
|
124
126
|
- lib/easypost/scan_form.rb
|
125
127
|
- lib/easypost/shipment.rb
|
128
|
+
- lib/easypost/tax_identifier.rb
|
126
129
|
- lib/easypost/tracker.rb
|
127
130
|
- lib/easypost/user.rb
|
128
131
|
- lib/easypost/util.rb
|
@@ -132,13 +135,13 @@ homepage: https://www.easypost.com/docs
|
|
132
135
|
licenses:
|
133
136
|
- MIT
|
134
137
|
metadata: {}
|
135
|
-
post_install_message:
|
138
|
+
post_install_message:
|
136
139
|
rdoc_options: []
|
137
140
|
require_paths:
|
138
141
|
- lib
|
139
142
|
required_ruby_version: !ruby/object:Gem::Requirement
|
140
143
|
requirements:
|
141
|
-
- - "
|
144
|
+
- - ">="
|
142
145
|
- !ruby/object:Gem::Version
|
143
146
|
version: '2.2'
|
144
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -147,8 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
150
|
- !ruby/object:Gem::Version
|
148
151
|
version: '0'
|
149
152
|
requirements: []
|
150
|
-
rubygems_version: 3.0.
|
151
|
-
signing_key:
|
153
|
+
rubygems_version: 3.0.3.1
|
154
|
+
signing_key:
|
152
155
|
specification_version: 4
|
153
156
|
summary: EasyPost Ruby Client Library
|
154
157
|
test_files: []
|
data/.travis.yml
DELETED
data/lib/easypost/item.rb
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
class EasyPost::Item < EasyPost::Resource
|
2
|
-
def self.retrieve_reference(params={}, api_key=nil)
|
3
|
-
response = EasyPost.make_request(:get, url + '/retrieve_reference', api_key, params)
|
4
|
-
return EasyPost::Util::convert_to_easypost_object(response, api_key) if response
|
5
|
-
end
|
6
|
-
end
|