easypost 4.11.0 → 4.12.0
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/CHANGELOG.md +5 -0
- data/README.md +5 -1
- data/VERSION +1 -1
- data/easypost.gemspec +2 -2
- data/lib/easypost/beta/rate.rb +14 -0
- data/lib/easypost/beta.rb +1 -0
- data/lib/easypost/billing.rb +6 -6
- data/lib/easypost/util.rb +52 -0
- metadata +3 -83
- data/docs/EasyPost/Address.html +0 -222
- data/docs/EasyPost/ApiKey.html +0 -99
- data/docs/EasyPost/Batch.html +0 -269
- data/docs/EasyPost/Beta/EndShipper.html +0 -225
- data/docs/EasyPost/Beta/Referral.html +0 -338
- data/docs/EasyPost/Beta.html +0 -91
- data/docs/EasyPost/Billing.html +0 -253
- data/docs/EasyPost/Brand.html +0 -140
- data/docs/EasyPost/CarbonOffset.html +0 -99
- data/docs/EasyPost/CarrierAccount.html +0 -136
- data/docs/EasyPost/CarrierType.html +0 -99
- data/docs/EasyPost/CustomsInfo.html +0 -136
- data/docs/EasyPost/CustomsItem.html +0 -136
- data/docs/EasyPost/EasyPostObject.html +0 -662
- data/docs/EasyPost/EndShipper.html +0 -175
- data/docs/EasyPost/Error.html +0 -258
- data/docs/EasyPost/Event.html +0 -136
- data/docs/EasyPost/Insurance.html +0 -99
- data/docs/EasyPost/Order.html +0 -222
- data/docs/EasyPost/Parcel.html +0 -136
- data/docs/EasyPost/PaymentMethod.html +0 -137
- data/docs/EasyPost/Pickup.html +0 -222
- data/docs/EasyPost/PickupRate.html +0 -99
- data/docs/EasyPost/PostageLabel.html +0 -99
- data/docs/EasyPost/Rate.html +0 -136
- data/docs/EasyPost/Referral.html +0 -334
- data/docs/EasyPost/Refund.html +0 -99
- data/docs/EasyPost/Report.html +0 -167
- data/docs/EasyPost/Resource.html +0 -399
- data/docs/EasyPost/ScanForm.html +0 -137
- data/docs/EasyPost/Shipment.html +0 -456
- data/docs/EasyPost/TaxIdentifier.html +0 -99
- data/docs/EasyPost/Tracker.html +0 -139
- data/docs/EasyPost/User.html +0 -307
- data/docs/EasyPost/Util.html +0 -462
- data/docs/EasyPost/Webhook.html +0 -221
- data/docs/EasyPost.html +0 -440
- data/docs/created.rid +0 -40
- data/docs/css/fonts.css +0 -167
- data/docs/css/rdoc.css +0 -639
- data/docs/fonts/Lato-Light.ttf +0 -0
- data/docs/fonts/Lato-LightItalic.ttf +0 -0
- data/docs/fonts/Lato-Regular.ttf +0 -0
- data/docs/fonts/Lato-RegularItalic.ttf +0 -0
- data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
- data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
- data/docs/images/add.png +0 -0
- data/docs/images/arrow_up.png +0 -0
- data/docs/images/brick.png +0 -0
- data/docs/images/brick_link.png +0 -0
- data/docs/images/bug.png +0 -0
- data/docs/images/bullet_black.png +0 -0
- data/docs/images/bullet_toggle_minus.png +0 -0
- data/docs/images/bullet_toggle_plus.png +0 -0
- data/docs/images/date.png +0 -0
- data/docs/images/delete.png +0 -0
- data/docs/images/find.png +0 -0
- data/docs/images/loadingAnimation.gif +0 -0
- data/docs/images/macFFBgHack.png +0 -0
- data/docs/images/package.png +0 -0
- data/docs/images/page_green.png +0 -0
- data/docs/images/page_white_text.png +0 -0
- data/docs/images/page_white_width.png +0 -0
- data/docs/images/plugin.png +0 -0
- data/docs/images/ruby.png +0 -0
- data/docs/images/tag_blue.png +0 -0
- data/docs/images/tag_green.png +0 -0
- data/docs/images/transparent.png +0 -0
- data/docs/images/wrench.png +0 -0
- data/docs/images/wrench_orange.png +0 -0
- data/docs/images/zoom.png +0 -0
- data/docs/index.html +0 -117
- data/docs/js/darkfish.js +0 -84
- data/docs/js/navigation.js +0 -105
- data/docs/js/navigation.js.gz +0 -0
- data/docs/js/search.js +0 -110
- data/docs/js/search_index.js +0 -1
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +0 -229
- data/docs/js/searcher.js.gz +0 -0
- data/docs/table_of_contents.html +0 -785
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5a3e6fa9af948ab36d6bb75ebf7d744f5580f4225b1181fb1d31bc7f834501bb
|
|
4
|
+
data.tar.gz: 5befe3b07667cb4494249eb6524c5ec8584e3f746475ec9162ae8cc6831ffaab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41e81f89a10321e694087652862c373b41c88a704a02584c5978ba1a72c1554f79d45277bea81c679a4211072e6b9d56b2829c8c2d6b832c74177018dc469b5e
|
|
7
|
+
data.tar.gz: 2f4180afe87daf91d6128e555b1ffb3d3befb1a07f8879dea7918887b0f394723901767c394de5e0f3530d03e24f7c355fdf97c68648b2a5c2f6ef47a09daf69
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -111,7 +111,11 @@ end
|
|
|
111
111
|
|
|
112
112
|
## Documentation
|
|
113
113
|
|
|
114
|
-
API
|
|
114
|
+
API documentation can be found at: <https://easypost.com/docs/api>.
|
|
115
|
+
|
|
116
|
+
Library documentation can be found on the web at: <https://easypost.github.io/easypost-ruby/> or locally in the `docs` directory.
|
|
117
|
+
|
|
118
|
+
Upgrading major versions of this project? Refer to the [Upgrade Guide](UPGRADE_GUIDE.md).
|
|
115
119
|
|
|
116
120
|
## Development
|
|
117
121
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.
|
|
1
|
+
4.12.0
|
data/easypost.gemspec
CHANGED
|
@@ -7,7 +7,7 @@ require 'easypost/version'
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = 'easypost'
|
|
9
9
|
spec.version = EasyPost::VERSION
|
|
10
|
-
spec.
|
|
10
|
+
spec.license = 'MIT'
|
|
11
11
|
spec.summary = 'EasyPost Ruby Client Library'
|
|
12
12
|
spec.description = 'Client library for accessing the EasyPost shipping API via Ruby.'
|
|
13
13
|
spec.authors = 'EasyPost Developers'
|
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
|
15
15
|
spec.homepage = 'https://www.easypost.com/docs'
|
|
16
16
|
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
18
|
-
f.match(%r{^(
|
|
18
|
+
f.match(%r{^(docs|examples|spec)/})
|
|
19
19
|
end
|
|
20
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
21
21
|
spec.require_paths = ['lib']
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# A Rate object contains all the details about the rate of a Shipment.
|
|
4
|
+
class EasyPost::Beta::Rate < EasyPost::Resource
|
|
5
|
+
# Retrieve a list of stateless rates.
|
|
6
|
+
def self.retrieve_stateless_rates(params = {}, api_key = nil)
|
|
7
|
+
wrapped_params = {
|
|
8
|
+
shipment: params,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
response = EasyPost.make_request(:post, '/beta/rates', api_key, wrapped_params)
|
|
12
|
+
EasyPost::Util.convert_to_easypost_object(response['rates'], api_key)
|
|
13
|
+
end
|
|
14
|
+
end
|
data/lib/easypost/beta.rb
CHANGED
data/lib/easypost/billing.rb
CHANGED
|
@@ -6,14 +6,14 @@ class EasyPost::Billing < EasyPost::Resource
|
|
|
6
6
|
protected
|
|
7
7
|
|
|
8
8
|
# Get payment method info (type of the payment method and ID of the payment method)
|
|
9
|
-
def get_payment_method_info(
|
|
9
|
+
def get_payment_method_info(priority)
|
|
10
10
|
payment_methods = EasyPost::Billing.retrieve_payment_methods
|
|
11
11
|
payment_method_map = {
|
|
12
12
|
'primary' => 'primary_payment_method',
|
|
13
13
|
'secondary' => 'secondary_payment_method',
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
payment_method_to_use = payment_method_map[
|
|
16
|
+
payment_method_to_use = payment_method_map[priority]
|
|
17
17
|
|
|
18
18
|
error_string = 'The chosen payment method is not valid. Please try again.'
|
|
19
19
|
raise EasyPost::Error.new(error_string) if payment_methods[payment_method_to_use].nil?
|
|
@@ -35,8 +35,8 @@ class EasyPost::Billing < EasyPost::Resource
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# Fund your EasyPost wallet by charging your primary or secondary card on file.
|
|
38
|
-
def self.fund_wallet(amount,
|
|
39
|
-
payment_info = get_payment_method_info(
|
|
38
|
+
def self.fund_wallet(amount, priority = 'primary', api_key = nil)
|
|
39
|
+
payment_info = get_payment_method_info(priority.downcase)
|
|
40
40
|
endpoint = payment_info[0]
|
|
41
41
|
payment_id = payment_info[1]
|
|
42
42
|
|
|
@@ -48,8 +48,8 @@ class EasyPost::Billing < EasyPost::Resource
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
# Delete a payment method.
|
|
51
|
-
def self.delete_payment_method(
|
|
52
|
-
payment_info = get_payment_method_info(
|
|
51
|
+
def self.delete_payment_method(priority, api_key = nil)
|
|
52
|
+
payment_info = get_payment_method_info(priority.downcase)
|
|
53
53
|
endpoint = payment_info[0]
|
|
54
54
|
payment_id = payment_info[1]
|
|
55
55
|
|
data/lib/easypost/util.rb
CHANGED
|
@@ -228,4 +228,56 @@ module EasyPost::Util
|
|
|
228
228
|
|
|
229
229
|
lowest_rate
|
|
230
230
|
end
|
|
231
|
+
|
|
232
|
+
# Gets the lowest stateless rate.
|
|
233
|
+
# You can exclude by having `'!'` as the first element of your optional filter lists
|
|
234
|
+
def self.get_lowest_stateless_rate(stateless_rates, carriers = [], services = [])
|
|
235
|
+
lowest_rate = nil
|
|
236
|
+
|
|
237
|
+
carriers = EasyPost::Util.normalize_string_list(carriers)
|
|
238
|
+
negative_carriers = []
|
|
239
|
+
carriers_copy = carriers.clone
|
|
240
|
+
carriers_copy.each do |carrier|
|
|
241
|
+
if carrier[0, 1] == '!'
|
|
242
|
+
negative_carriers << carrier[1..-1]
|
|
243
|
+
carriers.delete(carrier)
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
services = EasyPost::Util.normalize_string_list(services)
|
|
248
|
+
negative_services = []
|
|
249
|
+
services_copy = services.clone
|
|
250
|
+
services_copy.each do |service|
|
|
251
|
+
if service[0, 1] == '!'
|
|
252
|
+
negative_services << service[1..-1]
|
|
253
|
+
services.delete(service)
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
stateless_rates.each do |rate|
|
|
258
|
+
rate_carrier = rate.carrier.downcase
|
|
259
|
+
if carriers.size.positive? && !carriers.include?(rate_carrier)
|
|
260
|
+
next
|
|
261
|
+
end
|
|
262
|
+
if negative_carriers.size.positive? && negative_carriers.include?(rate_carrier)
|
|
263
|
+
next
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
rate_service = rate.service.downcase
|
|
267
|
+
if services.size.positive? && !services.include?(rate_service)
|
|
268
|
+
next
|
|
269
|
+
end
|
|
270
|
+
if negative_services.size.positive? && negative_services.include?(rate_service)
|
|
271
|
+
next
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
if lowest_rate.nil? || rate.rate.to_f < lowest_rate.rate.to_f
|
|
275
|
+
lowest_rate = rate
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
raise EasyPost::Error.new('No rates found.') if lowest_rate.nil?
|
|
280
|
+
|
|
281
|
+
lowest_rate
|
|
282
|
+
end
|
|
231
283
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: easypost
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.12.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- EasyPost Developers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-02-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: brakeman
|
|
@@ -203,87 +203,6 @@ files:
|
|
|
203
203
|
- UPGRADE_GUIDE.md
|
|
204
204
|
- VERSION
|
|
205
205
|
- bin/easypost-irb
|
|
206
|
-
- docs/EasyPost.html
|
|
207
|
-
- docs/EasyPost/Address.html
|
|
208
|
-
- docs/EasyPost/ApiKey.html
|
|
209
|
-
- docs/EasyPost/Batch.html
|
|
210
|
-
- docs/EasyPost/Beta.html
|
|
211
|
-
- docs/EasyPost/Beta/EndShipper.html
|
|
212
|
-
- docs/EasyPost/Beta/Referral.html
|
|
213
|
-
- docs/EasyPost/Billing.html
|
|
214
|
-
- docs/EasyPost/Brand.html
|
|
215
|
-
- docs/EasyPost/CarbonOffset.html
|
|
216
|
-
- docs/EasyPost/CarrierAccount.html
|
|
217
|
-
- docs/EasyPost/CarrierType.html
|
|
218
|
-
- docs/EasyPost/CustomsInfo.html
|
|
219
|
-
- docs/EasyPost/CustomsItem.html
|
|
220
|
-
- docs/EasyPost/EasyPostObject.html
|
|
221
|
-
- docs/EasyPost/EndShipper.html
|
|
222
|
-
- docs/EasyPost/Error.html
|
|
223
|
-
- docs/EasyPost/Event.html
|
|
224
|
-
- docs/EasyPost/Insurance.html
|
|
225
|
-
- docs/EasyPost/Order.html
|
|
226
|
-
- docs/EasyPost/Parcel.html
|
|
227
|
-
- docs/EasyPost/PaymentMethod.html
|
|
228
|
-
- docs/EasyPost/Pickup.html
|
|
229
|
-
- docs/EasyPost/PickupRate.html
|
|
230
|
-
- docs/EasyPost/PostageLabel.html
|
|
231
|
-
- docs/EasyPost/Rate.html
|
|
232
|
-
- docs/EasyPost/Referral.html
|
|
233
|
-
- docs/EasyPost/Refund.html
|
|
234
|
-
- docs/EasyPost/Report.html
|
|
235
|
-
- docs/EasyPost/Resource.html
|
|
236
|
-
- docs/EasyPost/ScanForm.html
|
|
237
|
-
- docs/EasyPost/Shipment.html
|
|
238
|
-
- docs/EasyPost/TaxIdentifier.html
|
|
239
|
-
- docs/EasyPost/Tracker.html
|
|
240
|
-
- docs/EasyPost/User.html
|
|
241
|
-
- docs/EasyPost/Util.html
|
|
242
|
-
- docs/EasyPost/Webhook.html
|
|
243
|
-
- docs/created.rid
|
|
244
|
-
- docs/css/fonts.css
|
|
245
|
-
- docs/css/rdoc.css
|
|
246
|
-
- docs/fonts/Lato-Light.ttf
|
|
247
|
-
- docs/fonts/Lato-LightItalic.ttf
|
|
248
|
-
- docs/fonts/Lato-Regular.ttf
|
|
249
|
-
- docs/fonts/Lato-RegularItalic.ttf
|
|
250
|
-
- docs/fonts/SourceCodePro-Bold.ttf
|
|
251
|
-
- docs/fonts/SourceCodePro-Regular.ttf
|
|
252
|
-
- docs/images/add.png
|
|
253
|
-
- docs/images/arrow_up.png
|
|
254
|
-
- docs/images/brick.png
|
|
255
|
-
- docs/images/brick_link.png
|
|
256
|
-
- docs/images/bug.png
|
|
257
|
-
- docs/images/bullet_black.png
|
|
258
|
-
- docs/images/bullet_toggle_minus.png
|
|
259
|
-
- docs/images/bullet_toggle_plus.png
|
|
260
|
-
- docs/images/date.png
|
|
261
|
-
- docs/images/delete.png
|
|
262
|
-
- docs/images/find.png
|
|
263
|
-
- docs/images/loadingAnimation.gif
|
|
264
|
-
- docs/images/macFFBgHack.png
|
|
265
|
-
- docs/images/package.png
|
|
266
|
-
- docs/images/page_green.png
|
|
267
|
-
- docs/images/page_white_text.png
|
|
268
|
-
- docs/images/page_white_width.png
|
|
269
|
-
- docs/images/plugin.png
|
|
270
|
-
- docs/images/ruby.png
|
|
271
|
-
- docs/images/tag_blue.png
|
|
272
|
-
- docs/images/tag_green.png
|
|
273
|
-
- docs/images/transparent.png
|
|
274
|
-
- docs/images/wrench.png
|
|
275
|
-
- docs/images/wrench_orange.png
|
|
276
|
-
- docs/images/zoom.png
|
|
277
|
-
- docs/index.html
|
|
278
|
-
- docs/js/darkfish.js
|
|
279
|
-
- docs/js/navigation.js
|
|
280
|
-
- docs/js/navigation.js.gz
|
|
281
|
-
- docs/js/search.js
|
|
282
|
-
- docs/js/search_index.js
|
|
283
|
-
- docs/js/search_index.js.gz
|
|
284
|
-
- docs/js/searcher.js
|
|
285
|
-
- docs/js/searcher.js.gz
|
|
286
|
-
- docs/table_of_contents.html
|
|
287
206
|
- easycop.yml
|
|
288
207
|
- easypost.gemspec
|
|
289
208
|
- lib/easypost.rb
|
|
@@ -293,6 +212,7 @@ files:
|
|
|
293
212
|
- lib/easypost/beta.rb
|
|
294
213
|
- lib/easypost/beta/end_shipper.rb
|
|
295
214
|
- lib/easypost/beta/payment_refund.rb
|
|
215
|
+
- lib/easypost/beta/rate.rb
|
|
296
216
|
- lib/easypost/beta/referral.rb
|
|
297
217
|
- lib/easypost/billing.rb
|
|
298
218
|
- lib/easypost/brand.rb
|
data/docs/EasyPost/Address.html
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
|
|
7
|
-
<title>class EasyPost::Address - EasyPost Ruby Docs</title>
|
|
8
|
-
|
|
9
|
-
<script type="text/javascript">
|
|
10
|
-
var rdoc_rel_prefix = "../";
|
|
11
|
-
var index_rel_prefix = "../";
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<script src="../js/navigation.js" defer></script>
|
|
15
|
-
<script src="../js/search.js" defer></script>
|
|
16
|
-
<script src="../js/search_index.js" defer></script>
|
|
17
|
-
<script src="../js/searcher.js" defer></script>
|
|
18
|
-
<script src="../js/darkfish.js" defer></script>
|
|
19
|
-
|
|
20
|
-
<link href="../css/fonts.css" rel="stylesheet">
|
|
21
|
-
<link href="../css/rdoc.css" rel="stylesheet">
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<body id="top" role="document" class="class">
|
|
25
|
-
<nav role="navigation">
|
|
26
|
-
<div id="project-navigation">
|
|
27
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
28
|
-
<h2>
|
|
29
|
-
<a href="../index.html" rel="home">Home</a>
|
|
30
|
-
</h2>
|
|
31
|
-
|
|
32
|
-
<div id="table-of-contents-navigation">
|
|
33
|
-
<a href="../table_of_contents.html#pages">Pages</a>
|
|
34
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
|
35
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
40
|
-
<form action="#" method="get" accept-charset="utf-8">
|
|
41
|
-
<div id="search-field-wrapper">
|
|
42
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
|
43
|
-
aria-autocomplete="list" aria-controls="search-results"
|
|
44
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
|
45
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<ul id="search-results" aria-label="Search Results"
|
|
49
|
-
aria-busy="false" aria-expanded="false"
|
|
50
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
|
51
|
-
</form>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<div id="class-metadata">
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<div id="parent-class-section" class="nav-section">
|
|
62
|
-
<h3>Parent</h3>
|
|
63
|
-
|
|
64
|
-
<p class="link"><a href="Resource.html">EasyPost::Resource</a>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<!-- Method Quickref -->
|
|
71
|
-
<div id="method-list-section" class="nav-section">
|
|
72
|
-
<h3>Methods</h3>
|
|
73
|
-
|
|
74
|
-
<ul class="link-list" role="directory">
|
|
75
|
-
<li ><a href="#method-c-create">::create</a>
|
|
76
|
-
<li ><a href="#method-c-create_and_verify">::create_and_verify</a>
|
|
77
|
-
<li ><a href="#method-i-verify">#verify</a>
|
|
78
|
-
</ul>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
</div>
|
|
82
|
-
</nav>
|
|
83
|
-
|
|
84
|
-
<main role="main" aria-labelledby="class-EasyPost::Address">
|
|
85
|
-
<h1 id="class-EasyPost::Address" class="class">
|
|
86
|
-
class EasyPost::Address
|
|
87
|
-
</h1>
|
|
88
|
-
|
|
89
|
-
<section class="description">
|
|
90
|
-
|
|
91
|
-
<p><a href="Address.html"><code>Address</code></a> objects are used to represent people, places, and organizations in a number of contexts.</p>
|
|
92
|
-
|
|
93
|
-
</section>
|
|
94
|
-
|
|
95
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<section class="attribute-method-details" class="method-section">
|
|
100
|
-
<header>
|
|
101
|
-
<h3>Attributes</h3>
|
|
102
|
-
</header>
|
|
103
|
-
|
|
104
|
-
<div id="attribute-i-message" class="method-detail">
|
|
105
|
-
<div class="method-heading attribute-method-heading">
|
|
106
|
-
<span class="method-name">message</span><span
|
|
107
|
-
class="attribute-access-type">[RW]</span>
|
|
108
|
-
</div>
|
|
109
|
-
|
|
110
|
-
<div class="method-description">
|
|
111
|
-
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
</section>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
|
118
|
-
<header>
|
|
119
|
-
<h3>Public Class Methods</h3>
|
|
120
|
-
</header>
|
|
121
|
-
|
|
122
|
-
<div id="method-c-create" class="method-detail ">
|
|
123
|
-
<div class="method-heading">
|
|
124
|
-
<span class="method-name">create</span><span
|
|
125
|
-
class="method-args">(params = {}, api_key = nil)</span>
|
|
126
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
127
|
-
</div>
|
|
128
|
-
|
|
129
|
-
<div class="method-description">
|
|
130
|
-
<p>Create an <a href="Address.html"><code>Address</code></a>.</p>
|
|
131
|
-
|
|
132
|
-
<div class="method-source-code" id="create-source">
|
|
133
|
-
<pre><span class="ruby-comment"># File lib/easypost/address.rb, line 8</span>
|
|
134
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">create</span>(<span class="ruby-identifier">params</span> = {}, <span class="ruby-identifier">api_key</span> = <span class="ruby-keyword">nil</span>)
|
|
135
|
-
<span class="ruby-identifier">address</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">_</span><span class="ruby-operator">|</span> [<span class="ruby-value">:verify</span>, <span class="ruby-value">:verify_strict</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">k</span>) }
|
|
136
|
-
|
|
137
|
-
<span class="ruby-identifier">wrapped_params</span> = { <span class="ruby-value">address:</span> <span class="ruby-identifier">address</span> }
|
|
138
|
-
|
|
139
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-value">:verify</span>]
|
|
140
|
-
<span class="ruby-identifier">wrapped_params</span>[<span class="ruby-value">:verify</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-value">:verify</span>]
|
|
141
|
-
<span class="ruby-keyword">end</span>
|
|
142
|
-
|
|
143
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-value">:verify_strict</span>]
|
|
144
|
-
<span class="ruby-identifier">wrapped_params</span>[<span class="ruby-value">:verify_strict</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-value">:verify_strict</span>]
|
|
145
|
-
<span class="ruby-keyword">end</span>
|
|
146
|
-
|
|
147
|
-
<span class="ruby-identifier">response</span> = <span class="ruby-constant">EasyPost</span>.<span class="ruby-identifier">make_request</span>(<span class="ruby-value">:post</span>, <span class="ruby-identifier">url</span>, <span class="ruby-identifier">api_key</span>, <span class="ruby-identifier">wrapped_params</span>)
|
|
148
|
-
<span class="ruby-constant">EasyPost</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">convert_to_easypost_object</span>(<span class="ruby-identifier">response</span>, <span class="ruby-identifier">api_key</span>)
|
|
149
|
-
<span class="ruby-keyword">end</span></pre>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
</div>
|
|
155
|
-
|
|
156
|
-
<div id="method-c-create_and_verify" class="method-detail ">
|
|
157
|
-
<div class="method-heading">
|
|
158
|
-
<span class="method-name">create_and_verify</span><span
|
|
159
|
-
class="method-args">(params = {}, api_key = nil)</span>
|
|
160
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
<div class="method-description">
|
|
164
|
-
<p>Create and verify an <a href="Address.html"><code>Address</code></a> in one call.</p>
|
|
165
|
-
|
|
166
|
-
<div class="method-source-code" id="create_and_verify-source">
|
|
167
|
-
<pre><span class="ruby-comment"># File lib/easypost/address.rb, line 26</span>
|
|
168
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">create_and_verify</span>(<span class="ruby-identifier">params</span> = {}, <span class="ruby-identifier">api_key</span> = <span class="ruby-keyword">nil</span>)
|
|
169
|
-
<span class="ruby-identifier">wrapped_params</span> = {}
|
|
170
|
-
<span class="ruby-identifier">wrapped_params</span>[<span class="ruby-identifier">class_name</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">params</span>
|
|
171
|
-
<span class="ruby-identifier">response</span> = <span class="ruby-constant">EasyPost</span>.<span class="ruby-identifier">make_request</span>(<span class="ruby-value">:post</span>, <span class="ruby-node">"#{url}/create_and_verify"</span>, <span class="ruby-identifier">api_key</span>, <span class="ruby-identifier">wrapped_params</span>)
|
|
172
|
-
|
|
173
|
-
<span class="ruby-constant">EasyPost</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">convert_to_easypost_object</span>(<span class="ruby-identifier">response</span>[<span class="ruby-string">'address'</span>], <span class="ruby-identifier">api_key</span>)
|
|
174
|
-
<span class="ruby-keyword">end</span></pre>
|
|
175
|
-
</div>
|
|
176
|
-
</div>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
</div>
|
|
180
|
-
|
|
181
|
-
</section>
|
|
182
|
-
|
|
183
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
|
184
|
-
<header>
|
|
185
|
-
<h3>Public Instance Methods</h3>
|
|
186
|
-
</header>
|
|
187
|
-
|
|
188
|
-
<div id="method-i-verify" class="method-detail ">
|
|
189
|
-
<div class="method-heading">
|
|
190
|
-
<span class="method-name">verify</span><span
|
|
191
|
-
class="method-args">()</span>
|
|
192
|
-
<span class="method-click-advice">click to toggle source</span>
|
|
193
|
-
</div>
|
|
194
|
-
|
|
195
|
-
<div class="method-description">
|
|
196
|
-
<p>Verify an <a href="Address.html"><code>Address</code></a>.</p>
|
|
197
|
-
|
|
198
|
-
<div class="method-source-code" id="verify-source">
|
|
199
|
-
<pre><span class="ruby-comment"># File lib/easypost/address.rb, line 35</span>
|
|
200
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">verify</span>
|
|
201
|
-
<span class="ruby-identifier">response</span> = <span class="ruby-constant">EasyPost</span>.<span class="ruby-identifier">make_request</span>(<span class="ruby-value">:get</span>, <span class="ruby-node">"#{url}/verify"</span>, <span class="ruby-ivar">@api_key</span>)
|
|
202
|
-
|
|
203
|
-
<span class="ruby-constant">EasyPost</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">convert_to_easypost_object</span>(<span class="ruby-identifier">response</span>[<span class="ruby-string">'address'</span>], <span class="ruby-identifier">api_key</span>)
|
|
204
|
-
<span class="ruby-keyword">end</span></pre>
|
|
205
|
-
</div>
|
|
206
|
-
</div>
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
</div>
|
|
210
|
-
|
|
211
|
-
</section>
|
|
212
|
-
|
|
213
|
-
</section>
|
|
214
|
-
</main>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
<footer id="validator-badges" role="contentinfo">
|
|
218
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
|
219
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
|
|
220
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
221
|
-
</footer>
|
|
222
|
-
|
data/docs/EasyPost/ApiKey.html
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
|
|
7
|
-
<title>class EasyPost::ApiKey - EasyPost Ruby Docs</title>
|
|
8
|
-
|
|
9
|
-
<script type="text/javascript">
|
|
10
|
-
var rdoc_rel_prefix = "../";
|
|
11
|
-
var index_rel_prefix = "../";
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<script src="../js/navigation.js" defer></script>
|
|
15
|
-
<script src="../js/search.js" defer></script>
|
|
16
|
-
<script src="../js/search_index.js" defer></script>
|
|
17
|
-
<script src="../js/searcher.js" defer></script>
|
|
18
|
-
<script src="../js/darkfish.js" defer></script>
|
|
19
|
-
|
|
20
|
-
<link href="../css/fonts.css" rel="stylesheet">
|
|
21
|
-
<link href="../css/rdoc.css" rel="stylesheet">
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<body id="top" role="document" class="class">
|
|
25
|
-
<nav role="navigation">
|
|
26
|
-
<div id="project-navigation">
|
|
27
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
|
28
|
-
<h2>
|
|
29
|
-
<a href="../index.html" rel="home">Home</a>
|
|
30
|
-
</h2>
|
|
31
|
-
|
|
32
|
-
<div id="table-of-contents-navigation">
|
|
33
|
-
<a href="../table_of_contents.html#pages">Pages</a>
|
|
34
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
|
35
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
|
40
|
-
<form action="#" method="get" accept-charset="utf-8">
|
|
41
|
-
<div id="search-field-wrapper">
|
|
42
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
|
43
|
-
aria-autocomplete="list" aria-controls="search-results"
|
|
44
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
|
45
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<ul id="search-results" aria-label="Search Results"
|
|
49
|
-
aria-busy="false" aria-expanded="false"
|
|
50
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
|
51
|
-
</form>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<div id="class-metadata">
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
<div id="parent-class-section" class="nav-section">
|
|
62
|
-
<h3>Parent</h3>
|
|
63
|
-
|
|
64
|
-
<p class="link"><a href="Resource.html">EasyPost::Resource</a>
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
</div>
|
|
71
|
-
</nav>
|
|
72
|
-
|
|
73
|
-
<main role="main" aria-labelledby="class-EasyPost::ApiKey">
|
|
74
|
-
<h1 id="class-EasyPost::ApiKey" class="class">
|
|
75
|
-
class EasyPost::ApiKey
|
|
76
|
-
</h1>
|
|
77
|
-
|
|
78
|
-
<section class="description">
|
|
79
|
-
|
|
80
|
-
<p>An <a href="ApiKey.html"><code>ApiKey</code></a> allows you to authenticate with the <a href="../EasyPost.html"><code>EasyPost</code></a> API.</p>
|
|
81
|
-
|
|
82
|
-
</section>
|
|
83
|
-
|
|
84
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
</section>
|
|
91
|
-
</main>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<footer id="validator-badges" role="contentinfo">
|
|
95
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
|
96
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
|
|
97
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
|
98
|
-
</footer>
|
|
99
|
-
|