workos 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70741b6fe93402cbd090a16e41cf7ea2cb6df08073f1bdb95c0fc8ab06f7e5b5
4
- data.tar.gz: 0a2726acf7ca96b490c4c66585dd3cf9ad0f70f89ec00991d69460ec8ec4907d
3
+ metadata.gz: 13b44f46640b8e437a8202d958cc545ddbb95f04d9ab1ae2e56153531c5c0cef
4
+ data.tar.gz: 538208b90831666360053a2cbb7b732c43a64299523c5649858e16f4a2553cde
5
5
  SHA512:
6
- metadata.gz: 2d3d401843a2d5a19adf7a1ebb9e6c8cdf49228702cd93bf82fe5c2cb368ad9770bffe0a567d9e2e94772df4dad4ecbb2f594a37de9ddba3f8334648a270ec9e
7
- data.tar.gz: a0a7f900ad0d0a60ccfb3aa8f5ac20e2f19dd0577cd27d9ecde782b4740ad50ef4bc2fbc326bca03fa7b7a55950bdfc73ef91db59c05904097ee753b79e09f59
6
+ metadata.gz: 4699ed5040947a19c420caaca3f1bd3bf5443398ec2cdcfda1aed6e03ac05c874158e139cdce87f8dd44e26804b62fa0786700c8c156e3f1cf1457e7bf3174a3
7
+ data.tar.gz: 8c65f6603e50ccf76b0179c9bee721ca3aaae64ce749fe91b5daa3c9c0f57db74049944f1d0cf89b2755dfd38ddbbd4e8dfc3d3f7cdf3e99cb88077c54fac9f9
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (0.1.0)
4
+ workos (0.1.1)
5
5
  sorbet-runtime (~> 0.5)
6
6
 
7
7
  GEM
@@ -56,7 +56,7 @@ GEM
56
56
  simplecov-html (0.10.2)
57
57
  sorbet (0.5.5181)
58
58
  sorbet-static (= 0.5.5181)
59
- sorbet-runtime (0.5.5182)
59
+ sorbet-runtime (0.5.5373)
60
60
  sorbet-static (0.5.5181-universal-darwin-14)
61
61
  unicode-display_width (1.6.0)
62
62
  url (0.3.2)
@@ -88,7 +88,7 @@
88
88
  <h2>Overview</h2><div class="docstring">
89
89
  <div class="discussion">
90
90
 
91
- <p>typed: strict</p>
91
+ <p>Use the WorkOS module to authenticate your requests to the WorkOS API. The gem will read your API key automatically from the ENV var `WORKOS_KEY`. Alternatively, you can set the key yourself with `WorkOS.key = [your api key]` somewhere in the load path of your application, such as an initializer.</p>
92
92
 
93
93
 
94
94
  </div>
@@ -120,12 +120,12 @@
120
120
  <dt id="API_HOSTNAME-constant" class="">API_HOSTNAME =
121
121
 
122
122
  </dt>
123
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>api.workos.com</span><span class='tstring_end'>&#39;</span></span></pre></dd>
123
+ <dd><pre class="code"><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>WORKOS_API_HOSTNAME</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>api.workos.com</span><span class='tstring_end'>&#39;</span></span></pre></dd>
124
124
 
125
125
  <dt id="VERSION-constant" class="">VERSION =
126
126
 
127
127
  </dt>
128
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.1.0</span><span class='tstring_end'>&#39;</span></span></pre></dd>
128
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>0.1.1</span><span class='tstring_end'>&#39;</span></span></pre></dd>
129
129
 
130
130
  </dl>
131
131
 
@@ -314,7 +314,7 @@
314
314
  </div>
315
315
 
316
316
  <div id="footer">
317
- Generated on Thu Jan 30 09:12:47 2020 by
317
+ Generated on Mon Mar 2 13:26:48 2020 by
318
318
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
319
319
  0.9.22 (ruby-2.6.5).
320
320
  </div>
@@ -150,7 +150,7 @@
150
150
  </div>
151
151
 
152
152
  <div id="footer">
153
- Generated on Thu Jan 30 09:12:47 2020 by
153
+ Generated on Mon Mar 2 13:26:48 2020 by
154
154
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
155
155
  0.9.22 (ruby-2.6.5).
