workos 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7d3d1ab0e4e31ce6558f2465677e784a4a084bc0eb7df11b70ddecf08c9afa1
4
- data.tar.gz: 8d3d2869ca1836bcb88d4f91bd584295588bd429715dd338ef5bf7d7f50d86c6
3
+ metadata.gz: cae0b9677dcbd0009ad596ea9c517d7a1f7ca6c42e7ef4021b338ef3f6d7fe33
4
+ data.tar.gz: 9a4f2907b7ceaf9267243d12f1df6c4200a3b50727c4cf2778a60c85b3c045cc
5
5
  SHA512:
6
- metadata.gz: f67a1ddc4ae967bb39745b29b349b75ae86f9841cb7d9f3406f7e77a035d77d09297df346783ab28a2b4789910263cedfcd9477ea3f9661e1d92198d74017aec
7
- data.tar.gz: fc3e8043768d02ce2bb8ec2a5af7127beb68ef56bb4614192715e56cb3ce26f7296d3b09219ace183787773f8ba8491a563a778c3785cdc985cc4dcc9a7cce3a
6
+ metadata.gz: 5f4eda363342a5c35f1e7f5ceb7b8b883639988e5829d738ab428359831c2ba0000b61c142454d48f44f67359e7d29f1c009d9df9ce0955f44183033a5269b7b
7
+ data.tar.gz: 577ae3386fce2825cae538464f7390f11c25ab8ca904162d2195e6652fdd04c51a5267692f78fcddee37d831d378a166207dcb37f32cd4651d299781ee008432
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (0.2.0)
4
+ workos (0.2.1)
5
5
  sorbet-runtime (~> 0.5)
6
6
 
7
7
  GEM
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'>&#39;</span><span class='tstring_content'>0.2.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.2.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 Sun Mar 15 22:11:09 2020 by
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>
@@ -150,7 +150,7 @@
150
150
  </div>
151
151
 
152
152
  <div id="footer">
153
- Generated on Sun Mar 15 22:11:09 2020 by
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>
@@ -225,7 +225,7 @@
225
225
  </div>
226
226
 
227
227
  <div id="footer">
228
- Generated on Sun Mar 15 22:11:09 2020 by
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 Sun Mar 15 22:11:09 2020 by
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>
@@ -277,7 +277,7 @@
277
277
  </div>
278
278
 
279
279
  <div id="footer">
280
- Generated on Sun Mar 15 22:11:09 2020 by
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>
@@ -494,7 +494,7 @@
494
494
  </div>
495
495
 
496
496
  <div id="footer">
497
- Generated on Sun Mar 15 22:11:09 2020 by
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 Sun Mar 15 22:11:09 2020 by
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>
@@ -778,7 +778,7 @@
778
778
  </div>
779
779
 
780
780
  <div id="footer">
781
- Generated on Sun Mar 15 22:11:09 2020 by
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 rubyid_query'>query</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_encode_www_form'>encode_www_form</span><span class='lparen'>(</span>
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'>&#39;</span><span class='tstring_content'>authorization_code</span><span class='tstring_end'>&#39;</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='rparen'>)</span>
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'>&quot;</span><span class='tstring_content'>/sso/token?</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_query'>query</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
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'>&#39;</span><span class='tstring_content'>/sso/token</span><span class='tstring_end'>&#39;</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 Sun Mar 15 22:11:09 2020 by
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>
@@ -118,7 +118,7 @@
118
118
  </div>
119
119
 
120
120
  <div id="footer">
121
- Generated on Sun Mar 15 22:11:09 2020 by
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 Sun Mar 15 22:11:09 2020 by
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 Sun Mar 15 22:11:09 2020 by
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 Sun Mar 15 22:11:09 2020 by
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>
@@ -242,7 +242,7 @@
242
242
  </div></div>
243
243
 
244
244
  <div id="footer">
245
- Generated on Sun Mar 15 22:11:09 2020 by
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 Sun Mar 15 22:11:08 2020 by
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 Sun Mar 15 22:11:09 2020 by
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
- query = URI.encode_www_form(
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: "/sso/token?#{query}"))
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)
@@ -3,5 +3,5 @@
3
3
 
4
4
 
5
5
  module WorkOS
6
- VERSION = '0.2.0'
6
+ VERSION = '0.2.1'
7
7
  end
@@ -127,7 +127,7 @@ describe WorkOS::SSO do
127
127
  }
128
128
  end
129
129
 
130
- let(:query) do
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(:body) { File.read("#{SPEC_ROOT}/support/profile.txt") }
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(query: query, headers: headers).
150
- to_return(status: 200, body: 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(query: query, headers: headers)).to have_been_made
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(query: query, headers: headers).
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(query: query).
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.0
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-15 00:00:00.000000000 Z
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.0.3
264
+ rubygems_version: 3.1.2
265
265
  signing_key:
266
266
  specification_version: 4
267
267
  summary: API client for WorkOS