workos 10.1.0 → 10.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 +4 -4
- data/.github/workflows/block-generated-edits.yml +1 -1
- data/.github/workflows/ci.yml +2 -2
- data/.github/workflows/docs.yml +2 -2
- data/.github/workflows/lint.yml +2 -2
- data/.github/workflows/release-please.yml +3 -3
- data/.github/workflows/release.yml +2 -2
- data/.last-synced-sha +1 -1
- data/.oagen-manifest.json +12 -0
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +63 -0
- data/Gemfile.lock +2 -2
- data/lib/workos/base_client.rb +14 -1
- data/lib/workos/connect.rb +2 -2
- data/lib/workos/events.rb +2 -2
- data/lib/workos/groups.rb +6 -2
- data/lib/workos/pipes/connected_account.rb +9 -0
- data/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +9 -0
- data/lib/workos/pipes/data_integrations_upsert_client_credentials_request.rb +31 -0
- data/lib/workos/pipes.rb +39 -2
- data/lib/workos/shared/agent_registration_refreshed.rb +34 -0
- data/lib/workos/shared/agent_registration_refreshed_data.rb +7 -0
- data/lib/workos/shared/waitlist_user.rb +3 -0
- data/lib/workos/types/authenticate_response_authentication_method.rb +3 -1
- data/lib/workos/types/connection_activated_data_connection_type.rb +3 -1
- data/lib/workos/types/connection_type.rb +3 -1
- data/lib/workos/types/connections_connection_type.rb +3 -1
- data/lib/workos/types/create_data_integration_auth_methods.rb +1 -5
- data/lib/workos/types/create_user_password_salt_position.rb +13 -0
- data/lib/workos/types/create_webhook_endpoint_events.rb +2 -1
- data/lib/workos/types/update_user_password_salt_position.rb +9 -0
- data/lib/workos/types/user_identities_get_item_provider.rb +3 -1
- data/lib/workos/user_management/create_user.rb +5 -2
- data/lib/workos/user_management/update_user.rb +5 -2
- data/lib/workos/user_management.rb +15 -7
- data/lib/workos/version.rb +1 -1
- data/rbi/workos/agent_registration_refreshed.rbi +54 -0
- data/rbi/workos/agent_registration_refreshed_data.rbi +24 -0
- data/rbi/workos/connected_account.rbi +18 -0
- data/rbi/workos/create_user.rbi +6 -0
- data/rbi/workos/custom_provider_definition.rbi +4 -4
- data/rbi/workos/data_integration.rbi +2 -2
- data/rbi/workos/data_integrations_list_response_data_connected_account.rbi +18 -0
- data/rbi/workos/data_integrations_upsert_client_credentials_request.rbi +48 -0
- data/rbi/workos/events.rbi +2 -2
- data/rbi/workos/groups.rbi +2 -1
- data/rbi/workos/pipes.rbi +13 -0
- data/rbi/workos/radar_sms_challenge_code_session_authenticate_request.rbi +4 -4
- data/rbi/workos/update_user.rbi +6 -0
- data/rbi/workos/user_management.rbi +6 -2
- data/rbi/workos/waitlist_user.rbi +6 -0
- data/test/workos/test_base_client.rb +155 -0
- data/test/workos/test_events.rb +2 -2
- data/test/workos/test_pipes.rb +8 -0
- data/test/workos/test_pipes_model_round_trip.rb +24 -3
- data/test/workos/test_shared_model_round_trip.rb +91 -0
- data/test/workos/test_user_management.rb +6 -6
- data/test/workos/test_user_management_model_round_trip.rb +4 -4
- metadata +9 -1
|
@@ -82,6 +82,24 @@ class BaseClientTest < Minitest::Test
|
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
+
# A pooled connection that either returns a canned response or raises when
|
|
86
|
+
# driven, so execute_request can be exercised without real TCP+TLS.
|
|
87
|
+
class StubConnection < FakeConnection
|
|
88
|
+
attr_accessor :read_timeout, :open_timeout
|
|
89
|
+
|
|
90
|
+
def initialize(response: nil, error: nil, **kwargs)
|
|
91
|
+
super(**kwargs)
|
|
92
|
+
@response = response
|
|
93
|
+
@error = error
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def request(_request)
|
|
97
|
+
raise @error if @error
|
|
98
|
+
|
|
99
|
+
@response
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
85
103
|
def setup
|
|
86
104
|
@client = WorkOS::BaseClient.new(api_key: "sk_test_123", max_retries: 1)
|
|
87
105
|
end
|
|
@@ -206,6 +224,143 @@ class BaseClientTest < Minitest::Test
|
|
|
206
224
|
refute keep.finished
|
|
207
225
|
end
|
|
208
226
|
|
|
227
|
+
# An exception execute_request's rescue clause doesn't list still leaves the
|
|
228
|
+
# socket mid-stream, so the connection must not survive in the pool for the
|
|
229
|
+
# next request on this thread to pick up.
|
|
230
|
+
def test_unlisted_request_error_evicts_the_pooled_connection
|
|
231
|
+
conn = StubConnection.new(error: Net::HTTPBadResponse.new("wrong version"))
|
|
232
|
+
cache = @client.send(:thread_connections)
|
|
233
|
+
cache["https:api.workos.com:443:30"] = conn
|
|
234
|
+
|
|
235
|
+
assert_raises(Net::HTTPBadResponse) do
|
|
236
|
+
@client.execute_request(request: Net::HTTP::Get.new("/things"))
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
refute cache.key?("https:api.workos.com:443:30"),
|
|
240
|
+
"a connection whose request did not complete must not stay pooled"
|
|
241
|
+
assert conn.finished
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
def test_completed_request_keeps_the_connection_pooled
|
|
245
|
+
conn = StubConnection.new(response: Net::HTTPOK.new("1.1", "200", "OK"))
|
|
246
|
+
cache = @client.send(:thread_connections)
|
|
247
|
+
cache["https:api.workos.com:443:30"] = conn
|
|
248
|
+
|
|
249
|
+
@client.execute_request(request: Net::HTTP::Get.new("/things"))
|
|
250
|
+
|
|
251
|
+
assert cache.key?("https:api.workos.com:443:30")
|
|
252
|
+
refute conn.finished
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Raised asynchronously into the worker thread to stand in for a caller-side
|
|
256
|
+
# abort: Timeout.timeout, Thread#kill, a signal handler unwinding the stack.
|
|
257
|
+
# It descends from Exception rather than StandardError so that nothing in
|
|
258
|
+
# execute_request can catch it — the `ensure` is the only cleanup that runs.
|
|
259
|
+
class AbortSignal < Exception; end # standard:disable Lint/InheritException
|
|
260
|
+
|
|
261
|
+
# End-to-end regression test over a real keep-alive socket, for the failure
|
|
262
|
+
# the eviction actually prevents: request one is abandoned mid-flight, the
|
|
263
|
+
# server then writes response one onto that socket, and request two on the
|
|
264
|
+
# same thread reads those stale bytes as if they were its own response.
|
|
265
|
+
#
|
|
266
|
+
# Before the fix, request two sees marker "one" (or a mangled response) off
|
|
267
|
+
# the pooled socket. After it, the abandoned socket is closed and the server
|
|
268
|
+
# accepts a fresh connection for request two.
|
|
269
|
+
def test_aborted_request_does_not_leak_its_response_to_the_next_request
|
|
270
|
+
WebMock.disable!
|
|
271
|
+
server = TCPServer.new("127.0.0.1", 0)
|
|
272
|
+
port = server.addr[1]
|
|
273
|
+
client = WorkOS::BaseClient.new(
|
|
274
|
+
api_key: "sk_test_123",
|
|
275
|
+
base_url: "http://127.0.0.1:#{port}",
|
|
276
|
+
timeout: 5,
|
|
277
|
+
max_retries: 0
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
request_one_read = Queue.new
|
|
281
|
+
release_response_one = Queue.new
|
|
282
|
+
response_one_written = Queue.new
|
|
283
|
+
aborted = Queue.new
|
|
284
|
+
connections = Queue.new
|
|
285
|
+
|
|
286
|
+
server_thread = Thread.new do
|
|
287
|
+
# Connection one: read the request, then hold the response back until
|
|
288
|
+
# the client has been aborted and has unwound.
|
|
289
|
+
first = server.accept
|
|
290
|
+
connections << first
|
|
291
|
+
read_http_request(first)
|
|
292
|
+
request_one_read << true
|
|
293
|
+
release_response_one.pop
|
|
294
|
+
begin
|
|
295
|
+
write_http_response(first, {marker: "one"})
|
|
296
|
+
rescue Errno::EPIPE, Errno::ECONNRESET, IOError
|
|
297
|
+
# Expected once the fix closes the abandoned socket.
|
|
298
|
+
end
|
|
299
|
+
response_one_written << true
|
|
300
|
+
|
|
301
|
+
# Connection two: a fresh accept, which only completes because the
|
|
302
|
+
# client did not reuse the socket above.
|
|
303
|
+
second = server.accept
|
|
304
|
+
connections << second
|
|
305
|
+
read_http_request(second)
|
|
306
|
+
write_http_response(second, {marker: "two"})
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
worker = Thread.new do
|
|
310
|
+
begin
|
|
311
|
+
client.execute_request(request: Net::HTTP::Get.new("/one"))
|
|
312
|
+
rescue AbortSignal
|
|
313
|
+
# The caller unwinds but the thread survives and goes on to serve more
|
|
314
|
+
# work, the way a Puma or Solid Queue worker does. execute_request's
|
|
315
|
+
# `ensure` has already run by the time this body executes.
|
|
316
|
+
aborted << true
|
|
317
|
+
response_one_written.pop
|
|
318
|
+
end
|
|
319
|
+
response = client.execute_request(request: Net::HTTP::Get.new("/two"))
|
|
320
|
+
JSON.parse(response.body)["marker"]
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
marker = Timeout.timeout(15) do
|
|
324
|
+
request_one_read.pop
|
|
325
|
+
worker.raise(AbortSignal)
|
|
326
|
+
aborted.pop
|
|
327
|
+
release_response_one << true
|
|
328
|
+
worker.value
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
assert_equal "two", marker,
|
|
332
|
+
"request two read the abandoned socket's response instead of its own"
|
|
333
|
+
ensure
|
|
334
|
+
server_thread&.kill
|
|
335
|
+
worker&.kill
|
|
336
|
+
until connections.nil? || connections.empty?
|
|
337
|
+
socket = connections.pop
|
|
338
|
+
socket.close unless socket.closed?
|
|
339
|
+
end
|
|
340
|
+
server&.close
|
|
341
|
+
WebMock.enable!
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
def read_http_request(socket)
|
|
345
|
+
socket.gets # request line
|
|
346
|
+
loop do
|
|
347
|
+
line = socket.gets
|
|
348
|
+
break if line.nil? || line == "\r\n"
|
|
349
|
+
end
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def write_http_response(socket, body)
|
|
353
|
+
payload = JSON.generate(body)
|
|
354
|
+
socket.write(
|
|
355
|
+
"HTTP/1.1 200 OK\r\n" \
|
|
356
|
+
"Content-Type: application/json\r\n" \
|
|
357
|
+
"Content-Length: #{payload.bytesize}\r\n" \
|
|
358
|
+
"Connection: keep-alive\r\n" \
|
|
359
|
+
"\r\n#{payload}"
|
|
360
|
+
)
|
|
361
|
+
socket.flush
|
|
362
|
+
end
|
|
363
|
+
|
|
209
364
|
# Regression test for https://github.com/workos/workos-ruby/issues/496
|
|
210
365
|
#
|
|
211
366
|
# The connection cache must be isolated per thread. A previous version
|
data/test/workos/test_events.rb
CHANGED
|
@@ -14,13 +14,13 @@ class EventsTest < Minitest::Test
|
|
|
14
14
|
def test_list_events_returns_expected_result
|
|
15
15
|
stub_request(:get, %r{\Ahttps://api\.workos\.com/events(\?|\z)})
|
|
16
16
|
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
17
|
-
result = @client.events.list_events
|
|
17
|
+
result = @client.events.list_events(events: ["stub"])
|
|
18
18
|
assert_kind_of WorkOS::Types::ListStruct, result
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
# Parameterized authentication error tests (one per endpoint).
|
|
22
22
|
[
|
|
23
|
-
{name: :list_events, verb: :get, url: %r{\Ahttps://api\.workos\.com/events(\?|\z)}}
|
|
23
|
+
{name: :list_events, verb: :get, url: %r{\Ahttps://api\.workos\.com/events(\?|\z)}, args: {events: ["stub"]}}
|
|
24
24
|
].each do |spec|
|
|
25
25
|
define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
|
|
26
26
|
stub_request(spec[:verb], spec[:url])
|
data/test/workos/test_pipes.rb
CHANGED
|
@@ -60,6 +60,13 @@ class PipesTest < Minitest::Test
|
|
|
60
60
|
refute_nil result
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
+
def test_update_data_integration_client_credentials_returns_expected_result
|
|
64
|
+
stub_request(:put, %r{\Ahttps://api\.workos\.com/data-integrations/stub/client-credentials(\?|\z)})
|
|
65
|
+
.to_return(body: "{}", status: 200)
|
|
66
|
+
result = @client.pipes.update_data_integration_client_credentials(slug: "stub", user_id: "stub", client_id: "stub", client_secret: "stub")
|
|
67
|
+
refute_nil result
|
|
68
|
+
end
|
|
69
|
+
|
|
63
70
|
def test_create_data_integration_credential_returns_expected_result
|
|
64
71
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations/stub/credentials(\?|\z)})
|
|
65
72
|
.to_return(body: "{}", status: 200)
|
|
@@ -118,6 +125,7 @@ class PipesTest < Minitest::Test
|
|
|
118
125
|
{name: :delete_data_integration, verb: :delete, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub(\?|\z)}, args: {slug: "stub"}},
|
|
119
126
|
{name: :update_data_integration_api_key, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/api-key(\?|\z)}, args: {slug: "stub", user_id: "stub", secret: "stub"}},
|
|
120
127
|
{name: :authorize_data_integration, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/authorize(\?|\z)}, args: {slug: "stub", user_id: "stub"}},
|
|
128
|
+
{name: :update_data_integration_client_credentials, verb: :put, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/client-credentials(\?|\z)}, args: {slug: "stub", user_id: "stub", client_id: "stub", client_secret: "stub"}},
|
|
121
129
|
{name: :create_data_integration_credential, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/credentials(\?|\z)}, args: {slug: "stub", user_id: "stub"}},
|
|
122
130
|
{name: :get_access_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)}, args: {provider: "stub", user_id: "stub"}},
|
|
123
131
|
{name: :get_user_connected_account, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}},
|
|
@@ -49,8 +49,6 @@ class PipesModelRoundTripTest < Minitest::Test
|
|
|
49
49
|
json = model.to_h
|
|
50
50
|
assert_kind_of Hash, json
|
|
51
51
|
assert_equal fixture["name"], json[:name]
|
|
52
|
-
assert_equal fixture["authorization_url"], json[:authorization_url]
|
|
53
|
-
assert_equal fixture["token_url"], json[:token_url]
|
|
54
52
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
55
53
|
end
|
|
56
54
|
|
|
@@ -134,7 +132,7 @@ class PipesModelRoundTripTest < Minitest::Test
|
|
|
134
132
|
"scopes" => nil,
|
|
135
133
|
"redirect_uri" => "stub",
|
|
136
134
|
"auth_methods" => [],
|
|
137
|
-
"credentials" =>
|
|
135
|
+
"credentials" => nil,
|
|
138
136
|
"installation" => nil,
|
|
139
137
|
"config" => {},
|
|
140
138
|
"custom_provider" => nil,
|
|
@@ -199,6 +197,9 @@ class PipesModelRoundTripTest < Minitest::Test
|
|
|
199
197
|
"scopes" => [],
|
|
200
198
|
"auth_method" => "stub",
|
|
201
199
|
"api_key_last_4" => nil,
|
|
200
|
+
"client_id" => nil,
|
|
201
|
+
"client_secret_last_4" => nil,
|
|
202
|
+
"config" => {},
|
|
202
203
|
"state" => "stub",
|
|
203
204
|
"created_at" => "stub",
|
|
204
205
|
"updated_at" => "stub"
|
|
@@ -376,6 +377,23 @@ class PipesModelRoundTripTest < Minitest::Test
|
|
|
376
377
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
377
378
|
end
|
|
378
379
|
|
|
380
|
+
def test_data_integrations_upsert_client_credentials_request_round_trip
|
|
381
|
+
fixture = {
|
|
382
|
+
"user_id" => "stub",
|
|
383
|
+
"organization_id" => "stub",
|
|
384
|
+
"client_id" => "stub",
|
|
385
|
+
"client_secret" => "stub",
|
|
386
|
+
"config" => {}
|
|
387
|
+
}
|
|
388
|
+
model = WorkOS::DataIntegrationsUpsertClientCredentialsRequest.new(fixture.to_json)
|
|
389
|
+
json = model.to_h
|
|
390
|
+
assert_kind_of Hash, json
|
|
391
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
392
|
+
assert_equal fixture["client_id"], json[:client_id]
|
|
393
|
+
assert_equal fixture["client_secret"], json[:client_secret]
|
|
394
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
395
|
+
end
|
|
396
|
+
|
|
379
397
|
def test_data_integrations_vend_credentials_request_round_trip
|
|
380
398
|
fixture = {
|
|
381
399
|
"user_id" => "stub",
|
|
@@ -409,6 +427,9 @@ class PipesModelRoundTripTest < Minitest::Test
|
|
|
409
427
|
"scopes" => [],
|
|
410
428
|
"auth_method" => "stub",
|
|
411
429
|
"api_key_last_4" => nil,
|
|
430
|
+
"client_id" => nil,
|
|
431
|
+
"client_secret_last_4" => nil,
|
|
432
|
+
"config" => {},
|
|
412
433
|
"state" => "stub",
|
|
413
434
|
"created_at" => "stub",
|
|
414
435
|
"updated_at" => "stub",
|
|
@@ -16,6 +16,39 @@ class SharedModelRoundTripTest < Minitest::Test
|
|
|
16
16
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
def test_object_summary_round_trip
|
|
20
|
+
fixture = {
|
|
21
|
+
"id" => "stub",
|
|
22
|
+
"name" => "stub",
|
|
23
|
+
"updated_at" => nil
|
|
24
|
+
}
|
|
25
|
+
model = WorkOS::ObjectSummary.new(fixture.to_json)
|
|
26
|
+
json = model.to_h
|
|
27
|
+
assert_kind_of Hash, json
|
|
28
|
+
assert_equal fixture["id"], json[:id]
|
|
29
|
+
assert_equal fixture["name"], json[:name]
|
|
30
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_object_version_round_trip
|
|
34
|
+
fixture = {
|
|
35
|
+
"created_at" => "stub",
|
|
36
|
+
"current_version" => true,
|
|
37
|
+
"etag" => "stub",
|
|
38
|
+
"id" => "stub",
|
|
39
|
+
"size" => 1
|
|
40
|
+
}
|
|
41
|
+
model = WorkOS::ObjectVersion.new(fixture.to_json)
|
|
42
|
+
json = model.to_h
|
|
43
|
+
assert_kind_of Hash, json
|
|
44
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
45
|
+
assert_equal fixture["current_version"], json[:current_version]
|
|
46
|
+
assert_equal fixture["etag"], json[:etag]
|
|
47
|
+
assert_equal fixture["id"], json[:id]
|
|
48
|
+
assert_equal fixture["size"], json[:size]
|
|
49
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
50
|
+
end
|
|
51
|
+
|
|
19
52
|
def test_connect_application_oauth_round_trip
|
|
20
53
|
fixture = {
|
|
21
54
|
"object" => "connect_application",
|
|
@@ -148,6 +181,7 @@ class SharedModelRoundTripTest < Minitest::Test
|
|
|
148
181
|
"email" => "stub",
|
|
149
182
|
"state" => "stub",
|
|
150
183
|
"approved_at" => nil,
|
|
184
|
+
"waitlist_id" => nil,
|
|
151
185
|
"created_at" => "stub",
|
|
152
186
|
"updated_at" => "stub"
|
|
153
187
|
}
|
|
@@ -162,6 +196,24 @@ class SharedModelRoundTripTest < Minitest::Test
|
|
|
162
196
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
163
197
|
end
|
|
164
198
|
|
|
199
|
+
def test_event_schema_round_trip
|
|
200
|
+
fixture = {
|
|
201
|
+
"object" => "event",
|
|
202
|
+
"id" => "stub",
|
|
203
|
+
"event" => "stub",
|
|
204
|
+
"data" => {},
|
|
205
|
+
"created_at" => "stub",
|
|
206
|
+
"context" => {}
|
|
207
|
+
}
|
|
208
|
+
model = WorkOS::EventSchema.new(fixture.to_json)
|
|
209
|
+
json = model.to_h
|
|
210
|
+
assert_kind_of Hash, json
|
|
211
|
+
assert_equal fixture["id"], json[:id]
|
|
212
|
+
assert_equal fixture["event"], json[:event]
|
|
213
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
214
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
215
|
+
end
|
|
216
|
+
|
|
165
217
|
def test_agent_registration_claim_attempt_created_round_trip
|
|
166
218
|
fixture = {
|
|
167
219
|
"object" => "event",
|
|
@@ -456,6 +508,34 @@ class SharedModelRoundTripTest < Minitest::Test
|
|
|
456
508
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
457
509
|
end
|
|
458
510
|
|
|
511
|
+
def test_agent_registration_refreshed_round_trip
|
|
512
|
+
fixture = {
|
|
513
|
+
"object" => "event",
|
|
514
|
+
"id" => "stub",
|
|
515
|
+
"event" => "agent.registration.refreshed",
|
|
516
|
+
"data" => {},
|
|
517
|
+
"created_at" => "stub",
|
|
518
|
+
"context" => {}
|
|
519
|
+
}
|
|
520
|
+
model = WorkOS::AgentRegistrationRefreshed.new(fixture.to_json)
|
|
521
|
+
json = model.to_h
|
|
522
|
+
assert_kind_of Hash, json
|
|
523
|
+
assert_equal fixture["id"], json[:id]
|
|
524
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
525
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
def test_agent_registration_refreshed_data_round_trip
|
|
529
|
+
fixture = {
|
|
530
|
+
"agent_registration_id" => "stub"
|
|
531
|
+
}
|
|
532
|
+
model = WorkOS::AgentRegistrationRefreshedData.new(fixture.to_json)
|
|
533
|
+
json = model.to_h
|
|
534
|
+
assert_kind_of Hash, json
|
|
535
|
+
assert_equal fixture["agent_registration_id"], json[:agent_registration_id]
|
|
536
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
537
|
+
end
|
|
538
|
+
|
|
459
539
|
def test_agent_registration_revoked_round_trip
|
|
460
540
|
fixture = {
|
|
461
541
|
"object" => "event",
|
|
@@ -787,6 +867,17 @@ class SharedModelRoundTripTest < Minitest::Test
|
|
|
787
867
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
788
868
|
end
|
|
789
869
|
|
|
870
|
+
def test_event_list_list_metadata_round_trip
|
|
871
|
+
fixture = {
|
|
872
|
+
"after" => nil
|
|
873
|
+
}
|
|
874
|
+
model = WorkOS::EventListListMetadata.new(fixture.to_json)
|
|
875
|
+
json = model.to_h
|
|
876
|
+
assert_kind_of Hash, json
|
|
877
|
+
assert_nil json[:after]
|
|
878
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
879
|
+
end
|
|
880
|
+
|
|
790
881
|
def test_event_context_google_analytics_session_round_trip
|
|
791
882
|
fixture = {
|
|
792
883
|
"containerId" => "stub",
|
|
@@ -163,7 +163,7 @@ class UserManagementTest < Minitest::Test
|
|
|
163
163
|
def test_authenticate_with_radar_sms_challenge_returns_expected_result
|
|
164
164
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)})
|
|
165
165
|
.to_return(body: "{}", status: 200)
|
|
166
|
-
result = @client.user_management.authenticate_with_radar_sms_challenge(code: "stub",
|
|
166
|
+
result = @client.user_management.authenticate_with_radar_sms_challenge(code: "stub", pending_authentication_token: "stub")
|
|
167
167
|
refute_nil result
|
|
168
168
|
end
|
|
169
169
|
|
|
@@ -171,7 +171,7 @@ class UserManagementTest < Minitest::Test
|
|
|
171
171
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)})
|
|
172
172
|
.to_return(body: '{"message": "Unauthorized"}', status: 401)
|
|
173
173
|
assert_raises(WorkOS::AuthenticationError) do
|
|
174
|
-
@client.user_management.authenticate_with_radar_sms_challenge(code: "stub",
|
|
174
|
+
@client.user_management.authenticate_with_radar_sms_challenge(code: "stub", pending_authentication_token: "stub")
|
|
175
175
|
end
|
|
176
176
|
end
|
|
177
177
|
|
|
@@ -262,9 +262,9 @@ class UserManagementTest < Minitest::Test
|
|
|
262
262
|
|
|
263
263
|
def test_create_user_with_password_hashed_returns_expected_result
|
|
264
264
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users(\?|\z)})
|
|
265
|
-
.with(body: hash_including("email" => "stub", "password_hash" => "stub", "password_hash_type" => "stub"))
|
|
265
|
+
.with(body: hash_including("email" => "stub", "password_hash" => "stub", "password_hash_type" => "stub", "password_salt_position" => "stub"))
|
|
266
266
|
.to_return(body: "{}", status: 200)
|
|
267
|
-
result = @client.user_management.create_user(email: "stub", password: WorkOS::UserManagement::PasswordHashed.new(password_hash: "stub", password_hash_type: "stub"))
|
|
267
|
+
result = @client.user_management.create_user(email: "stub", password: WorkOS::UserManagement::PasswordHashed.new(password_hash: "stub", password_hash_type: "stub", password_salt_position: "stub"))
|
|
268
268
|
refute_nil result
|
|
269
269
|
end
|
|
270
270
|
|
|
@@ -292,9 +292,9 @@ class UserManagementTest < Minitest::Test
|
|
|
292
292
|
|
|
293
293
|
def test_update_user_with_password_hashed_returns_expected_result
|
|
294
294
|
stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/users/stub(\?|\z)})
|
|
295
|
-
.with(body: hash_including("password_hash" => "stub", "password_hash_type" => "stub"))
|
|
295
|
+
.with(body: hash_including("password_hash" => "stub", "password_hash_type" => "stub", "password_salt_position" => "stub"))
|
|
296
296
|
.to_return(body: "{}", status: 200)
|
|
297
|
-
result = @client.user_management.update_user(id: "stub", password: WorkOS::UserManagement::PasswordHashed.new(password_hash: "stub", password_hash_type: "stub"))
|
|
297
|
+
result = @client.user_management.update_user(id: "stub", password: WorkOS::UserManagement::PasswordHashed.new(password_hash: "stub", password_hash_type: "stub", password_salt_position: "stub"))
|
|
298
298
|
refute_nil result
|
|
299
299
|
end
|
|
300
300
|
|
|
@@ -126,7 +126,8 @@ class UserManagementModelRoundTripTest < Minitest::Test
|
|
|
126
126
|
"signals_id" => "stub",
|
|
127
127
|
"password" => nil,
|
|
128
128
|
"password_hash" => "stub",
|
|
129
|
-
"password_hash_type" => "stub"
|
|
129
|
+
"password_hash_type" => "stub",
|
|
130
|
+
"password_salt_position" => "stub"
|
|
130
131
|
}
|
|
131
132
|
model = WorkOS::CreateUser.new(fixture.to_json)
|
|
132
133
|
json = model.to_h
|
|
@@ -147,7 +148,8 @@ class UserManagementModelRoundTripTest < Minitest::Test
|
|
|
147
148
|
"locale" => nil,
|
|
148
149
|
"password" => "stub",
|
|
149
150
|
"password_hash" => "stub",
|
|
150
|
-
"password_hash_type" => "stub"
|
|
151
|
+
"password_hash_type" => "stub",
|
|
152
|
+
"password_salt_position" => "stub"
|
|
151
153
|
}
|
|
152
154
|
model = WorkOS::UpdateUser.new(fixture.to_json)
|
|
153
155
|
json = model.to_h
|
|
@@ -2356,8 +2358,6 @@ class UserManagementModelRoundTripTest < Minitest::Test
|
|
|
2356
2358
|
assert_equal fixture["client_id"], json[:client_id]
|
|
2357
2359
|
assert_equal fixture["client_secret"], json[:client_secret]
|
|
2358
2360
|
assert_equal fixture["code"], json[:code]
|
|
2359
|
-
assert_equal fixture["verification_id"], json[:verification_id]
|
|
2360
|
-
assert_equal fixture["phone_number"], json[:phone_number]
|
|
2361
2361
|
assert_equal fixture["pending_authentication_token"], json[:pending_authentication_token]
|
|
2362
2362
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
2363
2363
|
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: 10.1
|
|
4
|
+
version: 10.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- WorkOS
|
|
@@ -442,6 +442,7 @@ files:
|
|
|
442
442
|
- lib/workos/pipes/data_integrations_list_response_data.rb
|
|
443
443
|
- lib/workos/pipes/data_integrations_list_response_data_connected_account.rb
|
|
444
444
|
- lib/workos/pipes/data_integrations_upsert_api_key_request.rb
|
|
445
|
+
- lib/workos/pipes/data_integrations_upsert_client_credentials_request.rb
|
|
445
446
|
- lib/workos/pipes/data_integrations_vend_credentials_request.rb
|
|
446
447
|
- lib/workos/pipes/update_custom_provider_definition.rb
|
|
447
448
|
- lib/workos/pipes/update_data_integration.rb
|
|
@@ -479,6 +480,8 @@ files:
|
|
|
479
480
|
- lib/workos/shared/agent_registration_expired_data.rb
|
|
480
481
|
- lib/workos/shared/agent_registration_organization_switched.rb
|
|
481
482
|
- lib/workos/shared/agent_registration_organization_switched_data.rb
|
|
483
|
+
- lib/workos/shared/agent_registration_refreshed.rb
|
|
484
|
+
- lib/workos/shared/agent_registration_refreshed_data.rb
|
|
482
485
|
- lib/workos/shared/agent_registration_revoked.rb
|
|
483
486
|
- lib/workos/shared/agent_registration_revoked_data.rb
|
|
484
487
|
- lib/workos/shared/auth_method_mismatch_error.rb
|
|
@@ -574,6 +577,7 @@ files:
|
|
|
574
577
|
- lib/workos/types/create_data_integration_auth_methods.rb
|
|
575
578
|
- lib/workos/types/create_user_invite_options_locale.rb
|
|
576
579
|
- lib/workos/types/create_user_password_hash_type.rb
|
|
580
|
+
- lib/workos/types/create_user_password_salt_position.rb
|
|
577
581
|
- lib/workos/types/create_webhook_endpoint_events.rb
|
|
578
582
|
- lib/workos/types/custom_provider_definition_authenticate_via.rb
|
|
579
583
|
- lib/workos/types/data_integration_access_token_response_error.rb
|
|
@@ -655,6 +659,7 @@ files:
|
|
|
655
659
|
- lib/workos/types/sso_provider.rb
|
|
656
660
|
- lib/workos/types/update_custom_provider_definition_authenticate_via.rb
|
|
657
661
|
- lib/workos/types/update_user_password_hash_type.rb
|
|
662
|
+
- lib/workos/types/update_user_password_salt_position.rb
|
|
658
663
|
- lib/workos/types/update_webhook_endpoint_events.rb
|
|
659
664
|
- lib/workos/types/update_webhook_endpoint_status.rb
|
|
660
665
|
- lib/workos/types/user_identities_get_item_provider.rb
|
|
@@ -907,6 +912,8 @@ files:
|
|
|
907
912
|
- rbi/workos/agent_registration_expired_data.rbi
|
|
908
913
|
- rbi/workos/agent_registration_organization_switched.rbi
|
|
909
914
|
- rbi/workos/agent_registration_organization_switched_data.rbi
|
|
915
|
+
- rbi/workos/agent_registration_refreshed.rbi
|
|
916
|
+
- rbi/workos/agent_registration_refreshed_data.rbi
|
|
910
917
|
- rbi/workos/agent_registration_revoked.rbi
|
|
911
918
|
- rbi/workos/agent_registration_revoked_data.rbi
|
|
912
919
|
- rbi/workos/agents.rbi
|
|
@@ -1096,6 +1103,7 @@ files:
|
|
|
1096
1103
|
- rbi/workos/data_integrations_list_response_data.rbi
|
|
1097
1104
|
- rbi/workos/data_integrations_list_response_data_connected_account.rbi
|
|
1098
1105
|
- rbi/workos/data_integrations_upsert_api_key_request.rbi
|
|
1106
|
+
- rbi/workos/data_integrations_upsert_client_credentials_request.rbi
|
|
1099
1107
|
- rbi/workos/data_integrations_vend_credentials_request.rbi
|
|
1100
1108
|
- rbi/workos/decrypt_request.rbi
|
|
1101
1109
|
- rbi/workos/decrypt_response.rbi
|