156
156
  </div>
@@ -225,7 +225,7 @@
225
225
  </div>
226
226
 
227
227
  <div id="footer">
228
- Generated on Thu Jan 30 09:12:47 2020 by
228
+ Generated on Mon Mar 2 13:26:48 2020 by
229
229
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
230
230
  0.9.22 (ruby-2.6.5).
231
231
  </div>
@@ -150,7 +150,7 @@
150
150
  </div>
151
151
 
152
152
  <div id="footer">
153
- Generated on Thu Jan 30 09:12:47 2020 by
153
+ Generated on Mon Mar 2 13:26:48 2020 by
154
154
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
155
155
  0.9.22 (ruby-2.6.5).
156
156
  </div>
@@ -93,7 +93,18 @@
93
93
 
94
94
  </div>
95
95
 
96
+ <h2>Overview</h2><div class="docstring">
97
+ <div class="discussion">
98
+
99
+ <p>The Base class handles setting and reading the WorkOS API Key for authentication</p>
100
+
96
101
 
102
+ </div>
103
+ </div>
104
+ <div class="tags">
105
+
106
+
107
+ </div>
97
108
 
98
109
 
99
110
 
@@ -197,12 +208,12 @@
197
208
  <pre class="lines">
198
209
 
199
210
 
200
- 13
201
- 14
202
- 15</pre>
211
+ 15
212
+ 16
213
+ 17</pre>
203
214
  </td>
204
215
  <td>
205
- <pre class="code"><span class="info file"># File 'lib/workos/base.rb', line 13</span>
216
+ <pre class="code"><span class="info file"># File 'lib/workos/base.rb', line 15</span>
206
217
 
207
218
  <span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
208
219
  <span class='ivar'>@key</span>
@@ -245,12 +256,12 @@
245
256
  <pre class="lines">
246
257
 
247
258
 
248
- 7
249
- 8
250
- 9</pre>
259
+ 9
260
+ 10
261
+ 11</pre>
251
262
  </td>
252
263
  <td>
253
- <pre class="code"><span class="info file"># File 'lib/workos/base.rb', line 7</span>
264
+ <pre class="code"><span class="info file"># File 'lib/workos/base.rb', line 9</span>
254
265
 
255
266
  <span class='kw'>def</span> <span class='id identifier rubyid_key'>key</span>
256
267
  <span class='ivar'>@key</span>
@@ -266,7 +277,7 @@
266
277
  </div>
267
278
 
268
279
  <div id="footer">
269
- Generated on Thu Jan 30 09:12:47 2020 by
280
+ Generated on Mon Mar 2 13:26:48 2020 by
270
281
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
271
282
  0.9.22 (ruby-2.6.5).
272
283
  </div>
@@ -98,7 +98,18 @@
98
98
 
99
99
  </div>
100
100
 
101
+ <h2>Overview</h2><div class="docstring">
102
+ <div class="discussion">
103
+
104
+ <p>A Net::HTTP based API client for interacting with the WorkOS API</p>
105
+
101
106
 
107
+ </div>
108
+ </div>
109
+ <div class="tags">
110
+
111
+
112
+ </div>
102
113
 
103
114
 
104
115
 
@@ -249,17 +260,17 @@
249
260
  <pre class="lines">
250
261
 
251
262
 
252
- 11
253
263
  12
254
264
  13
255
265
  14
256
266
  15
257
267
  16
258
268
  17
259
- 18</pre>
269
+ 18
270
+ 19</pre>
260
271
  </td>
261
272
  <td>
262
- <pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 11</span>
273
+ <pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 12</span>
263
274
 
264
275
  <span class='kw'>def</span> <span class='id identifier rubyid_client'>client</span>
265
276
  <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>
@@ -289,17 +300,17 @@
289
300
  <pre class="lines">
290
301
 
291
302
 
292
- 21
293
303
  22
294
304
  23
295
305
  24
296
306
  25
297
307
  26
298
308
  27
299
- 28</pre>
309
+ 28
310
+ 29</pre>
300
311
  </td>
301
312
  <td>
302
- <pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 21</span>
313
+ <pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 22</span>
303
314
 
304
315
  <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
316
  <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>
@@ -329,7 +340,6 @@
329
340
  <pre class="lines">
