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,307 @@
|
|
|
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 ApiKeysModelRoundTripTest < Minitest::Test
|
|
8
|
+
def test_validate_api_key_round_trip
|
|
9
|
+
fixture = {
|
|
10
|
+
"value" => "stub"
|
|
11
|
+
}
|
|
12
|
+
model = WorkOS::ValidateApiKey.new(fixture.to_json)
|
|
13
|
+
json = model.to_h
|
|
14
|
+
assert_kind_of Hash, json
|
|
15
|
+
assert_equal fixture["value"], json[:value]
|
|
16
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_expire_api_key_round_trip
|
|
20
|
+
fixture = {
|
|
21
|
+
"expires_at" => nil
|
|
22
|
+
}
|
|
23
|
+
model = WorkOS::ExpireApiKey.new(fixture.to_json)
|
|
24
|
+
json = model.to_h
|
|
25
|
+
assert_kind_of Hash, json
|
|
26
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_create_organization_api_key_round_trip
|
|
30
|
+
fixture = {
|
|
31
|
+
"name" => "stub",
|
|
32
|
+
"permissions" => [],
|
|
33
|
+
"expires_at" => "stub"
|
|
34
|
+
}
|
|
35
|
+
model = WorkOS::CreateOrganizationApiKey.new(fixture.to_json)
|
|
36
|
+
json = model.to_h
|
|
37
|
+
assert_kind_of Hash, json
|
|
38
|
+
assert_equal fixture["name"], json[:name]
|
|
39
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_api_key_round_trip
|
|
43
|
+
fixture = {
|
|
44
|
+
"object" => "api_key",
|
|
45
|
+
"id" => "stub",
|
|
46
|
+
"owner" => {},
|
|
47
|
+
"name" => "stub",
|
|
48
|
+
"obfuscated_value" => "stub",
|
|
49
|
+
"last_used_at" => nil,
|
|
50
|
+
"expires_at" => nil,
|
|
51
|
+
"permissions" => [],
|
|
52
|
+
"created_at" => "stub",
|
|
53
|
+
"updated_at" => "stub"
|
|
54
|
+
}
|
|
55
|
+
model = WorkOS::ApiKey.new(fixture.to_json)
|
|
56
|
+
json = model.to_h
|
|
57
|
+
assert_kind_of Hash, json
|
|
58
|
+
assert_equal fixture["id"], json[:id]
|
|
59
|
+
assert_equal fixture["name"], json[:name]
|
|
60
|
+
assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
|
|
61
|
+
assert_nil json[:last_used_at]
|
|
62
|
+
assert_nil json[:expires_at]
|
|
63
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
64
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
65
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def test_api_key_validation_response_round_trip
|
|
69
|
+
fixture = {
|
|
70
|
+
"api_key" => nil,
|
|
71
|
+
"agent_registration_id" => "stub"
|
|
72
|
+
}
|
|
73
|
+
model = WorkOS::ApiKeyValidationResponse.new(fixture.to_json)
|
|
74
|
+
json = model.to_h
|
|
75
|
+
assert_kind_of Hash, json
|
|
76
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def test_api_key_created_round_trip
|
|
80
|
+
fixture = {
|
|
81
|
+
"object" => "event",
|
|
82
|
+
"id" => "stub",
|
|
83
|
+
"event" => "api_key.created",
|
|
84
|
+
"data" => {},
|
|
85
|
+
"created_at" => "stub",
|
|
86
|
+
"context" => {}
|
|
87
|
+
}
|
|
88
|
+
model = WorkOS::ApiKeyCreated.new(fixture.to_json)
|
|
89
|
+
json = model.to_h
|
|
90
|
+
assert_kind_of Hash, json
|
|
91
|
+
assert_equal fixture["id"], json[:id]
|
|
92
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
93
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def test_api_key_created_data_round_trip
|
|
97
|
+
fixture = {
|
|
98
|
+
"object" => "api_key",
|
|
99
|
+
"id" => "stub",
|
|
100
|
+
"owner" => {},
|
|
101
|
+
"name" => "stub",
|
|
102
|
+
"obfuscated_value" => "stub",
|
|
103
|
+
"last_used_at" => nil,
|
|
104
|
+
"expires_at" => nil,
|
|
105
|
+
"permissions" => [],
|
|
106
|
+
"created_at" => "stub",
|
|
107
|
+
"updated_at" => "stub"
|
|
108
|
+
}
|
|
109
|
+
model = WorkOS::ApiKeyCreatedData.new(fixture.to_json)
|
|
110
|
+
json = model.to_h
|
|
111
|
+
assert_kind_of Hash, json
|
|
112
|
+
assert_equal fixture["id"], json[:id]
|
|
113
|
+
assert_equal fixture["name"], json[:name]
|
|
114
|
+
assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
|
|
115
|
+
assert_nil json[:last_used_at]
|
|
116
|
+
assert_nil json[:expires_at]
|
|
117
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
118
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
119
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def test_api_key_created_data_owner_round_trip
|
|
123
|
+
fixture = {
|
|
124
|
+
"type" => "organization",
|
|
125
|
+
"id" => "stub"
|
|
126
|
+
}
|
|
127
|
+
model = WorkOS::ApiKeyCreatedDataOwner.new(fixture.to_json)
|
|
128
|
+
json = model.to_h
|
|
129
|
+
assert_kind_of Hash, json
|
|
130
|
+
assert_equal fixture["id"], json[:id]
|
|
131
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def test_api_key_revoked_round_trip
|
|
135
|
+
fixture = {
|
|
136
|
+
"object" => "event",
|
|
137
|
+
"id" => "stub",
|
|
138
|
+
"event" => "api_key.revoked",
|
|
139
|
+
"data" => {},
|
|
140
|
+
"created_at" => "stub",
|
|
141
|
+
"context" => {}
|
|
142
|
+
}
|
|
143
|
+
model = WorkOS::ApiKeyRevoked.new(fixture.to_json)
|
|
144
|
+
json = model.to_h
|
|
145
|
+
assert_kind_of Hash, json
|
|
146
|
+
assert_equal fixture["id"], json[:id]
|
|
147
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
148
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def test_api_key_revoked_data_round_trip
|
|
152
|
+
fixture = {
|
|
153
|
+
"object" => "api_key",
|
|
154
|
+
"id" => "stub",
|
|
155
|
+
"owner" => {},
|
|
156
|
+
"name" => "stub",
|
|
157
|
+
"obfuscated_value" => "stub",
|
|
158
|
+
"last_used_at" => nil,
|
|
159
|
+
"expires_at" => nil,
|
|
160
|
+
"permissions" => [],
|
|
161
|
+
"created_at" => "stub",
|
|
162
|
+
"updated_at" => "stub"
|
|
163
|
+
}
|
|
164
|
+
model = WorkOS::ApiKeyRevokedData.new(fixture.to_json)
|
|
165
|
+
json = model.to_h
|
|
166
|
+
assert_kind_of Hash, json
|
|
167
|
+
assert_equal fixture["id"], json[:id]
|
|
168
|
+
assert_equal fixture["name"], json[:name]
|
|
169
|
+
assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
|
|
170
|
+
assert_nil json[:last_used_at]
|
|
171
|
+
assert_nil json[:expires_at]
|
|
172
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
173
|
+
assert_equal fixture["updated_at"], json[:updated_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_api_key_revoked_data_owner_round_trip
|
|
178
|
+
fixture = {
|
|
179
|
+
"type" => "organization",
|
|
180
|
+
"id" => "stub"
|
|
181
|
+
}
|
|
182
|
+
model = WorkOS::ApiKeyRevokedDataOwner.new(fixture.to_json)
|
|
183
|
+
json = model.to_h
|
|
184
|
+
assert_kind_of Hash, json
|
|
185
|
+
assert_equal fixture["id"], json[:id]
|
|
186
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def test_api_key_updated_round_trip
|
|
190
|
+
fixture = {
|
|
191
|
+
"object" => "event",
|
|
192
|
+
"id" => "stub",
|
|
193
|
+
"event" => "api_key.updated",
|
|
194
|
+
"data" => {},
|
|
195
|
+
"created_at" => "stub",
|
|
196
|
+
"context" => {}
|
|
197
|
+
}
|
|
198
|
+
model = WorkOS::ApiKeyUpdated.new(fixture.to_json)
|
|
199
|
+
json = model.to_h
|
|
200
|
+
assert_kind_of Hash, json
|
|
201
|
+
assert_equal fixture["id"], json[:id]
|
|
202
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
203
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
def test_api_key_updated_data_round_trip
|
|
207
|
+
fixture = {
|
|
208
|
+
"object" => "api_key",
|
|
209
|
+
"id" => "stub",
|
|
210
|
+
"owner" => {},
|
|
211
|
+
"name" => "stub",
|
|
212
|
+
"obfuscated_value" => "stub",
|
|
213
|
+
"last_used_at" => nil,
|
|
214
|
+
"expires_at" => nil,
|
|
215
|
+
"permissions" => [],
|
|
216
|
+
"created_at" => "stub",
|
|
217
|
+
"updated_at" => "stub",
|
|
218
|
+
"previous_attributes" => {}
|
|
219
|
+
}
|
|
220
|
+
model = WorkOS::ApiKeyUpdatedData.new(fixture.to_json)
|
|
221
|
+
json = model.to_h
|
|
222
|
+
assert_kind_of Hash, json
|
|
223
|
+
assert_equal fixture["id"], json[:id]
|
|
224
|
+
assert_equal fixture["name"], json[:name]
|
|
225
|
+
assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
|
|
226
|
+
assert_nil json[:last_used_at]
|
|
227
|
+
assert_nil json[:expires_at]
|
|
228
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
229
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
230
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
def test_api_key_updated_data_owner_round_trip
|
|
234
|
+
fixture = {
|
|
235
|
+
"type" => "organization",
|
|
236
|
+
"id" => "stub"
|
|
237
|
+
}
|
|
238
|
+
model = WorkOS::ApiKeyUpdatedDataOwner.new(fixture.to_json)
|
|
239
|
+
json = model.to_h
|
|
240
|
+
assert_kind_of Hash, json
|
|
241
|
+
assert_equal fixture["id"], json[:id]
|
|
242
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def test_api_key_updated_data_previous_attribute_round_trip
|
|
246
|
+
fixture = {
|
|
247
|
+
"expires_at" => nil
|
|
248
|
+
}
|
|
249
|
+
model = WorkOS::ApiKeyUpdatedDataPreviousAttribute.new(fixture.to_json)
|
|
250
|
+
json = model.to_h
|
|
251
|
+
assert_kind_of Hash, json
|
|
252
|
+
assert_nil json[:expires_at]
|
|
253
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
def test_organization_api_key_with_value_round_trip
|
|
257
|
+
fixture = {
|
|
258
|
+
"object" => "api_key",
|
|
259
|
+
"id" => "stub",
|
|
260
|
+
"owner" => {},
|
|
261
|
+
"name" => "stub",
|
|
262
|
+
"obfuscated_value" => "stub",
|
|
263
|
+
"last_used_at" => nil,
|
|
264
|
+
"expires_at" => nil,
|
|
265
|
+
"permissions" => [],
|
|
266
|
+
"created_at" => "stub",
|
|
267
|
+
"updated_at" => "stub",
|
|
268
|
+
"value" => "stub"
|
|
269
|
+
}
|
|
270
|
+
model = WorkOS::OrganizationApiKeyWithValue.new(fixture.to_json)
|
|
271
|
+
json = model.to_h
|
|
272
|
+
assert_kind_of Hash, json
|
|
273
|
+
assert_equal fixture["id"], json[:id]
|
|
274
|
+
assert_equal fixture["name"], json[:name]
|
|
275
|
+
assert_equal fixture["obfuscated_value"], json[:obfuscated_value]
|
|
276
|
+
assert_nil json[:last_used_at]
|
|
277
|
+
assert_nil json[:expires_at]
|
|
278
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
279
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
280
|
+
assert_equal fixture["value"], json[:value]
|
|
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_organization_api_key_with_value_owner_round_trip
|
|
285
|
+
fixture = {
|
|
286
|
+
"type" => "organization",
|
|
287
|
+
"id" => "stub"
|
|
288
|
+
}
|
|
289
|
+
model = WorkOS::OrganizationApiKeyWithValueOwner.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_api_key_owner_round_trip
|
|
297
|
+
fixture = {
|
|
298
|
+
"type" => "organization",
|
|
299
|
+
"id" => "stub"
|
|
300
|
+
}
|
|
301
|
+
model = WorkOS::ApiKeyOwner.new(fixture.to_json)
|
|
302
|
+
json = model.to_h
|
|
303
|
+
assert_kind_of Hash, json
|
|
304
|
+
assert_equal fixture["id"], json[:id]
|
|
305
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
306
|
+
end
|
|
307
|
+
end
|
|
@@ -386,6 +386,243 @@ class AuthorizationModelRoundTripTest < Minitest::Test
|
|
|
386
386
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
387
387
|
end
|
|
388
388
|
|
|
389
|
+
def test_permission_created_round_trip
|
|
390
|
+
fixture = {
|
|
391
|
+
"object" => "event",
|
|
392
|
+
"id" => "stub",
|
|
393
|
+
"event" => "permission.created",
|
|
394
|
+
"data" => {},
|
|
395
|
+
"created_at" => "stub",
|
|
396
|
+
"context" => {}
|
|
397
|
+
}
|
|
398
|
+
model = WorkOS::PermissionCreated.new(fixture.to_json)
|
|
399
|
+
json = model.to_h
|
|
400
|
+
assert_kind_of Hash, json
|
|
401
|
+
assert_equal fixture["id"], json[:id]
|
|
402
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
403
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
def test_permission_created_data_round_trip
|
|
407
|
+
fixture = {
|
|
408
|
+
"object" => "permission",
|
|
409
|
+
"id" => "stub",
|
|
410
|
+
"slug" => "stub",
|
|
411
|
+
"name" => "stub",
|
|
412
|
+
"description" => nil,
|
|
413
|
+
"system" => true,
|
|
414
|
+
"resource_type_slug" => "stub",
|
|
415
|
+
"created_at" => "stub",
|
|
416
|
+
"updated_at" => "stub"
|
|
417
|
+
}
|
|
418
|
+
model = WorkOS::PermissionCreatedData.new(fixture.to_json)
|
|
419
|
+
json = model.to_h
|
|
420
|
+
assert_kind_of Hash, json
|
|
421
|
+
assert_equal fixture["id"], json[:id]
|
|
422
|
+
assert_equal fixture["slug"], json[:slug]
|
|
423
|
+
assert_equal fixture["name"], json[:name]
|
|
424
|
+
assert_nil json[:description]
|
|
425
|
+
assert_equal fixture["system"], json[:system]
|
|
426
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
427
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
428
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
429
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
def test_permission_deleted_round_trip
|
|
433
|
+
fixture = {
|
|
434
|
+
"object" => "event",
|
|
435
|
+
"id" => "stub",
|
|
436
|
+
"event" => "permission.deleted",
|
|
437
|
+
"data" => {},
|
|
438
|
+
"created_at" => "stub",
|
|
439
|
+
"context" => {}
|
|
440
|
+
}
|
|
441
|
+
model = WorkOS::PermissionDeleted.new(fixture.to_json)
|
|
442
|
+
json = model.to_h
|
|
443
|
+
assert_kind_of Hash, json
|
|
444
|
+
assert_equal fixture["id"], json[:id]
|
|
445
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
446
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
447
|
+
end
|
|
448
|
+
|
|
449
|
+
def test_permission_deleted_data_round_trip
|
|
450
|
+
fixture = {
|
|
451
|
+
"object" => "permission",
|
|
452
|
+
"id" => "stub",
|
|
453
|
+
"slug" => "stub",
|
|
454
|
+
"name" => "stub",
|
|
455
|
+
"description" => nil,
|
|
456
|
+
"system" => true,
|
|
457
|
+
"resource_type_slug" => "stub",
|
|
458
|
+
"created_at" => "stub",
|
|
459
|
+
"updated_at" => "stub"
|
|
460
|
+
}
|
|
461
|
+
model = WorkOS::PermissionDeletedData.new(fixture.to_json)
|
|
462
|
+
json = model.to_h
|
|
463
|
+
assert_kind_of Hash, json
|
|
464
|
+
assert_equal fixture["id"], json[:id]
|
|
465
|
+
assert_equal fixture["slug"], json[:slug]
|
|
466
|
+
assert_equal fixture["name"], json[:name]
|
|
467
|
+
assert_nil json[:description]
|
|
468
|
+
assert_equal fixture["system"], json[:system]
|
|
469
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
470
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
471
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
472
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
def test_permission_updated_round_trip
|
|
476
|
+
fixture = {
|
|
477
|
+
"object" => "event",
|
|
478
|
+
"id" => "stub",
|
|
479
|
+
"event" => "permission.updated",
|
|
480
|
+
"data" => {},
|
|
481
|
+
"created_at" => "stub",
|
|
482
|
+
"context" => {}
|
|
483
|
+
}
|
|
484
|
+
model = WorkOS::PermissionUpdated.new(fixture.to_json)
|
|
485
|
+
json = model.to_h
|
|
486
|
+
assert_kind_of Hash, json
|
|
487
|
+
assert_equal fixture["id"], json[:id]
|
|
488
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
489
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
def test_permission_updated_data_round_trip
|
|
493
|
+
fixture = {
|
|
494
|
+
"object" => "permission",
|
|
495
|
+
"id" => "stub",
|
|
496
|
+
"slug" => "stub",
|
|
497
|
+
"name" => "stub",
|
|
498
|
+
"description" => nil,
|
|
499
|
+
"system" => true,
|
|
500
|
+
"resource_type_slug" => "stub",
|
|
501
|
+
"created_at" => "stub",
|
|
502
|
+
"updated_at" => "stub"
|
|
503
|
+
}
|
|
504
|
+
model = WorkOS::PermissionUpdatedData.new(fixture.to_json)
|
|
505
|
+
json = model.to_h
|
|
506
|
+
assert_kind_of Hash, json
|
|
507
|
+
assert_equal fixture["id"], json[:id]
|
|
508
|
+
assert_equal fixture["slug"], json[:slug]
|
|
509
|
+
assert_equal fixture["name"], json[:name]
|
|
510
|
+
assert_nil json[:description]
|
|
511
|
+
assert_equal fixture["system"], json[:system]
|
|
512
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
513
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
514
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
515
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
def test_role_created_round_trip
|
|
519
|
+
fixture = {
|
|
520
|
+
"object" => "event",
|
|
521
|
+
"id" => "stub",
|
|
522
|
+
"event" => "role.created",
|
|
523
|
+
"data" => {},
|
|
524
|
+
"created_at" => "stub",
|
|
525
|
+
"context" => {}
|
|
526
|
+
}
|
|
527
|
+
model = WorkOS::RoleCreated.new(fixture.to_json)
|
|
528
|
+
json = model.to_h
|
|
529
|
+
assert_kind_of Hash, json
|
|
530
|
+
assert_equal fixture["id"], json[:id]
|
|
531
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
532
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
def test_role_created_data_round_trip
|
|
536
|
+
fixture = {
|
|
537
|
+
"object" => "role",
|
|
538
|
+
"slug" => "stub",
|
|
539
|
+
"resource_type_slug" => "stub",
|
|
540
|
+
"permissions" => [],
|
|
541
|
+
"created_at" => "stub",
|
|
542
|
+
"updated_at" => "stub"
|
|
543
|
+
}
|
|
544
|
+
model = WorkOS::RoleCreatedData.new(fixture.to_json)
|
|
545
|
+
json = model.to_h
|
|
546
|
+
assert_kind_of Hash, json
|
|
547
|
+
assert_equal fixture["slug"], json[:slug]
|
|
548
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
549
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
550
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
551
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
552
|
+
end
|
|
553
|
+
|
|
554
|
+
def test_role_deleted_round_trip
|
|
555
|
+
fixture = {
|
|
556
|
+
"object" => "event",
|
|
557
|
+
"id" => "stub",
|
|
558
|
+
"event" => "role.deleted",
|
|
559
|
+
"data" => {},
|
|
560
|
+
"created_at" => "stub",
|
|
561
|
+
"context" => {}
|
|
562
|
+
}
|
|
563
|
+
model = WorkOS::RoleDeleted.new(fixture.to_json)
|
|
564
|
+
json = model.to_h
|
|
565
|
+
assert_kind_of Hash, json
|
|
566
|
+
assert_equal fixture["id"], json[:id]
|
|
567
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
568
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
569
|
+
end
|
|
570
|
+
|
|
571
|
+
def test_role_deleted_data_round_trip
|
|
572
|
+
fixture = {
|
|
573
|
+
"object" => "role",
|
|
574
|
+
"slug" => "stub",
|
|
575
|
+
"resource_type_slug" => "stub",
|
|
576
|
+
"permissions" => [],
|
|
577
|
+
"created_at" => "stub",
|
|
578
|
+
"updated_at" => "stub"
|
|
579
|
+
}
|
|
580
|
+
model = WorkOS::RoleDeletedData.new(fixture.to_json)
|
|
581
|
+
json = model.to_h
|
|
582
|
+
assert_kind_of Hash, json
|
|
583
|
+
assert_equal fixture["slug"], json[:slug]
|
|
584
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
585
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
586
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
587
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
def test_role_updated_round_trip
|
|
591
|
+
fixture = {
|
|
592
|
+
"object" => "event",
|
|
593
|
+
"id" => "stub",
|
|
594
|
+
"event" => "role.updated",
|
|
595
|
+
"data" => {},
|
|
596
|
+
"created_at" => "stub",
|
|
597
|
+
"context" => {}
|
|
598
|
+
}
|
|
599
|
+
model = WorkOS::RoleUpdated.new(fixture.to_json)
|
|
600
|
+
json = model.to_h
|
|
601
|
+
assert_kind_of Hash, json
|
|
602
|
+
assert_equal fixture["id"], json[:id]
|
|
603
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
604
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
605
|
+
end
|
|
606
|
+
|
|
607
|
+
def test_role_updated_data_round_trip
|
|
608
|
+
fixture = {
|
|
609
|
+
"object" => "role",
|
|
610
|
+
"slug" => "stub",
|
|
611
|
+
"resource_type_slug" => "stub",
|
|
612
|
+
"permissions" => [],
|
|
613
|
+
"created_at" => "stub",
|
|
614
|
+
"updated_at" => "stub"
|
|
615
|
+
}
|
|
616
|
+
model = WorkOS::RoleUpdatedData.new(fixture.to_json)
|
|
617
|
+
json = model.to_h
|
|
618
|
+
assert_kind_of Hash, json
|
|
619
|
+
assert_equal fixture["slug"], json[:slug]
|
|
620
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
621
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
622
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
623
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
624
|
+
end
|
|
625
|
+
|
|
389
626
|
def test_user_role_assignment_resource_round_trip
|
|
390
627
|
fixture = {
|
|
391
628
|
"id" => "stub",
|
|
@@ -119,6 +119,33 @@ class BaseClientTest < Minitest::Test
|
|
|
119
119
|
assert_equal "idem_123", request["Idempotency-Key"]
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
+
# The body is serialized verbatim (no `.compact`), so an explicit `nil` is
|
|
123
|
+
# sent as JSON `null` — this is what lets generated methods clear a nullable
|
|
124
|
+
# field. Omission is handled upstream in the generated method, not here.
|
|
125
|
+
def test_put_request_serializes_explicit_nil_as_json_null
|
|
126
|
+
request = @client.put_request(path: "/widgets/w_1", auth: true, body: {"external_id" => nil})
|
|
127
|
+
|
|
128
|
+
assert_equal({"external_id" => nil}, JSON.parse(request.body))
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def test_post_request_serializes_explicit_nil_as_json_null
|
|
132
|
+
request = @client.post_request(path: "/widgets", auth: true, body: {"external_id" => nil})
|
|
133
|
+
|
|
134
|
+
assert_equal({"external_id" => nil}, JSON.parse(request.body))
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def test_patch_request_serializes_explicit_nil_as_json_null
|
|
138
|
+
request = @client.patch_request(path: "/widgets/w_1", auth: true, body: {"external_id" => nil})
|
|
139
|
+
|
|
140
|
+
assert_equal({"external_id" => nil}, JSON.parse(request.body))
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def test_delete_request_serializes_explicit_nil_as_json_null
|
|
144
|
+
request = @client.delete_request(path: "/widgets/w_1", auth: true, body: {"external_id" => nil})
|
|
145
|
+
|
|
146
|
+
assert_equal({"external_id" => nil}, JSON.parse(request.body))
|
|
147
|
+
end
|
|
148
|
+
|
|
122
149
|
def test_retry_path_generates_idempotency_key_for_mutating_requests
|
|
123
150
|
stub_request(:post, "https://api.workos.com/widgets")
|
|
124
151
|
.to_return({status: 500, body: '{"message":"retry"}'}, {status: 200, body: "{}"})
|
|
@@ -0,0 +1,31 @@
|
|
|
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 ClientApiModelRoundTripTest < Minitest::Test
|
|
8
|
+
def test_client_api_token_round_trip
|
|
9
|
+
fixture = {
|
|
10
|
+
"organization_id" => "stub",
|
|
11
|
+
"user_id" => "stub"
|
|
12
|
+
}
|
|
13
|
+
model = WorkOS::ClientApiToken.new(fixture.to_json)
|
|
14
|
+
json = model.to_h
|
|
15
|
+
assert_kind_of Hash, json
|
|
16
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
17
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
18
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_client_api_token_response_round_trip
|
|
22
|
+
fixture = {
|
|
23
|
+
"token" => "stub"
|
|
24
|
+
}
|
|
25
|
+
model = WorkOS::ClientApiTokenResponse.new(fixture.to_json)
|
|
26
|
+
json = model.to_h
|
|
27
|
+
assert_kind_of Hash, json
|
|
28
|
+
assert_equal fixture["token"], json[:token]
|
|
29
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
30
|
+
end
|
|
31
|
+
end
|