workos 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -2
- data/Gemfile.lock +6 -2
- data/README.md +179 -8
- data/bin/docs +2 -2
- data/codecov.yml +1 -0
- data/docs/WorkOS.html +22 -26
- data/docs/WorkOS/APIError.html +160 -0
- data/docs/WorkOS/AuditLog.html +235 -0
- data/docs/WorkOS/AuthenticationError.html +160 -0
- data/docs/WorkOS/Base.html +27 -32
- data/docs/WorkOS/Client.html +493 -0
- data/docs/WorkOS/InvalidRequestError.html +160 -0
- data/docs/WorkOS/Profile.html +80 -17
- data/docs/WorkOS/RequestError.html +6 -6
- data/docs/WorkOS/SSO.html +118 -74
- data/docs/WorkOS/Types.html +9 -10
- data/docs/WorkOS/Types/ProfileStruct.html +6 -6
- data/docs/WorkOS/Types/Provider.html +135 -0
- data/docs/WorkOS/WorkOSError.html +447 -0
- data/docs/class_list.html +3 -3
- data/docs/css/style.css +2 -2
- data/docs/file.README.html +173 -13
- data/docs/file_list.html +2 -2
- data/docs/frames.html +2 -2
- data/docs/index.html +77 -16
- data/docs/js/app.js +14 -3
- data/docs/method_list.html +96 -8
- data/docs/top-level-namespace.html +6 -6
- data/lib/workos.rb +7 -2
- data/lib/workos/audit_log.rb +78 -0
- data/lib/workos/base.rb +5 -6
- data/lib/workos/client.rb +86 -0
- data/lib/workos/errors.rb +48 -0
- data/lib/workos/sso.rb +49 -27
- data/lib/workos/types.rb +2 -1
- data/lib/workos/types/provider_enum.rb +14 -0
- data/lib/workos/version.rb +2 -2
- data/sorbet/rbi/hidden-definitions/errors.txt +22108 -4368
- data/sorbet/rbi/hidden-definitions/hidden.rbi +32490 -6059
- data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +1 -1
- data/sorbet/rbi/todo.rbi +5 -0
- data/spec/lib/workos/audit_log_spec.rb +140 -0
- data/spec/lib/workos/base_spec.rb +30 -0
- data/spec/lib/workos/sso_spec.rb +131 -36
- data/spec/spec_helper.rb +21 -1
- data/spec/support/fixtures/vcr_cassettes/audit_log/create_event.yml +65 -0
- data/spec/support/fixtures/vcr_cassettes/audit_log/create_event_custom_idempotency_key.yml +67 -0
- data/spec/support/fixtures/vcr_cassettes/audit_log/create_event_invalid.yml +68 -0
- data/spec/support/fixtures/vcr_cassettes/audit_log/create_events_duplicate_idempotency_key_and_payload.yml +131 -0
- data/spec/support/fixtures/vcr_cassettes/audit_log/create_events_duplicate_idempotency_key_different_payload.yml +134 -0
- data/spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml +66 -0
- data/workos.gemspec +2 -0
- metadata +57 -27
- data/lib/workos/request_error.rb +0 -5
- data/sorbet/rbi/gems/addressable.rbi +0 -198
- data/sorbet/rbi/gems/ast.rbi +0 -47
- data/sorbet/rbi/gems/codecov.rbi +0 -19
- data/sorbet/rbi/gems/crack.rbi +0 -47
- data/sorbet/rbi/gems/docile.rbi +0 -31
- data/sorbet/rbi/gems/hashdiff.rbi +0 -65
- data/sorbet/rbi/gems/jaro_winkler.rbi +0 -14
- data/sorbet/rbi/gems/parallel.rbi +0 -81
- data/sorbet/rbi/gems/parser.rbi +0 -856
- data/sorbet/rbi/gems/public_suffix.rbi +0 -102
- data/sorbet/rbi/gems/rack.rbi +0 -103
- data/sorbet/rbi/gems/rainbow.rbi +0 -117
- data/sorbet/rbi/gems/rake.rbi +0 -632
- data/sorbet/rbi/gems/rspec-core.rbi +0 -1661
- data/sorbet/rbi/gems/rspec-expectations.rbi +0 -388
- data/sorbet/rbi/gems/rspec-mocks.rbi +0 -823
- data/sorbet/rbi/gems/rspec-support.rbi +0 -266
- data/sorbet/rbi/gems/rspec.rbi +0 -14
- data/sorbet/rbi/gems/rubocop.rbi +0 -7083
- data/sorbet/rbi/gems/ruby-progressbar.rbi +0 -304
- data/sorbet/rbi/gems/simplecov-html.rbi +0 -30
- data/sorbet/rbi/gems/simplecov.rbi +0 -225
- data/sorbet/rbi/gems/unicode-display_width.rbi +0 -16
- data/sorbet/rbi/gems/webmock.rbi +0 -526
@@ -0,0 +1,493 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: WorkOS::Client
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.22
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "WorkOS::Client";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (C)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Client</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: WorkOS::Client
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
<dl>
|
73
|
+
<dt>Extended by:</dt>
|
74
|
+
<dd>T::Sig</dd>
|
75
|
+
</dl>
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Includes:</dt>
|
81
|
+
<dd>Kernel</dd>
|
82
|
+
</dl>
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<dl>
|
88
|
+
<dt>Included in:</dt>
|
89
|
+
<dd><span class='object_link'><a href="AuditLog.html" title="WorkOS::AuditLog (module)">AuditLog</a></span>, <span class='object_link'><a href="SSO.html" title="WorkOS::SSO (module)">SSO</a></span></dd>
|
90
|
+
</dl>
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
<dl>
|
95
|
+
<dt>Defined in:</dt>
|
96
|
+
<dd>lib/workos/client.rb</dd>
|
97
|
+
</dl>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<h2>
|
110
|
+
Instance Method Summary
|
111
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
112
|
+
</h2>
|
113
|
+
|
114
|
+
<ul class="summary">
|
115
|
+
|
116
|
+
<li class="public ">
|
117
|
+
<span class="summary_signature">
|
118
|
+
|
119
|
+
<a href="#client-instance_method" title="#client (instance method)">#<strong>client</strong> ⇒ Object </a>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
</span>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
134
|
+
|
135
|
+
</li>
|
136
|
+
|
137
|
+
|
138
|
+
<li class="public ">
|
139
|
+
<span class="summary_signature">
|
140
|
+
|
141
|
+
<a href="#execute_request-instance_method" title="#execute_request (instance method)">#<strong>execute_request</strong>(request:) ⇒ Object </a>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
</span>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
156
|
+
|
157
|
+
</li>
|
158
|
+
|
159
|
+
|
160
|
+
<li class="public ">
|
161
|
+
<span class="summary_signature">
|
162
|
+
|
163
|
+
<a href="#handle_error_response-instance_method" title="#handle_error_response (instance method)">#<strong>handle_error_response</strong>(response:) ⇒ Object </a>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
</span>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
178
|
+
|
179
|
+
</li>
|
180
|
+
|
181
|
+
|
182
|
+
<li class="public ">
|
183
|
+
<span class="summary_signature">
|
184
|
+
|
185
|
+
<a href="#post_request-instance_method" title="#post_request (instance method)">#<strong>post_request</strong>(path:, body: nil) ⇒ Object </a>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
</span>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
200
|
+
|
201
|
+
</li>
|
202
|
+
|
203
|
+
|
204
|
+
<li class="public ">
|
205
|
+
<span class="summary_signature">
|
206
|
+
|
207
|
+
<a href="#user_agent-instance_method" title="#user_agent (instance method)">#<strong>user_agent</strong> ⇒ Object </a>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
</span>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
222
|
+
|
223
|
+
</li>
|
224
|
+
|
225
|
+
|
226
|
+
</ul>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
<div id="instance_method_details" class="method_details_list">
|
234
|
+
<h2>Instance Method Details</h2>
|
235
|
+
|
236
|
+
|
237
|
+
<div class="method_details first">
|
238
|
+
<h3 class="signature first" id="client-instance_method">
|
239
|
+
|
240
|
+
#<strong>client</strong> ⇒ <tt>Object</tt>
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
</h3><table class="source_code">
|
247
|
+
<tr>
|
248
|
+
<td>
|
249
|
+
<pre class="lines">
|
250
|
+
|
251
|
+
|
252
|
+
11
|
253
|
+
12
|
254
|
+
13
|
255
|
+
14
|
256
|
+
15
|
257
|
+
16
|
258
|
+
17
|
259
|
+
18</pre>
|
260
|
+
</td>
|
261
|
+
<td>
|
262
|
+
<pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 11</span>
|
263
|
+
|
264
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_client'>client</span>
|
265
|
+
<span class='kw'>return</span> <span class='ivar'>@client</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='ivar'>@client</span><span class='rparen'>)</span>
|
266
|
+
|
267
|
+
<span class='ivar'>@client</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../WorkOS.html#API_HOSTNAME-constant" title="WorkOS::API_HOSTNAME (constant)">API_HOSTNAME</a></span></span><span class='comma'>,</span> <span class='int'>443</span><span class='rparen'>)</span>
|
268
|
+
<span class='ivar'>@client</span><span class='period'>.</span><span class='id identifier rubyid_use_ssl'>use_ssl</span> <span class='op'>=</span> <span class='kw'>true</span>
|
269
|
+
|
270
|
+
<span class='ivar'>@client</span>
|
271
|
+
<span class='kw'>end</span></pre>
|
272
|
+
</td>
|
273
|
+
</tr>
|
274
|
+
</table>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div class="method_details ">
|
278
|
+
<h3 class="signature " id="execute_request-instance_method">
|
279
|
+
|
280
|
+
#<strong>execute_request</strong>(request:) ⇒ <tt>Object</tt>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
</h3><table class="source_code">
|
287
|
+
<tr>
|
288
|
+
<td>
|
289
|
+
<pre class="lines">
|
290
|
+
|
291
|
+
|
292
|
+
21
|
293
|
+
22
|
294
|
+
23
|
295
|
+
24
|
296
|
+
25
|
297
|
+
26
|
298
|
+
27
|
299
|
+
28</pre>
|
300
|
+
</td>
|
301
|
+
<td>
|
302
|
+
<pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 21</span>
|
303
|
+
|
304
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_execute_request'>execute_request</span><span class='lparen'>(</span><span class='label'>request:</span><span class='rparen'>)</span>
|
305
|
+
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span>
|
306
|
+
|
307
|
+
<span class='id identifier rubyid_http_status'>http_status</span> <span class='op'>=</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
308
|
+
<span class='id identifier rubyid_handle_error_response'>handle_error_response</span><span class='lparen'>(</span><span class='label'>response:</span> <span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_http_status'>http_status</span> <span class='op'>>=</span> <span class='int'>400</span>
|
309
|
+
|
310
|
+
<span class='id identifier rubyid_response'>response</span>
|
311
|
+
<span class='kw'>end</span></pre>
|
312
|
+
</td>
|
313
|
+
</tr>
|
314
|
+
</table>
|
315
|
+
</div>
|
316
|
+
|
317
|
+
<div class="method_details ">
|
318
|
+
<h3 class="signature " id="handle_error_response-instance_method">
|
319
|
+
|
320
|
+
#<strong>handle_error_response</strong>(response:) ⇒ <tt>Object</tt>
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
</h3><table class="source_code">
|
327
|
+
<tr>
|
328
|
+
<td>
|
329
|
+
<pre class="lines">
|
330
|
+
|
331
|
+
|
332
|
+
53
|
333
|
+
54
|
334
|
+
55
|
335
|
+
56
|
336
|
+
57
|
337
|
+
58
|
338
|
+
59
|
339
|
+
60
|
340
|
+
61
|
341
|
+
62
|
342
|
+
63
|
343
|
+
64
|
344
|
+
65
|
345
|
+
66
|
346
|
+
67
|
347
|
+
68
|
348
|
+
69
|
349
|
+
70
|
350
|
+
71
|
351
|
+
72
|
352
|
+
73
|
353
|
+
74
|
354
|
+
75
|
355
|
+
76
|
356
|
+
77
|
357
|
+
78
|
358
|
+
79
|
359
|
+
80
|
360
|
+
81
|
361
|
+
82</pre>
|
362
|
+
</td>
|
363
|
+
<td>
|
364
|
+
<pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 53</span>
|
365
|
+
|
366
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_handle_error_response'>handle_error_response</span><span class='lparen'>(</span><span class='label'>response:</span><span class='rparen'>)</span>
|
367
|
+
<span class='id identifier rubyid_http_status'>http_status</span> <span class='op'>=</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
368
|
+
<span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
|
369
|
+
|
370
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_http_status'>http_status</span>
|
371
|
+
<span class='kw'>when</span> <span class='int'>400</span>
|
372
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="InvalidRequestError.html" title="WorkOS::InvalidRequestError (class)">InvalidRequestError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="WorkOSError.html#initialize-instance_method" title="WorkOS::WorkOSError#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
373
|
+
<span class='label'>message:</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>message</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
374
|
+
<span class='label'>http_status:</span> <span class='id identifier rubyid_http_status'>http_status</span><span class='comma'>,</span>
|
375
|
+
<span class='label'>request_id:</span> <span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>x-request-id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
376
|
+
<span class='rparen'>)</span>
|
377
|
+
<span class='kw'>when</span> <span class='int'>401</span>
|
378
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="AuthenticationError.html" title="WorkOS::AuthenticationError (class)">AuthenticationError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="WorkOSError.html#initialize-instance_method" title="WorkOS::WorkOSError#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
379
|
+
<span class='label'>message:</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>message</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
380
|
+
<span class='label'>http_status:</span> <span class='id identifier rubyid_http_status'>http_status</span><span class='comma'>,</span>
|
381
|
+
<span class='label'>request_id:</span> <span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>x-request-id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
382
|
+
<span class='rparen'>)</span>
|
383
|
+
<span class='kw'>when</span> <span class='int'>422</span>
|
384
|
+
<span class='id identifier rubyid_errors'>errors</span> <span class='op'>=</span> <span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>errors</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_error'>error</span><span class='op'>|</span>
|
385
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>field</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_error'>error</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>code</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
386
|
+
<span class='kw'>end</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>; </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
387
|
+
|
388
|
+
<span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>message</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_errors'>errors</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span>
|
389
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="InvalidRequestError.html" title="WorkOS::InvalidRequestError (class)">InvalidRequestError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="WorkOSError.html#initialize-instance_method" title="WorkOS::WorkOSError#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
390
|
+
<span class='label'>message:</span> <span class='id identifier rubyid_message'>message</span><span class='comma'>,</span>
|
391
|
+
<span class='label'>http_status:</span> <span class='id identifier rubyid_http_status'>http_status</span><span class='comma'>,</span>
|
392
|
+
<span class='label'>request_id:</span> <span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>x-request-id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
|
393
|
+
<span class='rparen'>)</span>
|
394
|
+
<span class='kw'>end</span>
|
395
|
+
<span class='kw'>end</span></pre>
|
396
|
+
</td>
|
397
|
+
</tr>
|
398
|
+
</table>
|
399
|
+
</div>
|
400
|
+
|
401
|
+
<div class="method_details ">
|
402
|
+
<h3 class="signature " id="post_request-instance_method">
|
403
|
+
|
404
|
+
#<strong>post_request</strong>(path:, body: nil) ⇒ <tt>Object</tt>
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
</h3><table class="source_code">
|
411
|
+
<tr>
|
412
|
+
<td>
|
413
|
+
<pre class="lines">
|
414
|
+
|
415
|
+
|
416
|
+
31
|
417
|
+
32
|
418
|
+
33
|
419
|
+
34
|
420
|
+
35
|
421
|
+
36</pre>
|
422
|
+
</td>
|
423
|
+
<td>
|
424
|
+
<pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 31</span>
|
425
|
+
|
426
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_post_request'>post_request</span><span class='lparen'>(</span><span class='label'>path:</span><span class='comma'>,</span> <span class='label'>body:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
427
|
+
<span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Post</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>application/json</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
428
|
+
<span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span> <span class='kw'>if</span> <span class='id identifier rubyid_body'>body</span>
|
429
|
+
<span class='id identifier rubyid_request'>request</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>User-Agent</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_user_agent'>user_agent</span>
|
430
|
+
<span class='id identifier rubyid_request'>request</span>
|
431
|
+
<span class='kw'>end</span></pre>
|
432
|
+
</td>
|
433
|
+
</tr>
|
434
|
+
</table>
|
435
|
+
</div>
|
436
|
+
|
437
|
+
<div class="method_details ">
|
438
|
+
<h3 class="signature " id="user_agent-instance_method">
|
439
|
+
|
440
|
+
#<strong>user_agent</strong> ⇒ <tt>Object</tt>
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
</h3><table class="source_code">
|
447
|
+
<tr>
|
448
|
+
<td>
|
449
|
+
<pre class="lines">
|
450
|
+
|
451
|
+
|
452
|
+
39
|
453
|
+
40
|
454
|
+
41
|
455
|
+
42
|
456
|
+
43
|
457
|
+
44
|
458
|
+
45
|
459
|
+
46
|
460
|
+
47
|
461
|
+
48</pre>
|
462
|
+
</td>
|
463
|
+
<td>
|
464
|
+
<pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 39</span>
|
465
|
+
|
466
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_user_agent'>user_agent</span>
|
467
|
+
<span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>RUBY_ENGINE</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='op'>::</span><span class='const'>RUBY_ENGINE</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Ruby</span><span class='tstring_end'>'</span></span>
|
468
|
+
|
469
|
+
<span class='lbracket'>[</span>
|
470
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>WorkOS</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
471
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_engine'>engine</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='const'>RUBY_VERSION</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
472
|
+
<span class='const'>RUBY_PLATFORM</span><span class='comma'>,</span>
|
473
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>v</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="../WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../WorkOS.html#VERSION-constant" title="WorkOS::VERSION (constant)">VERSION</a></span></span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
474
|
+
<span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>; </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
475
|
+
<span class='kw'>end</span></pre>
|
476
|
+
</td>
|
477
|
+
</tr>
|
478
|
+
</table>
|
479
|
+
</div>
|
480
|
+
|
481
|
+
</div>
|
482
|
+
|
483
|
+
</div>
|
484
|
+
|
485
|
+
<div id="footer">
|
486
|
+
Generated on Thu Jan 30 09:12:47 2020 by
|
487
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
488
|
+
0.9.22 (ruby-2.6.5).
|
489
|
+
</div>
|
490
|
+
|
491
|
+
</div>
|
492
|
+
</body>
|
493
|
+
</html>
|