330
341
 
331
342
 
332
- 53
333
343
  54
334
344
  55
335
345
  56
@@ -358,10 +368,11 @@
358
368
  79
359
369
  80
360
370
  81
361
- 82</pre>
371
+ 82
372
+ 83</pre>
362
373
  </td>
363
374
  <td>
364
- <pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 53</span>
375
+ <pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 54</span>
365
376
 
366
377
  <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
378
  <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>
@@ -413,15 +424,15 @@
413
424
  <pre class="lines">
414
425
 
415
426
 
416
- 31
417
427
  32
418
428
  33
419
429
  34
420
430
  35
421
- 36</pre>
431
+ 36
432
+ 37</pre>
422
433
  </td>
423
434
  <td>
424
- <pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 31</span>
435
+ <pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 32</span>
425
436
 
426
437
  <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
438
  <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'>&#39;</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>application/json</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
@@ -449,7 +460,6 @@
449
460
  <pre class="lines">
450
461
 
451
462
 
452
- 39
453
463
  40
454
464
  41
455
465
  42
@@ -458,10 +468,11 @@
458
468
  45
459
469
  46
460
470
  47
461
- 48</pre>
471
+ 48
472
+ 49</pre>
462
473
  </td>
463
474
  <td>
464
- <pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 39</span>
475
+ <pre class="code"><span class="info file"># File 'lib/workos/client.rb', line 40</span>
465
476
 
466
477
  <span class='kw'>def</span> <span class='id identifier rubyid_user_agent'>user_agent</span>
467
478
  <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'>&#39;</span><span class='tstring_content'>Ruby</span><span class='tstring_end'>&#39;</span></span>
@@ -483,7 +494,7 @@
483
494
  </div>
484
495
 
485
496
  <div id="footer">
486
- Generated on Thu Jan 30 09:12:47 2020 by
497
+ Generated on Mon Mar 2 13:26:48 2020 by
487
498
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
488
499
  0.9.22 (ruby-2.6.5).
489
500
  </div>
@@ -150,7 +150,7 @@
150
150
  </div>
151
151
 
152
152
  <div id="footer">
153
- Generated on Thu Jan 30 09:12:47 2020 by
153
+ Generated on Mon Mar 2 13:26:48 2020 by
154
154
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
155
155
  0.9.22 (ruby-2.6.5).
156
156
  </div>
@@ -778,7 +778,7 @@
778
778
  </div>
779
779
 
780
780
  <div id="footer">
781
- Generated on Thu Jan 30 09:12:47 2020 by
781
+ Generated on Mon Mar 2 13:26:48 2020 by
782
782
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
783
783
  0.9.22 (ruby-2.6.5).
784
784
  </div>
@@ -187,6 +187,30 @@
187
187
  <p>Fetch the profile details for the authenticated SSO user.</p>
188
188
  </div></span>
189
189
 
190
+ </li>
191
+
192
+
193
+ <li class="public ">
194
+ <span class="summary_signature">
195
+
196
+ <a href="#promote_draft_connection-class_method" title="promote_draft_connection (class method)">.<strong>promote_draft_connection</strong>(token:) &#x21d2; Bool </a>
197
+
198
+
199
+
200
+ </span>
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+ <span class="summary_desc"><div class='inline'>
211
+ <p>Promote a DraftConnection created via IdP Link Embed such that the Enterprise users can begin signing into your application.</p>
212
+ </div></span>
213
+
190
214
  </li>
191
215
 
192
216
 
@@ -538,6 +562,118 @@
538
562
  </td>
539
563
  </tr>
540
564
  </table>
