easypost 4.8.1 → 4.9.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 +4 -0
- data/Makefile +10 -2
- data/README.md +5 -1
- 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/carrier_account.rb +17 -0
- data/lib/easypost/shipment.rb +1 -1
- data/lib/easypost/user.rb +5 -2
- data/lib/easypost/util.rb +2 -0
- metadata +115 -6
@@ -0,0 +1,338 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class EasyPost::Beta::Referral - 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-add_credit_card">::add_credit_card</a>
|
76
|
+
<li ><a href="#method-c-all">::all</a>
|
77
|
+
<li ><a href="#method-c-create">::create</a>
|
78
|
+
<li ><a href="#method-c-create_easypost_credit_card">::create_easypost_credit_card</a>
|
79
|
+
<li ><a href="#method-c-create_stripe_token">::create_stripe_token</a>
|
80
|
+
<li ><a href="#method-c-retrieve_easypost_stripe_api_key">::retrieve_easypost_stripe_api_key</a>
|
81
|
+
<li ><a href="#method-c-update_email">::update_email</a>
|
82
|
+
</ul>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
</div>
|
86
|
+
</nav>
|
87
|
+
|
88
|
+
<main role="main" aria-labelledby="class-EasyPost::Beta::Referral">
|
89
|
+
<h1 id="class-EasyPost::Beta::Referral" class="class">
|
90
|
+
class EasyPost::Beta::Referral
|
91
|
+
</h1>
|
92
|
+
|
93
|
+
<section class="description">
|
94
|
+
|
95
|
+
<p><a href="Referral.html"><code>Referral</code></a> objects are User objects created from a Partner user.</p>
|
96
|
+
|
97
|
+
</section>
|
98
|
+
|
99
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
106
|
+
<header>
|
107
|
+
<h3>Public Class Methods</h3>
|
108
|
+
</header>
|
109
|
+
|
110
|
+
<div id="method-c-add_credit_card" class="method-detail ">
|
111
|
+
<div class="method-heading">
|
112
|
+
<span class="method-name">add_credit_card</span><span
|
113
|
+
class="method-args">(referral_api_key, number, expiration_month, expiration_year, cvc, priority = 'primary')</span>
|
114
|
+
<span class="method-click-advice">click to toggle source</span>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
<div class="method-description">
|
118
|
+
<p>Add credit card to a referral user. This function requires the <a href="Referral.html"><code>Referral</code></a> User’s API key. <strong>DEPRECATED:</strong> Please use <code>Referral</code> in the main namespace instead.</p>
|
119
|
+
|
120
|
+
<div class="method-source-code" id="add_credit_card-source">
|
121
|
+
<pre><span class="ruby-comment"># File lib/easypost/beta/referral.rb, line 91</span>
|
122
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">add_credit_card</span>(<span class="ruby-identifier">referral_api_key</span>, <span class="ruby-identifier">number</span>, <span class="ruby-identifier">expiration_month</span>, <span class="ruby-identifier">expiration_year</span>, <span class="ruby-identifier">cvc</span>, <span class="ruby-identifier">priority</span> = <span class="ruby-string">'primary'</span>)
|
123
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-string">'[DEPRECATION] Please use `Referral.add_credit_card` in the main namespace instead.'</span>
|
124
|
+
<span class="ruby-identifier">easypost_stripe_api_key</span> = <span class="ruby-identifier">retrieve_easypost_stripe_api_key</span>
|
125
|
+
|
126
|
+
<span class="ruby-keyword">begin</span>
|
127
|
+
<span class="ruby-identifier">stripe_credit_card_token</span> = <span class="ruby-identifier">create_stripe_token</span>(
|
128
|
+
<span class="ruby-identifier">number</span>,
|
129
|
+
<span class="ruby-identifier">expiration_month</span>,
|
130
|
+
<span class="ruby-identifier">expiration_year</span>,
|
131
|
+
<span class="ruby-identifier">cvc</span>,
|
132
|
+
<span class="ruby-identifier">easypost_stripe_api_key</span>,
|
133
|
+
)
|
134
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span>
|
135
|
+
<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">'Could not send card details to Stripe, please try again later.'</span>)
|
136
|
+
<span class="ruby-keyword">end</span>
|
137
|
+
|
138
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">create_easypost_credit_card</span>(<span class="ruby-identifier">referral_api_key</span>, <span class="ruby-identifier">stripe_credit_card_token</span>, <span class="ruby-identifier">priority</span>)
|
139
|
+
<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">referral_api_key</span>)
|
140
|
+
<span class="ruby-keyword">end</span></pre>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
<div id="method-c-all" class="method-detail ">
|
148
|
+
<div class="method-heading">
|
149
|
+
<span class="method-name">all</span><span
|
150
|
+
class="method-args">(params = {}, api_key = nil)</span>
|
151
|
+
<span class="method-click-advice">click to toggle source</span>
|
152
|
+
</div>
|
153
|
+
|
154
|
+
<div class="method-description">
|
155
|
+
<p>Retrieve a list of referral users. This function requires the Partner User’s API key. <strong>DEPRECATED:</strong> Please use <code>Referral</code> in the main namespace instead.</p>
|
156
|
+
|
157
|
+
<div class="method-source-code" id="all-source">
|
158
|
+
<pre><span class="ruby-comment"># File lib/easypost/beta/referral.rb, line 83</span>
|
159
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">all</span>(<span class="ruby-identifier">params</span> = {}, <span class="ruby-identifier">api_key</span> = <span class="ruby-keyword">nil</span>)
|
160
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-string">'[DEPRECATION] Please use `Referral.all` in the main namespace instead.'</span>
|
161
|
+
<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-string">'/beta/referral_customers'</span>, <span class="ruby-identifier">api_key</span>, <span class="ruby-identifier">params</span>)
|
162
|
+
<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>)
|
163
|
+
<span class="ruby-keyword">end</span></pre>
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div id="method-c-create" class="method-detail ">
|
171
|
+
<div class="method-heading">
|
172
|
+
<span class="method-name">create</span><span
|
173
|
+
class="method-args">(params = {}, api_key = nil)</span>
|
174
|
+
<span class="method-click-advice">click to toggle source</span>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
<div class="method-description">
|
178
|
+
<p>Create a referral user. This function requires the Partner User’s API key. <strong>DEPRECATED:</strong> Please use <code>Referral</code> in the main namespace instead.</p>
|
179
|
+
|
180
|
+
<div class="method-source-code" id="create-source">
|
181
|
+
<pre><span class="ruby-comment"># File lib/easypost/beta/referral.rb, line 60</span>
|
182
|
+
<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>)
|
183
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-string">'[DEPRECATION] Please use `Referral.create` in the main namespace instead.'</span>
|
184
|
+
<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-string">'/beta/referral_customers'</span>, <span class="ruby-identifier">api_key</span>, { <span class="ruby-value">user:</span> <span class="ruby-identifier">params</span> })
|
185
|
+
<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>)
|
186
|
+
<span class="ruby-keyword">end</span></pre>
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
|
191
|
+
</div>
|
192
|
+
|
193
|
+
<div id="method-c-update_email" class="method-detail ">
|
194
|
+
<div class="method-heading">
|
195
|
+
<span class="method-name">update_email</span><span
|
196
|
+
class="method-args">(email, user_id, api_key = nil)</span>
|
197
|
+
<span class="method-click-advice">click to toggle source</span>
|
198
|
+
</div>
|
199
|
+
|
200
|
+
<div class="method-description">
|
201
|
+
<p>Update a referral user. This function requires the Partner User’s API key. <strong>DEPRECATED:</strong> Please use <code>Referral</code> in the main namespace instead.</p>
|
202
|
+
|
203
|
+
<div class="method-source-code" id="update_email-source">
|
204
|
+
<pre><span class="ruby-comment"># File lib/easypost/beta/referral.rb, line 68</span>
|
205
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">update_email</span>(<span class="ruby-identifier">email</span>, <span class="ruby-identifier">user_id</span>, <span class="ruby-identifier">api_key</span> = <span class="ruby-keyword">nil</span>)
|
206
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-string">'[DEPRECATION] Please use `Referral.update_email` in the main namespace instead.'</span>
|
207
|
+
<span class="ruby-identifier">wrapped_params</span> = {
|
208
|
+
<span class="ruby-value">user:</span> {
|
209
|
+
<span class="ruby-value">email:</span> <span class="ruby-identifier">email</span>,
|
210
|
+
},
|
211
|
+
}
|
212
|
+
<span class="ruby-constant">EasyPost</span>.<span class="ruby-identifier">make_request</span>(<span class="ruby-value">:put</span>, <span class="ruby-node">"/beta/referral_customers/#{user_id}"</span>, <span class="ruby-identifier">api_key</span>, <span class="ruby-identifier">wrapped_params</span>)
|
213
|
+
|
214
|
+
<span class="ruby-comment"># return true if API succeeds, else an error is throw if it fails.</span>
|
215
|
+
<span class="ruby-keyword">true</span>
|
216
|
+
<span class="ruby-keyword">end</span></pre>
|
217
|
+
</div>
|
218
|
+
</div>
|
219
|
+
|
220
|
+
|
221
|
+
</div>
|
222
|
+
|
223
|
+
</section>
|
224
|
+
|
225
|
+
<section id="protected-class-5Buntitled-5D-method-details" class="method-section">
|
226
|
+
<header>
|
227
|
+
<h3>Protected Class Methods</h3>
|
228
|
+
</header>
|
229
|
+
|
230
|
+
<div id="method-c-create_easypost_credit_card" class="method-detail ">
|
231
|
+
<div class="method-heading">
|
232
|
+
<span class="method-name">create_easypost_credit_card</span><span
|
233
|
+
class="method-args">(referral_api_key, stripe_object_id, priority = 'primary')</span>
|
234
|
+
<span class="method-click-advice">click to toggle source</span>
|
235
|
+
</div>
|
236
|
+
|
237
|
+
<div class="method-description">
|
238
|
+
<p>Submit Stripe credit card token to <a href="../../EasyPost.html"><code>EasyPost</code></a>.</p>
|
239
|
+
|
240
|
+
<div class="method-source-code" id="create_easypost_credit_card-source">
|
241
|
+
<pre><span class="ruby-comment"># File lib/easypost/beta/referral.rb, line 46</span>
|
242
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">create_easypost_credit_card</span>(<span class="ruby-identifier">referral_api_key</span>, <span class="ruby-identifier">stripe_object_id</span>, <span class="ruby-identifier">priority</span> = <span class="ruby-string">'primary'</span>)
|
243
|
+
<span class="ruby-identifier">wrapped_params</span> = {
|
244
|
+
<span class="ruby-value">credit_card:</span> {
|
245
|
+
<span class="ruby-value">stripe_object_id:</span> <span class="ruby-identifier">stripe_object_id</span>,
|
246
|
+
<span class="ruby-value">priority:</span> <span class="ruby-identifier">priority</span>,
|
247
|
+
},
|
248
|
+
}
|
249
|
+
<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-string">'/beta/credit_cards'</span>, <span class="ruby-identifier">referral_api_key</span>, <span class="ruby-identifier">wrapped_params</span>)
|
250
|
+
<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">referral_api_key</span>)
|
251
|
+
<span class="ruby-keyword">end</span></pre>
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
|
255
|
+
|
256
|
+
</div>
|
257
|
+
|
258
|
+
<div id="method-c-create_stripe_token" class="method-detail ">
|
259
|
+
<div class="method-heading">
|
260
|
+
<span class="method-name">create_stripe_token</span><span
|
261
|
+
class="method-args">(number, expiration_month, expiration_year, cvc, easypost_stripe_token)</span>
|
262
|
+
<span class="method-click-advice">click to toggle source</span>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
<div class="method-description">
|
266
|
+
<p>Get credit card token from Stripe.</p>
|
267
|
+
|
268
|
+
<div class="method-source-code" id="create_stripe_token-source">
|
269
|
+
<pre><span class="ruby-comment"># File lib/easypost/beta/referral.rb, line 15</span>
|
270
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">create_stripe_token</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">expiration_month</span>, <span class="ruby-identifier">expiration_year</span>,
|
271
|
+
<span class="ruby-identifier">cvc</span>, <span class="ruby-identifier">easypost_stripe_token</span>)
|
272
|
+
<span class="ruby-identifier">headers</span> = {
|
273
|
+
<span class="ruby-comment"># This Stripe endpoint only accepts URL form encoded bodies.</span>
|
274
|
+
<span class="ruby-value">Authorization:</span> <span class="ruby-node">"Bearer #{easypost_stripe_token}"</span>,
|
275
|
+
<span class="ruby-value">'Content-type':</span> <span class="ruby-string">'application/x-www-form-urlencoded'</span>,
|
276
|
+
}
|
277
|
+
|
278
|
+
<span class="ruby-identifier">credit_card_hash</span> = {
|
279
|
+
<span class="ruby-value">card:</span> {
|
280
|
+
<span class="ruby-value">number:</span> <span class="ruby-identifier">number</span>,
|
281
|
+
<span class="ruby-value">exp_month:</span> <span class="ruby-identifier">expiration_month</span>,
|
282
|
+
<span class="ruby-value">exp_year:</span> <span class="ruby-identifier">expiration_year</span>,
|
283
|
+
<span class="ruby-value">cvc:</span> <span class="ruby-identifier">cvc</span>,
|
284
|
+
},
|
285
|
+
}
|
286
|
+
|
287
|
+
<span class="ruby-identifier">form_encoded_params</span> = <span class="ruby-constant">EasyPost</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">form_encode_params</span>(<span class="ruby-identifier">credit_card_hash</span>)
|
288
|
+
|
289
|
+
<span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-string">'https://api.stripe.com/v1/tokens'</span>)
|
290
|
+
<span class="ruby-identifier">http</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>)
|
291
|
+
<span class="ruby-identifier">http</span>.<span class="ruby-identifier">use_ssl</span> = <span class="ruby-keyword">true</span>
|
292
|
+
<span class="ruby-identifier">request</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">request_uri</span>, <span class="ruby-identifier">headers</span>)
|
293
|
+
<span class="ruby-identifier">query</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">encode_www_form</span>(<span class="ruby-identifier">form_encoded_params</span>)
|
294
|
+
|
295
|
+
<span class="ruby-identifier">response</span> = <span class="ruby-identifier">http</span>.<span class="ruby-identifier">request</span>(<span class="ruby-identifier">request</span>, <span class="ruby-identifier">query</span>)
|
296
|
+
<span class="ruby-identifier">response_json</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span>)
|
297
|
+
<span class="ruby-identifier">response_json</span>[<span class="ruby-string">'id'</span>]
|
298
|
+
<span class="ruby-keyword">end</span></pre>
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
|
302
|
+
|
303
|
+
</div>
|
304
|
+
|
305
|
+
<div id="method-c-retrieve_easypost_stripe_api_key" class="method-detail ">
|
306
|
+
<div class="method-heading">
|
307
|
+
<span class="method-name">retrieve_easypost_stripe_api_key</span><span
|
308
|
+
class="method-args">()</span>
|
309
|
+
<span class="method-click-advice">click to toggle source</span>
|
310
|
+
</div>
|
311
|
+
|
312
|
+
<div class="method-description">
|
313
|
+
<p>Retrieve EasyPost’s Stripe public API key.</p>
|
314
|
+
|
315
|
+
<div class="method-source-code" id="retrieve_easypost_stripe_api_key-source">
|
316
|
+
<pre><span class="ruby-comment"># File lib/easypost/beta/referral.rb, line 9</span>
|
317
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">retrieve_easypost_stripe_api_key</span>
|
318
|
+
<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-string">'/beta/partners/stripe_public_key'</span>, <span class="ruby-ivar">@api_key</span>)
|
319
|
+
<span class="ruby-identifier">response</span>[<span class="ruby-string">'public_key'</span>]
|
320
|
+
<span class="ruby-keyword">end</span></pre>
|
321
|
+
</div>
|
322
|
+
</div>
|
323
|
+
|
324
|
+
|
325
|
+
</div>
|
326
|
+
|
327
|
+
</section>
|
328
|
+
|
329
|
+
</section>
|
330
|
+
</main>
|
331
|
+
|
332
|
+
|
333
|
+
<footer id="validator-badges" role="contentinfo">
|
334
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
335
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
|
336
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
337
|
+
</footer>
|
338
|
+
|
@@ -0,0 +1,91 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module EasyPost::Beta - 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="module">
|
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
|
+
|
62
|
+
|
63
|
+
|
64
|
+
</div>
|
65
|
+
</nav>
|
66
|
+
|
67
|
+
<main role="main" aria-labelledby="module-EasyPost::Beta">
|
68
|
+
<h1 id="module-EasyPost::Beta" class="module">
|
69
|
+
module EasyPost::Beta
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<section class="description">
|
73
|
+
|
74
|
+
</section>
|
75
|
+
|
76
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
</section>
|
83
|
+
</main>
|
84
|
+
|
85
|
+
|
86
|
+
<footer id="validator-badges" role="contentinfo">
|
87
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
88
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.
|
89
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
90
|
+
</footer>
|
91
|
+
|