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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9e4ea3a1f185f475aac49ab7985092a8ba095e928a812ad77c68eb7b450afdc
4
- data.tar.gz: b1291c1f7325559896f109257231fba6f0e781e7f9778c619ec115a86abf9731
3
+ metadata.gz: 61c0e0c8eb25bf4d96db43cd812a71df8648e2b1a77f2eef5d651bb4c1275cbf
4
+ data.tar.gz: ac36be5df27407e988d4fcc50c93a312fe8e1465cba96e85c8120d36acdfcf65
5
5
  SHA512:
6
- metadata.gz: f3c88ce92a498fa4a0bb45e4d0ca06aeee55158af398632ddce04c0513b0e3dae99f27d1d752f3fb6e69daf3cc536d3872c4c18ba141e20eab9e60fdc58872ae
7
- data.tar.gz: ec5ec3ad97341782372ba9c7b3e836b451a8c23dd5b9bf27e51dfcfeb561eb1140751c9529b13bbe8b384151ac5023628dff6803fe70a57a4b34070b1d83d64a
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
@@ -1,211 +1,248 @@
1
- === 3.1.5 2020-12-16
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
- === 3.1.4 2020-09-29
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
- === 3.1.3 2020-06-26
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
- === 3.1.2 2020-06-24
50
+
51
+ ## 3.1.2 2020-06-24
19
52
 
20
53
  * Bad gem push. New version required.
21
54
 
22
- === 3.1.1 2020-06-23
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
- === 3.1.0 2020-06-23
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
- === 3.0.1 2018-05-17
67
+
68
+ ## 3.0.1 2018-05-17
33
69
 
34
70
  * Enforce TLS certificate validity by default
35
71
 
36
- === 3.0.0 2018-02-09
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
- === 2.7.3 2017-05-25
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
- === 2.7.2 2018-01-31
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
- === 2.7.1 2017-05-25
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
- === 2.7.0 2017-04-04
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
- === 2.6.2 2017-02-14
100
+ ## 2.6.2 2017-02-14
64
101
 
65
102
  * Added get_rates method for Orders
66
103
 
67
104
 
68
- === 2.6.1 2017-01-19
105
+ ## 2.6.1 2017-01-19
69
106
 
70
107
  * Updated create method for ScanForms
71
108
 
72
109
 
73
- === 2.6.0 2017-01-17
110
+ ## 2.6.0 2017-01-17
74
111
 
75
112
  * Add basic CRUD methods for Webhooks
76
113
 
77
114
 
78
- === 2.5.0 2016-12-19
115
+ ## 2.5.0 2016-12-19
79
116
 
80
117
  * Add prefixes to report in utils
81
118
 
82
119
 
83
- === 2.4.0 2016-12-08
120
+ ## 2.4.0 2016-12-08
84
121
 
85
122
  * Add report resource to ruby client
86
123
 
87
124
 
88
- === 2.3.0 2016-11-25
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
- === 2.2.0 2016-07-26
130
+ ## 2.2.0 2016-07-26
94
131
 
95
132
  * Added standalone Insurance model
96
133
 
97
134
 
98
- === 2.1.11 2016-02-04
135
+ ## 2.1.11 2016-02-04
99
136
 
100
137
  * Allowed user creation for top-level users
101
138
 
102
139
 
103
- === 2.1.10 2015-12-23
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
- === 2.1.9 2015-11-04
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
- === 2.1.8 2015-10-21
153
+ ## 2.1.8 2015-10-21
117
154
 
118
155
  * Added Cancel method for Pickups (thanks Ramie Blatt!)
119
156
 
120
157
 
121
- === 2.1.7 2015-10-05
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
- === 2.1.6 2015-06-10
164
+ ## 2.1.6 2015-06-10
128
165
 
129
166
  * Added Address message accessor for backwards compatability
130
167
 
131
168
 
132
- === 2.1.5 2015-06-10
169
+ ## 2.1.5 2015-06-10
133
170
 
134
171
  * Removed Address.message
135
172
 
136
173
 
137
- === 2.1.4 2015-06-03
174
+ ## 2.1.4 2015-06-03
138
175
 
139
176
  * Add Printer and PrintJob resources.
140
177
 
141
178
 
142
- === 2.1.3 2015-04-30
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
- === 2.1.2 2015-04-29
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
- === 2.1.1 2015-04-15
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
- === 2.0.15 2015-04-15
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
- === 2.0.14 2015-04-15
202
+ ## 2.0.14 2015-04-15
166
203
 
167
204
  * Added User and CarrierAccount models with CRUD functionality
168
205
 
169
206
 
170
- === 2.0.13 2014-10-30
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
- === 2.0.12 2014-07-07
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
- === 2.0.11 2013-12-16
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
- === 2.0.10 2013-10-03
225
+ ## 2.0.10 2013-10-03
189
226
 
190
227
  * API Addition: Event resource added for webhook consumption.
191
228
 
192
229
 