565
+ </div>
566
+
567
+ <div class="method_details ">
568
+ <h3 class="signature " id="promote_draft_connection-class_method">
569
+
570
+ .<strong>promote_draft_connection</strong>(token:) &#x21d2; <tt>Bool</tt>
571
+
572
+
573
+
574
+
575
+
576
+ </h3><div class="docstring">
577
+ <div class="discussion">
578
+
579
+ <p>Promote a DraftConnection created via IdP Link Embed such that the Enterprise users can begin signing into your application.</p>
580
+
581
+ <p>you by the IdP Link Embed</p>
582
+
583
+
584
+ </div>
585
+ </div>
586
+ <div class="tags">
587
+
588
+ <div class="examples">
589
+ <p class="tag_title">Examples:</p>
590
+
591
+
592
+ <pre class="example code"><code>WorkOS::SSO.promote_draft_connection(
593
+ token: &#39;draft_conn_429u59js&#39;,
594
+ )
595
+ =&gt; true</code></pre>
596
+
597
+ </div>
598
+ <p class="tag_title">Parameters:</p>
599
+ <ul class="param">
600
+
601
+ <li>
602
+
603
+ <span class='name'>token</span>
604
+
605
+
606
+ <span class='type'>(<tt>String</tt>)</span>
607
+
608
+
609
+
610
+ &mdash;
611
+ <div class='inline'>
612
+ <p>The draft connection token that&#39;s been provided to</p>
613
+ </div>
614
+
615
+ </li>
616
+
617
+ </ul>
618
+
619
+ <p class="tag_title">Returns:</p>
620
+ <ul class="return">
621
+
622
+ <li>
623
+
624
+
625
+ <span class='type'>(<tt>Bool</tt>)</span>
626
+
627
+
628
+
629
+ &mdash;
630
+ <div class='inline'><ul><li>
631
+ <p>returns `true` if successful, `false` otherwise.</p>
632
+ </li></ul>
633
+ </div>
634
+
635
+ </li>
636
+
637
+ </ul>
638
+
639
+ <p class="tag_title">See Also:</p>
640
+ <ul class="see">
641
+
642
+ <li><a href="https://github.com/workos-inc/ruby-idp-link-example" target="_parent" title="https://github.com/workos-inc/ruby-idp-link-example">https://github.com/workos-inc/ruby-idp-link-example</a></li>
643
+
644
+ </ul>
645
+
646
+ </div><table class="source_code">
647
+ <tr>
648
+ <td>
649
+ <pre class="lines">
650
+
651
+
652
+ 142
653
+ 143
654
+ 144
655
+ 145
656
+ 146
657
+ 147
658
+ 148
659
+ 149
660
+ 150</pre>
661
+ </td>
662
+ <td>
663
+ <pre class="code"><span class="info file"># File 'lib/workos/sso.rb', line 142</span>
664
+
665
+ <span class='kw'>def</span> <span class='id identifier rubyid_promote_draft_connection'>promote_draft_connection</span><span class='lparen'>(</span><span class='label'>token:</span><span class='rparen'>)</span>
666
+ <span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='id identifier rubyid_bearer_post_request'>bearer_post_request</span><span class='lparen'>(</span>
667
+ <span class='label'>path:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/draft_connections/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_token'>token</span><span class='embexpr_end'>}</span><span class='tstring_content'>/activate</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
668
+ <span class='rparen'>)</span>
669
+
670
+ <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>
671
+
672
+ <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTPSuccess</span>
673
+ <span class='kw'>end</span></pre>
674
+ </td>
675
+ </tr>
676
+ </table>
541
677
  </div>
542
678
 
543
679
  </div>
@@ -545,7 +681,7 @@
545
681
  </div>
546
682
 
547
683
  <div id="footer">
548
- Generated on Thu Jan 30 09:12:47 2020 by
684
+ Generated on Mon Mar 2 13:26:48 2020 by
549
685
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
550
686
  0.9.22 (ruby-2.6.5).
551
687
  </div>
@@ -118,7 +118,7 @@
118
118
  </div>
119
119
 
120
120
  <div id="footer">
121
- Generated on Thu Jan 30 09:12:47 2020 by
121
+ Generated on Mon Mar 2 13:26:48 2020 by
122
122
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
123
123
  0.9.22 (ruby-2.6.5).
124
124
  </div>
@@ -125,7 +125,7 @@
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Thu Jan 30 09:12:47 2020 by
128
+ Generated on Mon Mar 2 13:26:48 2020 by
129
129
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.9.22 (ruby-2.6.5).
131
131
  </div>
@@ -125,7 +125,7 @@
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Thu Jan 30 09:12:47 2020 by
128
+ Generated on Mon Mar 2 13:26:48 2020 by
129
129
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.9.22 (ruby-2.6.5).
131
131
  </div>
@@ -109,7 +109,7 @@
109
109
  <h2>Overview</h2><div class="docstring">
