easypost 4.8.1 → 4.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitattributes +5 -0
- data/.github/workflows/ci.yml +8 -0
- data/.gitignore +10 -14
- data/CHANGELOG.md +12 -0
- data/Makefile +10 -2
- data/README.md +7 -3
- data/VERSION +1 -1
- data/docs/EasyPost/Address.html +222 -0
- data/docs/EasyPost/ApiKey.html +99 -0
- data/docs/EasyPost/Batch.html +269 -0
- data/docs/EasyPost/Beta/EndShipper.html +225 -0
- data/docs/EasyPost/Beta/Referral.html +338 -0
- data/docs/EasyPost/Beta.html +91 -0
- data/docs/EasyPost/Billing.html +253 -0
- data/docs/EasyPost/Brand.html +140 -0
- data/docs/EasyPost/CarbonOffset.html +99 -0
- data/docs/EasyPost/CarrierAccount.html +136 -0
- data/docs/EasyPost/CarrierType.html +99 -0
- data/docs/EasyPost/CustomsInfo.html +136 -0
- data/docs/EasyPost/CustomsItem.html +136 -0
- data/docs/EasyPost/EasyPostObject.html +662 -0
- data/docs/EasyPost/EndShipper.html +175 -0
- data/docs/EasyPost/Error.html +258 -0
- data/docs/EasyPost/Event.html +136 -0
- data/docs/EasyPost/Insurance.html +99 -0
- data/docs/EasyPost/Order.html +222 -0
- data/docs/EasyPost/Parcel.html +136 -0
- data/docs/EasyPost/PaymentMethod.html +137 -0
- data/docs/EasyPost/Pickup.html +222 -0
- data/docs/EasyPost/PickupRate.html +99 -0
- data/docs/EasyPost/PostageLabel.html +99 -0
- data/docs/EasyPost/Rate.html +136 -0
- data/docs/EasyPost/Referral.html +334 -0
- data/docs/EasyPost/Refund.html +99 -0
- data/docs/EasyPost/Report.html +167 -0
- data/docs/EasyPost/Resource.html +399 -0
- data/docs/EasyPost/ScanForm.html +137 -0
- data/docs/EasyPost/Shipment.html +456 -0
- data/docs/EasyPost/TaxIdentifier.html +99 -0
- data/docs/EasyPost/Tracker.html +139 -0
- data/docs/EasyPost/User.html +307 -0
- data/docs/EasyPost/Util.html +462 -0
- data/docs/EasyPost/Webhook.html +221 -0
- data/docs/EasyPost.html +440 -0
- data/docs/created.rid +40 -0
- data/docs/css/fonts.css +167 -0
- data/docs/css/rdoc.css +639 -0
- 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 +117 -0
- data/docs/js/darkfish.js +84 -0
- data/docs/js/navigation.js +105 -0
- data/docs/js/navigation.js.gz +0 -0
- data/docs/js/search.js +110 -0
- data/docs/js/search_index.js +1 -0
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +229 -0
- data/docs/js/searcher.js.gz +0 -0
- data/docs/table_of_contents.html +785 -0
- data/easypost.gemspec +3 -1
- data/lib/easypost/beta/payment_refund.rb +5 -0
- data/lib/easypost/beta/referral.rb +52 -4
- data/lib/easypost/carrier_account.rb +17 -0
- data/lib/easypost/payment_method.rb +2 -1
- data/lib/easypost/referral.rb +4 -4
- data/lib/easypost/shipment.rb +1 -1
- data/lib/easypost/user.rb +5 -2
- data/lib/easypost/util.rb +21 -12
- metadata +117 -11
- data/CODE_OF_CONDUCT.md +0 -16
- data/CONTRIBUTING.md +0 -47
- data/SECURITY.md +0 -7
- data/SUPPORT.md +0 -3
@@ -0,0 +1,456 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class EasyPost::Shipment - 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-get_lowest_smartrate">::get_lowest_smartrate</a>
|
77
|
+
<li ><a href="#method-i-buy">#buy</a>
|
78
|
+
<li ><a href="#method-i-generate_form">#generate_form</a>
|
79
|
+
<li ><a href="#method-i-get_smartrates">#get_smartrates</a>
|
80
|
+
<li ><a href="#method-i-insure">#insure</a>
|
81
|
+
<li ><a href="#method-i-label">#label</a>
|
82
|
+
<li ><a href="#method-i-lowest_rate">#lowest_rate</a>
|
83
|
+
<li ><a href="#method-i-lowest_smartrate">#lowest_smartrate</a>
|
84
|
+
<li ><a href="#method-i-refund">#refund</a>
|
85
|
+
<li ><a href="#method-i-regenerate_rates">#regenerate_rates</a>
|
86
|
+
</ul>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
</nav>
|
91
|
+
|
92
|
+
<main role="main" aria-labelledby="class-EasyPost::Shipment">
|
93
|
+
<h1 id="class-EasyPost::Shipment" class="class">
|
94
|
+
class EasyPost::Shipment
|
95
|
+
</h1>
|
96
|
+
|
97
|
+
<section class="description">
|
98
|
+
|
99
|
+
<p>The workhorse of the <a href="../EasyPost.html"><code>EasyPost</code></a> API, a <a href="Shipment.html"><code>Shipment</code></a> is made up of a “to” and “from” Address, the Parcel being shipped, and any customs forms required for international deliveries.</p>
|
100
|
+
|
101
|
+
</section>
|
102
|
+
|
103
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
110
|
+
<header>
|
111
|
+
<h3>Public Class Methods</h3>
|
112
|
+
</header>
|
113
|
+
|
114
|
+
<div id="method-c-create" class="method-detail ">
|
115
|
+
<div class="method-heading">
|
116
|
+
<span class="method-name">create</span><span
|
117
|
+
class="method-args">(params = {}, api_key = nil, with_carbon_offset = false)</span>
|
118
|
+
<span class="method-click-advice">click to toggle source</span>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
<div class="method-description">
|
122
|
+
<p>Create a <a href="Shipment.html"><code>Shipment</code></a>.</p>
|
123
|
+
|
124
|
+
<div class="method-source-code" id="create-source">
|
125
|
+
<pre><span class="ruby-comment"># File lib/easypost/shipment.rb, line 9</span>
|
126
|
+
<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>, <span class="ruby-identifier">with_carbon_offset</span> = <span class="ruby-keyword">false</span>)
|
127
|
+
<span class="ruby-identifier">wrapped_params</span> = {
|
128
|
+
<span class="ruby-value">shipment:</span> <span class="ruby-identifier">params</span>,
|
129
|
+
<span class="ruby-value">carbon_offset:</span> <span class="ruby-identifier">with_carbon_offset</span>,
|
130
|
+
}
|
131
|
+
|
132
|
+
<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>)
|
133
|
+
<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>)
|
134
|
+
<span class="ruby-keyword">end</span></pre>
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div id="method-c-get_lowest_smartrate" class="method-detail ">
|
142
|
+
<div class="method-heading">
|
143
|
+
<span class="method-name">get_lowest_smartrate</span><span
|
144
|
+
class="method-args">(smartrates, delivery_days, delivery_accuracy)</span>
|
145
|
+
<span class="method-click-advice">click to toggle source</span>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<div class="method-description">
|
149
|
+
<p>Get the lowest smartrate from a list of smartrates.</p>
|
150
|
+
|
151
|
+
<div class="method-source-code" id="get_lowest_smartrate-source">
|
152
|
+
<pre><span class="ruby-comment"># File lib/easypost/shipment.rb, line 110</span>
|
153
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">get_lowest_smartrate</span>(<span class="ruby-identifier">smartrates</span>, <span class="ruby-identifier">delivery_days</span>, <span class="ruby-identifier">delivery_accuracy</span>)
|
154
|
+
<span class="ruby-identifier">valid_delivery_accuracy_values</span> = <span class="ruby-constant">Set</span>[
|
155
|
+
<span class="ruby-string">'percentile_50'</span>,
|
156
|
+
<span class="ruby-string">'percentile_75'</span>,
|
157
|
+
<span class="ruby-string">'percentile_85'</span>,
|
158
|
+
<span class="ruby-string">'percentile_90'</span>,
|
159
|
+
<span class="ruby-string">'percentile_95'</span>,
|
160
|
+
<span class="ruby-string">'percentile_97'</span>,
|
161
|
+
<span class="ruby-string">'percentile_99'</span>,
|
162
|
+
]
|
163
|
+
<span class="ruby-identifier">lowest_smartrate</span> = <span class="ruby-keyword">nil</span>
|
164
|
+
|
165
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">valid_delivery_accuracy_values</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">delivery_accuracy</span>.<span class="ruby-identifier">downcase</span>)
|
166
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">EasyPost</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"Invalid delivery accuracy value, must be one of: #{valid_delivery_accuracy_values}"</span>)
|
167
|
+
<span class="ruby-keyword">end</span>
|
168
|
+
|
169
|
+
<span class="ruby-identifier">smartrates</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rate</span><span class="ruby-operator">|</span>
|
170
|
+
<span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">rate</span>[<span class="ruby-string">'time_in_transit'</span>][<span class="ruby-identifier">delivery_accuracy</span>] <span class="ruby-operator">></span> <span class="ruby-identifier">delivery_days</span>.<span class="ruby-identifier">to_i</span>
|
171
|
+
|
172
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">lowest_smartrate</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">rate</span>[<span class="ruby-string">'rate'</span>].<span class="ruby-identifier">to_f</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">lowest_smartrate</span>[<span class="ruby-string">'rate'</span>].<span class="ruby-identifier">to_f</span>
|
173
|
+
<span class="ruby-identifier">lowest_smartrate</span> = <span class="ruby-identifier">rate</span>
|
174
|
+
<span class="ruby-keyword">end</span>
|
175
|
+
<span class="ruby-keyword">end</span>
|
176
|
+
|
177
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">lowest_smartrate</span>.<span class="ruby-identifier">nil?</span>
|
178
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">EasyPost</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">'No rates found.'</span>)
|
179
|
+
<span class="ruby-keyword">end</span>
|
180
|
+
|
181
|
+
<span class="ruby-identifier">lowest_smartrate</span>
|
182
|
+
<span class="ruby-keyword">end</span></pre>
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
</section>
|
190
|
+
|
191
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
192
|
+
<header>
|
193
|
+
<h3>Public Instance Methods</h3>
|
194
|
+
</header>
|
195
|
+
|
196
|
+
<div id="method-i-buy" class="method-detail ">
|
197
|
+
<div class="method-heading">
|
198
|
+
<span class="method-name">buy</span><span
|
199
|
+
class="method-args">(params = {}, with_carbon_offset = false, end_shipper_id = nil)</span>
|
200
|
+
<span class="method-click-advice">click to toggle source</span>
|
201
|
+
</div>
|
202
|
+
|
203
|
+
<div class="method-description">
|
204
|
+
<p>Buy a <a href="Shipment.html"><code>Shipment</code></a>.</p>
|
205
|
+
|
206
|
+
<div class="method-source-code" id="buy-source">
|
207
|
+
<pre><span class="ruby-comment"># File lib/easypost/shipment.rb, line 38</span>
|
208
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">buy</span>(<span class="ruby-identifier">params</span> = {}, <span class="ruby-identifier">with_carbon_offset</span> = <span class="ruby-keyword">false</span>, <span class="ruby-identifier">end_shipper_id</span> = <span class="ruby-keyword">nil</span>)
|
209
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">EasyPost</span><span class="ruby-operator">::</span><span class="ruby-constant">Rate</span>)
|
210
|
+
<span class="ruby-identifier">temp</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">clone</span>
|
211
|
+
<span class="ruby-identifier">params</span> = {}
|
212
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value">:rate</span>] = <span class="ruby-identifier">temp</span>
|
213
|
+
<span class="ruby-keyword">end</span>
|
214
|
+
|
215
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-value">:with_carbon_offset</span>]
|
216
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value">:carbon_offset</span>] = <span class="ruby-identifier">params</span>[<span class="ruby-value">:with_carbon_offset</span>]
|
217
|
+
<span class="ruby-identifier">params</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:with_carbon_offset</span>)
|
218
|
+
<span class="ruby-keyword">else</span>
|
219
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value">:carbon_offset</span>] = <span class="ruby-identifier">with_carbon_offset</span>
|
220
|
+
<span class="ruby-keyword">end</span>
|
221
|
+
|
222
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">end_shipper_id</span>
|
223
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value">:end_shipper_id</span>] = <span class="ruby-identifier">end_shipper_id</span>
|
224
|
+
<span class="ruby-keyword">end</span>
|
225
|
+
|
226
|
+
<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}/buy"</span>, <span class="ruby-ivar">@api_key</span>, <span class="ruby-identifier">params</span>)
|
227
|
+
<span class="ruby-identifier">refresh_from</span>(<span class="ruby-identifier">response</span>, <span class="ruby-ivar">@api_key</span>)
|
228
|
+
|
229
|
+
<span class="ruby-keyword">self</span>
|
230
|
+
<span class="ruby-keyword">end</span></pre>
|
231
|
+
</div>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
|
235
|
+
</div>
|
236
|
+
|
237
|
+
<div id="method-i-generate_form" class="method-detail ">
|
238
|
+
<div class="method-heading">
|
239
|
+
<span class="method-name">generate_form</span><span
|
240
|
+
class="method-args">(form_type, form_options = {})</span>
|
241
|
+
<span class="method-click-advice">click to toggle source</span>
|
242
|
+
</div>
|
243
|
+
|
244
|
+
<div class="method-description">
|
245
|
+
<p>Generate a form for a <a href="Shipment.html"><code>Shipment</code></a>.</p>
|
246
|
+
|
247
|
+
<div class="method-source-code" id="generate_form-source">
|
248
|
+
<pre><span class="ruby-comment"># File lib/easypost/shipment.rb, line 142</span>
|
249
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">generate_form</span>(<span class="ruby-identifier">form_type</span>, <span class="ruby-identifier">form_options</span> = {})
|
250
|
+
<span class="ruby-identifier">params</span> = {}
|
251
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value">:type</span>] = <span class="ruby-identifier">form_type</span>
|
252
|
+
<span class="ruby-identifier">merged_params</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">form_options</span>)
|
253
|
+
<span class="ruby-identifier">wrapped_params</span> = {
|
254
|
+
<span class="ruby-value">form:</span> <span class="ruby-identifier">merged_params</span>,
|
255
|
+
}
|
256
|
+
|
257
|
+
<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}/forms"</span>, <span class="ruby-ivar">@api_key</span>, <span class="ruby-identifier">wrapped_params</span>)
|
258
|
+
<span class="ruby-identifier">refresh_from</span>(<span class="ruby-identifier">response</span>, <span class="ruby-ivar">@api_key</span>)
|
259
|
+
|
260
|
+
<span class="ruby-keyword">self</span>
|
261
|
+
<span class="ruby-keyword">end</span></pre>
|
262
|
+
</div>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
|
266
|
+
</div>
|
267
|
+
|
268
|
+
<div id="method-i-get_smartrates" class="method-detail ">
|
269
|
+
<div class="method-heading">
|
270
|
+
<span class="method-name">get_smartrates</span><span
|
271
|
+
class="method-args">()</span>
|
272
|
+
<span class="method-click-advice">click to toggle source</span>
|
273
|
+
</div>
|
274
|
+
|
275
|
+
<div class="method-description">
|
276
|
+
<p>Get the SmartRates of a <a href="Shipment.html"><code>Shipment</code></a>.</p>
|
277
|
+
|
278
|
+
<div class="method-source-code" id="get_smartrates-source">
|
279
|
+
<pre><span class="ruby-comment"># File lib/easypost/shipment.rb, line 31</span>
|
280
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_smartrates</span> <span class="ruby-comment"># rubocop:disable Naming/AccessorMethodName</span>
|
281
|
+
<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}/smartrate"</span>, <span class="ruby-ivar">@api_key</span>)
|
282
|
+
|
283
|
+
<span class="ruby-identifier">response</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-string">'result'</span>, [])
|
284
|
+
<span class="ruby-keyword">end</span></pre>
|
285
|
+
</div>
|
286
|
+
</div>
|
287
|
+
|
288
|
+
|
289
|
+
</div>
|
290
|
+
|
291
|
+
<div id="method-i-insure" class="method-detail ">
|
292
|
+
<div class="method-heading">
|
293
|
+
<span class="method-name">insure</span><span
|
294
|
+
class="method-args">(params = {})</span>
|
295
|
+
<span class="method-click-advice">click to toggle source</span>
|
296
|
+
</div>
|
297
|
+
|
298
|
+
<div class="method-description">
|
299
|
+
<p>Insure a <a href="Shipment.html"><code>Shipment</code></a>.</p>
|
300
|
+
|
301
|
+
<div class="method-source-code" id="insure-source">
|
302
|
+
<pre><span class="ruby-comment"># File lib/easypost/shipment.rb, line 63</span>
|
303
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insure</span>(<span class="ruby-identifier">params</span> = {})
|
304
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Integer</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Float</span>)
|
305
|
+
<span class="ruby-identifier">temp</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">clone</span>
|
306
|
+
<span class="ruby-identifier">params</span> = {}
|
307
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value">:amount</span>] = <span class="ruby-identifier">temp</span>
|
308
|
+
<span class="ruby-keyword">end</span>
|
309
|
+
|
310
|
+
<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}/insure"</span>, <span class="ruby-ivar">@api_key</span>, <span class="ruby-identifier">params</span>)
|
311
|
+
<span class="ruby-identifier">refresh_from</span>(<span class="ruby-identifier">response</span>, <span class="ruby-ivar">@api_key</span>)
|
312
|
+
|
313
|
+
<span class="ruby-keyword">self</span>
|
314
|
+
<span class="ruby-keyword">end</span></pre>
|
315
|
+
</div>
|
316
|
+
</div>
|
317
|
+
|
318
|
+
|
319
|
+
</div>
|
320
|
+
|
321
|
+
<div id="method-i-label" class="method-detail ">
|
322
|
+
<div class="method-heading">
|
323
|
+
<span class="method-name">label</span><span
|
324
|
+
class="method-args">(params = {})</span>
|
325
|
+
<span class="method-click-advice">click to toggle source</span>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
<div class="method-description">
|
329
|
+
<p>Convert the label format of a <a href="Shipment.html"><code>Shipment</code></a>.</p>
|
330
|
+
|
331
|
+
<div class="method-source-code" id="label-source">
|
332
|
+
<pre><span class="ruby-comment"># File lib/easypost/shipment.rb, line 85</span>
|
333
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">label</span>(<span class="ruby-identifier">params</span> = {})
|
334
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
335
|
+
<span class="ruby-identifier">temp</span> = <span class="ruby-identifier">params</span>.<span class="ruby-identifier">clone</span>
|
336
|
+
<span class="ruby-identifier">params</span> = {}
|
337
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value">:file_format</span>] = <span class="ruby-identifier">temp</span>
|
338
|
+
<span class="ruby-keyword">end</span>
|
339
|
+
|
340
|
+
<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}/label"</span>, <span class="ruby-ivar">@api_key</span>, <span class="ruby-identifier">params</span>)
|
341
|
+
<span class="ruby-identifier">refresh_from</span>(<span class="ruby-identifier">response</span>, <span class="ruby-ivar">@api_key</span>)
|
342
|
+
|
343
|
+
<span class="ruby-keyword">self</span>
|
344
|
+
<span class="ruby-keyword">end</span></pre>
|
345
|
+
</div>
|
346
|
+
</div>
|
347
|
+
|
348
|
+
|
349
|
+
</div>
|
350
|
+
|
351
|
+
<div id="method-i-lowest_rate" class="method-detail ">
|
352
|
+
<div class="method-heading">
|
353
|
+
<span class="method-name">lowest_rate</span><span
|
354
|
+
class="method-args">(carriers = [], services = [])</span>
|
355
|
+
<span class="method-click-advice">click to toggle source</span>
|
356
|
+
</div>
|
357
|
+
|
358
|
+
<div class="method-description">
|
359
|
+
<p>Get the lowest rate of a <a href="Shipment.html"><code>Shipment</code></a> (can exclude by having ‘’!‘` as the first element of your optional filter lists).</p>
|
360
|
+
|
361
|
+
<div class="method-source-code" id="lowest_rate-source">
|
362
|
+
<pre><span class="ruby-comment"># File lib/easypost/shipment.rb, line 99</span>
|
363
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">lowest_rate</span>(<span class="ruby-identifier">carriers</span> = [], <span class="ruby-identifier">services</span> = [])
|
364
|
+
<span class="ruby-constant">EasyPost</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">get_lowest_object_rate</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">carriers</span>, <span class="ruby-identifier">services</span>)
|
365
|
+
<span class="ruby-keyword">end</span></pre>
|
366
|
+
</div>
|
367
|
+
</div>
|
368
|
+
|
369
|
+
|
370
|
+
</div>
|
371
|
+
|
372
|
+
<div id="method-i-lowest_smartrate" class="method-detail ">
|
373
|
+
<div class="method-heading">
|
374
|
+
<span class="method-name">lowest_smartrate</span><span
|
375
|
+
class="method-args">(delivery_days, delivery_accuracy)</span>
|
376
|
+
<span class="method-click-advice">click to toggle source</span>
|
377
|
+
</div>
|
378
|
+
|
379
|
+
<div class="method-description">
|
380
|
+
<p>Get the lowest smartrate of a <a href="Shipment.html"><code>Shipment</code></a>.</p>
|
381
|
+
|
382
|
+
<div class="method-source-code" id="lowest_smartrate-source">
|
383
|
+
<pre><span class="ruby-comment"># File lib/easypost/shipment.rb, line 104</span>
|
384
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">lowest_smartrate</span>(<span class="ruby-identifier">delivery_days</span>, <span class="ruby-identifier">delivery_accuracy</span>)
|
385
|
+
<span class="ruby-identifier">smartrates</span> = <span class="ruby-identifier">get_smartrates</span>
|
386
|
+
<span class="ruby-constant">EasyPost</span><span class="ruby-operator">::</span><span class="ruby-constant">Shipment</span>.<span class="ruby-identifier">get_lowest_smartrate</span>(<span class="ruby-identifier">smartrates</span>, <span class="ruby-identifier">delivery_days</span>, <span class="ruby-identifier">delivery_accuracy</span>)
|
387
|
+
<span class="ruby-keyword">end</span></pre>
|
388
|
+
</div>
|
389
|
+
</div>
|
390
|
+
|
391
|
+
|
392
|
+
</div>
|
393
|
+
|
394
|
+
<div id="method-i-refund" class="method-detail ">
|
395
|
+
<div class="method-heading">
|
396
|
+
<span class="method-name">refund</span><span
|
397
|
+
class="method-args">(params = {})</span>
|
398
|
+
<span class="method-click-advice">click to toggle source</span>
|
399
|
+
</div>
|
400
|
+
|
401
|
+
<div class="method-description">
|
402
|
+
<p>Refund a <a href="Shipment.html"><code>Shipment</code></a>.</p>
|
403
|
+
|
404
|
+
<div class="method-source-code" id="refund-source">
|
405
|
+
<pre><span class="ruby-comment"># File lib/easypost/shipment.rb, line 77</span>
|
406
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refund</span>(<span class="ruby-identifier">params</span> = {})
|
407
|
+
<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}/refund"</span>, <span class="ruby-ivar">@api_key</span>, <span class="ruby-identifier">params</span>)
|
408
|
+
<span class="ruby-identifier">refresh_from</span>(<span class="ruby-identifier">response</span>, <span class="ruby-ivar">@api_key</span>)
|
409
|
+
|
410
|
+
<span class="ruby-keyword">self</span>
|
411
|
+
<span class="ruby-keyword">end</span></pre>
|
412
|
+
</div>
|
413
|
+
</div>
|
414
|
+
|
415
|
+
|
416
|
+
</div>
|
417
|
+
|
418
|
+
<div id="method-i-regenerate_rates" class="method-detail ">
|
419
|
+
<div class="method-heading">
|
420
|
+
<span class="method-name">regenerate_rates</span><span
|
421
|
+
class="method-args">(with_carbon_offset = false)</span>
|
422
|
+
<span class="method-click-advice">click to toggle source</span>
|
423
|
+
</div>
|
424
|
+
|
425
|
+
<div class="method-description">
|
426
|
+
<p>Regenerate the rates of a <a href="Shipment.html"><code>Shipment</code></a>.</p>
|
427
|
+
|
428
|
+
<div class="method-source-code" id="regenerate_rates-source">
|
429
|
+
<pre><span class="ruby-comment"># File lib/easypost/shipment.rb, line 20</span>
|
430
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">regenerate_rates</span>(<span class="ruby-identifier">with_carbon_offset</span> = <span class="ruby-keyword">false</span>)
|
431
|
+
<span class="ruby-identifier">params</span> = {}
|
432
|
+
<span class="ruby-identifier">params</span>[<span class="ruby-value">:carbon_offset</span>] = <span class="ruby-identifier">with_carbon_offset</span>
|
433
|
+
|
434
|
+
<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}/rerate"</span>, <span class="ruby-ivar">@api_key</span>, <span class="ruby-identifier">params</span>)
|
435
|
+
<span class="ruby-identifier">refresh_from</span>(<span class="ruby-identifier">response</span>, <span class="ruby-ivar">@api_key</span>)
|
436
|
+
|
437
|
+
<span class="ruby-keyword">self</span>
|
438
|
+
<span class="ruby-keyword">end</span></pre>
|
439
|
+
</div>
|
440
|
+
</div>
|
441
|
+
|
442
|
+
|
443
|
+
</div>
|
444
|
+
|
445
|
+
</section>
|
446
|
+
|
447
|
+
</section>
|
448
|
+
</main>
|
449
|
+
|
450
|
+
|
451
|
+
<footer id="validator-badges" role="contentinfo">
|
452
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
453
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
|
454
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
455
|
+
</footer>
|
456
|
+
|
@@ -0,0 +1,99 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class EasyPost::TaxIdentifier - 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::TaxIdentifier">
|
74
|
+
<h1 id="class-EasyPost::TaxIdentifier" class="class">
|
75
|
+
class EasyPost::TaxIdentifier
|
76
|
+
</h1>
|
77
|
+
|
78
|
+
<section class="description">
|
79
|
+
|
80
|
+
<p>TaxIdentifiers are identifying numbers or IDs that are used to charge a specific party when dealing with the importing or exporting of good across international borders.</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
|
+
|