easypost 3.3.0 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{CHANGELOG → CHANGELOG.md} +61 -74
- data/README.md +21 -15
- data/VERSION +1 -1
- data/lib/easypost/api_key.rb +2 -0
- data/lib/easypost/brand.rb +9 -0
- data/lib/easypost/object.rb +4 -0
- data/lib/easypost/shipment.rb +7 -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 +51 -29
- data/lib/easypost.rb +25 -19
- metadata +10 -8
- 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: c893399d43b9432c0b6812c5649ab48ad2ad1c04b6373e7999cc8c1fdf22d82b
|
4
|
+
data.tar.gz: f98230c21010af6117011b0ddee1a1bda574a821fc5ae470a85e4961e72954ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1822930673f844b99cc6f53ea4c5564b54342590383433ee359f4c3420d56ddbd3cc166d4d2e1975b52a848c95d6854b1b0e79245e3a9b9660ee309a795f5b99
|
7
|
+
data.tar.gz: b7fa805a9b6cc8a65b3076828f9bd5740709475b4d63824d34dc4981c9ea779af1c9eff273d546e59c7e79d0b7002f9dbbd3353d5faad2911e6615495cbec6cc
|
data/{CHANGELOG → CHANGELOG.md}
RENAMED
@@ -1,221 +1,208 @@
|
|
1
|
-
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## 3.5.1 2022-07-01
|
4
|
+
|
5
|
+
* Backports newer user-agent header
|
6
|
+
|
7
|
+
## 3.5.0 2021-12-06
|
8
|
+
|
9
|
+
* Adds the `update_brand` method to the user object (closes #122)
|
10
|
+
|
11
|
+
## 3.4.0 2021-07-13
|
12
|
+
|
13
|
+
* Removed deprecated `Item` object
|
14
|
+
* Sorted EasyPost Resources list
|
15
|
+
* Remove 2015-vintage experimental `all_updated` method on Tracker
|
16
|
+
* Fixes API key retrieval (#120, thanks @andychongyz)
|
17
|
+
* Adds `regenerate_rates` method for new rerate API
|
18
|
+
* Adds `deconstruct_keys` method to allow for pattern matching on EasyPost objects
|
19
|
+
|
20
|
+
## 3.3.0 2021-06-10
|
2
21
|
|
3
22
|
* Adds `SmartRate` functionality to the `Shipments` object (available by calling `get_smartrates` on a shipment)
|
4
23
|
* Fix bug where `EasyPost::CarrierAccount.types` was hitting the wrong endpoint
|
5
24
|
|
6
|
-
|
25
|
+
## 3.2.0 2021-01-14
|
7
26
|
|
8
27
|
* Replace Travis CI with Github Actions
|
9
28
|
* Add Ruby 3.0 to supported platforms (#110; thanks @maxwell)
|
10
29
|
|
11
|
-
|
30
|
+
## 3.1.5 2020-12-16
|
12
31
|
|
13
32
|
* Fix attribute lookup when manually constructing objects (#105; thanks @drewtempelmeyer)
|
14
33
|
* Flatten class names and clean up some other style issues
|
15
34
|
* Fix `EasyPost::Address.create_and_verify`, broken since 3.1.0 (#108; thanks @rajbirverma)
|
16
35
|
|
17
|
-
|
36
|
+
## 3.1.4 2020-09-29
|
18
37
|
|
19
38
|
* Don't modify params passed into Address#create (#78; thanks @TheRusskiy)
|
20
39
|
* Don't modify `carriers` and `services` parameters to `Shipment.lowest_rate` (#71 / #103, thanks @vladvinnikov and @jurisgalang)
|
21
40
|
* When constructing an easypost object, convert the key to a string (#102; thanks @Geesu)
|
22
41
|
* Expose the raw HTTP response as `#http_body` on `EasyPost::Error` objects (#101; thanks @Geesu)
|
23
42
|
|
24
|
-
|
43
|
+
## 3.1.3 2020-06-26
|
25
44
|
|
26
45
|
* Fix bug causing Authorization header to be included in User-Agent header. All users must upgrade.
|
27
46
|
|
28
|
-
|
47
|
+
## 3.1.2 2020-06-24
|
29
48
|
|
30
49
|
* Bad gem push. New version required.
|
31
50
|
|
32
|
-
|
51
|
+
## 3.1.1 2020-06-23
|
33
52
|
|
34
53
|
* Fix bug where EasyPost.http_config was invalid when not explicitly initialized.
|
35
54
|
|
36
|
-
|
55
|
+
## 3.1.0 2020-06-23
|
37
56
|
|
38
57
|
* Add Shipment Invoice and Refund Report
|
39
58
|
* Remove dependencies on `RestClient` and `MultiJson`
|
40
59
|
* Remove some deprecated endpoints
|
41
60
|
|
42
|
-
|
61
|
+
## 3.0.1 2018-05-17
|
43
62
|
|
44
63
|
* Enforce TLS certificate validity by default
|
45
64
|
|
46
|
-
|
65
|
+
## 3.0.0 2018-02-15
|
47
66
|
|
48
67
|
* Require use of ruby ~> 2.0 and TLSv1.2
|
49
68
|
|
50
|
-
|
51
|
-
=== 2.7.3 2018-02-05
|
69
|
+
## 2.7.3 2018-02-05
|
52
70
|
|
53
71
|
* Fix bug with introduced around certain JSON objects with IDs (thanks vladvinnikov!)
|
54
72
|
|
55
|
-
|
56
|
-
=== 2.7.2 2018-02-01
|
73
|
+
## 2.7.2 2018-02-01
|
57
74
|
|
58
75
|
* Removed unused and unsupported code paths for Container model
|
59
76
|
* Removed unused and unsupported code path for Stamp and Barcode methods on the Shipment model
|
60
77
|
* Fixed a bug with non-model JSON object with an "id" key being treated as models and raising errors
|
61
78
|
|
62
|
-
|
63
|
-
=== 2.7.1 2017-05-25
|
79
|
+
## 2.7.1 2017-05-25
|
64
80
|
|
65
81
|
* Allow reports to be retrieved without passing a type
|
66
82
|
|
67
|
-
|
68
|
-
=== 2.7.0 2017-04-04
|
83
|
+
## 2.7.0 2017-04-04
|
69
84
|
|
70
85
|
* Changed Report CRUD signatures. requires report type to be passed
|
71
86
|
|
72
|
-
|
73
|
-
=== 2.6.2 2017-02-14
|
87
|
+
## 2.6.2 2017-02-14
|
74
88
|
|
75
89
|
* Added get_rates method for Orders
|
76
90
|
|
77
|
-
|
78
|
-
=== 2.6.1 2017-01-19
|
91
|
+
## 2.6.1 2017-01-19
|
79
92
|
|
80
93
|
* Updated create method for ScanForms
|
81
94
|
|
82
|
-
|
83
|
-
=== 2.6.0 2017-01-17
|
95
|
+
## 2.6.0 2017-01-17
|
84
96
|
|
85
97
|
* Add basic CRUD methods for Webhooks
|
86
98
|
|
87
|
-
|
88
|
-
=== 2.5.0 2016-12-19
|
99
|
+
## 2.5.0 2016-12-19
|
89
100
|
|
90
101
|
* Add prefixes to report in utils
|
91
102
|
|
92
|
-
|
93
|
-
=== 2.4.0 2016-12-08
|
103
|
+
## 2.4.0 2016-12-08
|
94
104
|
|
95
105
|
* Add report resource to ruby client
|
96
106
|
|
97
|
-
|
98
|
-
=== 2.3.0 2016-11-25
|
107
|
+
## 2.3.0 2016-11-25
|
99
108
|
|
100
109
|
* Updated dependencies to allow rest-client 2.0.0 and above
|
101
110
|
|
102
|
-
|
103
|
-
=== 2.2.0 2016-07-26
|
111
|
+
## 2.2.0 2016-07-26
|
104
112
|
|
105
113
|
* Added standalone Insurance model
|
106
114
|
|
107
|
-
|
108
|
-
=== 2.1.11 2016-02-04
|
115
|
+
## 2.1.11 2016-02-04
|
109
116
|
|
110
117
|
* Allowed user creation for top-level users
|
111
118
|
|
112
|
-
|
113
|
-
=== 2.1.10 2015-12-23
|
119
|
+
## 2.1.10 2015-12-23
|
114
120
|
|
115
121
|
* Added verify and verify_strict params to Address.create
|
116
122
|
* Added Tracker.create_list and Tracker.all_updated for working with large
|
117
123
|
numbers of Trackers.
|
118
124
|
|
119
|
-
|
120
|
-
=== 2.1.9 2015-11-04
|
125
|
+
## 2.1.9 2015-11-04
|
121
126
|
|
122
127
|
* Added new tests for Tracker.all
|
123
128
|
* Updated some old examples
|
124
129
|
|
125
|
-
|
126
|
-
=== 2.1.8 2015-10-21
|
130
|
+
## 2.1.8 2015-10-21
|
127
131
|
|
128
132
|
* Added Cancel method for Pickups (thanks Ramie Blatt!)
|
129
133
|
|
130
|
-
|
131
|
-
=== 2.1.7 2015-10-05
|
134
|
+
## 2.1.7 2015-10-05
|
132
135
|
|
133
136
|
* Fixed Address.create_and_verify and changed how errors are raised (thanks Dimitri Roche!)
|
134
137
|
* Require newer version of the multi_json package
|
135
138
|
|
136
|
-
|
137
|
-
=== 2.1.6 2015-06-10
|
139
|
+
## 2.1.6 2015-06-10
|
138
140
|
|
139
141
|
* Added Address message accessor for backwards compatability
|
140
142
|
|
141
|
-
|
142
|
-
=== 2.1.5 2015-06-10
|
143
|
+
## 2.1.5 2015-06-10
|
143
144
|
|
144
145
|
* Removed Address.message
|
145
146
|
|
146
|
-
|
147
|
-
=== 2.1.4 2015-06-03
|
147
|
+
## 2.1.4 2015-06-03
|
148
148
|
|
149
149
|
* Add Printer and PrintJob resources.
|
150
150
|
|
151
|
-
|
152
|
-
=== 2.1.3 2015-04-30
|
151
|
+
## 2.1.3 2015-04-30
|
153
152
|
|
154
153
|
* Bux fix, EasyPost::Errors no longer break with a nil json body.
|
155
154
|
|
156
|
-
|
157
|
-
=== 2.1.2 2015-04-29
|
155
|
+
## 2.1.2 2015-04-29
|
158
156
|
|
159
157
|
* EasyPost::Errors now correctly parse field errors and error codes.
|
160
158
|
|
161
|
-
|
162
|
-
=== 2.1.1 2015-04-15
|
159
|
+
## 2.1.1 2015-04-15
|
163
160
|
|
164
161
|
* CarrierAccount will now correctly save in-place modifications to credentials
|
165
162
|
* Nested variables should now be saved correctly across all models
|
166
163
|
* Fixed version numbering confusion (the previous version was 2.0.15, not 2.1.0)
|
167
164
|
|
168
|
-
|
169
|
-
=== 2.0.15 2015-04-15
|
165
|
+
## 2.0.15 2015-04-15
|
170
166
|
|
171
167
|
* Added tracker to shipment buy response
|
172
168
|
* Updated tracker tests
|
173
169
|
|
174
|
-
|
175
|
-
=== 2.0.14 2015-04-15
|
170
|
+
## 2.0.14 2015-04-15
|
176
171
|
|
177
172
|
* Added User and CarrierAccount models with CRUD functionality
|
178
173
|
|
179
|
-
|
180
|
-
=== 2.0.13 2014-10-30
|
174
|
+
## 2.0.13 2014-10-30
|
181
175
|
|
182
176
|
* Added Pickup, PickupRate resources.
|
183
177
|
* Added ability to pass api_key to a few resources that were missing it.
|
184
178
|
|
185
|
-
|
186
|
-
=== 2.0.12 2014-07-07
|
179
|
+
## 2.0.12 2014-07-07
|
187
180
|
|
188
181
|
* Added Item, Container, and Order resources.
|
189
182
|
* Fixed and added a lot of tests.
|
190
183
|
|
191
|
-
|
192
|
-
=== 2.0.11 2013-12-16
|
184
|
+
## 2.0.11 2013-12-16
|
193
185
|
|
194
186
|
* Added Event.receive method for parsing events sent by webhook.
|
195
187
|
* Fixed tests to account for the tracking code returning and array of details instead of a Hash
|
196
188
|
|
197
|
-
|
198
|
-
=== 2.0.10 2013-10-03
|
189
|
+
## 2.0.10 2013-10-03
|
199
190
|
|
200
191
|
* API Addition: Event resource added for webhook consumption.
|
201
192
|
|
202
|
-
|
203
|
-
=== 2.0.9 2013-09-19
|
193
|
+
## 2.0.9 2013-09-19
|
204
194
|
|
205
195
|
* Interface Change: Changed batch.scan_form to batch.create_scan_form to support the ability to refer to scan forms associated to batches.
|
206
196
|
|
207
|
-
|
208
|
-
=== 2.0.3 2013-07-31
|
197
|
+
## 2.0.3 2013-07-31
|
209
198
|
|
210
199
|
* API Addition: Tracker resource added. Trackers can be used to register any tracking code with EasyPost webhooks.
|
211
200
|
|
212
|
-
|
213
|
-
=== 2.0.2 2013-07-23
|
201
|
+
## 2.0.2 2013-07-23
|
214
202
|
|
215
203
|
* API Addition: Shipment.track_with_code returns tracking details for any tracking code.
|
216
204
|
|
217
|
-
|
218
|
-
=== 2.0.1 2013-07-07
|
205
|
+
## 2.0.1 2013-07-07
|
219
206
|
|
220
207
|
* API Addition: Address.create_and_verify returns a verified address in one step.
|
221
208
|
* API Addition: Shipment.label forces the creation of additional label formats (pdf, epl2, zpl).
|
data/README.md
CHANGED
@@ -4,29 +4,27 @@
|
|
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.1
|
data/lib/easypost/object.rb
CHANGED
data/lib/easypost/shipment.rb
CHANGED
@@ -6,6 +6,13 @@ 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
|
+
|
9
16
|
def get_smartrates
|
10
17
|
response = EasyPost.make_request(:get, url + '/smartrate', @api_key)
|
11
18
|
|
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
@@ -1,4 +1,27 @@
|
|
1
1
|
module EasyPost::Util
|
2
|
+
attr_accessor :os_name, :os_version, :os_arch
|
3
|
+
|
4
|
+
def self.os_name
|
5
|
+
case RUBY_PLATFORM
|
6
|
+
when /linux/i
|
7
|
+
'Linux'
|
8
|
+
when /darwin/i
|
9
|
+
'Darwin'
|
10
|
+
when /cygwin|mswin|mingw|bccwin|wince|emx/i
|
11
|
+
'Windows'
|
12
|
+
else
|
13
|
+
'Unknown'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.os_version
|
18
|
+
Gem::Platform.local.version
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.os_arch
|
22
|
+
Gem::Platform.local.cpu
|
23
|
+
end
|
24
|
+
|
2
25
|
def self.objects_to_ids(obj)
|
3
26
|
case obj
|
4
27
|
when EasyPost::Resource
|
@@ -22,63 +45,62 @@ module EasyPost::Util
|
|
22
45
|
def self.convert_to_easypost_object(response, api_key, parent=nil, name=nil)
|
23
46
|
types = {
|
24
47
|
'Address' => EasyPost::Address,
|
25
|
-
'
|
26
|
-
'
|
48
|
+
'Batch' => EasyPost::Batch,
|
49
|
+
'CarrierAccount' => EasyPost::CarrierAccount,
|
27
50
|
'CustomsInfo' => EasyPost::CustomsInfo,
|
28
|
-
'
|
29
|
-
'Shipment' => EasyPost::Shipment,
|
30
|
-
'Rate' => EasyPost::Rate,
|
31
|
-
'Refund' => EasyPost::Refund,
|
51
|
+
'CustomsItem' => EasyPost::CustomsItem,
|
32
52
|
'Event' => EasyPost::Event,
|
33
|
-
'Batch' => EasyPost::Batch,
|
34
|
-
'Tracker' => EasyPost::Tracker,
|
35
|
-
'Item' => EasyPost::Item,
|
36
53
|
'Insurance' => EasyPost::Insurance,
|
37
54
|
'Order' => EasyPost::Order,
|
55
|
+
'Parcel' => EasyPost::Parcel,
|
56
|
+
'PaymentLogReport' => EasyPost::Report,
|
38
57
|
'Pickup' => EasyPost::Pickup,
|
39
58
|
'PickupRate' => EasyPost::PickupRate,
|
40
59
|
'PostageLabel' => EasyPost::PostageLabel,
|
41
60
|
'Printer' => EasyPost::Printer,
|
42
61
|
'PrintJob' => EasyPost::PrintJob,
|
43
|
-
'
|
44
|
-
'
|
62
|
+
'Rate' => EasyPost::Rate,
|
63
|
+
'Refund' => EasyPost::Refund,
|
64
|
+
'RefundReport' => EasyPost::Report,
|
45
65
|
'Report' => EasyPost::Report,
|
66
|
+
'ScanForm' => EasyPost::ScanForm,
|
67
|
+
'Shipment' => EasyPost::Shipment,
|
68
|
+
'TaxIdentifier' => EasyPost::TaxIdentifier,
|
69
|
+
'ShipmentInvoiceReport' => EasyPost::Report,
|
46
70
|
'ShipmentReport' => EasyPost::Report,
|
47
|
-
'
|
71
|
+
'Tracker' => EasyPost::Tracker,
|
48
72
|
'TrackerReport' => EasyPost::Report,
|
49
|
-
'
|
50
|
-
'ShipmentInvoiceReport' => EasyPost::Report,
|
73
|
+
'User' => EasyPost::User,
|
51
74
|
'Webhook' => EasyPost::Webhook
|
52
75
|
}
|
53
76
|
|
54
77
|
prefixes = {
|
55
78
|
'adr' => EasyPost::Address,
|
56
|
-
'
|
57
|
-
'
|
79
|
+
'batch' => EasyPost::Batch,
|
80
|
+
'ca' => EasyPost::CarrierAccount,
|
58
81
|
'cstinfo' => EasyPost::CustomsInfo,
|
59
|
-
'
|
60
|
-
'shp' => EasyPost::Shipment,
|
61
|
-
'rate' => EasyPost::Rate,
|
62
|
-
'rfnd' => EasyPost::Refund,
|
82
|
+
'cstitem' => EasyPost::CustomsItem,
|
63
83
|
'evt' => EasyPost::Event,
|
64
|
-
'
|
65
|
-
'trk' => EasyPost::Tracker,
|
66
|
-
'item' => EasyPost::Item,
|
84
|
+
'hook' => EasyPost::Webhook,
|
67
85
|
'ins' => EasyPost::Insurance,
|
68
86
|
'order' => EasyPost::Order,
|
69
87
|
'pickup' => EasyPost::Pickup,
|
70
88
|
'pickuprate' => EasyPost::PickupRate,
|
71
89
|
'pl' => EasyPost::PostageLabel,
|
90
|
+
'plrep' => EasyPost::Report,
|
91
|
+
'prcl' => EasyPost::Parcel,
|
72
92
|
'printer' => EasyPost::Printer,
|
73
93
|
'printjob' => EasyPost::PrintJob,
|
74
|
-
'
|
75
|
-
'user' => EasyPost::User,
|
76
|
-
'shprep' => EasyPost::Report,
|
77
|
-
'plrep' => EasyPost::Report,
|
78
|
-
'trkrep' => EasyPost::Report,
|
94
|
+
'rate' => EasyPost::Rate,
|
79
95
|
'refrep' => EasyPost::Report,
|
96
|
+
'rfnd' => EasyPost::Refund,
|
97
|
+
'sf' => EasyPost::ScanForm,
|
98
|
+
'shp' => EasyPost::Shipment,
|
80
99
|
'shpinvrep' => EasyPost::Report,
|
81
|
-
'
|
100
|
+
'shprep' => EasyPost::Report,
|
101
|
+
'trk' => EasyPost::Tracker,
|
102
|
+
'trkrep' => EasyPost::Report,
|
103
|
+
'user' => EasyPost::User
|
82
104
|
}
|
83
105
|
|
84
106
|
case response
|
data/lib/easypost.rb
CHANGED
@@ -2,37 +2,41 @@ 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/
|
31
|
-
require "easypost/
|
28
|
+
require "easypost/printer"
|
29
|
+
require "easypost/rate"
|
30
|
+
require "easypost/refund"
|
32
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"
|
33
37
|
require "easypost/webhook"
|
34
38
|
|
35
|
-
require
|
39
|
+
require 'easypost/util'
|
36
40
|
|
37
41
|
module EasyPost
|
38
42
|
@api_key = nil
|
@@ -123,7 +127,9 @@ module EasyPost
|
|
123
127
|
end
|
124
128
|
|
125
129
|
request["Content-Type"] = "application/json"
|
126
|
-
request["User-Agent"] = "EasyPost/v2 RubyClient/#{VERSION} Ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
|
130
|
+
request["User-Agent"] = "EasyPost/v2 RubyClient/#{EasyPost::VERSION} Ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} " \
|
131
|
+
"OS/#{EasyPost::Util.os_name} OSVersion/#{EasyPost::Util.os_version} " \
|
132
|
+
"OSArch/#{EasyPost::Util.os_arch}"
|
127
133
|
if api_key = api_key || @api_key
|
128
134
|
request["Authorization"] = "Basic #{Base64.strict_encode64("#{api_key}:")}"
|
129
135
|
end
|
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.1
|
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: 2022-07-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pry
|
@@ -91,7 +91,7 @@ extra_rdoc_files: []
|
|
91
91
|
files:
|
92
92
|
- ".github/workflows/ci.yml"
|
93
93
|
- ".gitignore"
|
94
|
-
- CHANGELOG
|
94
|
+
- CHANGELOG.md
|
95
95
|
- Gemfile
|
96
96
|
- LICENSE
|
97
97
|
- README.md
|
@@ -101,7 +101,9 @@ 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
|
106
108
|
- lib/easypost/carrier_type.rb
|
107
109
|
- lib/easypost/customs_info.rb
|
@@ -109,7 +111,6 @@ files:
|
|
109
111
|
- lib/easypost/error.rb
|
110
112
|
- lib/easypost/event.rb
|
111
113
|
- lib/easypost/insurance.rb
|
112
|
-
- lib/easypost/item.rb
|
113
114
|
- lib/easypost/object.rb
|
114
115
|
- lib/easypost/order.rb
|
115
116
|
- lib/easypost/parcel.rb
|
@@ -124,6 +125,7 @@ files:
|
|
124
125
|
- lib/easypost/resource.rb
|
125
126
|
- lib/easypost/scan_form.rb
|
126
127
|
- lib/easypost/shipment.rb
|
128
|
+
- lib/easypost/tax_identifier.rb
|
127
129
|
- lib/easypost/tracker.rb
|
128
130
|
- lib/easypost/user.rb
|
129
131
|
- lib/easypost/util.rb
|
@@ -133,7 +135,7 @@ homepage: https://www.easypost.com/docs
|
|
133
135
|
licenses:
|
134
136
|
- MIT
|
135
137
|
metadata: {}
|
136
|
-
post_install_message:
|
138
|
+
post_install_message:
|
137
139
|
rdoc_options: []
|
138
140
|
require_paths:
|
139
141
|
- lib
|
@@ -148,8 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
150
|
- !ruby/object:Gem::Version
|
149
151
|
version: '0'
|
150
152
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
152
|
-
signing_key:
|
153
|
+
rubygems_version: 3.3.11
|
154
|
+
signing_key:
|
153
155
|
specification_version: 4
|
154
156
|
summary: EasyPost Ruby Client Library
|
155
157
|
test_files: []
|
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
|