110
110
  <div class="discussion">
111
111
 
112
- <p>rubocop:disable Style/Documentation</p>
112
+ <p>Parent class for WorkOS related errors</p>
113
113
 
114
114
 
115
115
  </div>
@@ -281,14 +281,14 @@
281
281
  <pre class="lines">
282
282
 
283
283
 
284
- 19
285
284
  20
286
285
  21
287
286
  22
288
- 23</pre>
287
+ 23
288
+ 24</pre>
289
289
  </td>
290
290
  <td>
291
- <pre class="code"><span class="info file"># File 'lib/workos/errors.rb', line 19</span>
291
+ <pre class="code"><span class="info file"># File 'lib/workos/errors.rb', line 20</span>
292
292
 
293
293
  <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>message:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>http_status:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>request_id:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
294
294
  <span class='ivar'>@message</span> <span class='op'>=</span> <span class='id identifier rubyid_message'>message</span>
@@ -333,12 +333,12 @@
333
333
  <pre class="lines">
334
334
 
335
335
 
336
- 9
337
336
  10
338
- 11</pre>
337
+ 11
338
+ 12</pre>
339
339
  </td>
340
340
  <td>
341
- <pre class="code"><span class="info file"># File 'lib/workos/errors.rb', line 9</span>
341
+ <pre class="code"><span class="info file"># File 'lib/workos/errors.rb', line 10</span>
342
342
 
343
343
  <span class='kw'>def</span> <span class='id identifier rubyid_http_status'>http_status</span>
344
344
  <span class='ivar'>@http_status</span>
@@ -376,12 +376,12 @@
376
376
  <pre class="lines">
377
377
 
378
378
 
379
- 10
380
379
  11
381
- 12</pre>
380
+ 12
381
+ 13</pre>
382
382
  </td>
383
383
  <td>
384
- <pre class="code"><span class="info file"># File 'lib/workos/errors.rb', line 10</span>
384
+ <pre class="code"><span class="info file"># File 'lib/workos/errors.rb', line 11</span>
385
385
 
386
386
  <span class='kw'>def</span> <span class='id identifier rubyid_request_id'>request_id</span>
387
387
  <span class='ivar'>@request_id</span>
@@ -413,14 +413,14 @@
413
413
  <pre class="lines">
414
414
 
415
415
 
416
- 26
417
416
  27
418
417
  28
419
418
  29
420
- 30</pre>
419
+ 30
420
+ 31</pre>
421
421
  </td>
422
422
  <td>
423
- <pre class="code"><span class="info file"># File 'lib/workos/errors.rb', line 26</span>
423
+ <pre class="code"><span class="info file"># File 'lib/workos/errors.rb', line 27</span>
424
424
 
425
425
  <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
426
426
  <span class='id identifier rubyid_status_string'>status_string</span> <span class='op'>=</span> <span class='ivar'>@http_status</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Status </span><span class='embexpr_beg'>#{</span><span class='ivar'>@http_status</span><span class='embexpr_end'>}</span><span class='tstring_content'>, </span><span class='tstring_end'>&quot;</span></span>
@@ -437,7 +437,7 @@
437
437
  </div>
438
438
 
439
439
  <div id="footer">
440
- Generated on Thu Jan 30 09:12:47 2020 by
440
+ Generated on Mon Mar 2 13:26:48 2020 by
441
441
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
442
442
  0.9.22 (ruby-2.6.5).
443
443
  </div>
@@ -242,7 +242,7 @@
242
242
  </div></div>
243
243
 
244
244
  <div id="footer">
245
- Generated on Thu Jan 30 09:12:47 2020 by
245
+ Generated on Mon Mar 2 13:26:48 2020 by
246
246
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
247
247
  0.9.22 (ruby-2.6.5).
248
248
  </div>
@@ -240,7 +240,7 @@
240
240
  </div>
241
241
 
242
242
  <div id="footer">
243
- Generated on Thu Jan 30 09:12:46 2020 by
243
+ Generated on Mon Mar 2 13:26:47 2020 by
244
244
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
245
245
  0.9.22 (ruby-2.6.5).
246
246
  </div>
@@ -166,7 +166,7 @@
166
166
 
167
167
  <li class="even ">
168
168
  <div class="item">
