workos 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/docs/WorkOS.html +2 -2
- data/docs/WorkOS/APIError.html +1 -1
- data/docs/WorkOS/AuditTrail.html +1 -1
- data/docs/WorkOS/AuthenticationError.html +1 -1
- data/docs/WorkOS/Base.html +1 -1
- data/docs/WorkOS/Client.html +1 -1
- data/docs/WorkOS/InvalidRequestError.html +1 -1
- data/docs/WorkOS/Profile.html +1 -1
- data/docs/WorkOS/SSO.html +4 -4
- data/docs/WorkOS/Types.html +1 -1
- data/docs/WorkOS/Types/ProfileStruct.html +1 -1
- data/docs/WorkOS/Types/Provider.html +1 -1
- data/docs/WorkOS/WorkOSError.html +1 -1
- data/docs/file.README.html +1 -1
- data/docs/index.html +1 -1
- data/docs/top-level-namespace.html +1 -1
- data/lib/workos/sso.rb +3 -3
- data/lib/workos/version.rb +1 -1
- data/spec/lib/workos/sso_spec.rb +8 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cae0b9677dcbd0009ad596ea9c517d7a1f7ca6c42e7ef4021b338ef3f6d7fe33
|
4
|
+
data.tar.gz: 9a4f2907b7ceaf9267243d12f1df6c4200a3b50727c4cf2778a60c85b3c045cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f4eda363342a5c35f1e7f5ceb7b8b883639988e5829d738ab428359831c2ba0000b61c142454d48f44f67359e7d29f1c009d9df9ce0955f44183033a5269b7b
|
7
|
+
data.tar.gz: 577ae3386fce2825cae538464f7390f11c25ab8ca904162d2195e6652fdd04c51a5267692f78fcddee37d831d378a166207dcb37f32cd4651d299781ee008432
|
data/Gemfile.lock
CHANGED
data/docs/WorkOS.html
CHANGED
@@ -125,7 +125,7 @@
|
|
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'>'</span><span class='tstring_content'>0.2.
|
128
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.2.1</span><span class='tstring_end'>'</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
|
317
|
+
Generated on Thu Mar 19 20:24:36 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>
|
data/docs/WorkOS/APIError.html
CHANGED
@@ -150,7 +150,7 @@
|
|
150
150
|
</div>
|
151
151
|
|
152
152
|
<div id="footer">
|
153
|
-
Generated on
|
153
|
+
Generated on Thu Mar 19 20:24:37 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>
|
data/docs/WorkOS/AuditTrail.html
CHANGED
@@ -225,7 +225,7 @@
|
|
225
225
|
</div>
|
226
226
|
|
227
227
|
<div id="footer">
|
228
|
-
Generated on
|
228
|
+
Generated on Thu Mar 19 20:24:37 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
|
153
|
+
Generated on Thu Mar 19 20:24:37 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>
|
data/docs/WorkOS/Base.html
CHANGED
@@ -277,7 +277,7 @@
|
|
277
277
|
</div>
|
278
278
|
|
279
279
|
<div id="footer">
|
280
|
-
Generated on
|
280
|
+
Generated on Thu Mar 19 20:24:36 2020 by
|
281
281
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
282
282
|
0.9.22 (ruby-2.6.5).
|
283
283
|
</div>
|
data/docs/WorkOS/Client.html
CHANGED
@@ -494,7 +494,7 @@
|
|
494
494
|
</div>
|
495
495
|
|
496
496
|
<div id="footer">
|
497
|
-
Generated on
|
497
|
+
Generated on Thu Mar 19 20:24:37 2020 by
|
498
498
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
499
499
|
0.9.22 (ruby-2.6.5).
|
500
500
|
</div>
|
@@ -150,7 +150,7 @@
|
|
150
150
|
</div>
|
151
151
|
|
152
152
|
<div id="footer">
|
153
|
-
Generated on
|
153
|
+
Generated on Thu Mar 19 20:24:37 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>
|
data/docs/WorkOS/Profile.html
CHANGED
@@ -778,7 +778,7 @@
|
|
778
778
|
</div>
|
779
779
|
|
780
780
|
<div id="footer">
|
781
|
-
Generated on
|
781
|
+
Generated on Thu Mar 19 20:24:37 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>
|
data/docs/WorkOS/SSO.html
CHANGED
@@ -547,14 +547,14 @@
|
|
547
547
|
<pre class="code"><span class="info file"># File 'lib/workos/sso.rb', line 108</span>
|
548
548
|
|
549
549
|
<span class='kw'>def</span> <span class='id identifier rubyid_profile'>profile</span><span class='lparen'>(</span><span class='label'>code:</span><span class='comma'>,</span> <span class='label'>project_id:</span><span class='rparen'>)</span>
|
550
|
-
<span class='id identifier
|
550
|
+
<span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='lbrace'>{</span>
|
551
551
|
<span class='label'>client_id:</span> <span class='id identifier rubyid_project_id'>project_id</span><span class='comma'>,</span>
|
552
552
|
<span class='label'>client_secret:</span> <span class='const'><span class='object_link'><a href="../WorkOS.html" title="WorkOS (module)">WorkOS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_key!'><span class='object_link'><a href="../WorkOS.html#key!-class_method" title="WorkOS.key! (method)">key!</a></span></span><span class='comma'>,</span>
|
553
553
|
<span class='label'>grant_type:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>authorization_code</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
554
554
|
<span class='label'>code:</span> <span class='id identifier rubyid_code'>code</span><span class='comma'>,</span>
|
555
|
-
<span class='
|
555
|
+
<span class='rbrace'>}</span>
|
556
556
|
|
557
|
-
<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_post_request'>post_request</span><span class='lparen'>(</span><span class='label'>path:</span> <span class='tstring'><span class='tstring_beg'
|
557
|
+
<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_post_request'>post_request</span><span class='lparen'>(</span><span class='label'>path:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/sso/token</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>body:</span> <span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
558
558
|
<span class='id identifier rubyid_check_and_raise_profile_error'>check_and_raise_profile_error</span><span class='lparen'>(</span><span class='label'>response:</span> <span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span>
|
559
559
|
|
560
560
|
<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="Profile.html" title="WorkOS::Profile (class)">Profile</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Profile.html#initialize-instance_method" title="WorkOS::Profile#initialize (method)">new</a></span></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>
|
@@ -681,7 +681,7 @@
|
|
681
681
|
</div>
|
682
682
|
|
683
683
|
<div id="footer">
|
684
|
-
Generated on
|
684
|
+
Generated on Thu Mar 19 20:24:36 2020 by
|
685
685
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
686
686
|
0.9.22 (ruby-2.6.5).
|
687
687
|
</div>
|
data/docs/WorkOS/Types.html
CHANGED
@@ -118,7 +118,7 @@
|
|
118
118
|
</div>
|
119
119
|
|
120
120
|
<div id="footer">
|
121
|
-
Generated on
|
121
|
+
Generated on Thu Mar 19 20:24:36 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
|
128
|
+
Generated on Thu Mar 19 20:24:37 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
|
128
|
+
Generated on Thu Mar 19 20:24:37 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>
|
@@ -437,7 +437,7 @@
|
|
437
437
|
</div>
|
438
438
|
|
439
439
|
<div id="footer">
|
440
|
-
Generated on
|
440
|
+
Generated on Thu Mar 19 20:24:37 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>
|
data/docs/file.README.html
CHANGED
@@ -242,7 +242,7 @@
|
|
242
242
|
</div></div>
|
243
243
|
|
244
244
|
<div id="footer">
|
245
|
-
Generated on
|
245
|
+
Generated on Thu Mar 19 20:24:36 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>
|
data/docs/index.html
CHANGED
@@ -240,7 +240,7 @@
|
|
240
240
|
</div>
|
241
241
|
|
242
242
|
<div id="footer">
|
243
|
-
Generated on
|
243
|
+
Generated on Thu Mar 19 20:24:36 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>
|
@@ -100,7 +100,7 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
103
|
+
Generated on Thu Mar 19 20:24:36 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>
|
data/lib/workos/sso.rb
CHANGED
@@ -106,14 +106,14 @@ module WorkOS
|
|
106
106
|
#
|
107
107
|
# @return [WorkOS::Profile]
|
108
108
|
def profile(code:, project_id:)
|
109
|
-
|
109
|
+
body = {
|
110
110
|
client_id: project_id,
|
111
111
|
client_secret: WorkOS.key!,
|
112
112
|
grant_type: 'authorization_code',
|
113
113
|
code: code,
|
114
|
-
|
114
|
+
}
|
115
115
|
|
116
|
-
response = client.request(post_request(path:
|
116
|
+
response = client.request(post_request(path: '/sso/token', body: body))
|
117
117
|
check_and_raise_profile_error(response: response)
|
118
118
|
|
119
119
|
WorkOS::Profile.new(response.body)
|
data/lib/workos/version.rb
CHANGED
data/spec/lib/workos/sso_spec.rb
CHANGED
@@ -127,7 +127,7 @@ describe WorkOS::SSO do
|
|
127
127
|
}
|
128
128
|
end
|
129
129
|
|
130
|
-
let(:
|
130
|
+
let(:request_body) do
|
131
131
|
{
|
132
132
|
client_id: args[:project_id],
|
133
133
|
client_secret: WorkOS.key,
|
@@ -137,29 +137,29 @@ describe WorkOS::SSO do
|
|
137
137
|
end
|
138
138
|
let(:user_agent) { 'user-agent-string' }
|
139
139
|
let(:headers) { { 'User-Agent' => user_agent } }
|
140
|
+
|
140
141
|
before do
|
141
142
|
allow(described_class).to receive(:user_agent).and_return(user_agent)
|
142
143
|
end
|
143
144
|
|
144
145
|
context 'with a successful response' do
|
145
|
-
let(:
|
146
|
+
let(:response_body) { File.read("#{SPEC_ROOT}/support/profile.txt") }
|
146
147
|
|
147
148
|
before do
|
148
149
|
stub_request(:post, 'https://api.workos.com/sso/token').
|
149
|
-
with(
|
150
|
-
to_return(status: 200, body:
|
150
|
+
with(headers: headers, body: request_body).
|
151
|
+
to_return(status: 200, body: response_body)
|
151
152
|
end
|
152
153
|
|
153
154
|
it 'includes the SDK Version header' do
|
154
155
|
described_class.profile(**args)
|
155
156
|
|
156
157
|
expect(a_request(:post, 'https://api.workos.com/sso/token').
|
157
|
-
with(
|
158
|
+
with(headers: headers, body: request_body)).to have_been_made
|
158
159
|
end
|
159
160
|
|
160
161
|
it 'returns a WorkOS::Profile' do
|
161
162
|
profile = described_class.profile(**args)
|
162
|
-
|
163
163
|
expect(profile).to be_a(WorkOS::Profile)
|
164
164
|
end
|
165
165
|
end
|
@@ -167,7 +167,7 @@ describe WorkOS::SSO do
|
|
167
167
|
context 'with an unprocessable request' do
|
168
168
|
before do
|
169
169
|
stub_request(:post, 'https://api.workos.com/sso/token').
|
170
|
-
with(
|
170
|
+
with(headers: headers, body: request_body).
|
171
171
|
to_return(
|
172
172
|
headers: { 'X-Request-ID' => 'request-id' },
|
173
173
|
status: 422,
|
@@ -188,7 +188,7 @@ describe WorkOS::SSO do
|
|
188
188
|
context 'with an expired code' do
|
189
189
|
before do
|
190
190
|
stub_request(:post, 'https://api.workos.com/sso/token').
|
191
|
-
with(
|
191
|
+
with(body: request_body).
|
192
192
|
to_return(
|
193
193
|
status: 201,
|
194
194
|
headers: { 'X-Request-ID' => 'request-id' },
|
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.2.
|
4
|
+
version: 0.2.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-03-
|
13
|
+
date: 2020-03-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sorbet-runtime
|
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
261
261
|
- !ruby/object:Gem::Version
|
262
262
|
version: '0'
|
263
263
|
requirements: []
|
264
|
-
rubygems_version: 3.
|
264
|
+
rubygems_version: 3.1.2
|
265
265
|
signing_key:
|
266
266
|
specification_version: 4
|
267
267
|
summary: API client for WorkOS
|