easypost 4.8.1 → 4.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +5 -0
  3. data/.github/workflows/ci.yml +8 -0
  4. data/.gitignore +10 -14
  5. data/CHANGELOG.md +4 -0
  6. data/Makefile +10 -2
  7. data/README.md +5 -1
  8. data/VERSION +1 -1
  9. data/docs/EasyPost/Address.html +222 -0
  10. data/docs/EasyPost/ApiKey.html +99 -0
  11. data/docs/EasyPost/Batch.html +269 -0
  12. data/docs/EasyPost/Beta/EndShipper.html +225 -0
  13. data/docs/EasyPost/Beta/Referral.html +338 -0
  14. data/docs/EasyPost/Beta.html +91 -0
  15. data/docs/EasyPost/Billing.html +253 -0
  16. data/docs/EasyPost/Brand.html +140 -0
  17. data/docs/EasyPost/CarbonOffset.html +99 -0
  18. data/docs/EasyPost/CarrierAccount.html +136 -0
  19. data/docs/EasyPost/CarrierType.html +99 -0
  20. data/docs/EasyPost/CustomsInfo.html +136 -0
  21. data/docs/EasyPost/CustomsItem.html +136 -0
  22. data/docs/EasyPost/EasyPostObject.html +662 -0
  23. data/docs/EasyPost/EndShipper.html +175 -0
  24. data/docs/EasyPost/Error.html +258 -0
  25. data/docs/EasyPost/Event.html +136 -0
  26. data/docs/EasyPost/Insurance.html +99 -0
  27. data/docs/EasyPost/Order.html +222 -0
  28. data/docs/EasyPost/Parcel.html +136 -0
  29. data/docs/EasyPost/PaymentMethod.html +137 -0
  30. data/docs/EasyPost/Pickup.html +222 -0
  31. data/docs/EasyPost/PickupRate.html +99 -0
  32. data/docs/EasyPost/PostageLabel.html +99 -0
  33. data/docs/EasyPost/Rate.html +136 -0
  34. data/docs/EasyPost/Referral.html +334 -0
  35. data/docs/EasyPost/Refund.html +99 -0
  36. data/docs/EasyPost/Report.html +167 -0
  37. data/docs/EasyPost/Resource.html +399 -0
  38. data/docs/EasyPost/ScanForm.html +137 -0
  39. data/docs/EasyPost/Shipment.html +456 -0
  40. data/docs/EasyPost/TaxIdentifier.html +99 -0
  41. data/docs/EasyPost/Tracker.html +139 -0
  42. data/docs/EasyPost/User.html +307 -0
  43. data/docs/EasyPost/Util.html +462 -0
  44. data/docs/EasyPost/Webhook.html +221 -0
  45. data/docs/EasyPost.html +440 -0
  46. data/docs/created.rid +40 -0
  47. data/docs/css/fonts.css +167 -0
  48. data/docs/css/rdoc.css +639 -0
  49. data/docs/fonts/Lato-Light.ttf +0 -0
  50. data/docs/fonts/Lato-LightItalic.ttf +0 -0
  51. data/docs/fonts/Lato-Regular.ttf +0 -0
  52. data/docs/fonts/Lato-RegularItalic.ttf +0 -0
  53. data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
  54. data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
  55. data/docs/images/add.png +0 -0
  56. data/docs/images/arrow_up.png +0 -0
  57. data/docs/images/brick.png +0 -0
  58. data/docs/images/brick_link.png +0 -0
  59. data/docs/images/bug.png +0 -0
  60. data/docs/images/bullet_black.png +0 -0
  61. data/docs/images/bullet_toggle_minus.png +0 -0
  62. data/docs/images/bullet_toggle_plus.png +0 -0
  63. data/docs/images/date.png +0 -0
  64. data/docs/images/delete.png +0 -0
  65. data/docs/images/find.png +0 -0
  66. data/docs/images/loadingAnimation.gif +0 -0
  67. data/docs/images/macFFBgHack.png +0 -0
  68. data/docs/images/package.png +0 -0
  69. data/docs/images/page_green.png +0 -0
  70. data/docs/images/page_white_text.png +0 -0
  71. data/docs/images/page_white_width.png +0 -0
  72. data/docs/images/plugin.png +0 -0
  73. data/docs/images/ruby.png +0 -0
  74. data/docs/images/tag_blue.png +0 -0
  75. data/docs/images/tag_green.png +0 -0
  76. data/docs/images/transparent.png +0 -0
  77. data/docs/images/wrench.png +0 -0
  78. data/docs/images/wrench_orange.png +0 -0
  79. data/docs/images/zoom.png +0 -0
  80. data/docs/index.html +117 -0
  81. data/docs/js/darkfish.js +84 -0
  82. data/docs/js/navigation.js +105 -0
  83. data/docs/js/navigation.js.gz +0 -0
  84. data/docs/js/search.js +110 -0
  85. data/docs/js/search_index.js +1 -0
  86. data/docs/js/search_index.js.gz +0 -0
  87. data/docs/js/searcher.js +229 -0
  88. data/docs/js/searcher.js.gz +0 -0
  89. data/docs/table_of_contents.html +785 -0
  90. data/easypost.gemspec +3 -1
  91. data/lib/easypost/carrier_account.rb +17 -0
  92. data/lib/easypost/shipment.rb +1 -1
  93. data/lib/easypost/user.rb +5 -2
  94. data/lib/easypost/util.rb +2 -0
  95. metadata +115 -6