169
- <span class='object_link'><a href="WorkOS/Base.html#key-instance_method" title="WorkOS::Base#key (method)">#key</a></span>
169
+ <span class='object_link'><a href="WorkOS/Base.html#key-class_method" title="WorkOS::Base.key (method)">key</a></span>
170
170
  <small>WorkOS::Base</small>
171
171
  </div>
172
172
  </li>
@@ -174,7 +174,7 @@
174
174
 
175
175
  <li class="odd ">
176
176
  <div class="item">
177
- <span class='object_link'><a href="WorkOS/Base.html#key-class_method" title="WorkOS::Base.key (method)">key</a></span>
177
+ <span class='object_link'><a href="WorkOS/Base.html#key-instance_method" title="WorkOS::Base#key (method)">#key</a></span>
178
178
  <small>WorkOS::Base</small>
179
179
  </div>
180
180
  </li>
@@ -221,6 +221,14 @@
221
221
 
222
222
 
223
223
  <li class="odd ">
224
+ <div class="item">
225
+ <span class='object_link'><a href="WorkOS/SSO.html#promote_draft_connection-class_method" title="WorkOS::SSO.promote_draft_connection (method)">promote_draft_connection</a></span>
226
+ <small>WorkOS::SSO</small>
227
+ </div>
228
+ </li>
229
+
230
+
231
+ <li class="even ">
224
232
  <div class="item">
225
233
  <span class='object_link'><a href="WorkOS/WorkOSError.html#request_id-instance_method" title="WorkOS::WorkOSError#request_id (method)">#request_id</a></span>
226
234
  <small>WorkOS::WorkOSError</small>
@@ -228,7 +236,7 @@
228
236
  </li>
229
237
 
230
238
 
231
- <li class="even ">
239
+ <li class="odd ">
232
240
  <div class="item">
233
241
  <span class='object_link'><a href="WorkOS/Profile.html#to_json-instance_method" title="WorkOS::Profile#to_json (method)">#to_json</a></span>
234
242
  <small>WorkOS::Profile</small>
@@ -236,7 +244,7 @@
236
244
  </li>
237
245
 
238
246
 
239
- <li class="odd ">
247
+ <li class="even ">
240
248
  <div class="item">
241
249
  <span class='object_link'><a href="WorkOS/WorkOSError.html#to_s-instance_method" title="WorkOS::WorkOSError#to_s (method)">#to_s</a></span>
242
250
  <small>WorkOS::WorkOSError</small>
@@ -244,7 +252,7 @@
244
252
  </li>
245
253
 
246
254
 
247
- <li class="even ">
255
+ <li class="odd ">
248
256
  <div class="item">
249
257
  <span class='object_link'><a href="WorkOS/Client.html#user_agent-instance_method" title="WorkOS::Client#user_agent (method)">#user_agent</a></span>
250
258
  <small>WorkOS::Client</small>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Thu Jan 30 09:12:47 2020 by
103
+ Generated on Mon Mar 2 13:26:48 2020 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.22 (ruby-2.6.5).
106
106
  </div>
@@ -11,7 +11,7 @@ require 'sorbet-runtime'
11
11
  # `WorkOS.key = [your api key]` somewhere in the load path of
12
12
  # your application, such as an initializer.
13
13
  module WorkOS
14
- API_HOSTNAME = 'api.workos.com'
14
+ API_HOSTNAME = ENV['WORKOS_API_HOSTNAME'] || 'api.workos.com'
15
15
 
16
16
  def self.key=(value)
17
17
  Base.key = value
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  # typed: true
3
3
 
4
- # rubocop:disable Style/Documentation
4
+
5
5
  module WorkOS
6
+ ## The Base class handles setting and reading the WorkOS
7
+ ## API Key for authentication
6
8
  module Base
7
9
  attr_accessor :key
8
10
 
@@ -14,4 +16,3 @@ module WorkOS
14
16
  end
15
17
  end
16
18
  end
17
- # rubocop:enable Style/Documentation
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
  # typed: true
3
3
 
4
- # rubocop:disable Style/Documentation
4
+
5
5
  module WorkOS
6
+ # A Net::HTTP based API client for interacting with the WorkOS API
6
7
  module Client
7
8
  extend T::Sig
8
9
  include Kernel
