workos 9.4.0 → 10.0.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/.github/workflows/block-generated-edits.yml +13 -0
- data/.github/workflows/ci.yml +1 -1
- data/.github/workflows/docs.yml +1 -1
- data/.github/workflows/lint.yml +1 -1
- data/.github/workflows/release-please.yml +7 -1
- data/.github/workflows/release.yml +1 -1
- data/.last-synced-sha +1 -1
- data/.oagen-manifest.json +197 -68
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +103 -0
- data/Gemfile.lock +2 -2
- data/README.md +15 -14
- data/lib/workos/agents/agent_admin_link_claim_attempt_to_external_user_request.rb +28 -0
- data/lib/workos/agents/agent_admin_link_claim_attempt_to_external_user_request_user.rb +22 -0
- data/lib/workos/agents/agent_admin_validate_credential_request.rb +25 -0
- data/lib/workos/agents/agent_credential_validation.rb +25 -0
- data/lib/workos/agents/agent_registration.rb +40 -0
- data/lib/workos/agents/agent_registration_agent_identity.rb +28 -0
- data/lib/workos/agents/agent_registration_claim.rb +31 -0
- data/lib/workos/agents/agent_registration_claim_claim_completion.rb +31 -0
- data/lib/workos/agents/claim_view_response.rb +28 -0
- data/lib/workos/agents/claim_view_response_organization.rb +7 -0
- data/lib/workos/agents.rb +93 -0
- data/lib/workos/api_keys/api_key_validation_response.rb +6 -2
- data/lib/workos/api_keys.rb +3 -4
- data/lib/workos/authorization/permission_created_data.rb +1 -34
- data/lib/workos/authorization/permission_deleted_data.rb +1 -1
- data/lib/workos/authorization/permission_updated_data.rb +1 -1
- data/lib/workos/authorization.rb +24 -24
- data/lib/workos/base_client.rb +4 -4
- data/lib/workos/client.rb +4 -0
- data/lib/workos/connect.rb +23 -19
- data/lib/workos/directory_sync.rb +10 -2
- data/lib/workos/groups.rb +7 -7
- data/lib/workos/inflections.rb +0 -1
- data/lib/workos/organization_domains.rb +4 -4
- data/lib/workos/organizations/organization_authorized_connect_application_list_data.rb +34 -0
- data/lib/workos/organizations.rb +57 -10
- data/lib/workos/pipes/api_key_installation.rb +25 -0
- data/lib/workos/pipes/{connected_account_dto.rb → connected_account_input.rb} +1 -1
- data/lib/workos/pipes/create_data_integration.rb +7 -1
- data/lib/workos/pipes/data_integration.rb +6 -0
- data/lib/workos/pipes/{data_integration_credentials_dto.rb → data_integration_credentials_input.rb} +1 -1
- data/lib/workos/pipes/data_integration_installation.rb +28 -0
- data/lib/workos/pipes/data_integrations_upsert_api_key_request.rb +1 -19
- data/lib/workos/pipes/update_data_integration.rb +4 -1
- data/lib/workos/pipes.rb +25 -16
- data/lib/workos/pipes_provider.rb +2 -2
- data/lib/workos/shared/access_token_agent_registration_credential_issued_data_detail.rb +25 -0
- data/lib/workos/shared/agent_registration_claim_attempt_created.rb +34 -0
- data/lib/workos/shared/agent_registration_claim_attempt_created_data.rb +40 -0
- data/lib/workos/shared/agent_registration_claim_completed.rb +34 -0
- data/lib/workos/shared/agent_registration_claim_completed_data.rb +40 -0
- data/lib/workos/shared/agent_registration_claim_completed_data_claimed_by.rb +22 -0
- data/lib/workos/shared/agent_registration_created.rb +34 -0
- data/lib/workos/{organization_domains/organization_domain_stand_alone.rb → shared/agent_registration_created_data.rb} +13 -16
- data/lib/workos/shared/agent_registration_created_data_agent_identity.rb +25 -0
- data/lib/workos/shared/agent_registration_credential_issued.rb +34 -0
- data/lib/workos/shared/agent_registration_credential_issued_data.rb +34 -0
- data/lib/workos/shared/agent_registration_credential_issued_data_detail.rb +22 -0
- data/lib/workos/shared/agent_registration_deleted.rb +34 -0
- data/lib/workos/shared/agent_registration_deleted_data.rb +18 -0
- data/lib/workos/shared/agent_registration_expired.rb +34 -0
- data/lib/workos/shared/agent_registration_expired_data.rb +7 -0
- data/lib/workos/shared/agent_registration_organization_switched.rb +34 -0
- data/lib/workos/shared/agent_registration_organization_switched_data.rb +25 -0
- data/lib/workos/shared/agent_registration_revoked.rb +34 -0
- data/lib/workos/shared/agent_registration_revoked_data.rb +7 -0
- data/lib/workos/shared/pipes_connected_account_connection_failed.rb +34 -0
- data/lib/workos/shared/pipes_connected_account_connection_failed_data.rb +46 -0
- data/lib/workos/shared/radar_challenge_created.rb +34 -0
- data/lib/workos/shared/radar_challenge_created_data.rb +28 -0
- data/lib/workos/sso/connection.rb +3 -3
- data/lib/workos/types/agent_admin_validate_credential_request_type.rb +13 -0
- data/lib/workos/types/agent_registration_created_data_kind.rb +14 -0
- data/lib/workos/types/agent_registration_created_data_method.rb +14 -0
- data/lib/workos/types/agent_registration_created_data_status.rb +15 -0
- data/lib/workos/types/{data_integration_credentials_type.rb → agent_registration_kind.rb} +1 -1
- data/lib/workos/types/{organization_domain_stand_alone_state.rb → agent_registration_status.rb} +1 -1
- data/lib/workos/types/applications_registration_types.rb +13 -0
- data/lib/workos/types/{organization_domain_stand_alone_verification_strategy.rb → claim_view_response_status.rb} +1 -1
- data/lib/workos/types/connected_account_input_state.rb +13 -0
- data/lib/workos/types/connected_account_state.rb +2 -1
- data/lib/workos/types/create_data_integration_auth_methods.rb +9 -0
- data/lib/workos/types/create_user_password_hash_type.rb +2 -1
- data/lib/workos/types/create_webhook_endpoint_events.rb +5 -1
- data/lib/workos/types/data_integration_auth_methods.rb +9 -0
- data/lib/workos/types/data_integration_credentials_input_type.rb +9 -0
- data/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb +1 -6
- data/lib/workos/types/pipe_connected_account_state.rb +1 -5
- data/lib/workos/types/vault_kek_deleted_data_actor_source.rb +9 -0
- data/lib/workos/user_management/authentication_reauthentication_succeeded.rb +34 -0
- data/lib/workos/user_management/authentication_reauthentication_succeeded_data.rb +34 -0
- data/lib/workos/user_management/magic_auth_send_magic_auth_code_and_return_response.rb +26 -1
- data/lib/workos/user_management/radar_challenge.rb +43 -0
- data/lib/workos/user_management/user_create_response.rb +55 -1
- data/lib/workos/user_management.rb +155 -26
- data/lib/workos/vault/vault_kek_deleted.rb +34 -0
- data/lib/workos/vault/vault_kek_deleted_data.rb +31 -0
- data/lib/workos/vault.rb +4 -4
- data/lib/workos/version.rb +1 -1
- data/lib/workos/widgets.rb +2 -2
- data/lib/workos.rb +11 -0
- data/rbi/workos/access_token_agent_registration_credential_issued_data_detail.rbi +36 -0
- data/rbi/workos/agent_admin_link_claim_attempt_to_external_user_request.rbi +42 -0
- data/rbi/workos/agent_admin_link_claim_attempt_to_external_user_request_user.rbi +30 -0
- data/rbi/workos/agent_admin_validate_credential_request.rbi +36 -0
- data/rbi/workos/{sso_intent_options.rbi → agent_credential_validation.rbi} +11 -5
- data/rbi/workos/agent_registration.rbi +66 -0
- data/rbi/workos/agent_registration_agent_identity.rbi +42 -0
- data/rbi/workos/agent_registration_claim.rbi +48 -0
- data/rbi/workos/agent_registration_claim_attempt_created.rbi +54 -0
- data/rbi/workos/agent_registration_claim_attempt_created_data.rbi +66 -0
- data/rbi/workos/agent_registration_claim_claim_completion.rbi +48 -0
- data/rbi/workos/agent_registration_claim_completed.rbi +54 -0
- data/rbi/workos/agent_registration_claim_completed_data.rbi +66 -0
- data/rbi/workos/agent_registration_claim_completed_data_claimed_by.rbi +30 -0
- data/rbi/workos/agent_registration_created.rbi +54 -0
- data/rbi/workos/agent_registration_created_data.rbi +72 -0
- data/rbi/workos/agent_registration_created_data_agent_identity.rbi +36 -0
- data/rbi/workos/agent_registration_credential_issued.rbi +54 -0
- data/rbi/workos/agent_registration_credential_issued_data.rbi +54 -0
- data/rbi/workos/agent_registration_credential_issued_data_detail.rbi +30 -0
- data/rbi/workos/agent_registration_deleted.rbi +54 -0
- data/rbi/workos/{connection_option.rbi → agent_registration_deleted_data.rbi} +5 -5
- data/rbi/workos/agent_registration_expired.rbi +54 -0
- data/rbi/workos/{domain_verification_intent_options.rbi → agent_registration_expired_data.rbi} +5 -5
- data/rbi/workos/agent_registration_organization_switched.rbi +54 -0
- data/rbi/workos/agent_registration_organization_switched_data.rbi +36 -0
- data/rbi/workos/agent_registration_revoked.rbi +54 -0
- data/rbi/workos/agent_registration_revoked_data.rbi +24 -0
- data/rbi/workos/agents.rbi +42 -0
- data/rbi/workos/api_key_installation.rbi +36 -0
- data/rbi/workos/api_key_validation_response.rbi +6 -0
- data/rbi/workos/authentication_reauthentication_succeeded.rbi +54 -0
- data/rbi/workos/authentication_reauthentication_succeeded_data.rbi +54 -0
- data/rbi/workos/claim_view_response.rbi +42 -0
- data/rbi/workos/claim_view_response_organization.rbi +30 -0
- data/rbi/workos/client.rbi +3 -0
- data/rbi/workos/connect.rbi +2 -1
- data/rbi/workos/{connected_account_dto.rbi → connected_account_input.rbi} +1 -1
- data/rbi/workos/connection.rbi +4 -4
- data/rbi/workos/create_data_integration.rbi +14 -2
- data/rbi/workos/data_integration.rbi +12 -0
- data/rbi/workos/{data_integration_credentials_dto.rbi → data_integration_credentials_input.rbi} +1 -1
- data/rbi/workos/data_integration_installation.rbi +42 -0
- data/rbi/workos/directory_sync.rbi +3 -1
- data/rbi/workos/magic_auth_send_magic_auth_code_and_return_response.rbi +48 -0
- data/rbi/workos/organization_authorized_connect_application_list_data.rbi +54 -0
- data/rbi/workos/organization_domains.rbi +2 -2
- data/rbi/workos/organizations.rbi +12 -0
- data/rbi/workos/permission_created_data.rbi +6 -0
- data/rbi/workos/permission_deleted_data.rbi +6 -0
- data/rbi/workos/permission_updated_data.rbi +6 -0
- data/rbi/workos/pipes.rbi +7 -4
- data/rbi/workos/pipes_connected_account_connection_failed.rbi +54 -0
- data/rbi/workos/{organization_domain_stand_alone.rbi → pipes_connected_account_connection_failed_data.rbi} +23 -23
- data/rbi/workos/radar_challenge.rbi +72 -0
- data/rbi/workos/radar_challenge_created.rbi +54 -0
- data/rbi/workos/radar_challenge_created_data.rbi +42 -0
- data/rbi/workos/update_data_integration.rbi +8 -2
- data/rbi/workos/user_create_response.rbi +84 -0
- data/rbi/workos/user_management.rbi +16 -0
- data/rbi/workos/vault_kek_deleted.rbi +54 -0
- data/rbi/workos/vault_kek_deleted_data.rbi +48 -0
- data/rbi/workos/widget_session_token.rbi +2 -2
- data/rbi/workos/widgets.rbi +1 -1
- data/test/workos/test_agents.rb +49 -0
- data/test/workos/test_agents_model_round_trip.rb +165 -0
- data/test/workos/test_api_keys_model_round_trip.rb +307 -0
- data/test/workos/test_authorization_model_round_trip.rb +237 -0
- data/test/workos/test_base_client.rb +27 -0
- data/test/workos/test_client_api_model_round_trip.rb +31 -0
- data/test/workos/test_connect_model_round_trip.rb +175 -0
- data/test/workos/test_directory_sync_model_round_trip.rb +579 -0
- data/test/workos/test_feature_flags_model_round_trip.rb +580 -0
- data/test/workos/test_groups_model_round_trip.rb +56 -0
- data/test/workos/test_multi_factor_auth_model_round_trip.rb +192 -0
- data/test/workos/test_organization_domains_model_round_trip.rb +260 -0
- data/test/workos/test_organization_membership_model_round_trip.rb +89 -0
- data/test/workos/test_organizations.rb +9 -1
- data/test/workos/test_organizations_model_round_trip.rb +602 -0
- data/test/workos/test_pipes_model_round_trip.rb +40 -4
- data/test/workos/test_pipes_provider_model_round_trip.rb +75 -0
- data/test/workos/test_shared_model_round_trip.rb +787 -0
- data/test/workos/test_sso_model_round_trip.rb +422 -0
- data/test/workos/test_user_management.rb +46 -0
- data/test/workos/test_user_management_model_round_trip.rb +1540 -0
- data/test/workos/test_vault_model_round_trip.rb +571 -0
- data/test/workos/test_widgets.rb +2 -2
- data/test/workos/test_widgets_model_round_trip.rb +30 -0
- metadata +118 -19
- data/lib/workos/admin_portal/domain_verification_intent_options.rb +0 -18
- data/lib/workos/admin_portal/intent_options.rb +0 -22
- data/lib/workos/admin_portal/sso_intent_options.rb +0 -22
- data/lib/workos/sso/connection_option.rb +0 -18
- data/rbi/workos/intent_options.rbi +0 -30
- data/test/workos/test_model_round_trip.rb +0 -6
|
@@ -0,0 +1,422 @@
|
|
|
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 SsoModelRoundTripTest < Minitest::Test
|
|
8
|
+
def test_token_query_round_trip
|
|
9
|
+
fixture = {
|
|
10
|
+
"client_id" => "stub",
|
|
11
|
+
"client_secret" => "stub",
|
|
12
|
+
"code" => "stub",
|
|
13
|
+
"grant_type" => "authorization_code"
|
|
14
|
+
}
|
|
15
|
+
model = WorkOS::TokenQuery.new(fixture.to_json)
|
|
16
|
+
json = model.to_h
|
|
17
|
+
assert_kind_of Hash, json
|
|
18
|
+
assert_equal fixture["client_id"], json[:client_id]
|
|
19
|
+
assert_equal fixture["client_secret"], json[:client_secret]
|
|
20
|
+
assert_equal fixture["code"], json[:code]
|
|
21
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_connection_round_trip
|
|
25
|
+
fixture = {
|
|
26
|
+
"object" => "connection",
|
|
27
|
+
"id" => "stub",
|
|
28
|
+
"organization_id" => "stub",
|
|
29
|
+
"connection_type" => "stub",
|
|
30
|
+
"name" => "stub",
|
|
31
|
+
"state" => "stub",
|
|
32
|
+
"status" => "stub",
|
|
33
|
+
"domains" => [],
|
|
34
|
+
"callback_endpoint" => "stub",
|
|
35
|
+
"created_at" => "stub",
|
|
36
|
+
"updated_at" => "stub"
|
|
37
|
+
}
|
|
38
|
+
model = WorkOS::Connection.new(fixture.to_json)
|
|
39
|
+
json = model.to_h
|
|
40
|
+
assert_kind_of Hash, json
|
|
41
|
+
assert_equal fixture["id"], json[:id]
|
|
42
|
+
assert_equal fixture["name"], json[:name]
|
|
43
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
44
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
45
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_connection_activated_round_trip
|
|
49
|
+
fixture = {
|
|
50
|
+
"object" => "event",
|
|
51
|
+
"id" => "stub",
|
|
52
|
+
"event" => "connection.activated",
|
|
53
|
+
"data" => {},
|
|
54
|
+
"created_at" => "stub",
|
|
55
|
+
"context" => {}
|
|
56
|
+
}
|
|
57
|
+
model = WorkOS::ConnectionActivated.new(fixture.to_json)
|
|
58
|
+
json = model.to_h
|
|
59
|
+
assert_kind_of Hash, json
|
|
60
|
+
assert_equal fixture["id"], json[:id]
|
|
61
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
62
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def test_connection_activated_data_round_trip
|
|
66
|
+
fixture = {
|
|
67
|
+
"object" => "connection",
|
|
68
|
+
"id" => "stub",
|
|
69
|
+
"state" => "stub",
|
|
70
|
+
"name" => "stub",
|
|
71
|
+
"connection_type" => "stub",
|
|
72
|
+
"organization_id" => "stub",
|
|
73
|
+
"created_at" => "stub",
|
|
74
|
+
"updated_at" => "stub",
|
|
75
|
+
"external_key" => "stub",
|
|
76
|
+
"status" => "stub",
|
|
77
|
+
"domains" => []
|
|
78
|
+
}
|
|
79
|
+
model = WorkOS::ConnectionActivatedData.new(fixture.to_json)
|
|
80
|
+
json = model.to_h
|
|
81
|
+
assert_kind_of Hash, json
|
|
82
|
+
assert_equal fixture["id"], json[:id]
|
|
83
|
+
assert_equal fixture["name"], json[:name]
|
|
84
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
85
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
86
|
+
assert_equal fixture["external_key"], json[:external_key]
|
|
87
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def test_connection_activated_data_domain_round_trip
|
|
91
|
+
fixture = {
|
|
92
|
+
"object" => "connection_domain",
|
|
93
|
+
"id" => "stub",
|
|
94
|
+
"domain" => "stub"
|
|
95
|
+
}
|
|
96
|
+
model = WorkOS::ConnectionActivatedDataDomain.new(fixture.to_json)
|
|
97
|
+
json = model.to_h
|
|
98
|
+
assert_kind_of Hash, json
|
|
99
|
+
assert_equal fixture["id"], json[:id]
|
|
100
|
+
assert_equal fixture["domain"], json[:domain]
|
|
101
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def test_connection_deactivated_round_trip
|
|
105
|
+
fixture = {
|
|
106
|
+
"object" => "event",
|
|
107
|
+
"id" => "stub",
|
|
108
|
+
"event" => "connection.deactivated",
|
|
109
|
+
"data" => {},
|
|
110
|
+
"created_at" => "stub",
|
|
111
|
+
"context" => {}
|
|
112
|
+
}
|
|
113
|
+
model = WorkOS::ConnectionDeactivated.new(fixture.to_json)
|
|
114
|
+
json = model.to_h
|
|
115
|
+
assert_kind_of Hash, json
|
|
116
|
+
assert_equal fixture["id"], json[:id]
|
|
117
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
118
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def test_connection_deactivated_data_round_trip
|
|
122
|
+
fixture = {
|
|
123
|
+
"object" => "connection",
|
|
124
|
+
"id" => "stub",
|
|
125
|
+
"state" => "stub",
|
|
126
|
+
"name" => "stub",
|
|
127
|
+
"connection_type" => "stub",
|
|
128
|
+
"organization_id" => "stub",
|
|
129
|
+
"created_at" => "stub",
|
|
130
|
+
"updated_at" => "stub",
|
|
131
|
+
"external_key" => "stub",
|
|
132
|
+
"status" => "stub",
|
|
133
|
+
"domains" => []
|
|
134
|
+
}
|
|
135
|
+
model = WorkOS::ConnectionDeactivatedData.new(fixture.to_json)
|
|
136
|
+
json = model.to_h
|
|
137
|
+
assert_kind_of Hash, json
|
|
138
|
+
assert_equal fixture["id"], json[:id]
|
|
139
|
+
assert_equal fixture["name"], json[:name]
|
|
140
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
141
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
142
|
+
assert_equal fixture["external_key"], json[:external_key]
|
|
143
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def test_connection_deactivated_data_domain_round_trip
|
|
147
|
+
fixture = {
|
|
148
|
+
"object" => "connection_domain",
|
|
149
|
+
"id" => "stub",
|
|
150
|
+
"domain" => "stub"
|
|
151
|
+
}
|
|
152
|
+
model = WorkOS::ConnectionDeactivatedDataDomain.new(fixture.to_json)
|
|
153
|
+
json = model.to_h
|
|
154
|
+
assert_kind_of Hash, json
|
|
155
|
+
assert_equal fixture["id"], json[:id]
|
|
156
|
+
assert_equal fixture["domain"], json[:domain]
|
|
157
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def test_connection_deleted_round_trip
|
|
161
|
+
fixture = {
|
|
162
|
+
"object" => "event",
|
|
163
|
+
"id" => "stub",
|
|
164
|
+
"event" => "connection.deleted",
|
|
165
|
+
"data" => {},
|
|
166
|
+
"created_at" => "stub",
|
|
167
|
+
"context" => {}
|
|
168
|
+
}
|
|
169
|
+
model = WorkOS::ConnectionDeleted.new(fixture.to_json)
|
|
170
|
+
json = model.to_h
|
|
171
|
+
assert_kind_of Hash, json
|
|
172
|
+
assert_equal fixture["id"], json[:id]
|
|
173
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
174
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def test_connection_deleted_data_round_trip
|
|
178
|
+
fixture = {
|
|
179
|
+
"object" => "connection",
|
|
180
|
+
"id" => "stub",
|
|
181
|
+
"state" => "stub",
|
|
182
|
+
"name" => "stub",
|
|
183
|
+
"connection_type" => "stub",
|
|
184
|
+
"organization_id" => "stub",
|
|
185
|
+
"created_at" => "stub",
|
|
186
|
+
"updated_at" => "stub"
|
|
187
|
+
}
|
|
188
|
+
model = WorkOS::ConnectionDeletedData.new(fixture.to_json)
|
|
189
|
+
json = model.to_h
|
|
190
|
+
assert_kind_of Hash, json
|
|
191
|
+
assert_equal fixture["id"], json[:id]
|
|
192
|
+
assert_equal fixture["name"], json[:name]
|
|
193
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
194
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
195
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def test_connection_saml_certificate_renewal_required_round_trip
|
|
199
|
+
fixture = {
|
|
200
|
+
"object" => "event",
|
|
201
|
+
"id" => "stub",
|
|
202
|
+
"event" => "connection.saml_certificate_renewal_required",
|
|
203
|
+
"data" => {},
|
|
204
|
+
"created_at" => "stub",
|
|
205
|
+
"context" => {}
|
|
206
|
+
}
|
|
207
|
+
model = WorkOS::ConnectionSAMLCertificateRenewalRequired.new(fixture.to_json)
|
|
208
|
+
json = model.to_h
|
|
209
|
+
assert_kind_of Hash, json
|
|
210
|
+
assert_equal fixture["id"], json[:id]
|
|
211
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
212
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def test_connection_saml_certificate_renewal_required_data_round_trip
|
|
216
|
+
fixture = {
|
|
217
|
+
"connection" => {},
|
|
218
|
+
"certificate" => {},
|
|
219
|
+
"days_until_expiry" => 1
|
|
220
|
+
}
|
|
221
|
+
model = WorkOS::ConnectionSAMLCertificateRenewalRequiredData.new(fixture.to_json)
|
|
222
|
+
json = model.to_h
|
|
223
|
+
assert_kind_of Hash, json
|
|
224
|
+
assert_equal fixture["days_until_expiry"], json[:days_until_expiry]
|
|
225
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
def test_connection_saml_certificate_renewal_required_data_connection_round_trip
|
|
229
|
+
fixture = {
|
|
230
|
+
"id" => "stub",
|
|
231
|
+
"organization_id" => "stub"
|
|
232
|
+
}
|
|
233
|
+
model = WorkOS::ConnectionSAMLCertificateRenewalRequiredDataConnection.new(fixture.to_json)
|
|
234
|
+
json = model.to_h
|
|
235
|
+
assert_kind_of Hash, json
|
|
236
|
+
assert_equal fixture["id"], json[:id]
|
|
237
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def test_connection_saml_certificate_renewal_required_data_certificate_round_trip
|
|
241
|
+
fixture = {
|
|
242
|
+
"certificate_type" => "stub",
|
|
243
|
+
"expiry_date" => "stub",
|
|
244
|
+
"is_expired" => true
|
|
245
|
+
}
|
|
246
|
+
model = WorkOS::ConnectionSAMLCertificateRenewalRequiredDataCertificate.new(fixture.to_json)
|
|
247
|
+
json = model.to_h
|
|
248
|
+
assert_kind_of Hash, json
|
|
249
|
+
assert_equal fixture["expiry_date"], json[:expiry_date]
|
|
250
|
+
assert_equal fixture["is_expired"], json[:is_expired]
|
|
251
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
def test_connection_saml_certificate_renewed_round_trip
|
|
255
|
+
fixture = {
|
|
256
|
+
"object" => "event",
|
|
257
|
+
"id" => "stub",
|
|
258
|
+
"event" => "connection.saml_certificate_renewed",
|
|
259
|
+
"data" => {},
|
|
260
|
+
"created_at" => "stub",
|
|
261
|
+
"context" => {}
|
|
262
|
+
}
|
|
263
|
+
model = WorkOS::ConnectionSAMLCertificateRenewed.new(fixture.to_json)
|
|
264
|
+
json = model.to_h
|
|
265
|
+
assert_kind_of Hash, json
|
|
266
|
+
assert_equal fixture["id"], json[:id]
|
|
267
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
268
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
def test_connection_saml_certificate_renewed_data_round_trip
|
|
272
|
+
fixture = {
|
|
273
|
+
"connection" => {},
|
|
274
|
+
"certificate" => {},
|
|
275
|
+
"renewed_at" => "stub"
|
|
276
|
+
}
|
|
277
|
+
model = WorkOS::ConnectionSAMLCertificateRenewedData.new(fixture.to_json)
|
|
278
|
+
json = model.to_h
|
|
279
|
+
assert_kind_of Hash, json
|
|
280
|
+
assert_equal fixture["renewed_at"], json[:renewed_at]
|
|
281
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def test_connection_saml_certificate_renewed_data_connection_round_trip
|
|
285
|
+
fixture = {
|
|
286
|
+
"id" => "stub",
|
|
287
|
+
"organization_id" => "stub"
|
|
288
|
+
}
|
|
289
|
+
model = WorkOS::ConnectionSAMLCertificateRenewedDataConnection.new(fixture.to_json)
|
|
290
|
+
json = model.to_h
|
|
291
|
+
assert_kind_of Hash, json
|
|
292
|
+
assert_equal fixture["id"], json[:id]
|
|
293
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def test_connection_saml_certificate_renewed_data_certificate_round_trip
|
|
297
|
+
fixture = {
|
|
298
|
+
"certificate_type" => "stub",
|
|
299
|
+
"expiry_date" => "stub"
|
|
300
|
+
}
|
|
301
|
+
model = WorkOS::ConnectionSAMLCertificateRenewedDataCertificate.new(fixture.to_json)
|
|
302
|
+
json = model.to_h
|
|
303
|
+
assert_kind_of Hash, json
|
|
304
|
+
assert_equal fixture["expiry_date"], json[:expiry_date]
|
|
305
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
def test_sso_authorize_url_response_round_trip
|
|
309
|
+
fixture = {
|
|
310
|
+
"url" => "stub"
|
|
311
|
+
}
|
|
312
|
+
model = WorkOS::SSOAuthorizeUrlResponse.new(fixture.to_json)
|
|
313
|
+
json = model.to_h
|
|
314
|
+
assert_kind_of Hash, json
|
|
315
|
+
assert_equal fixture["url"], json[:url]
|
|
316
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
def test_profile_round_trip
|
|
320
|
+
fixture = {
|
|
321
|
+
"object" => "profile",
|
|
322
|
+
"id" => "stub",
|
|
323
|
+
"organization_id" => nil,
|
|
324
|
+
"connection_id" => "stub",
|
|
325
|
+
"connection_type" => "stub",
|
|
326
|
+
"idp_id" => "stub",
|
|
327
|
+
"email" => "stub",
|
|
328
|
+
"first_name" => nil,
|
|
329
|
+
"last_name" => nil,
|
|
330
|
+
"name" => nil,
|
|
331
|
+
"role" => nil,
|
|
332
|
+
"roles" => nil,
|
|
333
|
+
"groups" => [],
|
|
334
|
+
"custom_attributes" => {},
|
|
335
|
+
"raw_attributes" => {}
|
|
336
|
+
}
|
|
337
|
+
model = WorkOS::Profile.new(fixture.to_json)
|
|
338
|
+
json = model.to_h
|
|
339
|
+
assert_kind_of Hash, json
|
|
340
|
+
assert_equal fixture["id"], json[:id]
|
|
341
|
+
assert_nil json[:organization_id]
|
|
342
|
+
assert_equal fixture["connection_id"], json[:connection_id]
|
|
343
|
+
assert_equal fixture["idp_id"], json[:idp_id]
|
|
344
|
+
assert_equal fixture["email"], json[:email]
|
|
345
|
+
assert_nil json[:first_name]
|
|
346
|
+
assert_nil json[:last_name]
|
|
347
|
+
assert_nil json[:name]
|
|
348
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
def test_sso_token_response_round_trip
|
|
352
|
+
fixture = {
|
|
353
|
+
"token_type" => "Bearer",
|
|
354
|
+
"access_token" => "stub",
|
|
355
|
+
"expires_in" => 1,
|
|
356
|
+
"profile" => {},
|
|
357
|
+
"oauth_tokens" => {}
|
|
358
|
+
}
|
|
359
|
+
model = WorkOS::SSOTokenResponse.new(fixture.to_json)
|
|
360
|
+
json = model.to_h
|
|
361
|
+
assert_kind_of Hash, json
|
|
362
|
+
assert_equal fixture["access_token"], json[:access_token]
|
|
363
|
+
assert_equal fixture["expires_in"], json[:expires_in]
|
|
364
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
def test_sso_logout_authorize_response_round_trip
|
|
368
|
+
fixture = {
|
|
369
|
+
"logout_url" => "stub",
|
|
370
|
+
"logout_token" => "stub"
|
|
371
|
+
}
|
|
372
|
+
model = WorkOS::SSOLogoutAuthorizeResponse.new(fixture.to_json)
|
|
373
|
+
json = model.to_h
|
|
374
|
+
assert_kind_of Hash, json
|
|
375
|
+
assert_equal fixture["logout_url"], json[:logout_url]
|
|
376
|
+
assert_equal fixture["logout_token"], json[:logout_token]
|
|
377
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
def test_sso_token_response_oauth_token_round_trip
|
|
381
|
+
fixture = {
|
|
382
|
+
"provider" => "stub",
|
|
383
|
+
"refresh_token" => "stub",
|
|
384
|
+
"access_token" => "stub",
|
|
385
|
+
"expires_at" => 1,
|
|
386
|
+
"scopes" => []
|
|
387
|
+
}
|
|
388
|
+
model = WorkOS::SSOTokenResponseOAuthToken.new(fixture.to_json)
|
|
389
|
+
json = model.to_h
|
|
390
|
+
assert_kind_of Hash, json
|
|
391
|
+
assert_equal fixture["provider"], json[:provider]
|
|
392
|
+
assert_equal fixture["refresh_token"], json[:refresh_token]
|
|
393
|
+
assert_equal fixture["access_token"], json[:access_token]
|
|
394
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
395
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
def test_connection_domain_round_trip
|
|
399
|
+
fixture = {
|
|
400
|
+
"id" => "stub",
|
|
401
|
+
"object" => "connection_domain",
|
|
402
|
+
"domain" => "stub"
|
|
403
|
+
}
|
|
404
|
+
model = WorkOS::ConnectionDomain.new(fixture.to_json)
|
|
405
|
+
json = model.to_h
|
|
406
|
+
assert_kind_of Hash, json
|
|
407
|
+
assert_equal fixture["id"], json[:id]
|
|
408
|
+
assert_equal fixture["domain"], json[:domain]
|
|
409
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
def test_sso_logout_authorize_request_round_trip
|
|
413
|
+
fixture = {
|
|
414
|
+
"profile_id" => "stub"
|
|
415
|
+
}
|
|
416
|
+
model = WorkOS::SSOLogoutAuthorizeRequest.new(fixture.to_json)
|
|
417
|
+
json = model.to_h
|
|
418
|
+
assert_kind_of Hash, json
|
|
419
|
+
assert_equal fixture["profile_id"], json[:profile_id]
|
|
420
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
421
|
+
end
|
|
422
|
+
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)
|
|
@@ -159,6 +189,13 @@ class UserManagementTest < Minitest::Test
|
|
|
159
189
|
refute_nil result
|
|
160
190
|
end
|
|
161
191
|
|
|
192
|
+
def test_get_radar_challenge_returns_expected_result
|
|
193
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/radar_challenges/stub(\?|\z)})
|
|
194
|
+
.to_return(body: "{}", status: 200)
|
|
195
|
+
result = @client.user_management.get_radar_challenge(id: "stub")
|
|
196
|
+
refute_nil result
|
|
197
|
+
end
|
|
198
|
+
|
|
162
199
|
def test_revoke_session_returns_expected_result
|
|
163
200
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/sessions/revoke(\?|\z)})
|
|
164
201
|
.to_return(body: "{}", status: 200)
|
|
@@ -401,6 +438,13 @@ class UserManagementTest < Minitest::Test
|
|
|
401
438
|
refute_nil result
|
|
402
439
|
end
|
|
403
440
|
|
|
441
|
+
def test_delete_redirect_uris_returns_expected_result
|
|
442
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/user_management/redirect_uris/stub(\?|\z)})
|
|
443
|
+
.to_return(body: "{}", status: 200)
|
|
444
|
+
result = @client.user_management.delete_redirect_uris(id: "stub")
|
|
445
|
+
assert_nil result
|
|
446
|
+
end
|
|
447
|
+
|
|
404
448
|
def test_list_user_authorized_applications_returns_expected_result
|
|
405
449
|
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications(\?|\z)})
|
|
406
450
|
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
@@ -435,6 +479,7 @@ class UserManagementTest < Minitest::Test
|
|
|
435
479
|
{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"}},
|
|
436
480
|
{name: :create_device, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/authorize/device(\?|\z)}, args: {client_id: "stub"}},
|
|
437
481
|
{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"}},
|
|
482
|
+
{name: :get_radar_challenge, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/radar_challenges/stub(\?|\z)}, args: {id: "stub"}},
|
|
438
483
|
{name: :revoke_session, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/sessions/revoke(\?|\z)}, args: {session_id: "stub"}},
|
|
439
484
|
{name: :list_cors_origins, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/cors_origins(\?|\z)}},
|
|
440
485
|
{name: :create_cors_origin, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/cors_origins(\?|\z)}, args: {origin: "stub"}},
|
|
@@ -467,6 +512,7 @@ class UserManagementTest < Minitest::Test
|
|
|
467
512
|
{name: :get_magic_auth, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/magic_auth/stub(\?|\z)}, args: {id: "stub"}},
|
|
468
513
|
{name: :list_redirect_uris, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/redirect_uris(\?|\z)}},
|
|
469
514
|
{name: :create_redirect_uri, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/redirect_uris(\?|\z)}, args: {uri: "stub"}},
|
|
515
|
+
{name: :delete_redirect_uris, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/redirect_uris/stub(\?|\z)}, args: {id: "stub"}},
|
|
470
516
|
{name: :list_user_authorized_applications, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications(\?|\z)}, args: {user_id: "stub"}},
|
|
471
517
|
{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"}},
|
|
472
518
|
{name: :list_user_api_keys, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}, args: {user_id: "stub"}},
|