@@ -0,0 +1,399 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class EasyPost::Resource - 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="EasyPostObject.html">EasyPost::EasyPostObject</a>
65
+ </div>
66
+
67
+
68
+
69
+ <div id="extends-section" class="nav-section">
70
+ <h3>Extended With Modules</h3>
71
+
72
+ <ul class="link-list">
73
+ <li><span class="extend">Enumerable</span>
74
+ </ul>
75
+ </div>
76
+
77
+
78
+ <!-- Method Quickref -->
79
+ <div id="method-list-section" class="nav-section">
80
+ <h3>Methods</h3>
81
+
82
+ <ul class="link-list" role="directory">
83
+ <li ><a href="#method-c-all">::all</a>
84
+ <li ><a href="#method-c-class_name">::class_name</a>
85
+ <li ><a href="#method-c-create">::create</a>
86
+ <li ><a href="#method-c-each">::each</a>
87
+ <li ><a href="#method-c-retrieve">::retrieve</a>
88
+ <li ><a href="#method-c-url">::url</a>
89
+ <li ><a href="#method-i-delete">#delete</a>
90
+ <li ><a href="#method-i-refresh">#refresh</a>
91
+ <li ><a href="#method-i-save">#save</a>
92
+ <li ><a href="#method-i-url">#url</a>
93
+ </ul>
94
+ </div>
95
+
96
+ </div>
97
+ </nav>
98
+
99
+ <main role="main" aria-labelledby="class-EasyPost::Resource">
100
+ <h1 id="class-EasyPost::Resource" class="class">
101
+ class EasyPost::Resource
102
+ </h1>
103
+
104
+ <section class="description">
105
+
106
+ <p>The <a href="Resource.html"><code>Resource</code></a> object is extended by each <a href="../EasyPost.html"><code>EasyPost</code></a> object.</p>
107
+
108
+ </section>
109
+
110
+ <section id="5Buntitled-5D" class="documentation-section">
111
+
112
+
113
+
114
+
115
+
116
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
117
+ <header>
118
+ <h3>Public Class Methods</h3>
119
+ </header>
120
+
121
+ <div id="method-c-all" class="method-detail ">
122
+ <div class="method-heading">
123
+ <span class="method-name">all</span><span
124
+ class="method-args">(filters = {}, api_key = nil)</span>
125
+ <span class="method-click-advice">click to toggle source</span>
126
+ </div>
127
+
128
+ <div class="method-description">
129
+ <p>Retrieve a list of <a href="../EasyPost.html"><code>EasyPost</code></a> objects.</p>
130
+
131
+ <div class="method-source-code" id="all-source">
132
+ <pre><span class="ruby-comment"># File lib/easypost/resource.rb, line 46</span>
133
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">all</span>(<span class="ruby-identifier">filters</span> = {}, <span class="ruby-identifier">api_key</span> = <span class="ruby-keyword">nil</span>)
134
+ <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-identifier">url</span>, <span class="ruby-identifier">api_key</span>, <span class="ruby-identifier">filters</span>)
135
+ <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>)
136
+ <span class="ruby-keyword">end</span></pre>
137
+ </div>
138
+ </div>
139
+
140
+
141
+ </div>
142
+
143
+ <div id="method-c-class_name" class="method-detail ">
144
+ <div class="method-heading">
145
+ <span class="method-name">class_name</span><span
146
+ class="method-args">()</span>
147
+ <span class="method-click-advice">click to toggle source</span>
148
+ </div>
149
+
150
+ <div class="method-description">
151
+ <p>The class name of an <a href="../EasyPost.html"><code>EasyPost</code></a> object.</p>
152
+
153
+ <div class="method-source-code" id="class_name-source">
154
+ <pre><span class="ruby-comment"># File lib/easypost/resource.rb, line 8</span>
155
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">class_name</span>
156
+ <span class="ruby-identifier">camel</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&#39;::&#39;</span>)[<span class="ruby-value">-1</span>]
157
+ <span class="ruby-identifier">snake</span> = <span class="ruby-identifier">camel</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">camel</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/([A-Z])/</span>, <span class="ruby-string">&#39;_\1&#39;</span>)
158
+ <span class="ruby-identifier">snake</span>.<span class="ruby-identifier">downcase</span>
159
+ <span class="ruby-keyword">end</span></pre>
160
+ </div>
161
+ </div>
162
+
163
+
164
+ </div>
165
+
166
+ <div id="method-c-create" class="method-detail ">
167
+ <div class="method-heading">
168
+ <span class="method-name">create</span><span
169
+ class="method-args">(params = {}, api_key = nil)</span>
170
+ <span class="method-click-advice">click to toggle source</span>
171
+ </div>
172
+
173
+ <div class="method-description">
174
+ <p>Create an <a href="../EasyPost.html"><code>EasyPost</code></a> object.</p>
175
+
176
+ <div class="method-source-code" id="create-source">
177
+ <pre><span class="ruby-comment"># File lib/easypost/resource.rb, line 72</span>
178
+ <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>)
179
+ <span class="ruby-identifier">wrapped_params</span> = {}
180
+ <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>
181
+ <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>)
182
+ <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>)
183
+ <span class="ruby-keyword">end</span></pre>
184
+ </div>
185
+ </div>
186
+
187
+
188
+ </div>
189
+
190
+ <div id="method-c-each" class="method-detail ">
191
+ <div class="method-heading">
192
+ <span class="method-name">each</span><span
193
+ class="method-args">(filters = {}, api_key = EasyPost.api_key, &amp;block)</span>
194
+ <span class="method-click-advice">click to toggle source</span>
195
+ </div>
196
+
197
+ <div class="method-description">
198
+ <p>Filter all results based on criteria.</p>
199
+
200
+ <div class="method-source-code" id="each-source">
201
+ <pre><span class="ruby-comment"># File lib/easypost/resource.rb, line 52</span>
202
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">each</span>(<span class="ruby-identifier">filters</span> = {}, <span class="ruby-identifier">api_key</span> = <span class="ruby-constant">EasyPost</span>.<span class="ruby-identifier">api_key</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
203
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">to_enum</span>(<span class="ruby-value">:each</span>, <span class="ruby-identifier">filters</span>, <span class="ruby-identifier">api_key</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">block_given?</span>
204
+
205
+ <span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
206
+ <span class="ruby-identifier">page</span>, <span class="ruby-identifier">has_more</span> = <span class="ruby-identifier">all</span>(<span class="ruby-identifier">filters</span>, <span class="ruby-identifier">api_key</span>).<span class="ruby-identifier">values</span>
207
+ <span class="ruby-identifier">last</span> = <span class="ruby-identifier">page</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>).<span class="ruby-identifier">last</span>
208
+ <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">page</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">has_more</span>
209
+
210
+ <span class="ruby-identifier">filters</span>[<span class="ruby-value">:before_id</span>] = <span class="ruby-identifier">last</span>.<span class="ruby-identifier">id</span>
211
+ <span class="ruby-keyword">end</span>
212
+ <span class="ruby-keyword">end</span></pre>
213
+ </div>
214
+ </div>
215
+
216
+
217
+ </div>
218
+
219
+ <div id="method-c-retrieve" class="method-detail ">
220
+ <div class="method-heading">
221
+ <span class="method-name">retrieve</span><span
222
+ class="method-args">(id, api_key = nil)</span>
223
+ <span class="method-click-advice">click to toggle source</span>
224
+ </div>
225
+
226
+ <div class="method-description">
227
+ <p>Retrieve an <a href="../EasyPost.html"><code>EasyPost</code></a> object.</p>
228
+
229
+ <div class="method-source-code" id="retrieve-source">
230
+ <pre><span class="ruby-comment"># File lib/easypost/resource.rb, line 65</span>
231
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">retrieve</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">api_key</span> = <span class="ruby-keyword">nil</span>)
232
+ <span class="ruby-identifier">instance</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">api_key</span>)
233
+ <span class="ruby-identifier">instance</span>.<span class="ruby-identifier">refresh</span>
234
+ <span class="ruby-identifier">instance</span>
235
+ <span class="ruby-keyword">end</span></pre>
236
+ </div>
237
+ </div>
238
+
239
+
240
+ </div>
241
+
242
+ <div id="method-c-url" class="method-detail ">
243
+ <div class="method-heading">
244
+ <span class="method-name">url</span><span
245
+ class="method-args">()</span>
246
+ <span class="method-click-advice">click to toggle source</span>
247
+ </div>
248
+
249
+ <div class="method-description">
250
+ <p>The instance url of the <a href="Resource.html"><code>Resource</code></a>.</p>
251
+
252
+ <div class="method-source-code" id="url-source">
253
+ <pre><span class="ruby-comment"># File lib/easypost/resource.rb, line 15</span>
254
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">url</span>
255
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">class_name</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;resource&#39;</span>
256
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>.<span class="ruby-identifier">new</span>(
257
+ <span class="ruby-string">&#39;Resource is an abstract class. You should perform actions on its subclasses (Address, Shipment, etc.)&#39;</span>,
258
+ )
259
+ <span class="ruby-keyword">end</span>
260
+
261
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">class_name</span>[<span class="ruby-value">-1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&#39;s&#39;</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">class_name</span>[<span class="ruby-value">-1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&#39;h&#39;</span>
262
+ <span class="ruby-node">&quot;/v2/#{CGI.escape(class_name.downcase)}es&quot;</span>
263
+ <span class="ruby-keyword">else</span>
264
+ <span class="ruby-node">&quot;/v2/#{CGI.escape(class_name.downcase)}s&quot;</span>
265
+ <span class="ruby-keyword">end</span>
266
+ <span class="ruby-keyword">end</span></pre>
267
+ </div>
268
+ </div>
269
+
270
+
271
+ </div>
272
+
273
+ </section>
274
+
275
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
276
+ <header>
277
+ <h3>Public Instance Methods</h3>
278
+ </header>
279
+
280
+ <div id="method-i-delete" class="method-detail ">
281
+ <div class="method-heading">
282
+ <span class="method-name">delete</span><span
283
+ class="method-args">()</span>
284
+ <span class="method-click-advice">click to toggle source</span>
285
+ </div>
286
+
287
+ <div class="method-description">
288
+ <p>Delete an <a href="../EasyPost.html"><code>EasyPost</code></a> object.</p>
289
+
290
+ <div class="method-source-code" id="delete-source">
291
+ <pre><span class="ruby-comment"># File lib/easypost/resource.rb, line 80</span>
292
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete</span>
293
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">EasyPost</span>.<span class="ruby-identifier">make_request</span>(<span class="ruby-value">:delete</span>, <span class="ruby-identifier">url</span>, <span class="ruby-ivar">@api_key</span>)
294
+ <span class="ruby-identifier">refresh_from</span>(<span class="ruby-identifier">response</span>, <span class="ruby-identifier">api_key</span>)
295
+ <span class="ruby-keyword">self</span>
296
+ <span class="ruby-keyword">end</span></pre>
297
+ </div>
298
+ </div>
299
+
300
+
301
+ </div>
302
+
303
+ <div id="method-i-refresh" class="method-detail ">
304
+ <div class="method-heading">
305
+ <span class="method-name">refresh</span><span
306
+ class="method-args">()</span>
307
+ <span class="method-click-advice">click to toggle source</span>
308
+ </div>
309
+
310
+ <div class="method-description">
311
+ <p>Refresh an object from the API response.</p>
312
+
313
+ <div class="method-source-code" id="refresh-source">
314
+ <pre><span class="ruby-comment"># File lib/easypost/resource.rb, line 39</span>
315
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">refresh</span>
316
+ <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-identifier">url</span>, <span class="ruby-ivar">@api_key</span>, <span class="ruby-ivar">@retrieve_options</span>)
317
+ <span class="ruby-identifier">refresh_from</span>(<span class="ruby-identifier">response</span>, <span class="ruby-identifier">api_key</span>)
318
+ <span class="ruby-keyword">self</span>
319
+ <span class="ruby-keyword">end</span></pre>
320
+ </div>
321
+ </div>
322
+
323
+
324
+ </div>
325
+
326
+ <div id="method-i-save" class="method-detail ">
327
+ <div class="method-heading">
328
+ <span class="method-name">save</span><span
329
+ class="method-args">()</span>
330
+ <span class="method-click-advice">click to toggle source</span>
331
+ </div>
332
+
333
+ <div class="method-description">
334
+ <p>Save (update) and <a href="../EasyPost.html"><code>EasyPost</code></a> object.</p>
335
+
336
+ <div class="method-source-code" id="save-source">
337
+ <pre><span class="ruby-comment"># File lib/easypost/resource.rb, line 87</span>
338
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">save</span>
339
+ <span class="ruby-keyword">if</span> <span class="ruby-ivar">@unsaved_values</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">positive?</span>
340
+ <span class="ruby-identifier">values</span> = {}
341
+ <span class="ruby-ivar">@unsaved_values</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">values</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-ivar">@values</span>[<span class="ruby-identifier">k</span>] }
342
+
343
+ <span class="ruby-ivar">@unsaved_values</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-comment"># rubocop:disable Style/CombinableLoops</span>
344
+ <span class="ruby-identifier">value</span> = <span class="ruby-identifier">values</span>[<span class="ruby-identifier">key</span>]
345
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">EasyPost</span><span class="ruby-operator">::</span><span class="ruby-constant">EasyPostObject</span>)
346
+ <span class="ruby-identifier">values</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">flatten_unsaved</span>
347
+ <span class="ruby-keyword">end</span>
348
+ <span class="ruby-keyword">end</span>
349
+
350
+ <span class="ruby-identifier">wrapped_params</span> = { <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">class_name</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">values</span> }
351
+
352
+ <span class="ruby-identifier">response</span> = <span class="ruby-constant">EasyPost</span>.<span class="ruby-identifier">make_request</span>(<span class="ruby-value">:patch</span>, <span class="ruby-identifier">url</span>, <span class="ruby-ivar">@api_key</span>, <span class="ruby-identifier">wrapped_params</span>)
353
+ <span class="ruby-identifier">refresh_from</span>(<span class="ruby-identifier">response</span>, <span class="ruby-identifier">api_key</span>)
354
+ <span class="ruby-keyword">end</span>
355
+ <span class="ruby-keyword">self</span>
356
+ <span class="ruby-keyword">end</span></pre>
357
+ </div>
358
+ </div>
359
+
360
+
361
+ </div>
362
+
363
+ <div id="method-i-url" class="method-detail ">
364
+ <div class="method-heading">
365
+ <span class="method-name">url</span><span
366
+ class="method-args">()</span>
367
+ <span class="method-click-advice">click to toggle source</span>
368
+ </div>
369
+
370
+ <div class="method-description">
371
+ <p>The url of the <a href="Resource.html"><code>Resource</code></a>.</p>
372
+
373
+ <div class="method-source-code" id="url-source">
374
+ <pre><span class="ruby-comment"># File lib/easypost/resource.rb, line 30</span>
375
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">url</span>
376
+ <span class="ruby-keyword">unless</span> <span class="ruby-identifier">id</span>
377
+ <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">&quot;Could not determine which URL to request: #{self.class} instance has invalid ID: #{id.inspect}&quot;</span>)
378
+ <span class="ruby-keyword">end</span>
379
+
380
+ <span class="ruby-node">&quot;#{self.class.url}/#{CGI.escape(id)}&quot;</span>
381
+ <span class="ruby-keyword">end</span></pre>
382
+ </div>
383
+ </div>
384
+
385
+
386
+ </div>
387
+
388
+ </section>
389
+
390
+ </section>
391
+ </main>
392
+
393
+
394
+ <footer id="validator-badges" role="contentinfo">
395
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
396
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
397
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
398
+ </footer>
399
+
@@ -0,0 +1,137 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class EasyPost::ScanForm - 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
+ </ul>
77
+ </div>
78
+
79
+ </div>
80
+ </nav>
81
+
82
+ <main role="main" aria-labelledby="class-EasyPost::ScanForm">
83
+ <h1 id="class-EasyPost::ScanForm" class="class">
84
+ class EasyPost::ScanForm
85
+ </h1>
86
+
87
+ <section class="description">
88
+
89
+ <p>A <a href="ScanForm.html"><code>ScanForm</code></a> can be created to speed up and simplify the carrier pickup process. The <a href="ScanForm.html"><code>ScanForm</code></a> is one document that can be scanned to mark all included tracking codes as “Accepted for Shipment” by the carrier.</p>
90
+
91
+ </section>
92
+
93
+ <section id="5Buntitled-5D" class="documentation-section">
94
+
95
+
96
+
97
+
98
+
99
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
100
+ <header>
101
+ <h3>Public Class Methods</h3>
102
+ </header>
103
+
104
+ <div id="method-c-create" class="method-detail ">
105
+ <div class="method-heading">
106
+ <span class="method-name">create</span><span
107
+ class="method-args">(params = {}, api_key = nil)</span>
108
+ <span class="method-click-advice">click to toggle source</span>
109
+ </div>
110
+
111
+ <div class="method-description">
112
+ <p>Create a <a href="ScanForm.html"><code>ScanForm</code></a>.</p>
113
+
114
+ <div class="method-source-code" id="create-source">
115
+ <pre><span class="ruby-comment"># File lib/easypost/scan_form.rb, line 7</span>
116
+ <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>)
117
+ <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">params</span>)
118
+ <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>)
119
+ <span class="ruby-keyword">end</span></pre>
120
+ </div>
121
+ </div>
122
+
123
+
124
+ </div>
125
+
126
+ </section>
127
+
128
+ </section>
129
+ </main>
130
+
131
+
132
+ <footer id="validator-badges" role="contentinfo">
133
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
134
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
135
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
136
+ </footer>
137
+