workos 7.1.2 → 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/.github/workflows/ci.yml +2 -2
- data/.github/workflows/docs.yml +49 -0
- data/.github/workflows/lint.yml +2 -2
- data/.github/workflows/release-please.yml +164 -10
- data/.github/workflows/release.yml +2 -2
- data/.gitignore +2 -0
- data/.last-synced-sha +1 -1
- data/.oagen-manifest.json +403 -84
- data/.release-please-manifest.json +1 -1
- data/.ruby-version +1 -1
- data/.yardopts +6 -0
- data/CHANGELOG.md +331 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +35 -4
- data/README.md +19 -0
- data/docs/V7_MIGRATION_GUIDE.md +21 -0
- data/lib/workos/actions.rb +1 -1
- data/lib/workos/admin_portal/generate_link.rb +0 -3
- data/lib/workos/admin_portal.rb +0 -3
- data/lib/workos/api_keys/api_key.rb +4 -1
- data/lib/workos/api_keys/api_key_created.rb +5 -5
- data/lib/workos/api_keys/api_key_created_data.rb +4 -1
- data/lib/workos/api_keys/api_key_revoked.rb +5 -5
- data/lib/workos/{audit_logs/audit_log_export_json.rb → api_keys/api_key_updated.rb} +10 -10
- data/lib/workos/api_keys/api_key_updated_data.rb +49 -0
- data/lib/workos/{directory_sync/dsync_deactivated_data_domain.rb → api_keys/api_key_updated_data_owner.rb} +1 -1
- data/lib/workos/api_keys/api_key_updated_data_previous_attribute.rb +18 -0
- data/lib/workos/api_keys/create_organization_api_key.rb +5 -2
- data/lib/workos/api_keys/expire_api_key.rb +18 -0
- data/lib/workos/api_keys/organization_api_key.rb +46 -0
- data/lib/workos/{types/events_order.rb → api_keys/organization_api_key_owner.rb} +1 -3
- data/lib/workos/api_keys/organization_api_key_with_value.rb +49 -0
- data/lib/workos/{types/audit_logs_order.rb → api_keys/organization_api_key_with_value_owner.rb} +1 -3
- data/lib/workos/api_keys.rb +75 -47
- data/lib/workos/audit_logs/audit_log_action.rb +2 -7
- data/lib/workos/audit_logs/audit_log_export.rb +2 -7
- data/lib/workos/audit_logs/audit_log_schema.rb +11 -2
- data/lib/workos/audit_logs/audit_log_schema_actor_input.rb +7 -0
- data/lib/workos/audit_logs/audit_log_schema_input.rb +25 -0
- data/lib/workos/audit_logs/audit_log_schema_target.rb +16 -1
- data/lib/workos/audit_logs/audit_log_schema_target_input.rb +7 -0
- data/lib/workos/audit_logs.rb +20 -20
- data/lib/workos/{audit_logs/audit_log_schema_json_actor.rb → authorization/create_group_role_assignment.rb} +1 -1
- data/lib/workos/authorization/delete_group_role_assignments_by_criteria.rb +7 -0
- data/lib/workos/authorization/{role_assignment.rb → group_role_assignment.rb} +5 -2
- data/lib/workos/authorization/group_role_assignment_list.rb +25 -0
- data/lib/workos/authorization/{role_assignment_resource.rb → group_role_assignment_resource.rb} +1 -1
- data/lib/workos/authorization/permission_created.rb +5 -5
- data/lib/workos/authorization/permission_deleted.rb +5 -5
- data/lib/workos/authorization/permission_updated.rb +5 -5
- data/lib/workos/{api_keys/api_key_with_value_owner.rb → authorization/replace_group_role_assignment_entry.rb} +1 -1
- data/lib/workos/authorization/replace_group_role_assignments.rb +18 -0
- data/lib/workos/authorization/role_created.rb +5 -5
- data/lib/workos/authorization/role_deleted.rb +5 -5
- data/lib/workos/authorization/role_updated.rb +5 -5
- data/lib/workos/authorization/user_role_assignment.rb +40 -0
- data/lib/workos/authorization/user_role_assignment_resource.rb +7 -0
- data/lib/workos/{audit_logs/audit_log_schema_json_target.rb → authorization/user_role_assignment_source.rb} +4 -4
- data/lib/workos/authorization.rb +326 -30
- data/lib/workos/base_client.rb +90 -7
- data/lib/workos/client.rb +18 -10
- data/lib/workos/client_api/client_api_token.rb +22 -0
- data/lib/workos/client_api/client_api_token_response.rb +18 -0
- data/lib/workos/client_api.rb +39 -0
- data/lib/workos/connect/connect_application.rb +12 -0
- data/lib/workos/connect/connect_application_redirect_uri.rb +22 -0
- data/lib/workos/connect/user_object.rb +3 -0
- data/lib/workos/connect.rb +2 -2
- data/lib/workos/directory_sync/directory_user.rb +3 -0
- data/lib/workos/directory_sync/directory_user_with_groups.rb +4 -1
- data/lib/workos/directory_sync/dsync_activated.rb +5 -5
- data/lib/workos/directory_sync/dsync_deleted.rb +5 -5
- data/lib/workos/directory_sync/dsync_group_created.rb +5 -5
- data/lib/workos/directory_sync/dsync_group_deleted.rb +5 -5
- data/lib/workos/directory_sync/dsync_group_updated.rb +5 -5
- data/lib/workos/directory_sync/dsync_group_user_added.rb +5 -5
- data/lib/workos/directory_sync/dsync_group_user_removed.rb +5 -5
- data/lib/workos/directory_sync/dsync_token_created.rb +34 -0
- data/lib/workos/directory_sync/dsync_token_created_data.rb +34 -0
- data/lib/workos/directory_sync/dsync_token_revoked.rb +34 -0
- data/lib/workos/directory_sync/dsync_token_revoked_data.rb +7 -0
- data/lib/workos/directory_sync/dsync_user_created.rb +5 -5
- data/lib/workos/directory_sync/dsync_user_deleted.rb +5 -5
- data/lib/workos/directory_sync/dsync_user_updated.rb +5 -5
- data/lib/workos/directory_sync/dsync_user_updated_data.rb +3 -0
- data/lib/workos/directory_sync.rb +6 -6
- data/lib/workos/encryptors/aes_gcm.rb +19 -5
- data/lib/workos/events.rb +2 -2
- data/lib/workos/feature_flags/flag_created.rb +5 -5
- data/lib/workos/feature_flags/flag_deleted.rb +5 -5
- data/lib/workos/feature_flags/flag_rule_updated.rb +5 -5
- data/lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb +1 -16
- data/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rb +1 -1
- data/lib/workos/feature_flags/flag_updated.rb +5 -5
- data/lib/workos/feature_flags.rb +6 -6
- data/lib/workos/{authorization → groups}/user_organization_membership_base_list_data.rb +5 -2
- data/lib/workos/groups.rb +4 -4
- data/lib/workos/inflections.rb +3 -1
- data/lib/workos/multi_factor_auth.rb +2 -2
- data/lib/workos/organization_domains/organization_domain_created.rb +5 -5
- data/lib/workos/organization_domains/organization_domain_deleted.rb +5 -5
- data/lib/workos/organization_domains/organization_domain_updated.rb +5 -5
- data/lib/workos/organization_domains/organization_domain_verification_failed.rb +5 -5
- data/lib/workos/organization_domains/organization_domain_verified.rb +5 -5
- data/lib/workos/{user_management → organization_membership}/organization_membership.rb +8 -2
- data/lib/workos/{user_management → organization_membership}/user_organization_membership.rb +8 -2
- data/lib/workos/organization_membership_service.rb +273 -0
- data/lib/workos/organizations/audit_logs_retention.rb +2 -7
- data/lib/workos/organizations/organization_created.rb +5 -5
- data/lib/workos/organizations/organization_deleted.rb +5 -5
- data/lib/workos/organizations/organization_membership_created.rb +5 -5
- data/lib/workos/organizations/organization_membership_deleted.rb +5 -5
- data/lib/workos/organizations/organization_membership_updated.rb +5 -5
- data/lib/workos/organizations/organization_role_created.rb +5 -5
- data/lib/workos/organizations/organization_role_deleted.rb +5 -5
- data/lib/workos/organizations/organization_role_updated.rb +5 -5
- data/lib/workos/organizations/organization_updated.rb +5 -5
- data/lib/workos/organizations.rb +2 -2
- data/lib/workos/pipes/connected_account.rb +6 -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_list_response_data.rb +3 -0
- data/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +6 -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 +309 -5
- data/lib/workos/pipes_provider/configure_data_integration_body.rb +28 -0
- data/lib/workos/pipes_provider/data_integration_configuration_list_response.rb +22 -0
- data/lib/workos/{directory_sync/dsync_deactivated_data.rb → pipes_provider/data_integration_configuration_response.rb} +13 -13
- data/lib/workos/pipes_provider/data_integration_credentials.rb +31 -0
- data/lib/workos/pipes_provider.rb +68 -0
- data/lib/workos/radar/radar_standalone_assess_request.rb +3 -6
- data/lib/workos/radar.rb +7 -10
- data/lib/workos/session.rb +28 -7
- data/lib/workos/session_manager.rb +24 -1
- data/lib/workos/shared/auth_method_mismatch_error.rb +22 -0
- data/lib/workos/shared/connect_application_m2m.rb +46 -0
- data/lib/workos/shared/connect_application_oauth.rb +58 -0
- data/lib/workos/shared/connect_application_oauth_redirect_uris.rb +22 -0
- data/lib/workos/shared/error_response.rb +18 -0
- data/lib/workos/shared/group_created.rb +5 -5
- data/lib/workos/shared/group_deleted.rb +5 -5
- data/lib/workos/shared/group_member_added.rb +5 -5
- data/lib/workos/shared/group_member_removed.rb +5 -5
- data/lib/workos/shared/group_updated.rb +5 -5
- data/lib/workos/shared/pipe_connected_account.rb +46 -0
- data/lib/workos/{directory_sync/dsync_deactivated.rb → shared/pipes_connected_account_connected.rb} +7 -7
- data/lib/workos/shared/pipes_connected_account_disconnected.rb +34 -0
- data/lib/workos/shared/pipes_connected_account_reauthorization_needed.rb +34 -0
- data/lib/workos/shared/waitlist_user_approved.rb +5 -5
- data/lib/workos/shared/waitlist_user_created.rb +5 -5
- data/lib/workos/shared/waitlist_user_denied.rb +5 -5
- data/lib/workos/sso/connection_activated.rb +5 -5
- data/lib/workos/sso/connection_deactivated.rb +5 -5
- data/lib/workos/sso/connection_deleted.rb +5 -5
- data/lib/workos/sso/connection_saml_certificate_renewal_required.rb +5 -5
- data/lib/workos/sso/connection_saml_certificate_renewed.rb +5 -5
- data/lib/workos/sso/profile.rb +3 -0
- data/lib/workos/sso.rb +2 -2
- data/lib/workos/types/audit_log_configuration_log_stream_type.rb +2 -1
- data/lib/workos/types/audit_log_export_state.rb +2 -1
- data/lib/workos/types/connected_account_auth_method.rb +13 -0
- data/lib/workos/types/connected_account_state.rb +1 -2
- data/lib/workos/types/create_webhook_endpoint_events.rb +12 -1
- data/lib/workos/types/custom_provider_definition_authenticate_via.rb +13 -0
- data/lib/workos/types/data_integration_access_token_response_error.rb +2 -2
- data/lib/workos/types/data_integration_credential_type.rb +13 -0
- data/lib/workos/types/data_integration_credentials_credentials_type.rb +14 -0
- data/lib/workos/types/{directories_order.rb → data_integration_credentials_response_error.rb} +1 -1
- data/lib/workos/types/{authorization_order.rb → data_integration_credentials_type.rb} +1 -1
- 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/{connections_order.rb → data_integrations_list_response_data_auth_methods.rb} +1 -1
- data/lib/workos/types/data_integrations_list_response_data_connected_account_auth_method.rb +9 -0
- data/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb +6 -1
- data/lib/workos/types/event_context_actor_source.rb +2 -1
- data/lib/workos/types/{applications_order.rb → pagination_order.rb} +1 -1
- data/lib/workos/types/pipe_connected_account_state.rb +13 -0
- data/lib/workos/types/{radar_action.rb → radar_list_action.rb} +1 -1
- data/lib/workos/types/radar_list_type.rb +18 -0
- data/lib/workos/types/radar_standalone_assess_request_action.rb +1 -7
- data/lib/workos/types/radar_standalone_response_blocklist_type.rb +1 -10
- data/lib/workos/types/radar_standalone_response_control.rb +1 -4
- data/lib/workos/types/update_custom_provider_definition_authenticate_via.rb +9 -0
- data/lib/workos/types/user_management_authentication_screen_hint.rb +1 -5
- data/lib/workos/types/user_role_assignment_source_type.rb +13 -0
- data/lib/workos/types/{vault_byok_key_verification_completed_data_key_provider.rb → vault_byok_key_provider.rb} +1 -1
- data/{rbi/workos/types/request_options.rbi → lib/workos/types/vault_order.rb} +4 -3
- data/lib/workos/types/webhook_endpoint_status.rb +1 -5
- data/lib/workos/types/widget_session_token_scopes.rb +2 -1
- data/lib/workos/user_management/action_authentication_denied.rb +6 -6
- data/lib/workos/user_management/action_user_registration_denied.rb +6 -6
- data/lib/workos/user_management/authentication_email_verification_failed.rb +5 -5
- data/lib/workos/user_management/authentication_email_verification_succeeded.rb +5 -5
- data/lib/workos/user_management/authentication_magic_auth_failed.rb +5 -5
- data/lib/workos/user_management/authentication_magic_auth_succeeded.rb +5 -5
- data/lib/workos/user_management/authentication_mfa_failed.rb +5 -5
- data/lib/workos/user_management/authentication_mfa_succeeded.rb +5 -5
- data/lib/workos/user_management/authentication_oauth_failed.rb +5 -5
- data/lib/workos/user_management/authentication_oauth_succeeded.rb +5 -5
- data/lib/workos/user_management/authentication_passkey_failed.rb +5 -5
- data/lib/workos/user_management/authentication_passkey_succeeded.rb +5 -5
- data/lib/workos/user_management/authentication_password_failed.rb +5 -5
- data/lib/workos/user_management/authentication_password_succeeded.rb +5 -5
- data/lib/workos/user_management/authentication_radar_risk_detected.rb +5 -5
- data/lib/workos/user_management/authentication_sso_failed.rb +5 -5
- data/lib/workos/user_management/authentication_sso_started.rb +5 -5
- data/lib/workos/user_management/authentication_sso_succeeded.rb +5 -5
- data/lib/workos/user_management/authentication_sso_timed_out.rb +5 -5
- 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 +12 -0
- data/lib/workos/user_management/create_user_api_key.rb +28 -0
- data/lib/workos/user_management/email_change_confirmation_user.rb +3 -0
- data/lib/workos/user_management/email_verification_created.rb +5 -5
- data/lib/workos/user_management/invitation_accepted.rb +5 -5
- data/lib/workos/user_management/invitation_created.rb +5 -5
- data/lib/workos/user_management/invitation_resent.rb +5 -5
- data/lib/workos/user_management/invitation_revoked.rb +5 -5
- data/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb +5 -2
- data/lib/workos/user_management/magic_auth_created.rb +5 -5
- data/lib/workos/user_management/magic_auth_send_magic_auth_code_and_return_response.rb +43 -0
- data/lib/workos/user_management/password_reset_created.rb +5 -5
- data/lib/workos/user_management/password_reset_succeeded.rb +5 -5
- 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/revoke_session.rb +2 -6
- 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/session_created.rb +5 -5
- data/lib/workos/user_management/session_revoked.rb +5 -5
- data/lib/workos/user_management/update_user.rb +3 -0
- data/lib/workos/user_management/user_api_key.rb +46 -0
- data/lib/workos/user_management/user_api_key_created_data_owner.rb +25 -0
- data/lib/workos/user_management/user_api_key_owner.rb +7 -0
- data/lib/workos/user_management/user_api_key_revoked_data_owner.rb +7 -0
- data/lib/workos/user_management/user_api_key_updated_data_owner.rb +7 -0
- data/lib/workos/{api_keys/api_key_with_value.rb → user_management/user_api_key_with_value.rb} +5 -2
- data/lib/workos/user_management/user_api_key_with_value_owner.rb +7 -0
- data/lib/workos/user_management/user_create_response.rb +61 -0
- data/lib/workos/user_management/user_created.rb +5 -5
- data/lib/workos/user_management/user_deleted.rb +5 -5
- data/lib/workos/user_management/user_updated.rb +5 -5
- data/lib/workos/user_management.rb +351 -202
- data/lib/workos/vault/actor.rb +22 -0
- data/lib/workos/vault/create_data_key_request.rb +18 -0
- data/lib/workos/vault/create_data_key_response.rb +28 -0
- data/lib/workos/vault/create_object_request.rb +25 -0
- data/lib/workos/vault/decrypt_request.rb +18 -0
- data/lib/workos/vault/decrypt_response.rb +22 -0
- data/lib/workos/vault/delete_object_response.rb +22 -0
- data/lib/workos/vault/object_metadata.rb +37 -0
- data/lib/workos/{audit_logs/audit_log_action_json.rb → vault/object_summary.rb} +4 -10
- data/lib/workos/vault/object_version.rb +31 -0
- data/lib/workos/vault/object_without_value.rb +25 -0
- data/lib/workos/vault/rekey_request.rb +22 -0
- data/lib/workos/vault/update_object_request.rb +22 -0
- data/lib/workos/vault/vault_byok_key_deleted.rb +34 -0
- data/lib/workos/vault/vault_byok_key_deleted_data.rb +22 -0
- data/lib/workos/vault/vault_byok_key_verification_completed.rb +5 -5
- data/lib/workos/vault/vault_data_created.rb +5 -5
- data/lib/workos/vault/vault_data_deleted.rb +5 -5
- data/lib/workos/vault/vault_data_read.rb +5 -5
- data/lib/workos/vault/vault_data_updated.rb +5 -5
- data/lib/workos/vault/vault_dek_decrypted.rb +5 -5
- data/lib/workos/vault/vault_dek_read.rb +5 -5
- data/lib/workos/vault/vault_kek_created.rb +5 -5
- data/lib/workos/vault/vault_metadata_read.rb +5 -5
- data/lib/workos/vault/vault_names_listed.rb +5 -5
- data/lib/workos/vault/vault_object.rb +28 -0
- data/lib/workos/vault/version_list_response.rb +22 -0
- data/lib/workos/vault.rb +273 -139
- data/lib/workos/version.rb +1 -1
- data/lib/workos/webhooks/webhook_endpoint.rb +2 -7
- data/lib/workos/webhooks.rb +10 -11
- data/lib/workos/widgets/widget_session_token_response.rb +1 -12
- data/lib/workos.rb +3 -0
- data/rbi/workos/action_authentication_denied.rbi +10 -10
- data/rbi/workos/action_user_registration_denied.rbi +10 -10
- data/rbi/workos/actor.rbi +30 -0
- data/rbi/workos/admin_portal.rbi +1 -2
- data/rbi/workos/api_key.rbi +8 -2
- data/rbi/workos/api_key_created.rbi +6 -6
- data/rbi/workos/api_key_created_data.rbi +8 -2
- data/rbi/workos/api_key_revoked.rbi +6 -6
- data/rbi/workos/api_key_revoked_data.rbi +8 -2
- data/rbi/workos/{dsync_deactivated.rbi → api_key_updated.rbi} +9 -9
- data/rbi/workos/api_key_updated_data.rbi +84 -0
- data/rbi/workos/{api_key_with_value_owner.rbi → api_key_updated_data_owner.rbi} +1 -1
- data/rbi/workos/{audit_logs_retention_json.rbi → api_key_updated_data_previous_attribute.rbi} +5 -5
- data/rbi/workos/api_keys.rbi +27 -17
- data/rbi/workos/audit_log_action.rbi +1 -0
- data/rbi/workos/audit_log_export.rbi +1 -0
- data/rbi/workos/audit_log_schema.rbi +18 -0
- data/rbi/workos/{audit_log_schema_json_actor.rbi → audit_log_schema_actor_input.rbi} +1 -1
- data/rbi/workos/audit_log_schema_input.rbi +36 -0
- data/rbi/workos/{audit_log_schema_json_target.rbi → audit_log_schema_target_input.rbi} +1 -1
- data/rbi/workos/audit_logs.rbi +9 -9
- data/rbi/workos/audit_logs_retention.rbi +1 -0
- data/rbi/workos/auth_method_mismatch_error.rbi +30 -0
- data/rbi/workos/authentication_email_verification_failed.rbi +6 -6
- data/rbi/workos/authentication_email_verification_succeeded.rbi +6 -6
- data/rbi/workos/authentication_magic_auth_failed.rbi +6 -6
- data/rbi/workos/authentication_magic_auth_succeeded.rbi +6 -6
- data/rbi/workos/authentication_mfa_failed.rbi +6 -6
- data/rbi/workos/authentication_mfa_succeeded.rbi +6 -6
- data/rbi/workos/authentication_oauth_failed.rbi +6 -6
- data/rbi/workos/authentication_oauth_succeeded.rbi +6 -6
- data/rbi/workos/authentication_passkey_failed.rbi +6 -6
- data/rbi/workos/authentication_passkey_succeeded.rbi +6 -6
- data/rbi/workos/authentication_password_failed.rbi +6 -6
- data/rbi/workos/authentication_password_succeeded.rbi +6 -6
- data/rbi/workos/authentication_radar_risk_detected.rbi +6 -6
- data/rbi/workos/authentication_sso_failed.rbi +6 -6
- data/rbi/workos/authentication_sso_started.rbi +6 -6
- data/rbi/workos/authentication_sso_succeeded.rbi +6 -6
- data/rbi/workos/authentication_sso_timed_out.rbi +6 -6
- data/rbi/workos/authorization.rbi +97 -4
- data/rbi/workos/authorization_code_session_authenticate_request.rbi +8 -2
- data/rbi/workos/client.rbi +15 -6
- data/rbi/workos/client_api.rbi +22 -0
- data/rbi/workos/client_api_token.rbi +30 -0
- data/rbi/workos/client_api_token_response.rbi +24 -0
- data/rbi/workos/configure_data_integration_body.rbi +42 -0
- data/rbi/workos/connect_application.rbi +0 -12
- data/rbi/workos/{dsync_deactivated_data.rbi → connect_application_m2m.rbi} +19 -19
- data/rbi/workos/connect_application_oauth.rbi +102 -0
- data/rbi/workos/connect_application_oauth_redirect_uris.rbi +30 -0
- data/rbi/workos/connected_account.rbi +12 -0
- data/rbi/workos/connected_account_dto.rbi +48 -0
- data/rbi/workos/connection_activated.rbi +6 -6
- data/rbi/workos/connection_deactivated.rbi +6 -6
- data/rbi/workos/connection_deleted.rbi +6 -6
- data/rbi/workos/connection_saml_certificate_renewal_required.rbi +6 -6
- data/rbi/workos/connection_saml_certificate_renewed.rbi +6 -6
- data/rbi/workos/create_data_integration.rbi +54 -0
- data/rbi/workos/create_data_key_request.rbi +24 -0
- data/rbi/workos/create_data_key_response.rbi +42 -0
- data/rbi/workos/create_group_role_assignment.rbi +42 -0
- data/rbi/workos/create_magic_code_and_return.rbi +24 -0
- data/rbi/workos/create_object_request.rbi +36 -0
- data/rbi/workos/create_organization_api_key.rbi +6 -0
- data/rbi/workos/create_user.rbi +24 -0
- data/rbi/workos/create_user_api_key.rbi +42 -0
- data/rbi/workos/custom_provider_definition.rbi +84 -0
- data/rbi/workos/data_integration.rbi +96 -0
- data/rbi/workos/data_integration_configuration_list_response.rbi +30 -0
- data/rbi/workos/data_integration_configuration_response.rbi +78 -0
- data/rbi/workos/data_integration_credential.rbi +36 -0
- data/rbi/workos/data_integration_credentials.rbi +48 -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_list_response_data.rbi +6 -0
- data/rbi/workos/data_integrations_list_response_data_connected_account.rbi +12 -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/decrypt_request.rbi +24 -0
- data/rbi/workos/decrypt_response.rbi +30 -0
- data/rbi/workos/delete_group_role_assignments_by_criteria.rbi +42 -0
- data/rbi/workos/delete_object_response.rbi +30 -0
- data/rbi/workos/directory_user.rbi +6 -0
- data/rbi/workos/directory_user_with_groups.rbi +6 -0
- data/rbi/workos/dsync_activated.rbi +6 -6
- data/rbi/workos/dsync_deleted.rbi +6 -6
- data/rbi/workos/dsync_group_created.rbi +6 -6
- data/rbi/workos/dsync_group_deleted.rbi +6 -6
- data/rbi/workos/dsync_group_updated.rbi +6 -6
- data/rbi/workos/dsync_group_user_added.rbi +6 -6
- data/rbi/workos/dsync_group_user_removed.rbi +6 -6
- data/rbi/workos/dsync_token_created.rbi +54 -0
- data/rbi/workos/{audit_log_export_json.rbi → dsync_token_created_data.rbi} +9 -9
- data/rbi/workos/dsync_token_revoked.rbi +54 -0
- data/rbi/workos/{audit_log_action_json.rbi → dsync_token_revoked_data.rbi} +17 -11
- data/rbi/workos/dsync_user_created.rbi +6 -6
- data/rbi/workos/dsync_user_deleted.rbi +6 -6
- data/rbi/workos/dsync_user_updated.rbi +6 -6
- data/rbi/workos/dsync_user_updated_data.rbi +6 -0
- data/rbi/workos/email_change_confirmation_user.rbi +6 -0
- data/rbi/workos/email_verification_created.rbi +6 -6
- data/rbi/workos/error_response.rbi +24 -0
- data/rbi/workos/expire_api_key.rbi +24 -0
- data/rbi/workos/flag_created.rbi +6 -6
- data/rbi/workos/flag_deleted.rbi +6 -6
- data/rbi/workos/flag_rule_updated.rbi +6 -6
- data/rbi/workos/flag_updated.rbi +6 -6
- data/rbi/workos/generate_link.rbi +0 -6
- data/rbi/workos/group_created.rbi +6 -6
- data/rbi/workos/group_deleted.rbi +6 -6
- data/rbi/workos/group_member_added.rbi +6 -6
- data/rbi/workos/group_member_removed.rbi +6 -6
- data/rbi/workos/{role_assignment.rbi → group_role_assignment.rbi} +9 -3
- data/rbi/workos/group_role_assignment_resource.rbi +36 -0
- data/rbi/workos/group_updated.rbi +6 -6
- data/rbi/workos/invitation_accepted.rbi +6 -6
- data/rbi/workos/invitation_created.rbi +6 -6
- data/rbi/workos/invitation_resent.rbi +6 -6
- data/rbi/workos/invitation_revoked.rbi +6 -6
- data/rbi/workos/magic_auth_code_session_authenticate_request.rbi +6 -0
- data/rbi/workos/magic_auth_created.rbi +6 -6
- data/rbi/workos/{webhook_endpoint_json.rbi → magic_auth_send_magic_auth_code_and_return_response.rbi} +19 -13
- data/rbi/workos/object_metadata.rbi +60 -0
- data/rbi/workos/object_summary.rbi +36 -0
- data/rbi/workos/object_version.rbi +48 -0
- data/rbi/workos/object_without_value.rbi +36 -0
- data/rbi/workos/organization_api_key.rbi +78 -0
- data/rbi/workos/organization_api_key_owner.rbi +30 -0
- data/rbi/workos/organization_api_key_with_value.rbi +84 -0
- data/rbi/workos/organization_api_key_with_value_owner.rbi +30 -0
- data/rbi/workos/organization_created.rbi +6 -6
- data/rbi/workos/organization_deleted.rbi +6 -6
- data/rbi/workos/organization_domain_created.rbi +6 -6
- data/rbi/workos/organization_domain_deleted.rbi +6 -6
- data/rbi/workos/organization_domain_updated.rbi +6 -6
- data/rbi/workos/organization_domain_verification_failed.rbi +6 -6
- data/rbi/workos/organization_domain_verified.rbi +6 -6
- data/rbi/workos/organization_membership.rbi +12 -0
- data/rbi/workos/organization_membership_created.rbi +6 -6
- data/rbi/workos/organization_membership_deleted.rbi +6 -6
- data/rbi/workos/organization_membership_service.rbi +114 -0
- data/rbi/workos/organization_membership_updated.rbi +6 -6
- data/rbi/workos/organization_role_created.rbi +6 -6
- data/rbi/workos/organization_role_deleted.rbi +6 -6
- data/rbi/workos/organization_role_updated.rbi +6 -6
- data/rbi/workos/organization_updated.rbi +6 -6
- data/rbi/workos/password_reset_created.rbi +6 -6
- data/rbi/workos/password_reset_succeeded.rbi +6 -6
- data/rbi/workos/password_session_authenticate_request.rbi +12 -0
- data/rbi/workos/permission_created.rbi +6 -6
- data/rbi/workos/permission_deleted.rbi +6 -6
- data/rbi/workos/permission_updated.rbi +6 -6
- data/rbi/workos/pipe_connected_account.rbi +78 -0
- data/rbi/workos/pipes.rbi +105 -1
- data/rbi/workos/pipes_connected_account_connected.rbi +54 -0
- data/rbi/workos/pipes_connected_account_disconnected.rbi +54 -0
- data/rbi/workos/pipes_connected_account_reauthorization_needed.rbi +54 -0
- data/rbi/workos/pipes_provider.rbi +34 -0
- data/rbi/workos/profile.rbi +6 -0
- data/rbi/workos/radar.rbi +2 -3
- 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 +2 -8
- data/rbi/workos/refresh_token_session_authenticate_request.rbi +2 -2
- data/rbi/workos/rekey_request.rbi +30 -0
- data/rbi/workos/replace_group_role_assignment_entry.rbi +42 -0
- data/rbi/workos/replace_group_role_assignments.rbi +24 -0
- data/rbi/workos/revoke_session.rbi +0 -6
- data/rbi/workos/role_created.rbi +6 -6
- data/rbi/workos/role_deleted.rbi +6 -6
- data/rbi/workos/role_updated.rbi +6 -6
- data/rbi/workos/send_radar_sms_challenge.rbi +48 -0
- data/rbi/workos/send_radar_sms_challenge_response.rbi +30 -0
- data/rbi/workos/session_created.rbi +6 -6
- data/rbi/workos/session_manager.rbi +1 -1
- data/rbi/workos/session_revoked.rbi +6 -6
- data/rbi/workos/update_custom_provider_definition.rbi +84 -0
- data/rbi/workos/update_data_integration.rbi +48 -0
- data/rbi/workos/update_object_request.rbi +30 -0
- data/rbi/workos/update_user.rbi +6 -0
- data/rbi/workos/user.rbi +6 -0
- data/rbi/workos/{api_key_with_value.rbi → user_api_key.rbi} +9 -9
- data/rbi/workos/user_api_key_created_data_owner.rbi +36 -0
- data/rbi/workos/{dsync_deactivated_data_domain.rbi → user_api_key_owner.rbi} +5 -5
- data/rbi/workos/user_api_key_revoked_data_owner.rbi +36 -0
- data/rbi/workos/user_api_key_updated_data_owner.rbi +36 -0
- data/rbi/workos/user_api_key_with_value.rbi +84 -0
- data/rbi/workos/user_api_key_with_value_owner.rbi +36 -0
- data/rbi/workos/user_create_response.rbi +108 -0
- data/rbi/workos/user_created.rbi +6 -6
- data/rbi/workos/user_deleted.rbi +6 -6
- data/rbi/workos/user_management.rbi +72 -86
- data/rbi/workos/user_object.rbi +6 -0
- data/rbi/workos/user_organization_membership.rbi +12 -0
- data/rbi/workos/user_organization_membership_base_list_data.rbi +6 -0
- data/rbi/workos/user_role_assignment.rbi +66 -0
- data/rbi/workos/{role_assignment_resource.rbi → user_role_assignment_resource.rbi} +1 -1
- data/rbi/workos/user_role_assignment_source.rbi +30 -0
- data/rbi/workos/user_updated.rbi +6 -6
- data/rbi/workos/vault.rbi +70 -95
- data/rbi/workos/vault_byok_key_deleted.rbi +54 -0
- data/rbi/workos/vault_byok_key_deleted_data.rbi +30 -0
- data/rbi/workos/vault_byok_key_verification_completed.rbi +6 -6
- data/rbi/workos/vault_data_created.rbi +6 -6
- data/rbi/workos/vault_data_deleted.rbi +6 -6
- data/rbi/workos/vault_data_read.rbi +6 -6
- data/rbi/workos/vault_data_updated.rbi +6 -6
- data/rbi/workos/vault_dek_decrypted.rbi +6 -6
- data/rbi/workos/vault_dek_read.rbi +6 -6
- data/rbi/workos/vault_kek_created.rbi +6 -6
- data/rbi/workos/vault_metadata_read.rbi +6 -6
- data/rbi/workos/vault_names_listed.rbi +6 -6
- data/rbi/workos/vault_object.rbi +42 -0
- data/rbi/workos/waitlist_user_approved.rbi +6 -6
- data/rbi/workos/waitlist_user_created.rbi +6 -6
- data/rbi/workos/waitlist_user_denied.rbi +6 -6
- data/rbi/workos/webhook_endpoint.rbi +1 -0
- data/rbi/workos/webhooks.rbi +2 -2
- data/renovate.json +1 -61
- data/script/docs +16 -0
- data/script/docs-serve +12 -0
- data/script/llms-txt +37 -0
- data/test/workos/test_actions.rb +9 -0
- data/test/workos/test_admin_portal_model_round_trip.rb +33 -0
- data/test/workos/test_api_keys.rb +20 -12
- data/test/workos/test_audit_logs_model_round_trip.rb +218 -0
- data/test/workos/test_authorization.rb +64 -0
- data/test/workos/test_authorization_model_round_trip.rb +456 -0
- data/test/workos/test_base_client.rb +108 -0
- data/test/workos/test_client_api.rb +33 -0
- data/test/workos/test_connect_model_round_trip.rb +30 -0
- data/test/workos/test_encryptors_aes_gcm.rb +16 -1
- data/test/workos/test_groups_model_round_trip.rb +33 -0
- data/test/workos/test_model_round_trip.rb +2 -7138
- data/test/workos/test_organization_membership_service.rb +107 -0
- data/test/workos/test_organizations_model_round_trip.rb +29 -0
- data/test/workos/test_pipes.rb +75 -3
- data/test/workos/test_pipes_model_round_trip.rb +389 -0
- data/test/workos/test_pipes_provider.rb +41 -0
- data/test/workos/test_radar_model_round_trip.rb +85 -0
- data/test/workos/test_session.rb +43 -4
- data/test/workos/test_shared_model_round_trip.rb +92 -0
- data/test/workos/test_user_management.rb +77 -73
- data/test/workos/test_user_management_model_round_trip.rb +1087 -0
- data/test/workos/test_vault.rb +91 -88
- data/test/workos/test_webhook_verify.rb +11 -0
- data/test/workos/test_webhooks_model_round_trip.rb +53 -0
- metadata +220 -85
- data/lib/workos/audit_logs/audit_log_schema_json.rb +0 -34
- data/lib/workos/organizations/audit_logs_retention_json.rb +0 -18
- data/lib/workos/types/audit_log_export_json_state.rb +0 -14
- data/lib/workos/types/directory_groups_order.rb +0 -9
- data/lib/workos/types/directory_users_order.rb +0 -9
- data/lib/workos/types/dsync_deactivated_data_state.rb +0 -9
- data/lib/workos/types/dsync_deactivated_data_type.rb +0 -9
- data/lib/workos/types/feature_flags_order.rb +0 -9
- data/lib/workos/types/groups_order.rb +0 -9
- data/lib/workos/types/organizations_api_keys_order.rb +0 -9
- data/lib/workos/types/organizations_feature_flags_order.rb +0 -9
- data/lib/workos/types/organizations_order.rb +0 -9
- data/lib/workos/types/permissions_order.rb +0 -9
- data/lib/workos/types/radar_type.rb +0 -9
- data/lib/workos/types/user_management_invitations_order.rb +0 -9
- data/lib/workos/types/user_management_multi_factor_authentication_order.rb +0 -9
- data/lib/workos/types/user_management_organization_membership_groups_order.rb +0 -9
- data/lib/workos/types/user_management_organization_membership_order.rb +0 -9
- data/lib/workos/types/user_management_users_authorized_applications_order.rb +0 -9
- data/lib/workos/types/user_management_users_feature_flags_order.rb +0 -9
- data/lib/workos/types/user_management_users_order.rb +0 -9
- data/lib/workos/types/webhook_endpoint_json_status.rb +0 -9
- data/lib/workos/types/webhooks_order.rb +0 -9
- data/lib/workos/user_management_organization_membership_groups.rb +0 -60
- data/lib/workos/webhooks/webhook_endpoint_json.rb +0 -40
- data/rbi/workos/actions.rbi +0 -48
- data/rbi/workos/audit_log_schema_json.rbi +0 -54
- data/rbi/workos/base_client.rbi +0 -132
- data/rbi/workos/configuration.rbi +0 -68
- data/rbi/workos/encryptors/aes_gcm.rbi +0 -19
- data/rbi/workos/errors.rbi +0 -43
- data/rbi/workos/hash_provider.rbi +0 -18
- data/rbi/workos/passwordless.rbi +0 -47
- data/rbi/workos/public_client.rbi +0 -12
- data/rbi/workos/session.rbi +0 -43
- data/rbi/workos/types/api_response.rbi +0 -29
- data/rbi/workos/types/base_model.rbi +0 -22
- data/rbi/workos/types/list_struct.rbi +0 -89
- data/rbi/workos/user_management_organization_membership_groups.rbi +0 -25
- data/rbi/workos/util.rbi +0 -12
- data/test/workos/test_user_management_organization_membership_groups.rb +0 -33
- /data/lib/workos/{user_management → organization_membership}/create_user_organization_membership.rb +0 -0
- /data/lib/workos/{user_management → organization_membership}/update_user_organization_membership.rb +0 -0
|
@@ -0,0 +1,456 @@
|
|
|
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 AuthorizationModelRoundTripTest < Minitest::Test
|
|
8
|
+
def test_check_authorization_round_trip
|
|
9
|
+
fixture = {
|
|
10
|
+
"permission_slug" => "stub",
|
|
11
|
+
"resource_id" => "stub",
|
|
12
|
+
"resource_external_id" => "stub",
|
|
13
|
+
"resource_type_slug" => "stub"
|
|
14
|
+
}
|
|
15
|
+
model = WorkOS::CheckAuthorization.new(fixture.to_json)
|
|
16
|
+
json = model.to_h
|
|
17
|
+
assert_kind_of Hash, json
|
|
18
|
+
assert_equal fixture["permission_slug"], json[:permission_slug]
|
|
19
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_create_group_role_assignment_round_trip
|
|
23
|
+
fixture = {
|
|
24
|
+
"role_slug" => "stub",
|
|
25
|
+
"resource_id" => "stub",
|
|
26
|
+
"resource_external_id" => "stub",
|
|
27
|
+
"resource_type_slug" => "stub"
|
|
28
|
+
}
|
|
29
|
+
model = WorkOS::CreateGroupRoleAssignment.new(fixture.to_json)
|
|
30
|
+
json = model.to_h
|
|
31
|
+
assert_kind_of Hash, json
|
|
32
|
+
assert_equal fixture["role_slug"], json[:role_slug]
|
|
33
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_replace_group_role_assignment_entry_round_trip
|
|
37
|
+
fixture = {
|
|
38
|
+
"role_slug" => "stub",
|
|
39
|
+
"resource_id" => "stub",
|
|
40
|
+
"resource_external_id" => "stub",
|
|
41
|
+
"resource_type_slug" => "stub"
|
|
42
|
+
}
|
|
43
|
+
model = WorkOS::ReplaceGroupRoleAssignmentEntry.new(fixture.to_json)
|
|
44
|
+
json = model.to_h
|
|
45
|
+
assert_kind_of Hash, json
|
|
46
|
+
assert_equal fixture["role_slug"], json[:role_slug]
|
|
47
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def test_replace_group_role_assignments_round_trip
|
|
51
|
+
fixture = {
|
|
52
|
+
"role_assignments" => []
|
|
53
|
+
}
|
|
54
|
+
model = WorkOS::ReplaceGroupRoleAssignments.new(fixture.to_json)
|
|
55
|
+
json = model.to_h
|
|
56
|
+
assert_kind_of Hash, json
|
|
57
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def test_delete_group_role_assignments_by_criteria_round_trip
|
|
61
|
+
fixture = {
|
|
62
|
+
"role_slug" => "stub",
|
|
63
|
+
"resource_id" => "stub",
|
|
64
|
+
"resource_external_id" => "stub",
|
|
65
|
+
"resource_type_slug" => "stub"
|
|
66
|
+
}
|
|
67
|
+
model = WorkOS::DeleteGroupRoleAssignmentsByCriteria.new(fixture.to_json)
|
|
68
|
+
json = model.to_h
|
|
69
|
+
assert_kind_of Hash, json
|
|
70
|
+
assert_equal fixture["role_slug"], json[:role_slug]
|
|
71
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_assign_role_round_trip
|
|
75
|
+
fixture = {
|
|
76
|
+
"role_slug" => "stub",
|
|
77
|
+
"resource_id" => "stub",
|
|
78
|
+
"resource_external_id" => "stub",
|
|
79
|
+
"resource_type_slug" => "stub"
|
|
80
|
+
}
|
|
81
|
+
model = WorkOS::AssignRole.new(fixture.to_json)
|
|
82
|
+
json = model.to_h
|
|
83
|
+
assert_kind_of Hash, json
|
|
84
|
+
assert_equal fixture["role_slug"], json[:role_slug]
|
|
85
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def test_remove_role_round_trip
|
|
89
|
+
fixture = {
|
|
90
|
+
"role_slug" => "stub",
|
|
91
|
+
"resource_id" => "stub",
|
|
92
|
+
"resource_external_id" => "stub",
|
|
93
|
+
"resource_type_slug" => "stub"
|
|
94
|
+
}
|
|
95
|
+
model = WorkOS::RemoveRole.new(fixture.to_json)
|
|
96
|
+
json = model.to_h
|
|
97
|
+
assert_kind_of Hash, json
|
|
98
|
+
assert_equal fixture["role_slug"], json[:role_slug]
|
|
99
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def test_set_role_permissions_round_trip
|
|
103
|
+
fixture = {
|
|
104
|
+
"permissions" => []
|
|
105
|
+
}
|
|
106
|
+
model = WorkOS::SetRolePermissions.new(fixture.to_json)
|
|
107
|
+
json = model.to_h
|
|
108
|
+
assert_kind_of Hash, json
|
|
109
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def test_add_role_permission_round_trip
|
|
113
|
+
fixture = {
|
|
114
|
+
"slug" => "stub"
|
|
115
|
+
}
|
|
116
|
+
model = WorkOS::AddRolePermission.new(fixture.to_json)
|
|
117
|
+
json = model.to_h
|
|
118
|
+
assert_kind_of Hash, json
|
|
119
|
+
assert_equal fixture["slug"], json[:slug]
|
|
120
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def test_create_organization_role_round_trip
|
|
124
|
+
fixture = {
|
|
125
|
+
"slug" => "stub",
|
|
126
|
+
"name" => "stub",
|
|
127
|
+
"description" => nil,
|
|
128
|
+
"resource_type_slug" => "stub"
|
|
129
|
+
}
|
|
130
|
+
model = WorkOS::CreateOrganizationRole.new(fixture.to_json)
|
|
131
|
+
json = model.to_h
|
|
132
|
+
assert_kind_of Hash, json
|
|
133
|
+
assert_equal fixture["name"], json[:name]
|
|
134
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def test_update_organization_role_round_trip
|
|
138
|
+
fixture = {
|
|
139
|
+
"name" => "stub",
|
|
140
|
+
"description" => nil
|
|
141
|
+
}
|
|
142
|
+
model = WorkOS::UpdateOrganizationRole.new(fixture.to_json)
|
|
143
|
+
json = model.to_h
|
|
144
|
+
assert_kind_of Hash, json
|
|
145
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def test_create_authorization_permission_round_trip
|
|
149
|
+
fixture = {
|
|
150
|
+
"slug" => "stub",
|
|
151
|
+
"name" => "stub",
|
|
152
|
+
"description" => nil,
|
|
153
|
+
"resource_type_slug" => "stub"
|
|
154
|
+
}
|
|
155
|
+
model = WorkOS::CreateAuthorizationPermission.new(fixture.to_json)
|
|
156
|
+
json = model.to_h
|
|
157
|
+
assert_kind_of Hash, json
|
|
158
|
+
assert_equal fixture["slug"], json[:slug]
|
|
159
|
+
assert_equal fixture["name"], json[:name]
|
|
160
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def test_update_authorization_permission_round_trip
|
|
164
|
+
fixture = {
|
|
165
|
+
"name" => "stub",
|
|
166
|
+
"description" => nil
|
|
167
|
+
}
|
|
168
|
+
model = WorkOS::UpdateAuthorizationPermission.new(fixture.to_json)
|
|
169
|
+
json = model.to_h
|
|
170
|
+
assert_kind_of Hash, json
|
|
171
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def test_create_role_round_trip
|
|
175
|
+
fixture = {
|
|
176
|
+
"slug" => "stub",
|
|
177
|
+
"name" => "stub",
|
|
178
|
+
"description" => nil,
|
|
179
|
+
"resource_type_slug" => "stub"
|
|
180
|
+
}
|
|
181
|
+
model = WorkOS::CreateRole.new(fixture.to_json)
|
|
182
|
+
json = model.to_h
|
|
183
|
+
assert_kind_of Hash, json
|
|
184
|
+
assert_equal fixture["slug"], json[:slug]
|
|
185
|
+
assert_equal fixture["name"], json[:name]
|
|
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_update_role_round_trip
|
|
190
|
+
fixture = {
|
|
191
|
+
"name" => "stub",
|
|
192
|
+
"description" => nil
|
|
193
|
+
}
|
|
194
|
+
model = WorkOS::UpdateRole.new(fixture.to_json)
|
|
195
|
+
json = model.to_h
|
|
196
|
+
assert_kind_of Hash, json
|
|
197
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def test_update_authorization_resource_round_trip
|
|
201
|
+
fixture = {
|
|
202
|
+
"name" => "stub",
|
|
203
|
+
"description" => nil,
|
|
204
|
+
"parent_resource_id" => "stub",
|
|
205
|
+
"parent_resource_external_id" => "stub",
|
|
206
|
+
"parent_resource_type_slug" => "stub"
|
|
207
|
+
}
|
|
208
|
+
model = WorkOS::UpdateAuthorizationResource.new(fixture.to_json)
|
|
209
|
+
json = model.to_h
|
|
210
|
+
assert_kind_of Hash, json
|
|
211
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def test_create_authorization_resource_round_trip
|
|
215
|
+
fixture = {
|
|
216
|
+
"external_id" => "stub",
|
|
217
|
+
"name" => "stub",
|
|
218
|
+
"description" => nil,
|
|
219
|
+
"resource_type_slug" => "stub",
|
|
220
|
+
"organization_id" => "stub",
|
|
221
|
+
"parent_resource_id" => nil,
|
|
222
|
+
"parent_resource_external_id" => "stub",
|
|
223
|
+
"parent_resource_type_slug" => "stub"
|
|
224
|
+
}
|
|
225
|
+
model = WorkOS::CreateAuthorizationResource.new(fixture.to_json)
|
|
226
|
+
json = model.to_h
|
|
227
|
+
assert_kind_of Hash, json
|
|
228
|
+
assert_equal fixture["external_id"], json[:external_id]
|
|
229
|
+
assert_equal fixture["name"], json[:name]
|
|
230
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
231
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
232
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def test_authorization_check_round_trip
|
|
236
|
+
fixture = {
|
|
237
|
+
"authorized" => true
|
|
238
|
+
}
|
|
239
|
+
model = WorkOS::AuthorizationCheck.new(fixture.to_json)
|
|
240
|
+
json = model.to_h
|
|
241
|
+
assert_kind_of Hash, json
|
|
242
|
+
assert_equal fixture["authorized"], json[:authorized]
|
|
243
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def test_authorization_resource_round_trip
|
|
247
|
+
fixture = {
|
|
248
|
+
"object" => "authorization_resource",
|
|
249
|
+
"name" => "stub",
|
|
250
|
+
"description" => nil,
|
|
251
|
+
"organization_id" => "stub",
|
|
252
|
+
"parent_resource_id" => nil,
|
|
253
|
+
"id" => "stub",
|
|
254
|
+
"external_id" => "stub",
|
|
255
|
+
"resource_type_slug" => "stub",
|
|
256
|
+
"created_at" => "stub",
|
|
257
|
+
"updated_at" => "stub"
|
|
258
|
+
}
|
|
259
|
+
model = WorkOS::AuthorizationResource.new(fixture.to_json)
|
|
260
|
+
json = model.to_h
|
|
261
|
+
assert_kind_of Hash, json
|
|
262
|
+
assert_equal fixture["name"], json[:name]
|
|
263
|
+
assert_nil json[:description]
|
|
264
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
265
|
+
assert_nil json[:parent_resource_id]
|
|
266
|
+
assert_equal fixture["id"], json[:id]
|
|
267
|
+
assert_equal fixture["external_id"], json[:external_id]
|
|
268
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
269
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
270
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
271
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def test_authorization_permission_round_trip
|
|
275
|
+
fixture = {
|
|
276
|
+
"object" => "permission",
|
|
277
|
+
"id" => "stub",
|
|
278
|
+
"slug" => "stub",
|
|
279
|
+
"name" => "stub",
|
|
280
|
+
"description" => nil,
|
|
281
|
+
"system" => true,
|
|
282
|
+
"resource_type_slug" => "stub",
|
|
283
|
+
"created_at" => "stub",
|
|
284
|
+
"updated_at" => "stub"
|
|
285
|
+
}
|
|
286
|
+
model = WorkOS::AuthorizationPermission.new(fixture.to_json)
|
|
287
|
+
json = model.to_h
|
|
288
|
+
assert_kind_of Hash, json
|
|
289
|
+
assert_equal fixture["id"], json[:id]
|
|
290
|
+
assert_equal fixture["slug"], json[:slug]
|
|
291
|
+
assert_equal fixture["name"], json[:name]
|
|
292
|
+
assert_nil json[:description]
|
|
293
|
+
assert_equal fixture["system"], json[:system]
|
|
294
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
295
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
296
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
297
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
def test_slim_role_round_trip
|
|
301
|
+
fixture = {
|
|
302
|
+
"slug" => "stub"
|
|
303
|
+
}
|
|
304
|
+
model = WorkOS::SlimRole.new(fixture.to_json)
|
|
305
|
+
json = model.to_h
|
|
306
|
+
assert_kind_of Hash, json
|
|
307
|
+
assert_equal fixture["slug"], json[:slug]
|
|
308
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def test_group_role_assignment_round_trip
|
|
312
|
+
fixture = {
|
|
313
|
+
"object" => "group_role_assignment",
|
|
314
|
+
"id" => "stub",
|
|
315
|
+
"group_id" => "stub",
|
|
316
|
+
"role" => {},
|
|
317
|
+
"resource" => {},
|
|
318
|
+
"created_at" => "stub",
|
|
319
|
+
"updated_at" => "stub"
|
|
320
|
+
}
|
|
321
|
+
model = WorkOS::GroupRoleAssignment.new(fixture.to_json)
|
|
322
|
+
json = model.to_h
|
|
323
|
+
assert_kind_of Hash, json
|
|
324
|
+
assert_equal fixture["id"], json[:id]
|
|
325
|
+
assert_equal fixture["group_id"], json[:group_id]
|
|
326
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
327
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
328
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
def test_user_role_assignment_round_trip
|
|
332
|
+
fixture = {
|
|
333
|
+
"object" => "role_assignment",
|
|
334
|
+
"id" => "stub",
|
|
335
|
+
"organization_membership_id" => "stub",
|
|
336
|
+
"role" => {},
|
|
337
|
+
"resource" => {},
|
|
338
|
+
"source" => {},
|
|
339
|
+
"created_at" => "stub",
|
|
340
|
+
"updated_at" => "stub"
|
|
341
|
+
}
|
|
342
|
+
model = WorkOS::UserRoleAssignment.new(fixture.to_json)
|
|
343
|
+
json = model.to_h
|
|
344
|
+
assert_kind_of Hash, json
|
|
345
|
+
assert_equal fixture["id"], json[:id]
|
|
346
|
+
assert_equal fixture["organization_membership_id"], json[:organization_membership_id]
|
|
347
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
348
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
349
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def test_role_round_trip
|
|
353
|
+
fixture = {
|
|
354
|
+
"slug" => "stub",
|
|
355
|
+
"object" => "role",
|
|
356
|
+
"id" => "stub",
|
|
357
|
+
"name" => "stub",
|
|
358
|
+
"description" => nil,
|
|
359
|
+
"type" => "stub",
|
|
360
|
+
"resource_type_slug" => "stub",
|
|
361
|
+
"permissions" => [],
|
|
362
|
+
"created_at" => "stub",
|
|
363
|
+
"updated_at" => "stub"
|
|
364
|
+
}
|
|
365
|
+
model = WorkOS::Role.new(fixture.to_json)
|
|
366
|
+
json = model.to_h
|
|
367
|
+
assert_kind_of Hash, json
|
|
368
|
+
assert_equal fixture["slug"], json[:slug]
|
|
369
|
+
assert_equal fixture["id"], json[:id]
|
|
370
|
+
assert_equal fixture["name"], json[:name]
|
|
371
|
+
assert_nil json[:description]
|
|
372
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
373
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
374
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
375
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
def test_role_list_round_trip
|
|
379
|
+
fixture = {
|
|
380
|
+
"object" => "list",
|
|
381
|
+
"data" => []
|
|
382
|
+
}
|
|
383
|
+
model = WorkOS::RoleList.new(fixture.to_json)
|
|
384
|
+
json = model.to_h
|
|
385
|
+
assert_kind_of Hash, json
|
|
386
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
def test_user_role_assignment_resource_round_trip
|
|
390
|
+
fixture = {
|
|
391
|
+
"id" => "stub",
|
|
392
|
+
"external_id" => "stub",
|
|
393
|
+
"resource_type_slug" => "stub"
|
|
394
|
+
}
|
|
395
|
+
model = WorkOS::UserRoleAssignmentResource.new(fixture.to_json)
|
|
396
|
+
json = model.to_h
|
|
397
|
+
assert_kind_of Hash, json
|
|
398
|
+
assert_equal fixture["id"], json[:id]
|
|
399
|
+
assert_equal fixture["external_id"], json[:external_id]
|
|
400
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
401
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
402
|
+
end
|
|
403
|
+
|
|
404
|
+
def test_user_role_assignment_source_round_trip
|
|
405
|
+
fixture = {
|
|
406
|
+
"type" => "stub",
|
|
407
|
+
"group_role_assignment_id" => nil
|
|
408
|
+
}
|
|
409
|
+
model = WorkOS::UserRoleAssignmentSource.new(fixture.to_json)
|
|
410
|
+
json = model.to_h
|
|
411
|
+
assert_kind_of Hash, json
|
|
412
|
+
assert_nil json[:group_role_assignment_id]
|
|
413
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
def test_group_role_assignment_resource_round_trip
|
|
417
|
+
fixture = {
|
|
418
|
+
"id" => "stub",
|
|
419
|
+
"external_id" => "stub",
|
|
420
|
+
"resource_type_slug" => "stub"
|
|
421
|
+
}
|
|
422
|
+
model = WorkOS::GroupRoleAssignmentResource.new(fixture.to_json)
|
|
423
|
+
json = model.to_h
|
|
424
|
+
assert_kind_of Hash, json
|
|
425
|
+
assert_equal fixture["id"], json[:id]
|
|
426
|
+
assert_equal fixture["external_id"], json[:external_id]
|
|
427
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
428
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
def test_permission_round_trip
|
|
432
|
+
fixture = {
|
|
433
|
+
"object" => "permission",
|
|
434
|
+
"id" => "stub",
|
|
435
|
+
"slug" => "stub",
|
|
436
|
+
"name" => "stub",
|
|
437
|
+
"description" => nil,
|
|
438
|
+
"system" => true,
|
|
439
|
+
"resource_type_slug" => "stub",
|
|
440
|
+
"created_at" => "stub",
|
|
441
|
+
"updated_at" => "stub"
|
|
442
|
+
}
|
|
443
|
+
model = WorkOS::Permission.new(fixture.to_json)
|
|
444
|
+
json = model.to_h
|
|
445
|
+
assert_kind_of Hash, json
|
|
446
|
+
assert_equal fixture["id"], json[:id]
|
|
447
|
+
assert_equal fixture["slug"], json[:slug]
|
|
448
|
+
assert_equal fixture["name"], json[:name]
|
|
449
|
+
assert_nil json[:description]
|
|
450
|
+
assert_equal fixture["system"], json[:system]
|
|
451
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
452
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
453
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
454
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
455
|
+
end
|
|
456
|
+
end
|
|
@@ -86,6 +86,14 @@ class BaseClientTest < Minitest::Test
|
|
|
86
86
|
@client = WorkOS::BaseClient.new(api_key: "sk_test_123", max_retries: 1)
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
+
def teardown
|
|
90
|
+
super
|
|
91
|
+
# Close any open connections and clear the thread-local cache to avoid
|
|
92
|
+
# leaking sockets between tests.
|
|
93
|
+
@client.shutdown
|
|
94
|
+
Thread.current[:workos_connections] = nil
|
|
95
|
+
end
|
|
96
|
+
|
|
89
97
|
def test_request_dispatches_known_methods
|
|
90
98
|
client = RecordingClient.new(api_key: "sk_test_123")
|
|
91
99
|
|
|
@@ -170,4 +178,104 @@ class BaseClientTest < Minitest::Test
|
|
|
170
178
|
assert evict.finished
|
|
171
179
|
refute keep.finished
|
|
172
180
|
end
|
|
181
|
+
|
|
182
|
+
# Regression test for https://github.com/workos/workos-ruby/issues/496
|
|
183
|
+
#
|
|
184
|
+
# The connection cache must be isolated per thread. A previous version
|
|
185
|
+
# keyed it on Fiber[] (inheritable fiber storage), which is inherited *by
|
|
186
|
+
# reference* by child threads — so a Net::HTTP socket warmed in a parent
|
|
187
|
+
# thread leaked into every worker thread spawned afterward (Solid Queue,
|
|
188
|
+
# Puma, etc.) and got driven concurrently, corrupting the stream.
|
|
189
|
+
def test_connection_cache_is_not_shared_with_threads_spawned_after_warming
|
|
190
|
+
# Warm a connection in the "parent" thread before spawning workers.
|
|
191
|
+
parent_cache = @client.send(:thread_connections)
|
|
192
|
+
warm = FakeConnection.new
|
|
193
|
+
parent_cache["https:api.workos.com:443:30"] = warm
|
|
194
|
+
|
|
195
|
+
results = Array.new(4) do
|
|
196
|
+
Thread.new do
|
|
197
|
+
cache = @client.send(:thread_connections)
|
|
198
|
+
{cache_id: cache.object_id, leaked: cache.value?(warm), size: cache.size}
|
|
199
|
+
end
|
|
200
|
+
end.map(&:value)
|
|
201
|
+
|
|
202
|
+
results.each do |r|
|
|
203
|
+
refute_equal parent_cache.object_id, r[:cache_id],
|
|
204
|
+
"worker thread must not share the parent thread's connection cache"
|
|
205
|
+
refute r[:leaked],
|
|
206
|
+
"parent thread's warmed connection leaked into a worker thread"
|
|
207
|
+
assert_equal 0, r[:size],
|
|
208
|
+
"worker thread should start with an empty, isolated cache"
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# The parent's own cache is left intact.
|
|
212
|
+
assert_same warm, parent_cache["https:api.workos.com:443:30"]
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Exercises the connection_for path (not just the storage helper):
|
|
216
|
+
# each thread must open and cache its *own* Net::HTTP connection rather
|
|
217
|
+
# than reusing one established on another thread.
|
|
218
|
+
#
|
|
219
|
+
# Net::HTTP#start is stubbed to avoid real TCP+TLS connections.
|
|
220
|
+
def test_connection_for_opens_a_distinct_connection_per_thread
|
|
221
|
+
original_start = Net::HTTP.instance_method(:start)
|
|
222
|
+
Net::HTTP.define_method(:start) { self }
|
|
223
|
+
|
|
224
|
+
parent_conn = @client.send(:connection_for, "https://api.workos.com", 30)
|
|
225
|
+
|
|
226
|
+
worker_conns = Array.new(4) do
|
|
227
|
+
Thread.new { @client.send(:connection_for, "https://api.workos.com", 30).object_id }
|
|
228
|
+
end.map(&:value)
|
|
229
|
+
|
|
230
|
+
refute_includes worker_conns, parent_conn.object_id,
|
|
231
|
+
"a worker thread reused a connection opened on another thread"
|
|
232
|
+
assert_equal worker_conns.length, worker_conns.uniq.length,
|
|
233
|
+
"worker threads must each get a distinct connection"
|
|
234
|
+
ensure
|
|
235
|
+
Net::HTTP.define_method(:start, original_start)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def test_redact_path_strips_invitation_token_segment
|
|
239
|
+
redacted = @client.send(:redact_path, "/user_management/invitations/by_token/invtoken_secret123")
|
|
240
|
+
assert_equal "/user_management/invitations/by_token/[REDACTED]", redacted
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
def test_redact_path_strips_magic_auth_token_segment
|
|
244
|
+
redacted = @client.send(:redact_path, "/user_management/magic_auth/magic_secret/extra")
|
|
245
|
+
assert_equal "/user_management/magic_auth/[REDACTED]/[REDACTED]", redacted
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def test_redact_path_preserves_non_token_paths
|
|
249
|
+
assert_equal "/organizations/org_123", @client.send(:redact_path, "/organizations/org_123")
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
def test_redact_path_preserves_query_string
|
|
253
|
+
redacted = @client.send(:redact_path, "/user_management/invitations/by_token/secret?foo=bar")
|
|
254
|
+
assert_equal "/user_management/invitations/by_token/[REDACTED]?foo=bar", redacted
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
def test_redact_path_handles_nil_and_empty
|
|
258
|
+
assert_nil @client.send(:redact_path, nil)
|
|
259
|
+
assert_equal "", @client.send(:redact_path, "")
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def test_redact_path_scrubs_sensitive_query_params
|
|
263
|
+
redacted = @client.send(:redact_path, "/user_management/sessions/logout?session_id=ses_abc123&return_to=https://app.example.com")
|
|
264
|
+
assert_equal "/user_management/sessions/logout?session_id=[REDACTED]&return_to=https://app.example.com", redacted
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
def test_redact_path_scrubs_authorize_code_query_param
|
|
268
|
+
redacted = @client.send(:redact_path, "/user_management/authorize?client_id=client_1&code=auth_code_secret&state=xyz")
|
|
269
|
+
assert_equal "/user_management/authorize?client_id=client_1&code=[REDACTED]&state=xyz", redacted
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
def test_redact_path_leaves_non_sensitive_query_params_untouched
|
|
273
|
+
redacted = @client.send(:redact_path, "/user_management/users?limit=10&order=desc")
|
|
274
|
+
assert_equal "/user_management/users?limit=10&order=desc", redacted
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
def test_redact_path_scrubs_query_alongside_path_segment_redaction
|
|
278
|
+
redacted = @client.send(:redact_path, "/user_management/magic_auth/magic_secret?token=qs_token")
|
|
279
|
+
assert_equal "/user_management/magic_auth/[REDACTED]?token=[REDACTED]", redacted
|
|
280
|
+
end
|
|
173
281
|
end
|
|
@@ -0,0 +1,33 @@
|
|
|
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 ClientApiTest < Minitest::Test
|
|
8
|
+
include FixtureHelper
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
@client = WorkOS::Client.new(api_key: "sk_test_123")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_create_token_returns_expected_result
|
|
15
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/client/token(\?|\z)})
|
|
16
|
+
.to_return(body: "{}", status: 200)
|
|
17
|
+
result = @client.client_api.create_token(organization_id: "stub", user_id: "stub")
|
|
18
|
+
refute_nil result
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Parameterized authentication error tests (one per endpoint).
|
|
22
|
+
[
|
|
23
|
+
{name: :create_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/client/token(\?|\z)}, args: {organization_id: "stub", user_id: "stub"}}
|
|
24
|
+
].each do |spec|
|
|
25
|
+
define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
|
|
26
|
+
stub_request(spec[:verb], spec[:url])
|
|
27
|
+
.to_return(body: '{"message": "Unauthorized"}', status: 401)
|
|
28
|
+
assert_raises(WorkOS::AuthenticationError) do
|
|
29
|
+
@client.client_api.send(spec[:name], **(spec[:args] || {}))
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
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 ConnectModelRoundTripTest < Minitest::Test
|
|
8
|
+
def test_connect_application_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
|
+
}
|
|
19
|
+
model = WorkOS::ConnectApplication.new(fixture.to_json)
|
|
20
|
+
json = model.to_h
|
|
21
|
+
assert_kind_of Hash, json
|
|
22
|
+
assert_equal fixture["id"], json[:id]
|
|
23
|
+
assert_equal fixture["client_id"], json[:client_id]
|
|
24
|
+
assert_nil json[:description]
|
|
25
|
+
assert_equal fixture["name"], json[:name]
|
|
26
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
27
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
28
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -28,11 +28,26 @@ class EncryptorsAesGcmTest < Minitest::Test
|
|
|
28
28
|
|
|
29
29
|
def test_unseal_with_wrong_key_raises
|
|
30
30
|
sealed = @enc.seal({"x" => 1}, PASSWORD)
|
|
31
|
+
# Wrong key is the same length (>= 32 bytes) so the length guard doesn't
|
|
32
|
+
# short-circuit; we want to assert the underlying cipher rejection.
|
|
31
33
|
assert_raises(OpenSSL::Cipher::CipherError) do
|
|
32
|
-
@enc.unseal(sealed, "wrong-password")
|
|
34
|
+
@enc.unseal(sealed, "wrong-cookie-password-32-bytes--")
|
|
33
35
|
end
|
|
34
36
|
end
|
|
35
37
|
|
|
38
|
+
def test_unseal_rejects_short_key
|
|
39
|
+
sealed = @enc.seal({"x" => 1}, PASSWORD)
|
|
40
|
+
assert_raises(ArgumentError) do
|
|
41
|
+
@enc.unseal(sealed, "too-short")
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_seal_rejects_short_key
|
|
46
|
+
assert_raises(ArgumentError) { @enc.seal({"x" => 1}, "too-short") }
|
|
47
|
+
assert_raises(ArgumentError) { @enc.seal({"x" => 1}, nil) }
|
|
48
|
+
assert_raises(ArgumentError) { @enc.seal({"x" => 1}, "") }
|
|
49
|
+
end
|
|
50
|
+
|
|
36
51
|
def test_unseal_rejects_short_payload
|
|
37
52
|
assert_raises(ArgumentError) do
|
|
38
53
|
@enc.unseal(Base64.strict_encode64("short"), PASSWORD)
|