workos 9.3.0 → 9.5.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/.last-synced-sha +1 -1
- data/.oagen-manifest.json +117 -1
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +139 -0
- data/Gemfile.lock +2 -2
- data/lib/workos/admin_portal/generate_link.rb +0 -3
- data/lib/workos/admin_portal.rb +0 -3
- data/lib/workos/authorization/user_role_assignment.rb +3 -0
- data/lib/workos/authorization/user_role_assignment_source.rb +22 -0
- data/lib/workos/pipes/connected_account_dto.rb +31 -0
- data/lib/workos/pipes/create_data_integration.rb +34 -0
- data/lib/workos/pipes/custom_provider_definition.rb +49 -0
- data/lib/workos/pipes/data_integration.rb +55 -0
- data/lib/workos/pipes/data_integration_credential.rb +25 -0
- data/lib/workos/pipes/data_integration_credentials_dto.rb +25 -0
- data/lib/workos/pipes/data_integration_credentials_response.rb +25 -0
- data/lib/workos/pipes/data_integration_credentials_response_credential.rb +34 -0
- data/lib/workos/pipes/data_integration_custom_provider.rb +49 -0
- data/lib/workos/pipes/data_integrations_upsert_api_key_request.rb +25 -0
- data/lib/workos/pipes/data_integrations_vend_credentials_request.rb +22 -0
- data/lib/workos/pipes/update_custom_provider_definition.rb +49 -0
- data/lib/workos/pipes/update_data_integration.rb +31 -0
- data/lib/workos/pipes.rb +304 -0
- data/lib/workos/radar/radar_standalone_assess_request.rb +5 -2
- data/lib/workos/radar.rb +5 -2
- data/lib/workos/shared/auth_method_mismatch_error.rb +22 -0
- data/lib/workos/types/audit_log_export_state.rb +2 -1
- data/lib/workos/types/connected_account_state.rb +1 -2
- data/lib/workos/types/create_webhook_endpoint_events.rb +8 -1
- data/lib/workos/types/custom_provider_definition_authenticate_via.rb +13 -0
- data/lib/workos/types/data_integration_credential_type.rb +13 -0
- data/lib/workos/types/data_integration_credentials_response_error.rb +9 -0
- data/lib/workos/types/data_integration_credentials_type.rb +9 -0
- data/lib/workos/types/data_integration_custom_provider_authenticate_via.rb +9 -0
- data/lib/workos/types/data_integration_state.rb +14 -0
- data/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb +6 -1
- data/lib/workos/types/update_custom_provider_definition_authenticate_via.rb +9 -0
- data/lib/workos/types/user_role_assignment_source_type.rb +13 -0
- data/lib/workos/user_management/authorization_code_session_authenticate_request.rb +5 -2
- data/lib/workos/user_management/create_magic_code_and_return.rb +14 -2
- data/lib/workos/user_management/create_user.rb +9 -0
- data/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb +5 -2
- data/lib/workos/user_management/magic_auth_send_magic_auth_code_and_return_response.rb +43 -0
- data/lib/workos/user_management/password_session_authenticate_request.rb +8 -2
- data/lib/workos/user_management/radar_email_challenge_code_session_authenticate_request.rb +43 -0
- data/lib/workos/user_management/radar_sms_challenge_code_session_authenticate_request.rb +46 -0
- data/lib/workos/user_management/send_radar_sms_challenge.rb +31 -0
- data/lib/workos/user_management/send_radar_sms_challenge_response.rb +22 -0
- data/lib/workos/user_management/user_create_response.rb +61 -0
- data/lib/workos/user_management.rb +261 -9
- data/lib/workos/version.rb +1 -1
- data/rbi/workos/admin_portal.rbi +1 -2
- data/rbi/workos/auth_method_mismatch_error.rbi +30 -0
- data/rbi/workos/authorization_code_session_authenticate_request.rbi +6 -0
- data/rbi/workos/connected_account_dto.rbi +48 -0
- data/rbi/workos/create_data_integration.rbi +54 -0
- data/rbi/workos/create_magic_code_and_return.rbi +24 -0
- data/rbi/workos/create_user.rbi +18 -0
- data/rbi/workos/custom_provider_definition.rbi +84 -0
- data/rbi/workos/data_integration.rbi +96 -0
- data/rbi/workos/data_integration_credential.rbi +36 -0
- data/rbi/workos/data_integration_credentials_dto.rbi +36 -0
- data/rbi/workos/data_integration_credentials_response.rbi +36 -0
- data/rbi/workos/data_integration_credentials_response_credential.rbi +54 -0
- data/rbi/workos/data_integration_custom_provider.rbi +84 -0
- data/rbi/workos/data_integrations_upsert_api_key_request.rbi +36 -0
- data/rbi/workos/data_integrations_vend_credentials_request.rbi +30 -0
- data/rbi/workos/generate_link.rbi +0 -6
- data/rbi/workos/magic_auth_code_session_authenticate_request.rbi +6 -0
- data/rbi/workos/magic_auth_send_magic_auth_code_and_return_response.rbi +72 -0
- data/rbi/workos/password_session_authenticate_request.rbi +12 -0
- data/rbi/workos/pipes.rbi +104 -0
- data/rbi/workos/radar.rbi +2 -1
- data/rbi/workos/radar_email_challenge_code_session_authenticate_request.rbi +72 -0
- data/rbi/workos/radar_sms_challenge_code_session_authenticate_request.rbi +78 -0
- data/rbi/workos/radar_standalone_assess_request.rbi +6 -0
- data/rbi/workos/send_radar_sms_challenge.rbi +48 -0
- data/rbi/workos/send_radar_sms_challenge_response.rbi +30 -0
- data/rbi/workos/update_custom_provider_definition.rbi +84 -0
- data/rbi/workos/update_data_integration.rbi +48 -0
- data/rbi/workos/user_create_response.rbi +108 -0
- data/rbi/workos/user_management.rbi +47 -5
- data/rbi/workos/user_role_assignment.rbi +6 -0
- data/rbi/workos/user_role_assignment_source.rbi +30 -0
- data/test/workos/test_admin_portal_model_round_trip.rb +33 -0
- data/test/workos/test_audit_logs_model_round_trip.rb +218 -0
- data/test/workos/test_authorization_model_round_trip.rb +456 -0
- data/test/workos/test_connect_model_round_trip.rb +30 -0
- data/test/workos/test_groups_model_round_trip.rb +33 -0
- data/test/workos/test_model_round_trip.rb +2 -7857
- data/test/workos/test_organizations_model_round_trip.rb +29 -0
- data/test/workos/test_pipes.rb +72 -0
- data/test/workos/test_pipes_model_round_trip.rb +389 -0
- data/test/workos/test_radar_model_round_trip.rb +85 -0
- data/test/workos/test_shared_model_round_trip.rb +92 -0
- data/test/workos/test_user_management.rb +54 -0
- data/test/workos/test_user_management_model_round_trip.rb +1087 -0
- data/test/workos/test_webhooks_model_round_trip.rb +53 -0
- metadata +62 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "test_helper"
|
|
6
|
+
|
|
7
|
+
class SharedModelRoundTripTest < Minitest::Test
|
|
8
|
+
def test_connect_application_oauth_round_trip
|
|
9
|
+
fixture = {
|
|
10
|
+
"object" => "connect_application",
|
|
11
|
+
"id" => "stub",
|
|
12
|
+
"client_id" => "stub",
|
|
13
|
+
"description" => nil,
|
|
14
|
+
"name" => "stub",
|
|
15
|
+
"scopes" => [],
|
|
16
|
+
"created_at" => "stub",
|
|
17
|
+
"updated_at" => "stub",
|
|
18
|
+
"application_type" => "oauth",
|
|
19
|
+
"redirect_uris" => [],
|
|
20
|
+
"uses_pkce" => true,
|
|
21
|
+
"is_first_party" => true,
|
|
22
|
+
"was_dynamically_registered" => true,
|
|
23
|
+
"organization_id" => "stub"
|
|
24
|
+
}
|
|
25
|
+
model = WorkOS::ConnectApplicationOAuth.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["client_id"], json[:client_id]
|
|
30
|
+
assert_nil json[:description]
|
|
31
|
+
assert_equal fixture["name"], json[:name]
|
|
32
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
33
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
34
|
+
assert_equal fixture["uses_pkce"], json[:uses_pkce]
|
|
35
|
+
assert_equal fixture["is_first_party"], json[:is_first_party]
|
|
36
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def test_connect_application_oauth_redirect_uris_round_trip
|
|
40
|
+
fixture = {
|
|
41
|
+
"uri" => "stub",
|
|
42
|
+
"default" => true
|
|
43
|
+
}
|
|
44
|
+
model = WorkOS::ConnectApplicationOAuthRedirectUris.new(fixture.to_json)
|
|
45
|
+
json = model.to_h
|
|
46
|
+
assert_kind_of Hash, json
|
|
47
|
+
assert_equal fixture["uri"], json[:uri]
|
|
48
|
+
assert_equal fixture["default"], json[:default]
|
|
49
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def test_connect_application_m2m_round_trip
|
|
53
|
+
fixture = {
|
|
54
|
+
"object" => "connect_application",
|
|
55
|
+
"id" => "stub",
|
|
56
|
+
"client_id" => "stub",
|
|
57
|
+
"description" => nil,
|
|
58
|
+
"name" => "stub",
|
|
59
|
+
"scopes" => [],
|
|
60
|
+
"created_at" => "stub",
|
|
61
|
+
"updated_at" => "stub",
|
|
62
|
+
"application_type" => "m2m",
|
|
63
|
+
"organization_id" => "stub"
|
|
64
|
+
}
|
|
65
|
+
model = WorkOS::ConnectApplicationM2M.new(fixture.to_json)
|
|
66
|
+
json = model.to_h
|
|
67
|
+
assert_kind_of Hash, json
|
|
68
|
+
assert_equal fixture["id"], json[:id]
|
|
69
|
+
assert_equal fixture["client_id"], json[:client_id]
|
|
70
|
+
assert_nil json[:description]
|
|
71
|
+
assert_equal fixture["name"], json[:name]
|
|
72
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
73
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
74
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
75
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def test_authorized_connect_application_list_data_round_trip
|
|
79
|
+
fixture = {
|
|
80
|
+
"object" => "authorized_connect_application",
|
|
81
|
+
"id" => "stub",
|
|
82
|
+
"granted_scopes" => [],
|
|
83
|
+
"oauth_resource" => "stub",
|
|
84
|
+
"application" => {}
|
|
85
|
+
}
|
|
86
|
+
model = WorkOS::AuthorizedConnectApplicationListData.new(fixture.to_json)
|
|
87
|
+
json = model.to_h
|
|
88
|
+
assert_kind_of Hash, json
|
|
89
|
+
assert_equal fixture["id"], json[:id]
|
|
90
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -145,6 +145,36 @@ class UserManagementTest < Minitest::Test
|
|
|
145
145
|
end
|
|
146
146
|
end
|
|
147
147
|
|
|
148
|
+
def test_authenticate_with_radar_email_challenge_returns_expected_result
|
|
149
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)})
|
|
150
|
+
.to_return(body: "{}", status: 200)
|
|
151
|
+
result = @client.user_management.authenticate_with_radar_email_challenge(code: "stub", radar_challenge_id: "stub", pending_authentication_token: "stub")
|
|
152
|
+
refute_nil result
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def test_authenticate_with_radar_email_challenge_raises_authentication_error_on_401
|
|
156
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)})
|
|
157
|
+
.to_return(body: '{"message": "Unauthorized"}', status: 401)
|
|
158
|
+
assert_raises(WorkOS::AuthenticationError) do
|
|
159
|
+
@client.user_management.authenticate_with_radar_email_challenge(code: "stub", radar_challenge_id: "stub", pending_authentication_token: "stub")
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def test_authenticate_with_radar_sms_challenge_returns_expected_result
|
|
164
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)})
|
|
165
|
+
.to_return(body: "{}", status: 200)
|
|
166
|
+
result = @client.user_management.authenticate_with_radar_sms_challenge(code: "stub", verification_id: "stub", phone_number: "stub", pending_authentication_token: "stub")
|
|
167
|
+
refute_nil result
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def test_authenticate_with_radar_sms_challenge_raises_authentication_error_on_401
|
|
171
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)})
|
|
172
|
+
.to_return(body: '{"message": "Unauthorized"}', status: 401)
|
|
173
|
+
assert_raises(WorkOS::AuthenticationError) do
|
|
174
|
+
@client.user_management.authenticate_with_radar_sms_challenge(code: "stub", verification_id: "stub", phone_number: "stub", pending_authentication_token: "stub")
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
148
178
|
def test_create_device_returns_expected_result
|
|
149
179
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authorize/device(\?|\z)})
|
|
150
180
|
.to_return(body: "{}", status: 200)
|
|
@@ -152,6 +182,13 @@ class UserManagementTest < Minitest::Test
|
|
|
152
182
|
refute_nil result
|
|
153
183
|
end
|
|
154
184
|
|
|
185
|
+
def test_create_radar_challenge_returns_expected_result
|
|
186
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/radar_challenges(\?|\z)})
|
|
187
|
+
.to_return(body: "{}", status: 200)
|
|
188
|
+
result = @client.user_management.create_radar_challenge(user_id: "stub", pending_authentication_token: "stub", phone_number: "stub")
|
|
189
|
+
refute_nil result
|
|
190
|
+
end
|
|
191
|
+
|
|
155
192
|
def test_revoke_session_returns_expected_result
|
|
156
193
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/sessions/revoke(\?|\z)})
|
|
157
194
|
.to_return(body: "{}", status: 200)
|
|
@@ -159,6 +196,13 @@ class UserManagementTest < Minitest::Test
|
|
|
159
196
|
assert_nil result
|
|
160
197
|
end
|
|
161
198
|
|
|
199
|
+
def test_list_cors_origins_returns_expected_result
|
|
200
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/cors_origins(\?|\z)})
|
|
201
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
202
|
+
result = @client.user_management.list_cors_origins
|
|
203
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
204
|
+
end
|
|
205
|
+
|
|
162
206
|
def test_create_cors_origin_returns_expected_result
|
|
163
207
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/cors_origins(\?|\z)})
|
|
164
208
|
.to_return(body: "{}", status: 200)
|
|
@@ -373,6 +417,13 @@ class UserManagementTest < Minitest::Test
|
|
|
373
417
|
refute_nil result
|
|
374
418
|
end
|
|
375
419
|
|
|
420
|
+
def test_list_redirect_uris_returns_expected_result
|
|
421
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/redirect_uris(\?|\z)})
|
|
422
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
423
|
+
result = @client.user_management.list_redirect_uris
|
|
424
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
425
|
+
end
|
|
426
|
+
|
|
376
427
|
def test_create_redirect_uri_returns_expected_result
|
|
377
428
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/redirect_uris(\?|\z)})
|
|
378
429
|
.to_return(body: "{}", status: 200)
|
|
@@ -413,7 +464,9 @@ class UserManagementTest < Minitest::Test
|
|
|
413
464
|
{name: :get_jwks, verb: :get, url: %r{\Ahttps://api\.workos\.com/sso/jwks/stub(\?|\z)}, args: {client_id: "stub"}},
|
|
414
465
|
{name: :create_authenticate, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}, args: {client_id: "stub", grant_type: "authorization_code", code: "stub"}},
|
|
415
466
|
{name: :create_device, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/authorize/device(\?|\z)}, args: {client_id: "stub"}},
|
|
467
|
+
{name: :create_radar_challenge, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/radar_challenges(\?|\z)}, args: {user_id: "stub", pending_authentication_token: "stub", phone_number: "stub"}},
|
|
416
468
|
{name: :revoke_session, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/sessions/revoke(\?|\z)}, args: {session_id: "stub"}},
|
|
469
|
+
{name: :list_cors_origins, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/cors_origins(\?|\z)}},
|
|
417
470
|
{name: :create_cors_origin, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/cors_origins(\?|\z)}, args: {origin: "stub"}},
|
|
418
471
|
{name: :get_email_verification, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/email_verification/stub(\?|\z)}, args: {id: "stub"}},
|
|
419
472
|
{name: :reset_password, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/password_reset(\?|\z)}, args: {email: "stub"}},
|
|
@@ -442,6 +495,7 @@ class UserManagementTest < Minitest::Test
|
|
|
442
495
|
{name: :update_jwt_template, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/jwt_template(\?|\z)}, args: {content: "stub"}},
|
|
443
496
|
{name: :create_magic_auth, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/magic_auth(\?|\z)}, args: {email: "stub"}},
|
|
444
497
|
{name: :get_magic_auth, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/magic_auth/stub(\?|\z)}, args: {id: "stub"}},
|
|
498
|
+
{name: :list_redirect_uris, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/redirect_uris(\?|\z)}},
|
|
445
499
|
{name: :create_redirect_uri, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/redirect_uris(\?|\z)}, args: {uri: "stub"}},
|
|
446
500
|
{name: :list_user_authorized_applications, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications(\?|\z)}, args: {user_id: "stub"}},
|
|
447
501
|
{name: :delete_user_authorized_application, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications/stub(\?|\z)}, args: {application_id: "stub", user_id: "stub"}},
|