@@ -83,4 +84,3 @@ module WorkOS
83
84
  # rubocop:enable Metrics/MethodLength, Metrics/AbcSize
84
85
  end
85
86
  end
86
- # rubocop:enable Style/Documentation
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
  # typed: true
3
3
 
4
+
4
5
  module WorkOS
5
- # rubocop:disable Style/Documentation
6
+ # Parent class for WorkOS related errors
6
7
  class WorkOSError < StandardError
7
8
  extend T::Sig
8
9
 
@@ -43,6 +44,4 @@ module WorkOS
43
44
  # InvalidRequestError is raised when a request is initiated with invalid
44
45
  # parameters.
45
46
  class InvalidRequestError < WorkOSError; end
46
-
47
- # rubocop:enable Style/Documentation
48
47
  end
@@ -119,6 +119,36 @@ module WorkOS
119
119
  WorkOS::Profile.new(response.body)
120
120
  end
121
121
 
122
+ sig do
123
+ params(
124
+ token: String,
125
+ ).returns(T::Boolean)
126
+ end
127
+
128
+ # Promote a DraftConnection created via IdP Link Embed such that the
129
+ # Enterprise users can begin signing into your application.
130
+ #
131
+ # @param [String] token The draft connection token that's been provided to
132
+ # you by the IdP Link Embed
133
+ #
134
+ # @example
135
+ # WorkOS::SSO.promote_draft_connection(
136
+ # token: 'draft_conn_429u59js',
137
+ # )
138
+ # => true
139
+ #
140
+ # @return [Bool] - returns `true` if successful, `false` otherwise.
141
+ # @see https://github.com/workos-inc/ruby-idp-link-example
142
+ def promote_draft_connection(token:)
143
+ request = bearer_post_request(
144
+ path: "/draft_connections/#{token}/activate",
145
+ )
146
+
147
+ response = client.request(request)
148
+
149
+ response.is_a? Net::HTTPSuccess
150
+ end
151
+
122
152
  private
123
153
 
124
154
  sig do
@@ -158,6 +188,12 @@ module WorkOS
158
188
  )
159
189
  end
160
190
  # rubocop:enable Metrics/MethodLength
191
+
192
+ def bearer_post_request(path:, body: nil)
193
+ request = post_request(path: path, body: body)
194
+ request['Authorization'] = "Bearer #{WorkOS.key!}"
195
+ request
196
+ end
161
197
  end
162
198
  end
163
199
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- # typed: strong
2
+ # typed: strict
3
3
 
4
4
 
5
5
  module WorkOS
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  # typed: strict
3
3
 
4
+
4
5
  module WorkOS
5
6
  module Types
6
7
  # The ProviderEnum is type-safe declarations of a
@@ -3,5 +3,5 @@
3
3
 
4
4
 
5
5
  module WorkOS
6
- VERSION = '0.1.0'
6
+ VERSION = '0.1.1'
7
7
  end
@@ -210,4 +210,41 @@ describe WorkOS::SSO do
210
210
  end
211
211
  end
212
212
  end
213
+
214
+ describe '.promote_draft_connection' do
215
+ let(:token) { 'draft_conn_id' }
216
+ let(:project_id) { 'proj_0239u590h' }
217
+
218
+ context 'with a valid request' do
219
+ before do
220
+ stub_request(
221
+ :post,
222
+ "https://api.workos.com/draft_connections/#{token}/activate",
223
+ ).to_return(status: 200)
224
+ end
225
+ it 'returns true' do
226
+ response = described_class.promote_draft_connection(
227
+ token: token,
228
+ )
229
+
230
+ expect(response).to be(true)
231
+ end
232
+ end
233
+
234
+ context 'with an invalid request' do
235
+ before do
236
+ stub_request(
237
+ :post,
238
+ "https://api.workos.com/draft_connections/#{token}/activate",
239
+ ).to_return(status: 403)
240
+ end
241
+ it 'returns true' do
242
+ response = described_class.promote_draft_connection(
243
+ token: token,
244
+ )
245
+
246
+ expect(response).to be(false)
247
+ end
248
+ end
249
+ end
213
250
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - WorkOS
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-01-31 00:00:00.000000000 Z
13
+ date: 2020-03-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sorbet-runtime