193
- === 2.0.9 2013-09-19
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
- === 2.0.3 2013-07-31
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
- === 2.0.2 2013-07-23
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
- === 2.0.1 2013-07-07
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://travis-ci.com/EasyPost/easypost-ruby.svg?branch=master)](https://travis-ci.com/EasyPost/easypost-ruby)
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 = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
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
- Tests
103
- --------------------
100
+ ## Development
104
101
 
102
+ ```bash
103
+ # Run tests
104
+ API_KEY=123... bundle exec rspec
105
105
  ```
106
- rspec spec
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.5
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 = "~> 2.2"
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"
@@ -0,0 +1,2 @@
1
+ class EasyPost::ApiKey < EasyPost::Resource
2
+ end
@@ -0,0 +1,9 @@
1
+ class EasyPost::Brand < EasyPost::Resource
2
+ def url
3
+ if user_id.nil? || user_id.empty?
4
+ raise EasyPost::Error, "Missing user_id: #{self.class} instance is missing user_id"
5
+ end
6
+
7
+ "#{::EasyPost::User.url}/#{CGI.escape(user_id)}/brand"
8
+ end
9
+ end
@@ -1,6 +1,5 @@
1
1
  class EasyPost::CarrierAccount < EasyPost::Resource
2
2
  def self.types
3
- response = EasyPost.make_request(:get, "/carrier_types", @api_key)
4
- return EasyPost::Util.convert_to_easypost_object(response, api_key)
3
+ EasyPost::CarrierType.all
5
4
  end
6
5
  end
@@ -0,0 +1,2 @@
1
+ class EasyPost::CarrierType < EasyPost::Resource
2
+ end
@@ -75,6 +75,10 @@ class EasyPost::EasyPostObject
75
75
  @values
76
76
  end
77
77
 
78
+ def deconstruct_keys(_keys)
79
+ @values.transform_keys(&:to_sym)
80
+ end
81
+
78
82
  def each(&blk)
79
83
  @values.each(&blk)
80
84
  end
@@ -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
@@ -0,0 +1,2 @@
1
+ class EasyPost::TaxIdentifier < EasyPost::Resource
2
+ end
@@ -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, self.url, api_key, {self.class_name.to_sym => params})
4
- return EasyPost::Util.convert_to_easypost_object(response, api_key)
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
- return self
17
+ self
18
18
  end
19
19
 
20
20
  def self.retrieve_me
21
- self.all
21
+ all
22
22
  end
23
23
 
24
24
  def self.all_api_keys
25
- response = EasyPost.make_request(:get, "/api_keys", @api_key)
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 == self.id
31
+ if api_keys.id == id
33
32
  my_api_keys = api_keys.keys
34
33
  else
35
- for child in api_keys.children
36
- if child.id == self.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
- 'ScanForm' => EasyPost::ScanForm,
26
- 'CustomsItem' => EasyPost::CustomsItem,
25
+ 'Batch' => EasyPost::Batch,
26
+ 'CarrierAccount' => EasyPost::CarrierAccount,
27
27
  'CustomsInfo' => EasyPost::CustomsInfo,
28
- 'Parcel' => EasyPost::Parcel,
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
- 'CarrierAccount' => EasyPost::CarrierAccount,
44
- 'User' => EasyPost::User,
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
- 'PaymentLogReport' => EasyPost::Report,
48
+ 'Tracker' => EasyPost::Tracker,
48
49
  'TrackerReport' => EasyPost::Report,
49
- 'RefundReport' => EasyPost::Report,
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
- 'sf' => EasyPost::ScanForm,
57
- 'cstitem' => EasyPost::CustomsItem,
56
+ 'batch' => EasyPost::Batch,
57
+ 'ca' => EasyPost::CarrierAccount,
58
58
  'cstinfo' => EasyPost::CustomsInfo,
59
- 'prcl' => EasyPost::Parcel,
60
- 'shp' => EasyPost::Shipment,
61
- 'rate' => EasyPost::Rate,
62
- 'rfnd' => EasyPost::Refund,
59
+ 'cstitem' => EasyPost::CustomsItem,
63
60
  'evt' => EasyPost::Event,
64
- 'batch' => EasyPost::Batch,
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
- 'ca' => EasyPost::CarrierAccount,
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
- 'hook' => EasyPost::Webhook
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/parcel"
12
- require "easypost/customs_item"
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/shipment"
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/batch"
22
- require "easypost/tracker"
23
- require "easypost/item"
21
+ require "easypost/insurance"
24
22
  require "easypost/order"
25
- require "easypost/pickup"
23
+ require "easypost/parcel"
26
24
  require "easypost/pickup_rate"
27
- require "easypost/printer"
25
+ require "easypost/pickup"
26
+ require "easypost/postage_label"
28
27
  require "easypost/print_job"
29
- require "easypost/carrier_account"
30
- require "easypost/user"
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.1.5
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: 2020-12-16 00:00:00.000000000 Z
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
- - ".travis.yml"
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.6
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
@@ -1,9 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2
4
- - 2.3
5
- - 2.4
6
- - 2.5
7
- - 2.6
8
- - 2.7
9
- script: "bundle exec rspec"
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