easypost 3.5.0 → 4.1.1
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/.github/workflows/ci.yml +19 -5
- data/.gitignore +2 -0
- data/.rubocop.yml +5 -0
- data/CHANGELOG.md +151 -141
- data/Gemfile +2 -0
- data/README.md +51 -8
- data/Rakefile +2 -1
- data/UPGRADE_GUIDE.md +62 -0
- data/VERSION +1 -1
- data/bin/easypost-irb +5 -3
- data/easycop.yml +180 -0
- data/easypost.gemspec +21 -19
- data/lib/easypost/address.rb +26 -26
- data/lib/easypost/api_key.rb +3 -0
- data/lib/easypost/batch.rb +31 -30
- data/lib/easypost/brand.rb +4 -0
- data/lib/easypost/carrier_account.rb +4 -0
- data/lib/easypost/carrier_type.rb +3 -0
- data/lib/easypost/connection.rb +68 -0
- data/lib/easypost/customs_info.rb +5 -1
- data/lib/easypost/customs_item.rb +5 -1
- data/lib/easypost/error.rb +7 -7
- data/lib/easypost/event.rb +5 -1
- data/lib/easypost/insurance.rb +4 -0
- data/lib/easypost/object.rb +44 -28
- data/lib/easypost/order.rb +15 -11
- data/lib/easypost/parcel.rb +7 -0
- data/lib/easypost/pickup.rb +15 -9
- data/lib/easypost/pickup_rate.rb +3 -1
- data/lib/easypost/postage_label.rb +3 -0
- data/lib/easypost/rate.rb +7 -0
- data/lib/easypost/refund.rb +3 -0
- data/lib/easypost/report.rb +9 -16
- data/lib/easypost/resource.rb +55 -25
- data/lib/easypost/scan_form.rb +8 -3
- data/lib/easypost/shipment.rb +47 -51
- data/lib/easypost/tax_identifier.rb +4 -0
- data/lib/easypost/tracker.rb +9 -4
- data/lib/easypost/user.rb +14 -5
- data/lib/easypost/util.rb +21 -17
- data/lib/easypost/version.rb +3 -1
- data/lib/easypost/webhook.rb +18 -12
- data/lib/easypost.rb +99 -109
- metadata +75 -19
- data/lib/easypost/print_job.rb +0 -2
- data/lib/easypost/printer.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80b21caf35b36c26582451d01113e423da031f0a8dd4ab3e86bc02e40113f2ef
|
4
|
+
data.tar.gz: adc284c07d8e9f8650bbbbba486997b6c252d364f489982e9cc2b41af1a822a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d771d5798aefff39d456db171bf206db492c90b0bdbb8bbf8471d7112de25ec5ce433c7f8c73f90f6c14bc9b55d0af5016677ba3a70c5d053e5fdeb496da214
|
7
|
+
data.tar.gz: 74ed0c9883907b041c05baf185644be0db456c1350fb08db63071b5188b5391260d1be6d1f4851e430d587c79de6fd32ec3653c28f7699b630680bdcb63e1c44
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
name:
|
1
|
+
name: "CI"
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
|
-
branches: [
|
5
|
+
branches: [master]
|
6
6
|
pull_request: ~
|
7
7
|
|
8
8
|
jobs:
|
@@ -10,13 +10,27 @@ jobs:
|
|
10
10
|
runs-on: ubuntu-latest
|
11
11
|
strategy:
|
12
12
|
matrix:
|
13
|
-
rubyversion: [
|
13
|
+
rubyversion: ["2.5", "2.6", "2.7", "3.0", "3.1"]
|
14
14
|
steps:
|
15
|
-
-
|
16
|
-
|
15
|
+
- name: Checkout Repository
|
16
|
+
uses: actions/checkout@v2
|
17
|
+
- name: Set up Ruby
|
17
18
|
uses: ruby/setup-ruby@v1
|
18
19
|
with:
|
19
20
|
ruby-version: ${{ matrix.rubyversion }}
|
20
21
|
bundler-cache: true
|
21
22
|
- name: run tests
|
22
23
|
run: bundle exec rspec
|
24
|
+
lint:
|
25
|
+
runs-on: ubuntu-latest
|
26
|
+
steps:
|
27
|
+
- name: Checkout Repository
|
28
|
+
uses: actions/checkout@v2
|
29
|
+
- name: Set up Ruby
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: "3.0"
|
33
|
+
- name: Install Dependencies
|
34
|
+
run: bundle install
|
35
|
+
- name: Lint Project
|
36
|
+
run: rubocop
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,250 +1,260 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v4.1.1 (2022-03-14)
|
3
4
|
|
4
|
-
|
5
|
+
- Fixes a bug that prematurely closed connections when using multithreading by wrapping requests in a mutex (closes #148)
|
5
6
|
|
6
|
-
|
7
|
+
## v4.1.0 (2022-03-09)
|
7
8
|
|
9
|
+
- Adds support for custom client connections (#142)
|
10
|
+
- Reduces memory usage by reusing connections
|
11
|
+
- Extends all objects with `Enumerable` allowing for iterator patterns (#143)
|
8
12
|
|
9
|
-
##
|
13
|
+
## v4.0.0 (2022-02-25)
|
10
14
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
- Bumps minimum Ruby version from `2.2` to `2.5`
|
16
|
+
- Bumps dev dependencies
|
17
|
+
- Documents each interface of the project in code
|
18
|
+
- Overhauls the test suite with full coverage
|
19
|
+
- Introduces `Rubocop` and lints the entire project
|
20
|
+
- Removes the unusable `Print` and `PrintJob` objects
|
21
|
+
- Removes deprecated and unusable `stamp_and_barcode_by_reference` method on the Batch object
|
22
|
+
- Explicitly returns an error of "not implemented" for `Rate.all` and `Parcel.all`
|
23
|
+
- Removes the `Shipment.get_rates` function as shipments already contain rates. If you need to get new rates for a shipment, use the `Shipment.regenerate_rates` function instead
|
24
|
+
- Removes the parameters from `Address.verify` as they are unusable
|
25
|
+
- Removes the deprecated `http_status` property of the `EasyPost::Error` object as it was replaced with `status`
|
26
|
+
- Fixes a bug that would append an extra `id` field to each retrieved object
|
27
|
+
- Various other small improvements and bug fixes
|
17
28
|
|
29
|
+
## v3.5.0 (2021-12-06)
|
18
30
|
|
19
|
-
|
31
|
+
- Adds the `update_brand` method to the user object (closes #122)
|
20
32
|
|
21
|
-
|
22
|
-
* Fix bug where `EasyPost::CarrierAccount.types` was hitting the wrong endpoint
|
33
|
+
## v3.4.0 (2021-07-13)
|
23
34
|
|
35
|
+
- Removed deprecated `Item` object
|
36
|
+
- Sorted EasyPost Resources list
|
37
|
+
- Remove 2015-vintage experimental `all_updated` method on Tracker
|
38
|
+
- Fixes API key retrieval (#120, thanks @andychongyz)
|
39
|
+
- Adds `regenerate_rates` method for new rerate API
|
40
|
+
- Adds `deconstruct_keys` method to allow for pattern matching on EasyPost objects
|
24
41
|
|
25
|
-
## 3.
|
42
|
+
## v3.3.0 (2021-06-10)
|
26
43
|
|
27
|
-
|
28
|
-
|
44
|
+
- Adds `SmartRate` functionality to the `Shipments` object (available by calling `get_smartrates` on a shipment)
|
45
|
+
- Fix bug where `EasyPost::CarrierAccount.types` was hitting the wrong endpoint
|
29
46
|
|
47
|
+
## v3.2.0 (2021-01-14)
|
30
48
|
|
31
|
-
|
49
|
+
- Replace Travis CI with Github Actions
|
50
|
+
- Add Ruby 3.0 to supported platforms (#110; thanks @maxwell)
|
32
51
|
|
33
|
-
|
34
|
-
* Flatten class names and clean up some other style issues
|
35
|
-
* Fix `EasyPost::Address.create_and_verify`, broken since 3.1.0 (#108; thanks @rajbirverma)
|
52
|
+
## v3.1.5 (2020-12-16)
|
36
53
|
|
54
|
+
- Fix attribute lookup when manually constructing objects (#105; thanks @drewtempelmeyer)
|
55
|
+
- Flatten class names and clean up some other style issues
|
56
|
+
- Fix `EasyPost::Address.create_and_verify`, broken since 3.1.0 (#108; thanks @rajbirverma)
|
37
57
|
|
38
|
-
##
|
58
|
+
## v3.1.4 (2020-09-29)
|
39
59
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
60
|
+
- Don't modify params passed into Address#create (#78; thanks @TheRusskiy)
|
61
|
+
- Don't modify `carriers` and `services` parameters to `Shipment.lowest_rate` (#71 / #103, thanks @vladvinnikov and @jurisgalang)
|
62
|
+
- When constructing an easypost object, convert the key to a string (#102; thanks @Geesu)
|
63
|
+
- Expose the raw HTTP response as `#http_body` on `EasyPost::Error` objects (#101; thanks @Geesu)
|
44
64
|
|
65
|
+
## v3.1.3 (2020-06-26)
|
45
66
|
|
46
|
-
|
67
|
+
- Fix bug causing Authorization header to be included in User-Agent header. All users must upgrade.
|
47
68
|
|
48
|
-
|
69
|
+
## v3.1.2 (2020-06-24)
|
49
70
|
|
71
|
+
- Bad gem push. New version required.
|
50
72
|
|
51
|
-
##
|
73
|
+
## v3.1.1 (2020-06-23)
|
52
74
|
|
53
|
-
|
75
|
+
- Fix bug where EasyPost.http_config was invalid when not explicitly initialized.
|
54
76
|
|
77
|
+
## v3.1.0 (2020-06-23)
|
55
78
|
|
56
|
-
|
79
|
+
- Add Shipment Invoice and Refund Report
|
80
|
+
- Remove dependencies on `RestClient` and `MultiJson`
|
81
|
+
- Remove some deprecated endpoints
|
57
82
|
|
58
|
-
|
83
|
+
## v3.0.1 (2018-05-17)
|
59
84
|
|
85
|
+
- Enforce TLS certificate validity by default
|
60
86
|
|
61
|
-
##
|
87
|
+
## v3.0.0 (2018-02-15)
|
62
88
|
|
63
|
-
|
64
|
-
* Remove dependencies on `RestClient` and `MultiJson`
|
65
|
-
* Remove some deprecated endpoints
|
89
|
+
- Require use of ruby ~> 2.0 and TLSv1.2
|
66
90
|
|
91
|
+
## v2.7.3 (2018-02-05)
|
67
92
|
|
68
|
-
|
93
|
+
- Fix bug with introduced around certain JSON objects with IDs (thanks vladvinnikov!)
|
69
94
|
|
70
|
-
|
95
|
+
## v2.7.2 (2018-02-01)
|
71
96
|
|
97
|
+
- Removed unused and unsupported code paths for Container model
|
98
|
+
- Removed unused and unsupported code path for Stamp and Barcode methods on the Shipment model
|
99
|
+
- Fixed a bug with non-model JSON object with an "id" key being treated as models and raising errors
|
72
100
|
|
73
|
-
##
|
101
|
+
## v2.7.1 (2017-05-25)
|
74
102
|
|
75
|
-
|
103
|
+
- Allow reports to be retrieved without passing a type
|
76
104
|
|
105
|
+
## v2.7.0 (2017-04-04)
|
77
106
|
|
78
|
-
|
107
|
+
- Changed Report CRUD signatures. requires report type to be passed
|
79
108
|
|
80
|
-
|
109
|
+
## v2.6.2 (2017-02-14)
|
81
110
|
|
111
|
+
- Added get_rates method for Orders
|
82
112
|
|
83
|
-
##
|
113
|
+
## v2.6.1 (2017-01-19)
|
84
114
|
|
85
|
-
|
86
|
-
* Removed unused and unsupported code path for Stamp and Barcode methods on the Shipment model
|
87
|
-
* Fixed a bug with non-model JSON object with an "id" key being treated as models and raising errors
|
115
|
+
- Updated create method for ScanForms
|
88
116
|
|
117
|
+
## v2.6.0 (2017-01-17)
|
89
118
|
|
90
|
-
|
119
|
+
- Add basic CRUD methods for Webhooks
|
91
120
|
|
92
|
-
|
121
|
+
## v2.5.0 (2016-12-19)
|
93
122
|
|
123
|
+
- Add prefixes to report in utils
|
94
124
|
|
95
|
-
##
|
125
|
+
## v2.4.0 (2016-12-08)
|
96
126
|
|
97
|
-
|
127
|
+
- Add report resource to ruby client
|
98
128
|
|
129
|
+
## v2.3.0 (2016-11-25)
|
99
130
|
|
100
|
-
|
131
|
+
- Updated dependencies to allow rest-client 2.0.0 and above
|
101
132
|
|
102
|
-
|
133
|
+
## v2.2.0 (2016-07-260
|
103
134
|
|
135
|
+
- Added standalone Insurance model
|
104
136
|
|
105
|
-
##
|
137
|
+
## v2.1.11 (2016-02-04)
|
106
138
|
|
107
|
-
|
139
|
+
- Allowed user creation for top-level users
|
108
140
|
|
141
|
+
## v2.1.10 (2015-12-23)
|
109
142
|
|
110
|
-
|
143
|
+
- Added verify and verify_strict params to Address.create
|
144
|
+
- Added Tracker.create_list and Tracker.all_updated for working with large
|
145
|
+
numbers of Trackers.
|
111
146
|
|
112
|
-
|
147
|
+
## v2.1.9 (2015-11-04)
|
113
148
|
|
149
|
+
- Added new tests for Tracker.all
|
150
|
+
- Updated some old examples
|
114
151
|
|
115
|
-
##
|
152
|
+
## v2.1.8 (2015-10-21)
|
116
153
|
|
117
|
-
|
154
|
+
- Added Cancel method for Pickups (thanks Ramie Blatt!)
|
118
155
|
|
156
|
+
## v2.1.7 (2015-10-05)
|
119
157
|
|
120
|
-
|
158
|
+
- Fixed Address.create_and_verify and changed how errors are raised (thanks Dimitri Roche!)
|
159
|
+
- Require newer version of the multi_json package
|
121
160
|
|
122
|
-
|
161
|
+
## v2.1.6 (2015-06-10)
|
123
162
|
|
163
|
+
- Added Address message accessor for backwards compatability
|
124
164
|
|
125
|
-
##
|
165
|
+
## v2.1.5 (2015-06-10)
|
126
166
|
|
127
|
-
|
167
|
+
- Removed Address.message
|
128
168
|
|
169
|
+
## v2.1.4 (2015-06-03)
|
129
170
|
|
130
|
-
|
171
|
+
- Add Printer and PrintJob resources.
|
131
172
|
|
132
|
-
|
173
|
+
## v2.1.3 (2015-04-30)
|
133
174
|
|
175
|
+
- Bux fix, EasyPost::Errors no longer break with a nil json body.
|
134
176
|
|
135
|
-
##
|
177
|
+
## v2.1.2 (2015-04-29)
|
136
178
|
|
137
|
-
|
179
|
+
- EasyPost::Errors now correctly parse field errors and error codes.
|
138
180
|
|
181
|
+
## v2.1.1 (2015-04-15)
|
139
182
|
|
140
|
-
|
183
|
+
- CarrierAccount will now correctly save in-place modifications to credentials
|
184
|
+
- Nested variables should now be saved correctly across all models
|
185
|
+
- Fixed version numbering confusion (the previous version was 2.0.15, not 2.1.0)
|
141
186
|
|
142
|
-
|
143
|
-
* Added Tracker.create_list and Tracker.all_updated for working with large
|
144
|
-
numbers of Trackers.
|
187
|
+
## v2.0.15 (2015-04-15)
|
145
188
|
|
189
|
+
- Added tracker to shipment buy response
|
190
|
+
- Updated tracker tests
|
146
191
|
|
147
|
-
##
|
192
|
+
## v2.0.14 (2015-04-15)
|
148
193
|
|
149
|
-
|
150
|
-
* Updated some old examples
|
194
|
+
- Added User and CarrierAccount models with CRUD functionality
|
151
195
|
|
196
|
+
## v2.0.13 (2014-10-30)
|
152
197
|
|
153
|
-
|
198
|
+
- Added Pickup, PickupRate resources.
|
199
|
+
- Added ability to pass api_key to a few resources that were missing it.
|
154
200
|
|
155
|
-
|
201
|
+
## v2.0.12 (2014-07-07)
|
156
202
|
|
203
|
+
- Added Item, Container, and Order resources.
|
204
|
+
- Fixed and added a lot of tests.
|
157
205
|
|
158
|
-
##
|
206
|
+
## v2.0.11 (2013-12-16)
|
159
207
|
|
160
|
-
|
161
|
-
|
208
|
+
- Added Event.receive method for parsing events sent by webhook.
|
209
|
+
- Fixed tests to account for the tracking code returning and array of details instead of a Hash
|
162
210
|
|
211
|
+
## v2.0.10 (2013-10-03)
|
163
212
|
|
164
|
-
|
213
|
+
- API Addition: Event resource added for webhook consumption.
|
165
214
|
|
166
|
-
|
215
|
+
## v2.0.9 (2013-09-19)
|
167
216
|
|
217
|
+
- Interface Change: Changed batch.scan_form to batch.create_scan_form to support the ability to refer to scan forms associated to batches.
|
168
218
|
|
169
|
-
##
|
219
|
+
## v2.0.3 (2013-07-31)
|
170
220
|
|
171
|
-
|
221
|
+
- API Addition: Tracker resource added. Trackers can be used to register any tracking code with EasyPost webhooks.
|
172
222
|
|
223
|
+
## v2.0.2 (2013-07-23)
|
173
224
|
|
174
|
-
|
225
|
+
- API Addition: Shipment.track_with_code returns tracking details for any tracking code.
|
175
226
|
|
176
|
-
|
227
|
+
## v2.0.1 (2013-07-07)
|
177
228
|
|
229
|
+
- API Addition: Address.create_and_verify returns a verified address in one step.
|
230
|
+
- API Addition: Shipment.label forces the creation of additional label formats (pdf, epl2, zpl).
|
231
|
+
- API Addition: Shipment.insure purchases insurance for a shipment.
|
232
|
+
- Library Update: Added the ability to negatively filter carriers and services with Shipment.lowest_rate (e.g. '!usps').
|
178
233
|
|
179
|
-
##
|
234
|
+
## v2.0.0 (2013-06-25)
|
180
235
|
|
181
|
-
|
236
|
+
## v1.1.3 (2013-06-05)
|
182
237
|
|
238
|
+
## v1.1.2 (2013-06-05)
|
183
239
|
|
184
|
-
##
|
240
|
+
## v1.1.1 (2013-02-12)
|
185
241
|
|
186
|
-
|
242
|
+
## v1.1.0 (2013-01-29)
|
187
243
|
|
244
|
+
## v1.0.8 (2012-11-19)
|
188
245
|
|
189
|
-
##
|
246
|
+
## v1.0.7 (2012-11-19)
|
190
247
|
|
191
|
-
|
192
|
-
* Nested variables should now be saved correctly across all models
|
193
|
-
* Fixed version numbering confusion (the previous version was 2.0.15, not 2.1.0)
|
248
|
+
## v1.0.6 (2012-11-19)
|
194
249
|
|
250
|
+
## v1.0.5 (2012-11-19)
|
195
251
|
|
196
|
-
##
|
252
|
+
## v1.0.4 (2012-11-14)
|
197
253
|
|
198
|
-
|
199
|
-
* Updated tracker tests
|
254
|
+
## v1.0.3 (2012-11-13)
|
200
255
|
|
256
|
+
## v1.0.2 (2012-11-13)
|
201
257
|
|
202
|
-
##
|
258
|
+
## v1.0.1 (2012-11-13)
|
203
259
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
## 2.0.13 2014-10-30
|
208
|
-
|
209
|
-
* Added Pickup, PickupRate resources.
|
210
|
-
* Added ability to pass api_key to a few resources that were missing it.
|
211
|
-
|
212
|
-
|
213
|
-
## 2.0.12 2014-07-07
|
214
|
-
|
215
|
-
* Added Item, Container, and Order resources.
|
216
|
-
* Fixed and added a lot of tests.
|
217
|
-
|
218
|
-
|
219
|
-
## 2.0.11 2013-12-16
|
220
|
-
|
221
|
-
* Added Event.receive method for parsing events sent by webhook.
|
222
|
-
* Fixed tests to account for the tracking code returning and array of details instead of a Hash
|
223
|
-
|
224
|
-
|
225
|
-
## 2.0.10 2013-10-03
|
226
|
-
|
227
|
-
* API Addition: Event resource added for webhook consumption.
|
228
|
-
|
229
|
-
|
230
|
-
## 2.0.9 2013-09-19
|
231
|
-
|
232
|
-
* Interface Change: Changed batch.scan_form to batch.create_scan_form to support the ability to refer to scan forms associated to batches.
|
233
|
-
|
234
|
-
|
235
|
-
## 2.0.3 2013-07-31
|
236
|
-
|
237
|
-
* API Addition: Tracker resource added. Trackers can be used to register any tracking code with EasyPost webhooks.
|
238
|
-
|
239
|
-
|
240
|
-
## 2.0.2 2013-07-23
|
241
|
-
|
242
|
-
* API Addition: Shipment.track_with_code returns tracking details for any tracking code.
|
243
|
-
|
244
|
-
|
245
|
-
## 2.0.1 2013-07-07
|
246
|
-
|
247
|
-
* API Addition: Address.create_and_verify returns a verified address in one step.
|
248
|
-
* API Addition: Shipment.label forces the creation of additional label formats (pdf, epl2, zpl).
|
249
|
-
* API Addition: Shipment.insure purchases insurance for a shipment.
|
250
|
-
* Library Update: Added the ability to negatively filter carriers and services with Shipment.lowest_rate (e.g. '!usps').
|
260
|
+
## v1.0.0 (2012-11-02)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -100,14 +100,57 @@ Up-to-date documentation at: https://easypost.com/docs
|
|
100
100
|
## Development
|
101
101
|
|
102
102
|
```bash
|
103
|
-
# Run tests
|
104
|
-
|
103
|
+
# Run tests (coverage is generated on a successful test suite run)
|
104
|
+
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... bundle exec rspec
|
105
105
|
```
|
106
106
|
|
107
|
-
##
|
107
|
+
## Custom connections
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
109
|
+
Set `EasyPost.default_connection` to an object that responds to `call(method, path, api_key = nil, body = nil)`
|
110
|
+
|
111
|
+
### Faraday
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
require 'faraday'
|
115
|
+
require 'faraday/response/logger'
|
116
|
+
require 'logger'
|
117
|
+
|
118
|
+
EasyPost.default_connection = lambda do |method, path, api_key = nil, body = nil|
|
119
|
+
Faraday
|
120
|
+
.new(url: EasyPost.api_base, headers: EasyPost.default_headers) { |builder|
|
121
|
+
builder.use Faraday::Response::Logger, Logger.new(STDOUT), {bodies: true, headers: true}
|
122
|
+
builder.adapter :net_http
|
123
|
+
}
|
124
|
+
.public_send(method, path) { |request|
|
125
|
+
request.headers['Authorization'] = EasyPost.authorization(api_key)
|
126
|
+
request.body = JSON.dump(EasyPost::Util.objects_to_ids(body)) if body
|
127
|
+
}.yield_self { |response|
|
128
|
+
EasyPost.parse_response(
|
129
|
+
status: response.status,
|
130
|
+
body: response.body,
|
131
|
+
json: response.headers['Content-Type'].start_with?('application/json'),
|
132
|
+
)
|
133
|
+
}
|
134
|
+
end
|
135
|
+
```
|
136
|
+
|
137
|
+
### Typhoeus
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
require 'typhoeus'
|
141
|
+
|
142
|
+
EasyPost.default_connection = lambda do |method, path, api_key = nil, body = nil|
|
143
|
+
Typhoeus.public_send(
|
144
|
+
method,
|
145
|
+
File.join(EasyPost.api_base, path),
|
146
|
+
headers: EasyPost.default_headers.merge('Authorization' => EasyPost.authorization(api_key)),
|
147
|
+
body: body.nil? ? nil : JSON.dump(EasyPost::Util.objects_to_ids(body)),
|
148
|
+
).yield_self { |response|
|
149
|
+
EasyPost.parse_response(
|
150
|
+
status: response.code,
|
151
|
+
body: response.body,
|
152
|
+
json: response.headers['Content-Type'].start_with?('application/json'),
|
153
|
+
)
|
154
|
+
}
|
155
|
+
end
|
156
|
+
```
|
data/Rakefile
CHANGED
data/UPGRADE_GUIDE.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# Upgrade Guide
|
2
|
+
|
3
|
+
Use the following guide to assist in the upgrade process of the `easypost-ruby` library between major versions.
|
4
|
+
|
5
|
+
## Upgrading from 3.x to 4.0
|
6
|
+
|
7
|
+
### 4.0 High Impact Changes
|
8
|
+
|
9
|
+
* [Updating Dependencies](#40-updating-dependencies)
|
10
|
+
|
11
|
+
### 4.0 Medium Impact Changes
|
12
|
+
|
13
|
+
* [Removal of `get_rates` Shipment Method](#40-removal-of-getrates-shipment-method)
|
14
|
+
|
15
|
+
### 4.0 Low Impact Changes
|
16
|
+
|
17
|
+
* [Removal of `Print` and `PrintJob` Objects](#40-removal-of-print-and-printjob-objects)
|
18
|
+
* [Removal of `stamp_and_barcode_by_reference` Batch Method](#40-removal-of-stampandbarcodebyreference-batch-method)
|
19
|
+
* [Removal of `Address.verify` Parameters](#40-removal-of-addressverify-parameters)
|
20
|
+
* [Removal of the `http_status` Property on EasyPost::Error](#40-removal-of-httpstatus-property-on-easyposterror)
|
21
|
+
|
22
|
+
## 4.0 Updating Dependencies
|
23
|
+
|
24
|
+
Likelihood of Impact: High
|
25
|
+
|
26
|
+
**Ruby 2.5 Required**
|
27
|
+
|
28
|
+
easypost-ruby now requires Ruby 2.5 or greater.
|
29
|
+
|
30
|
+
**Dependencies**
|
31
|
+
|
32
|
+
No production dependencies were altered. Development dependencies were all bumped and `simplecov` and `rubocop` were introduced.
|
33
|
+
|
34
|
+
## 4.0 Removal of get_rates Shipment Method
|
35
|
+
|
36
|
+
Likelihood of Impact: Medium
|
37
|
+
|
38
|
+
The HTTP method used for the `get_rates` endpoint at the API level has changed from `POST` to `GET` and will only retrieve rates for a shipment instead of regenerating them. A new `/rerate` endpoint has been introduced to replace this functionality; In this library, you can now call the `Shipment.regenerate_rates` method to regenerate rates. Due to the logic change, the `get_rates` method has been removed since a Shipment inherently already has rates associated.
|
39
|
+
|
40
|
+
## 4.0 Removal of Print and PrintJob Objects
|
41
|
+
|
42
|
+
Likelihood of Impact: Low
|
43
|
+
|
44
|
+
The `Print` and `PrintJob` objects have been removed as they are no longer usable with the current version of the API.
|
45
|
+
|
46
|
+
## 4.0 Removal of stamp_and_barcode_by_reference Batch Method
|
47
|
+
|
48
|
+
Likelihood of Impact: Low
|
49
|
+
|
50
|
+
The `stamp_and_barcode_by_reference` Batch method has been removed as it is no longer usable with the current version of the API.
|
51
|
+
|
52
|
+
## 4.0 Removal of Address.verify Parameters
|
53
|
+
|
54
|
+
Likelihood of Impact: Low
|
55
|
+
|
56
|
+
The parameters for the `Address.verify` method were removed as they were unusable, the current version of the API does not allow you to verify an address by specifying a carrier.
|
57
|
+
|
58
|
+
## 4.0 Removal of http_status Property on EasyPost::Error
|
59
|
+
|
60
|
+
Likelihood of Impact: Low
|
61
|
+
|
62
|
+
The deprecated `http_status` property has been removed in favor of the `status` property on the EasyPost::Error object.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
4.1.1
|
data/bin/easypost-irb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
3
5
|
|
4
|
-
libs =
|
5
|
-
libs <<
|
6
|
-
puts
|
6
|
+
libs = ' -r irb/completion'
|
7
|
+
libs << " -r #{"#{File.dirname(__FILE__)}/../lib/easypost"}"
|
8
|
+
puts 'Initializing EasyPost...'
|
7
9
|
exec "#{irb} #{libs} --simple-prompt"
|