From 7563131f50e497c59ccb249294461dc32799251d Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Tue, 14 Apr 2026 18:27:39 -0400 Subject: [PATCH 01/12] Bump to 3.3 --- workos.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workos.gemspec b/workos.gemspec index 2e52b02c..f9357d7a 100644 --- a/workos.gemspec +++ b/workos.gemspec @@ -31,5 +31,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'vcr', '~> 6.0' spec.add_development_dependency 'webmock' - spec.required_ruby_version = '>= 3.1' + spec.required_ruby_version = '>= 3.3' end From b7530c94475fdda3d2ddeae6bfd46d34124e6431 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Tue, 14 Apr 2026 19:05:19 -0400 Subject: [PATCH 02/12] switch to standardrb --- .github/workflows/ci.yml | 4 - .github/workflows/lint.yml | 26 + .rubocop.yml | 34 - .rubocop_todo.yml | 94 - .ruby-version | 1 - .standard.yml | 10 + Gemfile | 2 +- Gemfile.lock | 116 +- Rakefile | 4 +- lib/workos.rb | 126 +- lib/workos/audit_log_export.rb | 2 +- lib/workos/audit_logs.rb | 30 +- .../authentication_factor_and_challenge.rb | 6 +- lib/workos/authentication_response.rb | 22 +- lib/workos/challenge.rb | 2 +- lib/workos/client.rb | 98 +- lib/workos/configuration.rb | 2 +- lib/workos/connection.rb | 4 +- lib/workos/deprecated_hash_wrapper.rb | 16 +- lib/workos/deprecation.rb | 2 +- lib/workos/directory.rb | 2 +- lib/workos/directory_group.rb | 4 +- lib/workos/directory_sync.rb | 50 +- lib/workos/directory_user.rb | 14 +- lib/workos/email_verification.rb | 4 +- lib/workos/encryptors.rb | 2 +- lib/workos/encryptors/aes_gcm.rb | 12 +- lib/workos/errors.rb | 4 +- lib/workos/event.rb | 2 +- lib/workos/events.rb | 14 +- lib/workos/factor.rb | 3 +- lib/workos/feature_flag.rb | 2 +- lib/workos/hash_provider.rb | 2 +- lib/workos/impersonator.rb | 2 +- lib/workos/invitation.rb | 4 +- lib/workos/magic_auth.rb | 4 +- lib/workos/mfa.rb | 43 +- lib/workos/oauth_tokens.rb | 2 +- lib/workos/organization.rb | 4 +- lib/workos/organization_membership.rb | 4 +- lib/workos/organizations.rb | 75 +- lib/workos/password_reset.rb | 4 +- lib/workos/passwordless.rb | 20 +- lib/workos/portal.rb | 8 +- lib/workos/profile.rb | 6 +- lib/workos/profile_and_token.rb | 2 +- lib/workos/refresh_authentication_response.rb | 8 +- lib/workos/role.rb | 2 +- lib/workos/session.rb | 73 +- lib/workos/sso.rb | 44 +- lib/workos/types.rb | 10 +- lib/workos/types/intent.rb | 12 +- lib/workos/types/provider.rb | 8 +- lib/workos/types/widget_scope.rb | 6 +- lib/workos/user.rb | 4 +- lib/workos/user_and_token.rb | 2 +- lib/workos/user_management.rb | 309 ++- lib/workos/user_management/session.rb | 5 +- lib/workos/user_response.rb | 2 +- lib/workos/verify_challenge.rb | 2 +- lib/workos/version.rb | 2 +- lib/workos/webhook.rb | 2 +- lib/workos/webhooks.rb | 22 +- lib/workos/widgets.rb | 10 +- spec/lib/workos/audit_logs_spec.rb | 154 +- spec/lib/workos/cache_spec.rb | 100 +- spec/lib/workos/client.rb | 34 +- spec/lib/workos/configuration_spec.rb | 34 +- spec/lib/workos/directory_sync_spec.rb | 408 ++-- spec/lib/workos/directory_user_spec.rb | 44 +- spec/lib/workos/encryptors/aes_gcm_spec.rb | 22 +- spec/lib/workos/event_spec.rb | 82 +- spec/lib/workos/mfa_spec.rb | 216 +-- spec/lib/workos/organizations_spec.rb | 502 ++--- spec/lib/workos/passwordless_spec.rb | 52 +- spec/lib/workos/portal_spec.rb | 90 +- spec/lib/workos/role_spec.rb | 162 +- spec/lib/workos/session_spec.rb | 364 ++-- spec/lib/workos/sso_spec.rb | 590 +++--- spec/lib/workos/user_management_spec.rb | 1674 ++++++++--------- spec/lib/workos/webhooks_spec.rb | 178 +- spec/lib/workos/widgets_spec.rb | 50 +- spec/spec_helper.rb | 28 +- spec/support/shared_examples/client.rb | 12 +- workos.gemspec | 5 +- 85 files changed, 3089 insertions(+), 3129 deletions(-) create mode 100644 .github/workflows/lint.yml delete mode 100644 .rubocop.yml delete mode 100644 .rubocop_todo.yml delete mode 100644 .ruby-version create mode 100644 .standard.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e10f1270..d4d752a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,10 +26,6 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Rubocop - run: | - bundle exec rubocop - - name: Spec run: | bundle exec rspec diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..eb35be6c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,26 @@ +name: Lint + +on: + push: + branches: + - 'main' + pull_request: {} + +defaults: + run: + shell: bash + +jobs: + standard: + name: Standard Ruby + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: Standard + run: | + bundle exec standardrb diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index bd4c3333..00000000 --- a/.rubocop.yml +++ /dev/null @@ -1,34 +0,0 @@ -inherit_from: .rubocop_todo.yml - -Layout/DotPosition: - EnforcedStyle: trailing -Layout/EmptyLineAfterMagicComment: - Enabled: false -Layout/EmptyLines: - Enabled: false -Layout/LineLength: - AllowedPatterns: - - 'VCR\.use_cassette' - - '(\A|\s)/.*?/' -Metrics/BlockLength: - AllowedMethods: ['describe', 'context', 'before', 'it'] -Metrics/ClassLength: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ModuleLength: - Enabled: false -Metrics/ParameterLists: - Max: 6 -Naming/ConstantName: - Exclude: - - 'lib/workos/user_management.rb' - - 'lib/workos/types/*.rb' -Style/TrailingCommaInArguments: - EnforcedStyleForMultiline: 'consistent_comma' -Style/TrailingCommaInHashLiteral: - EnforcedStyleForMultiline: 'consistent_comma' -AllCops: - TargetRubyVersion: 3.1 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml deleted file mode 100644 index 54f5f130..00000000 --- a/.rubocop_todo.yml +++ /dev/null @@ -1,94 +0,0 @@ -# This configuration was generated by -# `rubocop --auto-gen-config` -# on 2025-01-22 21:38:20 UTC using RuboCop version 1.71.0. -# The point is for the user to remove these configuration records -# one by one as the offenses are removed from the code base. -# Note that changes in the inspected code, or installation of new -# versions of RuboCop, may require this file to be generated again. - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleAlignWith. -# SupportedStylesAlignWith: either, start_of_block, start_of_line -Layout/BlockAlignment: - Exclude: - - 'spec/lib/workos/session_spec.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Layout/EmptyLinesAroundMethodBody: - Exclude: - - 'lib/workos/mfa.rb' - - 'lib/workos/user_management.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Layout/SpaceAroundMethodCallOperator: - Exclude: - - 'spec/lib/workos/directory_sync_spec.rb' - -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -Lint/DuplicateRequire: - Exclude: - - 'lib/workos/session.rb' - -# Offense count: 3 -# Configuration parameters: AllowedParentClasses. -Lint/MissingSuper: - Exclude: - - 'lib/workos/directory_group.rb' - - 'lib/workos/directory_user.rb' - - 'lib/workos/errors.rb' - -# Offense count: 5 -# Configuration parameters: CountComments, CountAsOne. -Metrics/ClassLength: - Max: 624 - -# Offense count: 8 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: separated, grouped -Style/AccessorGrouping: - Exclude: - - 'lib/workos/errors.rb' - -# Offense count: 34 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: braces, no_braces -Style/HashAsLastArrayItem: - Exclude: - - 'spec/lib/workos/directory_sync_spec.rb' - - 'spec/lib/workos/event_spec.rb' - - 'spec/lib/workos/organizations_spec.rb' - - 'spec/lib/workos/sso_spec.rb' - - 'spec/lib/workos/user_management_spec.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Style/KeywordParametersOrder: - Exclude: - - 'lib/workos/organizations.rb' - -# Offense count: 3 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: SafeForConstants. -Style/RedundantFetchBlock: - Exclude: - - 'spec/lib/workos/cache_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowMultipleReturnValues. -Style/RedundantReturn: - Exclude: - - 'lib/workos/directory_user.rb' - -# Offense count: 2 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/SlicingWithRange: - Exclude: - - 'lib/workos/deprecated_hash_wrapper.rb' - - 'lib/workos/session.rb' diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index 0aec50e6..00000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -3.1.4 diff --git a/.standard.yml b/.standard.yml new file mode 100644 index 00000000..e8acb923 --- /dev/null +++ b/.standard.yml @@ -0,0 +1,10 @@ +ruby_version: 3.3 + +ignore: + - "lib/workos/types/provider.rb": + - Naming/ConstantName + - "lib/workos/user_management.rb": + - Naming/ConstantName + - Metrics/ParameterLists + - "spec/**/*_spec.rb": + - Metrics/BlockLength diff --git a/Gemfile b/Gemfile index 7f4f5e95..be173b20 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ # frozen_string_literal: true -source 'https://rubygems.org' +source "https://rubygems.org" gemspec diff --git a/Gemfile.lock b/Gemfile.lock index e4f6561f..521f2115 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,31 +8,33 @@ PATH GEM remote: https://rubygems.org/ specs: - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) - ast (2.4.2) + addressable (2.9.0) + public_suffix (>= 2.0.2, < 8.0) + ast (2.4.3) base64 (0.3.0) - bigdecimal (3.1.7) - crack (1.0.0) + bigdecimal (4.1.1) + crack (1.0.1) bigdecimal rexml - diff-lcs (1.5.1) + diff-lcs (1.6.2) encryptor (3.0.0) - hashdiff (1.1.0) - json (2.9.1) + hashdiff (1.2.1) + json (2.19.3) jwt (3.1.2) base64 - language_server-protocol (3.17.0.3) - parallel (1.26.3) - parser (3.3.7.0) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + parallel (1.28.0) + parser (3.3.11.1) ast (~> 2.4.1) racc - public_suffix (5.0.4) + prism (1.9.0) + public_suffix (7.0.5) racc (1.8.1) rainbow (3.1.1) - rake (13.3.1) - regexp_parser (2.10.0) - rexml (3.4.2) + rake (13.4.1) + regexp_parser (2.12.0) + rexml (3.4.4) rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) @@ -46,40 +48,98 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-support (3.9.4) - rubocop (1.71.0) + rubocop (1.84.2) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.36.2, < 2.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.37.0) - parser (>= 3.3.1.0) + rubocop-ast (1.49.1) + parser (>= 3.3.7.2) + prism (~> 1.7) + rubocop-performance (1.26.1) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) ruby-progressbar (1.13.0) - unicode-display_width (3.1.4) - unicode-emoji (~> 4.0, >= 4.0.4) - unicode-emoji (4.0.4) - vcr (6.3.1) - base64 - webmock (3.23.0) + standard (1.54.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.84.0) + standard-custom (~> 1.0.0) + standard-performance (~> 1.8) + standard-custom (1.0.2) + lint_roller (~> 1.0) + rubocop (~> 1.50) + standard-performance (1.9.0) + lint_roller (~> 1.1) + rubocop-performance (~> 1.26.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) + vcr (6.4.0) + webmock (3.26.2) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) PLATFORMS + arm64-darwin-25 ruby DEPENDENCIES bundler (>= 2.0.1) rake rspec (~> 3.9.0) - rubocop (~> 1.71) + standard (~> 1.49) vcr (~> 6.0) webmock workos! +CHECKSUMS + addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af + ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383 + base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b + bigdecimal (4.1.1) sha256=1c09efab961da45203c8316b0cdaec0ff391dfadb952dd459584b63ebf8054ca + crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e + diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962 + encryptor (3.0.0) sha256=abf23f94ab4d864b8cea85b43f3432044a60001982cda7c33c1cd90da8db1969 + hashdiff (1.2.1) sha256=9c079dbc513dfc8833ab59c0c2d8f230fa28499cc5efb4b8dd276cf931457cd1 + json (2.19.3) sha256=289b0bb53052a1fa8c34ab33cc750b659ba14a5c45f3fcf4b18762dc67c78646 + jwt (3.1.2) sha256=af6991f19a6bb4060d618d9add7a66f0eeb005ac0bc017cd01f63b42e122d535 + language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc + lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87 + parallel (1.28.0) sha256=33e6de1484baf2524792d178b0913fc8eb94c628d6cfe45599ad4458c638c970 + parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54 + prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85 + public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623 + racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f + rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a + rake (13.4.1) sha256=b4e81bd6a748308a6799619d824ec6a23cd1acd07d9ec41e5f2ebfb2294447c8 + regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb + rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 + rspec (3.9.0) sha256=90a037a7cc02365d7c112201881839aafbc875a88094423bc8cba778c98bfac3 + rspec-core (3.9.3) sha256=704f3af166bb8d763199742d94f0be3027c0f26d61a2f2156d99d0444248082d + rspec-expectations (3.9.4) sha256=58248bcc7ca1cde7255aa2436d27a1a6133d8d235409011b5256a24ce050583e + rspec-mocks (3.9.1) sha256=b9820ed35afbc552b4448ccb98984ffe20e92bff6760dbd60f4fec503d6e75a7 + rspec-support (3.9.4) sha256=f4333c6df9413909aa652e8460588b36e8bb62e76e51e94c039e1b4bc3e4e645 + rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f + rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035 + rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834 + ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 + standard (1.54.0) sha256=7a4b08f83d9893083c8f03bc486f0feeb6a84d48233b40829c03ef4767ea0100 + standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b + standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2 + unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42 + unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f + vcr (6.4.0) sha256=077ac92cc16efc5904eb90492a18153b5e6ca5398046d8a249a7c96a9ea24ae6 + webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90 + workos (6.2.0) + BUNDLED WITH - 2.2.33 + 4.0.3 diff --git a/Rakefile b/Rakefile index 82bb534a..b6ae7341 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ # frozen_string_literal: true -require 'bundler/gem_tasks' -require 'rspec/core/rake_task' +require "bundler/gem_tasks" +require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) diff --git a/lib/workos.rb b/lib/workos.rb index b098e3bf..4b92c309 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -require 'workos/version' -require 'json' -require 'workos/hash_provider' -require 'workos/configuration' +require "workos/version" +require "json" +require "workos/hash_provider" +require "workos/configuration" # Use the WorkOS module to authenticate your # requests to the WorkOS API. The gem will read @@ -14,10 +14,10 @@ module WorkOS def self.default_config Configuration.new.tap do |config| - config.api_hostname = ENV['WORKOS_API_HOSTNAME'] || 'api.workos.com' + config.api_hostname = ENV["WORKOS_API_HOSTNAME"] || "api.workos.com" # Remove WORKOS_KEY at some point in the future. Keeping it here now for # backwards compatibility. - config.key = ENV['WORKOS_API_KEY'] || ENV['WORKOS_KEY'] + config.key = ENV["WORKOS_API_KEY"] || ENV["WORKOS_KEY"] end end @@ -30,72 +30,72 @@ def self.configure end def self.key=(value) - warn '`WorkOS.key=` is deprecated. Use `WorkOS.configure` instead.' + warn "`WorkOS.key=` is deprecated. Use `WorkOS.configure` instead." config.key = value end def self.key - warn '`WorkOS.key` is deprecated. Use `WorkOS.configure` instead.' + warn "`WorkOS.key` is deprecated. Use `WorkOS.configure` instead." config.key end - autoload :AuditLogExport, 'workos/audit_log_export' - autoload :AuthenticationFactorAndChallenge, 'workos/authentication_factor_and_challenge' - autoload :AuthenticationResponse, 'workos/authentication_response' - autoload :AuditLogs, 'workos/audit_logs' - autoload :Cache, 'workos/cache' - autoload :Challenge, 'workos/challenge' - autoload :Client, 'workos/client' - autoload :Connection, 'workos/connection' - autoload :DeprecatedHashWrapper, 'workos/deprecated_hash_wrapper' - autoload :Deprecation, 'workos/deprecation' - autoload :Directory, 'workos/directory' - autoload :DirectoryGroup, 'workos/directory_group' - autoload :DirectorySync, 'workos/directory_sync' - autoload :DirectoryUser, 'workos/directory_user' - autoload :EmailVerification, 'workos/email_verification' - autoload :Encryptors, 'workos/encryptors' - autoload :Event, 'workos/event' - autoload :Events, 'workos/events' - autoload :Factor, 'workos/factor' - autoload :FeatureFlag, 'workos/feature_flag' - autoload :Impersonator, 'workos/impersonator' - autoload :Invitation, 'workos/invitation' - autoload :MagicAuth, 'workos/magic_auth' - autoload :MFA, 'workos/mfa' - autoload :OAuthTokens, 'workos/oauth_tokens' - autoload :Organization, 'workos/organization' - autoload :Organizations, 'workos/organizations' - autoload :OrganizationMembership, 'workos/organization_membership' - autoload :Passwordless, 'workos/passwordless' - autoload :PasswordReset, 'workos/password_reset' - autoload :Portal, 'workos/portal' - autoload :Profile, 'workos/profile' - autoload :ProfileAndToken, 'workos/profile_and_token' - autoload :RefreshAuthenticationResponse, 'workos/refresh_authentication_response' - autoload :Role, 'workos/role' - autoload :Session, 'workos/session' - autoload :SSO, 'workos/sso' - autoload :Types, 'workos/types' - autoload :User, 'workos/user' - autoload :UserAndToken, 'workos/user_and_token' - autoload :UserManagement, 'workos/user_management' - autoload :UserResponse, 'workos/user_response' - autoload :VerifyChallenge, 'workos/verify_challenge' - autoload :Webhook, 'workos/webhook' - autoload :Webhooks, 'workos/webhooks' - autoload :Widgets, 'workos/widgets' + autoload :AuditLogExport, "workos/audit_log_export" + autoload :AuthenticationFactorAndChallenge, "workos/authentication_factor_and_challenge" + autoload :AuthenticationResponse, "workos/authentication_response" + autoload :AuditLogs, "workos/audit_logs" + autoload :Cache, "workos/cache" + autoload :Challenge, "workos/challenge" + autoload :Client, "workos/client" + autoload :Connection, "workos/connection" + autoload :DeprecatedHashWrapper, "workos/deprecated_hash_wrapper" + autoload :Deprecation, "workos/deprecation" + autoload :Directory, "workos/directory" + autoload :DirectoryGroup, "workos/directory_group" + autoload :DirectorySync, "workos/directory_sync" + autoload :DirectoryUser, "workos/directory_user" + autoload :EmailVerification, "workos/email_verification" + autoload :Encryptors, "workos/encryptors" + autoload :Event, "workos/event" + autoload :Events, "workos/events" + autoload :Factor, "workos/factor" + autoload :FeatureFlag, "workos/feature_flag" + autoload :Impersonator, "workos/impersonator" + autoload :Invitation, "workos/invitation" + autoload :MagicAuth, "workos/magic_auth" + autoload :MFA, "workos/mfa" + autoload :OAuthTokens, "workos/oauth_tokens" + autoload :Organization, "workos/organization" + autoload :Organizations, "workos/organizations" + autoload :OrganizationMembership, "workos/organization_membership" + autoload :Passwordless, "workos/passwordless" + autoload :PasswordReset, "workos/password_reset" + autoload :Portal, "workos/portal" + autoload :Profile, "workos/profile" + autoload :ProfileAndToken, "workos/profile_and_token" + autoload :RefreshAuthenticationResponse, "workos/refresh_authentication_response" + autoload :Role, "workos/role" + autoload :Session, "workos/session" + autoload :SSO, "workos/sso" + autoload :Types, "workos/types" + autoload :User, "workos/user" + autoload :UserAndToken, "workos/user_and_token" + autoload :UserManagement, "workos/user_management" + autoload :UserResponse, "workos/user_response" + autoload :VerifyChallenge, "workos/verify_challenge" + autoload :Webhook, "workos/webhook" + autoload :Webhooks, "workos/webhooks" + autoload :Widgets, "workos/widgets" # Errors - autoload :APIError, 'workos/errors' - autoload :AuthenticationError, 'workos/errors' - autoload :InvalidRequestError, 'workos/errors' - autoload :ForbiddenRequestError, 'workos/errors' - autoload :SignatureVerificationError, 'workos/errors' - autoload :TimeoutError, 'workos/errors' - autoload :NotFoundError, 'workos/errors' - autoload :UnprocessableEntityError, 'workos/errors' - autoload :RateLimitExceededError, 'workos/errors' + autoload :APIError, "workos/errors" + autoload :AuthenticationError, "workos/errors" + autoload :InvalidRequestError, "workos/errors" + autoload :ForbiddenRequestError, "workos/errors" + autoload :SignatureVerificationError, "workos/errors" + autoload :TimeoutError, "workos/errors" + autoload :NotFoundError, "workos/errors" + autoload :UnprocessableEntityError, "workos/errors" + autoload :RateLimitExceededError, "workos/errors" end diff --git a/lib/workos/audit_log_export.rb b/lib/workos/audit_log_export.rb index a7176831..0c38c258 100644 --- a/lib/workos/audit_log_export.rb +++ b/lib/workos/audit_log_export.rb @@ -25,7 +25,7 @@ def to_json(*) state: state, url: url, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/audit_logs.rb b/lib/workos/audit_logs.rb index 7865e2ca..3d521155 100644 --- a/lib/workos/audit_logs.rb +++ b/lib/workos/audit_logs.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require 'net/http' -require 'uri' +require "net/http" +require "uri" module WorkOS # The Audit Logs module provides convenience methods for working with the @@ -19,13 +19,13 @@ class << self # @return [nil] def create_event(organization:, event:, idempotency_key: nil) request = post_request( - path: '/audit_logs/events', + path: "/audit_logs/events", auth: true, idempotency_key: idempotency_key, body: { organization_id: organization, - event: event, - }, + event: event + } ) execute_request(request: request) @@ -44,23 +44,23 @@ def create_event(organization:, event:, idempotency_key: nil) # # @return [WorkOS::AuditLogExport] def create_export(organization:, range_start:, range_end:, actions: nil, # rubocop:disable Metrics/ParameterLists - actors: nil, targets: nil, actor_names: nil, actor_ids: nil) + actors: nil, targets: nil, actor_names: nil, actor_ids: nil) body = { organization_id: organization, range_start: range_start, - range_end: range_end, + range_end: range_end } - body['actions'] = actions unless actions.nil? - body['actors'] = actors unless actors.nil? - body['actor_names'] = actor_names unless actor_names.nil? - body['actor_ids'] = actor_ids unless actor_ids.nil? - body['targets'] = targets unless targets.nil? + body["actions"] = actions unless actions.nil? + body["actors"] = actors unless actors.nil? + body["actor_names"] = actor_names unless actor_names.nil? + body["actor_ids"] = actor_ids unless actor_ids.nil? + body["targets"] = targets unless targets.nil? request = post_request( - path: '/audit_logs/exports', + path: "/audit_logs/exports", auth: true, - body: body, + body: body ) response = execute_request(request: request) @@ -76,7 +76,7 @@ def create_export(organization:, range_start:, range_end:, actions: nil, # ruboc def get_export(id:) request = get_request( auth: true, - path: "/audit_logs/exports/#{id}", + path: "/audit_logs/exports/#{id}" ) response = execute_request(request: request) diff --git a/lib/workos/authentication_factor_and_challenge.rb b/lib/workos/authentication_factor_and_challenge.rb index 83e8e904..12ad5a3f 100644 --- a/lib/workos/authentication_factor_and_challenge.rb +++ b/lib/workos/authentication_factor_and_challenge.rb @@ -11,17 +11,17 @@ class AuthenticationFactorAndChallenge def initialize(authentication_response_json) json = JSON.parse(authentication_response_json, symbolize_names: true) @authentication_factor = WorkOS::Factor.new( - json[:authentication_factor].to_json, + json[:authentication_factor].to_json ) @authentication_challenge = WorkOS::Challenge.new( - json[:authentication_challenge].to_json, + json[:authentication_challenge].to_json ) end def to_json(*) { authentication_factor: authentication_factor.to_json, - authentication_challenge: authentication_challenge.to_json, + authentication_challenge: authentication_challenge.to_json } end end diff --git a/lib/workos/authentication_response.rb b/lib/workos/authentication_response.rb index 52f733d1..5ea9d8dc 100644 --- a/lib/workos/authentication_response.rb +++ b/lib/workos/authentication_response.rb @@ -7,13 +7,13 @@ class AuthenticationResponse include HashProvider attr_accessor :user, - :organization_id, - :impersonator, - :access_token, - :refresh_token, - :authentication_method, - :sealed_session, - :oauth_tokens + :organization_id, + :impersonator, + :access_token, + :refresh_token, + :authentication_method, + :sealed_session, + :oauth_tokens # rubocop:disable Metrics/AbcSize def initialize(authentication_response_json, session = nil) @@ -25,7 +25,7 @@ def initialize(authentication_response_json, session = nil) @impersonator = if (impersonator_json = json[:impersonator]) Impersonator.new(email: impersonator_json[:email], - reason: impersonator_json[:reason],) + reason: impersonator_json[:reason]) end @authentication_method = json[:authentication_method] @oauth_tokens = json[:oauth_tokens] ? WorkOS::OAuthTokens.new(json[:oauth_tokens].to_json) : nil @@ -37,10 +37,10 @@ def initialize(authentication_response_json, session = nil) refresh_token: refresh_token, user: user.to_json, organization_id: organization_id, - impersonator: impersonator.to_json, + impersonator: impersonator.to_json }, session[:cookie_password], - encryptor: session[:encryptor], + encryptor: session[:encryptor] ) end end @@ -55,7 +55,7 @@ def to_json(*) refresh_token: refresh_token, authentication_method: authentication_method, sealed_session: sealed_session, - oauth_tokens: oauth_tokens&.to_json, + oauth_tokens: oauth_tokens&.to_json } end end diff --git a/lib/workos/challenge.rb b/lib/workos/challenge.rb index fece268d..b403021e 100644 --- a/lib/workos/challenge.rb +++ b/lib/workos/challenge.rb @@ -29,7 +29,7 @@ def to_json(*) code: code, authentication_factor_id: authentication_factor_id, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/client.rb b/lib/workos/client.rb index 1fa102ff..2d2544c3 100644 --- a/lib/workos/client.rb +++ b/lib/workos/client.rb @@ -10,7 +10,7 @@ def client http_client.use_ssl = true http_client.open_timeout = WorkOS.config.timeout http_client.read_timeout = WorkOS.config.timeout - http_client.write_timeout = WorkOS.config.timeout if RUBY_VERSION >= '2.6.0' + http_client.write_timeout = WorkOS.config.timeout if RUBY_VERSION >= "2.6.0" end end @@ -19,7 +19,7 @@ def execute_request(request:) response = client.request(request) rescue Net::OpenTimeout, Net::ReadTimeout, Net::WriteTimeout raise TimeoutError.new( - message: 'API Timeout Error', + message: "API Timeout Error" ) end @@ -35,20 +35,20 @@ def get_request(path:, auth: false, params: {}, access_token: nil) request = Net::HTTP::Get.new( uri.to_s, - 'Content-Type' => 'application/json', + "Content-Type" => "application/json" ) - request['Authorization'] = "Bearer #{access_token || WorkOS.config.key!}" if auth - request['User-Agent'] = user_agent + request["Authorization"] = "Bearer #{access_token || WorkOS.config.key!}" if auth + request["User-Agent"] = user_agent request end def post_request(path:, auth: false, idempotency_key: nil, body: nil) - request = Net::HTTP::Post.new(path, 'Content-Type' => 'application/json') + request = Net::HTTP::Post.new(path, "Content-Type" => "application/json") request.body = body.to_json if body - request['Authorization'] = "Bearer #{WorkOS.config.key!}" if auth - request['Idempotency-Key'] = idempotency_key if idempotency_key - request['User-Agent'] = user_agent + request["Authorization"] = "Bearer #{WorkOS.config.key!}" if auth + request["Idempotency-Key"] = idempotency_key if idempotency_key + request["User-Agent"] = user_agent request end @@ -58,35 +58,35 @@ def delete_request(path:, auth: false, params: {}) request = Net::HTTP::Delete.new( uri.to_s, - 'Content-Type' => 'application/json', + "Content-Type" => "application/json" ) - request['Authorization'] = "Bearer #{WorkOS.config.key!}" if auth - request['User-Agent'] = user_agent + request["Authorization"] = "Bearer #{WorkOS.config.key!}" if auth + request["User-Agent"] = user_agent request end def put_request(path:, auth: false, idempotency_key: nil, body: nil) - request = Net::HTTP::Put.new(path, 'Content-Type' => 'application/json') + request = Net::HTTP::Put.new(path, "Content-Type" => "application/json") request.body = body.to_json if body - request['Authorization'] = "Bearer #{WorkOS.config.key!}" if auth - request['Idempotency-Key'] = idempotency_key if idempotency_key - request['User-Agent'] = user_agent + request["Authorization"] = "Bearer #{WorkOS.config.key!}" if auth + request["Idempotency-Key"] = idempotency_key if idempotency_key + request["User-Agent"] = user_agent request end def user_agent - engine = defined?(::RUBY_ENGINE) ? ::RUBY_ENGINE : 'Ruby' + engine = defined?(::RUBY_ENGINE) ? ::RUBY_ENGINE : "Ruby" [ - 'WorkOS', + "WorkOS", "#{engine}/#{RUBY_VERSION}", RUBY_PLATFORM, "v#{WorkOS::VERSION}" - ].join('; ') + ].join("; ") end - # rubocop:disable Metrics/AbcSize: + # rubocop:disable Metrics/AbcSize def handle_error_response(response:) http_status = response.code.to_i json = JSON.parse(response.body) @@ -94,72 +94,72 @@ def handle_error_response(response:) case http_status when 400 raise InvalidRequestError.new( - message: json['message'], + message: json["message"], http_status: http_status, - request_id: response['x-request-id'], - code: json['code'], - errors: json['errors'], - error: json['error'], - error_description: json['error_description'], - data: json, + request_id: response["x-request-id"], + code: json["code"], + errors: json["errors"], + error: json["error"], + error_description: json["error_description"], + data: json ) when 401 raise AuthenticationError.new( - message: json['message'], + message: json["message"], http_status: http_status, - request_id: response['x-request-id'], + request_id: response["x-request-id"] ) when 403 raise ForbiddenRequestError.new( - message: json['message'], + message: json["message"], http_status: http_status, - request_id: response['x-request-id'], - code: json['code'], - data: json, + request_id: response["x-request-id"], + code: json["code"], + data: json ) when 404 raise NotFoundError.new( - message: json['message'], + message: json["message"], http_status: http_status, - request_id: response['x-request-id'], + request_id: response["x-request-id"] ) when 422 - message = json['message'] - code = json['code'] - errors = extract_error(json['errors']) if json['errors'] + message = json["message"] + code = json["code"] + errors = extract_error(json["errors"]) if json["errors"] message += " (#{errors})" if errors raise UnprocessableEntityError.new( message: message, http_status: http_status, - request_id: response['x-request-id'], - error: json['error'], + request_id: response["x-request-id"], + error: json["error"], errors: errors, - code: code, + code: code ) when 429 raise RateLimitExceededError.new( - message: json['message'], + message: json["message"], http_status: http_status, - request_id: response['x-request-id'], - retry_after: response['Retry-After'], + request_id: response["x-request-id"], + retry_after: response["Retry-After"] ) else raise APIError.new( - message: json['message'], + message: json["message"], http_status: http_status, - request_id: response['x-request-id'], + request_id: response["x-request-id"] ) end end - # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity: + # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity private def extract_error(errors) errors.map do |error| - "#{error['field']}: #{error['code']}" - end.join('; ') + "#{error["field"]}: #{error["code"]}" + end.join("; ") end end end diff --git a/lib/workos/configuration.rb b/lib/workos/configuration.rb index 58be1f5c..980c8080 100644 --- a/lib/workos/configuration.rb +++ b/lib/workos/configuration.rb @@ -10,7 +10,7 @@ def initialize end def key! - key or raise '`WorkOS.config.key` not set' + key or raise "`WorkOS.config.key` not set" end end end diff --git a/lib/workos/connection.rb b/lib/workos/connection.rb index 2608fc16..9e6e931d 100644 --- a/lib/workos/connection.rb +++ b/lib/workos/connection.rb @@ -9,7 +9,7 @@ class Connection include HashProvider attr_accessor :id, :name, :connection_type, :domains, :organization_id, - :state, :status, :created_at, :updated_at + :state, :status, :created_at, :updated_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -35,7 +35,7 @@ def to_json(*) state: state, status: status, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/deprecated_hash_wrapper.rb b/lib/workos/deprecated_hash_wrapper.rb index 756da4a6..314b0a1e 100644 --- a/lib/workos/deprecated_hash_wrapper.rb +++ b/lib/workos/deprecated_hash_wrapper.rb @@ -26,7 +26,7 @@ def [](attribute_name) warning_message = "WARNING: The Hash style access for #{class_name} attributes is deprecated and will be removed in a future version. Please use `#{usage}` or equivalent accessor.\n" - print_deprecation_warning('[]', warning_message) + print_deprecation_warning("[]", warning_message) super(attribute_name.to_sym) end @@ -41,7 +41,7 @@ def deprecation_warning(method_name) end def print_deprecation_warning(method_name, warning_message = deprecation_warning(method_name)) - if RUBY_VERSION > '3' + if RUBY_VERSION > "3" warn warning_message, category: :deprecated else warn warning_message @@ -55,20 +55,20 @@ def class_name # We want to do class_name.demodulize.underscore here, but that's not available in Ruby 1.9, so # implementing the demodulize and underscore methods here. def object_name - i = class_name.rindex('::') - object_name = i ? class_name[(i + 2)..-1] : class_name + i = class_name.rindex("::") + object_name = i ? class_name[(i + 2)..] : class_name underscore(object_name) end def underscore(camel_cased_word) return camel_cased_word.to_s unless /[A-Z-]|::/.match?(camel_cased_word) - word = camel_cased_word.to_s.gsub('::', '/') + word = camel_cased_word.to_s.gsub("::", "/") word.gsub!(/(?:(?<=([A-Za-z\d]))|\b)((?=a)b)(?=\b|[^a-z])/) do - "#{Regexp.last_match(1) && '_'}#{Regexp.last_match(2).downcase}" + "#{Regexp.last_match(1) && "_"}#{Regexp.last_match(2).downcase}" end - word.gsub!(/([A-Z]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) { (Regexp.last_match(1) || Regexp.last_match(2)) << '_' } - word.tr!('-', '_') + word.gsub!(/([A-Z]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) { (Regexp.last_match(1) || Regexp.last_match(2)) << "_" } + word.tr!("-", "_") word.downcase! word end diff --git a/lib/workos/deprecation.rb b/lib/workos/deprecation.rb index 3c348349..7a27114c 100644 --- a/lib/workos/deprecation.rb +++ b/lib/workos/deprecation.rb @@ -6,7 +6,7 @@ module Deprecation def warn_deprecation(message) full_message = "[DEPRECATION] #{message}" - if RUBY_VERSION > '3' + if RUBY_VERSION > "3" warn full_message, category: :deprecated else warn full_message diff --git a/lib/workos/directory.rb b/lib/workos/directory.rb index 7aeb4bce..dcec48cb 100644 --- a/lib/workos/directory.rb +++ b/lib/workos/directory.rb @@ -31,7 +31,7 @@ def to_json(*) state: state, organization_id: organization_id, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/directory_group.rb b/lib/workos/directory_group.rb index 7cdd5a2c..b1d29d48 100644 --- a/lib/workos/directory_group.rb +++ b/lib/workos/directory_group.rb @@ -8,7 +8,7 @@ class DirectoryGroup < DeprecatedHashWrapper include HashProvider attr_accessor :id, :directory_id, :idp_id, :name, :created_at, :updated_at, - :raw_attributes, :organization_id + :raw_attributes, :organization_id def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -34,7 +34,7 @@ def to_json(*) name: name, created_at: created_at, updated_at: updated_at, - raw_attributes: raw_attributes, + raw_attributes: raw_attributes } end end diff --git a/lib/workos/directory_sync.rb b/lib/workos/directory_sync.rb index 17345d7e..10a9a607 100644 --- a/lib/workos/directory_sync.rb +++ b/lib/workos/directory_sync.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'net/http' +require "net/http" module WorkOS # The Directory Sync module provides convenience methods for working with the @@ -26,23 +26,23 @@ class << self # # @return [Hash] def list_directories(options = {}) - options[:order] ||= 'desc' + options[:order] ||= "desc" response = execute_request( request: get_request( - path: '/directories', + path: "/directories", auth: true, - params: options, - ), + params: options + ) ) parsed_response = JSON.parse(response.body) - directories = parsed_response['data'].map do |directory| + directories = parsed_response["data"].map do |directory| ::WorkOS::Directory.new(directory.to_json) end WorkOS::Types::ListStruct.new( data: directories, - list_metadata: parsed_response['listMetadata'], + list_metadata: parsed_response["listMetadata"] ) end @@ -66,7 +66,7 @@ def list_directories(options = {}) def get_directory(id:) request = get_request( auth: true, - path: "/directories/#{id}", + path: "/directories/#{id}" ) response = execute_request(request: request) @@ -90,23 +90,23 @@ def get_directory(id:) # # @return [WorkOS::DirectoryGroup] def list_groups(options = {}) - options[:order] ||= 'desc' + options[:order] ||= "desc" response = execute_request( request: get_request( - path: '/directory_groups', + path: "/directory_groups", auth: true, - params: options, - ), + params: options + ) ) parsed_response = JSON.parse(response.body) - groups = parsed_response['data'].map do |group| + groups = parsed_response["data"].map do |group| ::WorkOS::DirectoryGroup.new(group.to_json) end WorkOS::Types::ListStruct.new( data: groups, - list_metadata: parsed_response['listMetadata'], + list_metadata: parsed_response["listMetadata"] ) end @@ -126,23 +126,23 @@ def list_groups(options = {}) # # @return [WorkOS::DirectoryUser] def list_users(options = {}) - options[:order] ||= 'desc' + options[:order] ||= "desc" response = execute_request( request: get_request( - path: '/directory_users', + path: "/directory_users", auth: true, - params: options, - ), + params: options + ) ) parsed_response = JSON.parse(response.body) - users = parsed_response['data'].map do |user| + users = parsed_response["data"].map do |user| ::WorkOS::DirectoryUser.new(user.to_json) end WorkOS::Types::ListStruct.new( data: users, - list_metadata: parsed_response['listMetadata'], + list_metadata: parsed_response["listMetadata"] ) end @@ -155,8 +155,8 @@ def get_group(id) response = execute_request( request: get_request( path: "/directory_groups/#{id}", - auth: true, - ), + auth: true + ) ) ::WorkOS::DirectoryGroup.new(response.body) @@ -171,8 +171,8 @@ def get_user(id) response = execute_request( request: get_request( path: "/directory_users/#{id}", - auth: true, - ), + auth: true + ) ) ::WorkOS::DirectoryUser.new(response.body) @@ -186,7 +186,7 @@ def get_user(id) def delete_directory(id) request = delete_request( auth: true, - path: "/directories/#{id}", + path: "/directories/#{id}" ) response = execute_request(request: request) diff --git a/lib/workos/directory_user.rb b/lib/workos/directory_user.rb index a168c1ee..8a9b6e2f 100644 --- a/lib/workos/directory_user.rb +++ b/lib/workos/directory_user.rb @@ -8,8 +8,8 @@ class DirectoryUser < DeprecatedHashWrapper include HashProvider attr_accessor :id, :idp_id, :email, :emails, :first_name, :last_name, :job_title, :username, :state, - :groups, :role, :roles, :custom_attributes, :raw_attributes, :directory_id, :organization_id, - :created_at, :updated_at + :groups, :role, :roles, :custom_attributes, :raw_attributes, :directory_id, :organization_id, + :created_at, :updated_at # rubocop:disable Metrics/AbcSize def initialize(json) @@ -48,8 +48,8 @@ def initialize(json) # rubocop:enable Metrics/AbcSize def to_json(*) - base_attributes. - merge(authorization_attributes) + base_attributes + .merge(authorization_attributes) end private @@ -71,14 +71,14 @@ def base_attributes custom_attributes: custom_attributes, raw_attributes: raw_attributes, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end def authorization_attributes { role: role, - roles: roles, + roles: roles } end @@ -87,7 +87,7 @@ def authorization_attributes # @deprecated Will be removed in a future major version. Use {#email} instead. def primary_email primary_email = (emails || []).find { |email| email[:primary] } - return primary_email[:value] if primary_email + primary_email[:value] if primary_email end end end diff --git a/lib/workos/email_verification.rb b/lib/workos/email_verification.rb index 8d205c94..4c63b2de 100644 --- a/lib/workos/email_verification.rb +++ b/lib/workos/email_verification.rb @@ -8,7 +8,7 @@ class EmailVerification include HashProvider attr_accessor :id, :user_id, :email, - :expires_at, :code, :created_at, :updated_at + :expires_at, :code, :created_at, :updated_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -30,7 +30,7 @@ def to_json(*) code: code, expires_at: expires_at, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/encryptors.rb b/lib/workos/encryptors.rb index f78591e0..8384dcf5 100644 --- a/lib/workos/encryptors.rb +++ b/lib/workos/encryptors.rb @@ -4,6 +4,6 @@ module WorkOS # Encryptors module provides pluggable encryption implementations for session data. # The default encryptor is AesGcm, which uses AES-256-GCM encryption. module Encryptors - autoload :AesGcm, 'workos/encryptors/aes_gcm' + autoload :AesGcm, "workos/encryptors/aes_gcm" end end diff --git a/lib/workos/encryptors/aes_gcm.rb b/lib/workos/encryptors/aes_gcm.rb index 72a02248..c5f4fcf5 100644 --- a/lib/workos/encryptors/aes_gcm.rb +++ b/lib/workos/encryptors/aes_gcm.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -require 'encryptor' -require 'securerandom' -require 'json' -require 'base64' +require "encryptor" +require "securerandom" +require "json" +require "base64" module WorkOS module Encryptors @@ -21,7 +21,7 @@ def seal(data, key) value: JSON.generate(data), key: key, iv: iv, - algorithm: 'aes-256-gcm', + algorithm: "aes-256-gcm" ) Base64.encode64(iv + encrypted_data) end @@ -39,7 +39,7 @@ def unseal(sealed_data, key) value: encrypted_data, key: key, iv: iv, - algorithm: 'aes-256-gcm', + algorithm: "aes-256-gcm" ) JSON.parse(decrypted_data, symbolize_names: true) diff --git a/lib/workos/errors.rb b/lib/workos/errors.rb index c7c2acd7..2001ab13 100644 --- a/lib/workos/errors.rb +++ b/lib/workos/errors.rb @@ -37,8 +37,8 @@ def initialize( # rubocop:enable Metrics/ParameterLists def to_s - status_string = @http_status.nil? ? '' : "Status #{@http_status}, " - id_string = @request_id.nil? ? '' : " - request ID: #{@request_id}" + status_string = @http_status.nil? ? "" : "Status #{@http_status}, " + id_string = @request_id.nil? ? "" : " - request ID: #{@request_id}" if @error && @error_description error_string = "error: #{@error}, error_description: #{@error_description}" "#{status_string}#{error_string}#{id_string}" diff --git a/lib/workos/event.rb b/lib/workos/event.rb index 5e38a951..5a337b70 100644 --- a/lib/workos/event.rb +++ b/lib/workos/event.rb @@ -23,7 +23,7 @@ def to_json(*) id: id, event: event, data: data, - created_at: created_at, + created_at: created_at } end end diff --git a/lib/workos/events.rb b/lib/workos/events.rb index 3f39e1dc..354e6ad6 100644 --- a/lib/workos/events.rb +++ b/lib/workos/events.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'net/http' +require "net/http" module WorkOS # The Events module provides convenience methods for working with the @@ -22,24 +22,24 @@ class << self # # @return [Hash] def list_events(options = {}) - raise ArgumentError, 'Events parameter is required.' if options[:events].nil? + raise ArgumentError, "Events parameter is required." if options[:events].nil? response = execute_request( request: get_request( - path: '/events', + path: "/events", auth: true, - params: options, - ), + params: options + ) ) parsed_response = JSON.parse(response.body) - events = parsed_response['data'].map do |event| + events = parsed_response["data"].map do |event| ::WorkOS::Event.new(event.to_json) end WorkOS::Types::ListStruct.new( data: events, - list_metadata: parsed_response['list_metadata'], + list_metadata: parsed_response["list_metadata"] ) end end diff --git a/lib/workos/factor.rb b/lib/workos/factor.rb index bacfb58e..8c6b565c 100644 --- a/lib/workos/factor.rb +++ b/lib/workos/factor.rb @@ -6,6 +6,7 @@ module WorkOS # in DirectoryUser space, and is instantiated internally but exposed. class Factor include HashProvider + attr_accessor :id, :object, :type, :sms, :totp, :updated_at, :created_at def initialize(json) @@ -28,7 +29,7 @@ def to_json(*) totp: totp, sms: sms, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/feature_flag.rb b/lib/workos/feature_flag.rb index 85d958e2..021eac38 100644 --- a/lib/workos/feature_flag.rb +++ b/lib/workos/feature_flag.rb @@ -27,7 +27,7 @@ def to_json(*) slug: slug, description: description, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/hash_provider.rb b/lib/workos/hash_provider.rb index de3e7beb..8a55b191 100644 --- a/lib/workos/hash_provider.rb +++ b/lib/workos/hash_provider.rb @@ -8,7 +8,7 @@ module HashProvider include Kernel def to_json(*) - raise 'Must be implemented by including class.' + raise "Must be implemented by including class." end def to_h diff --git a/lib/workos/impersonator.rb b/lib/workos/impersonator.rb index 08c64b8d..20507425 100644 --- a/lib/workos/impersonator.rb +++ b/lib/workos/impersonator.rb @@ -16,7 +16,7 @@ def initialize(email:, reason:) def to_json(*) { email: email, - reason: reason, + reason: reason } end end diff --git a/lib/workos/invitation.rb b/lib/workos/invitation.rb index 9e182a67..a65d2a97 100644 --- a/lib/workos/invitation.rb +++ b/lib/workos/invitation.rb @@ -8,7 +8,7 @@ class Invitation include HashProvider attr_accessor :id, :email, :state, :accepted_at, :revoked_at, :accept_invitation_url, - :expires_at, :token, :organization_id, :inviter_user_id, :created_at, :updated_at + :expires_at, :token, :organization_id, :inviter_user_id, :created_at, :updated_at # rubocop:disable Metrics/AbcSize def initialize(json) @@ -42,7 +42,7 @@ def to_json(*) revoked_at: revoked_at, expires_at: expires_at, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/magic_auth.rb b/lib/workos/magic_auth.rb index e05aad12..410c4a25 100644 --- a/lib/workos/magic_auth.rb +++ b/lib/workos/magic_auth.rb @@ -8,7 +8,7 @@ class MagicAuth include HashProvider attr_accessor :id, :user_id, :email, - :expires_at, :code, :created_at, :updated_at + :expires_at, :code, :created_at, :updated_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -30,7 +30,7 @@ def to_json(*) code: code, expires_at: expires_at, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/mfa.rb b/lib/workos/mfa.rb index 239edf96..aa4913c8 100644 --- a/lib/workos/mfa.rb +++ b/lib/workos/mfa.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require 'net/http' -require 'uri' +require "net/http" +require "uri" module WorkOS # The MFA module provides convenience methods for working with the WorkOS @@ -14,8 +14,8 @@ def delete_factor(id:) response = execute_request( request: delete_request( path: "/auth/factors/#{id}", - auth: true, - ), + auth: true + ) ) response.is_a? Net::HTTPSuccess end @@ -26,8 +26,8 @@ def get_factor( response = execute_request( request: get_request( path: "/auth/factors/#{id}", - auth: true, - ), + auth: true + ) ) WorkOS::Factor.new(response.body) end @@ -39,15 +39,15 @@ def validate_args( totp_user: nil, phone_number: nil ) - if type != 'sms' && type != 'totp' && type != 'generic_otp' + if type != "sms" && type != "totp" && type != "generic_otp" raise ArgumentError, "Type argument must be either 'sms' or 'totp'" end - if (type == 'totp' && totp_issuer.nil?) || (type == 'totp' && totp_user.nil?) - raise ArgumentError, 'Incomplete arguments. Need to specify both totp_issuer and totp_user when type is totp' + if (type == "totp" && totp_issuer.nil?) || (type == "totp" && totp_user.nil?) + raise ArgumentError, "Incomplete arguments. Need to specify both totp_issuer and totp_user when type is totp" end - return unless type == 'sms' && phone_number.nil? + return unless type == "sms" && phone_number.nil? - raise ArgumentError, 'Incomplete arguments. Need to specify phone_number when type is sms' + raise ArgumentError, "Incomplete arguments. Need to specify phone_number when type is sms" end # rubocop:enable Metrics/CyclomaticComplexity # rubocop:enable Metrics/PerceivedComplexity @@ -62,7 +62,7 @@ def enroll_factor( type: type, totp_issuer: totp_issuer, totp_user: totp_user, - phone_number: phone_number, + phone_number: phone_number ) response = execute_request(request: post_request( auth: true, @@ -70,9 +70,9 @@ def enroll_factor( type: type, totp_issuer: totp_issuer, totp_user: totp_user, - phone_number: phone_number, + phone_number: phone_number }, - path: '/auth/factors/enroll', + path: "/auth/factors/enroll" )) WorkOS::Factor.new(response.body) end @@ -88,9 +88,9 @@ def challenge_factor( request = post_request( auth: true, body: { - sms_template: sms_template, + sms_template: sms_template }, - path: "/auth/factors/#{authentication_factor_id}/challenge", + path: "/auth/factors/#{authentication_factor_id}/challenge" ) response = execute_request(request: request) @@ -101,11 +101,11 @@ def verify_factor( authentication_challenge_id: nil, code: nil ) - warn_deprecation '`verify_factor` is deprecated. Please use `verify_challenge` instead.' + warn_deprecation "`verify_factor` is deprecated. Please use `verify_challenge` instead." verify_challenge( authentication_challenge_id: authentication_challenge_id, - code: code, + code: code ) end @@ -113,21 +113,20 @@ def verify_challenge( authentication_challenge_id: nil, code: nil ) - if authentication_challenge_id.nil? || code.nil? raise ArgumentError, "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments" end options = { - "code": code, + code: code } response = execute_request( request: post_request( path: "/auth/challenges/#{authentication_challenge_id}/verify", auth: true, - body: options, - ), + body: options + ) ) WorkOS::VerifyChallenge.new(response.body) end diff --git a/lib/workos/oauth_tokens.rb b/lib/workos/oauth_tokens.rb index f124085c..9456d38f 100644 --- a/lib/workos/oauth_tokens.rb +++ b/lib/workos/oauth_tokens.rb @@ -22,7 +22,7 @@ def to_json(*) access_token: access_token, refresh_token: refresh_token, scopes: scopes, - expires_at: expires_at, + expires_at: expires_at } end end diff --git a/lib/workos/organization.rb b/lib/workos/organization.rb index 19c98a20..8c88fdaa 100644 --- a/lib/workos/organization.rb +++ b/lib/workos/organization.rb @@ -15,7 +15,7 @@ class Organization :external_id, :allow_profiles_outside_organization, :created_at, - :updated_at, + :updated_at ) def initialize(json) @@ -40,7 +40,7 @@ def to_json(*) domains: domains, stripe_customer_id: stripe_customer_id, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/organization_membership.rb b/lib/workos/organization_membership.rb index cde9a901..18a51ea3 100644 --- a/lib/workos/organization_membership.rb +++ b/lib/workos/organization_membership.rb @@ -8,7 +8,7 @@ class OrganizationMembership include HashProvider attr_accessor :id, :user_id, :organization_id, :status, :role, :roles, :custom_attributes, :directory_managed, - :created_at, :updated_at + :created_at, :updated_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -36,7 +36,7 @@ def to_json(*) custom_attributes: custom_attributes, directory_managed: directory_managed, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index d130fa03..d7bc14c4 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'net/http' +require "net/http" module WorkOS # The Organizations module provides resource methods for working with Organizations @@ -22,24 +22,24 @@ class << self # @param [String] order The order in which to paginate records # of listed Organizations that are returned. def list_organizations(options = {}) - options[:order] ||= 'desc' + options[:order] ||= "desc" response = execute_request( request: get_request( - path: '/organizations', + path: "/organizations", auth: true, - params: options, - ), + params: options + ) ) parsed_response = JSON.parse(response.body) - organizations = parsed_response['data'].map do |organization| + organizations = parsed_response["data"].map do |organization| ::WorkOS::Organization.new(organization.to_json) end WorkOS::Types::ListStruct.new( data: organizations, - list_metadata: parsed_response['listMetadata'], + list_metadata: parsed_response["listMetadata"] ) end @@ -61,7 +61,7 @@ def list_organizations(options = {}) def get_organization(id:) request = get_request( auth: true, - path: "/organizations/#{id}", + path: "/organizations/#{id}" ) response = execute_request(request: request) @@ -83,33 +83,32 @@ def get_organization(id:) # @param [Array] domains List of domains that belong to the organization. # Deprecated: Use domain_data instead. def create_organization( - domain_data: nil, + name:, domain_data: nil, domains: nil, - name:, external_id: nil, allow_profiles_outside_organization: nil, idempotency_key: nil ) - body = { name: name } + body = {name: name} body[:domain_data] = domain_data if domain_data body[:external_id] = external_id if external_id if domains - warn_deprecation '`domains` is deprecated. Use `domain_data` instead.' + warn_deprecation "`domains` is deprecated. Use `domain_data` instead." body[:domains] = domains end unless allow_profiles_outside_organization.nil? - warn_deprecation '`allow_profiles_outside_organization` is deprecated. ' \ - 'If you need to allow sign-ins from any email domain, contact support@workos.com.' + warn_deprecation "`allow_profiles_outside_organization` is deprecated. " \ + "If you need to allow sign-ins from any email domain, contact support@workos.com." body[:allow_profiles_outside_organization] = allow_profiles_outside_organization end request = post_request( auth: true, body: body, - path: '/organizations', - idempotency_key: idempotency_key, + path: "/organizations", + idempotency_key: idempotency_key ) response = execute_request(request: request) @@ -142,26 +141,26 @@ def update_organization( external_id: :not_set, allow_profiles_outside_organization: nil ) - body = { name: name } + body = {name: name} body[:domain_data] = domain_data if domain_data body[:stripe_customer_id] = stripe_customer_id if stripe_customer_id body[:external_id] = external_id if external_id != :not_set if domains - warn_deprecation '`domains` is deprecated. Use `domain_data` instead.' + warn_deprecation "`domains` is deprecated. Use `domain_data` instead." body[:domains] = domains end unless allow_profiles_outside_organization.nil? - warn_deprecation '`allow_profiles_outside_organization` is deprecated. ' \ - 'If you need to allow sign-ins from any email domain, contact support@workos.com.' + warn_deprecation "`allow_profiles_outside_organization` is deprecated. " \ + "If you need to allow sign-ins from any email domain, contact support@workos.com." body[:allow_profiles_outside_organization] = allow_profiles_outside_organization end request = put_request( auth: true, body: body, - path: "/organizations/#{organization}", + path: "/organizations/#{organization}" ) response = execute_request(request: request) @@ -183,7 +182,7 @@ def update_organization( def delete_organization(id:) request = delete_request( auth: true, - path: "/organizations/#{id}", + path: "/organizations/#{id}" ) response = execute_request(request: request) @@ -205,13 +204,13 @@ def list_organization_roles(organization_id:) response = execute_request( request: get_request( path: "/organizations/#{organization_id}/roles", - auth: true, - ), + auth: true + ) ) parsed_response = JSON.parse(response.body) - roles = parsed_response['data'].map do |role| + roles = parsed_response["data"].map do |role| WorkOS::Role.new(role.to_json) end @@ -219,8 +218,8 @@ def list_organization_roles(organization_id:) data: roles, list_metadata: { after: nil, - before: nil, - }, + before: nil + } ) end @@ -243,24 +242,24 @@ def list_organization_roles(organization_id:) # # @return [WorkOS::Types::ListStruct] - Collection of FeatureFlag objects def list_organization_feature_flags(organization_id:, options: {}) - options[:order] ||= 'desc' + options[:order] ||= "desc" response = execute_request( request: get_request( path: "/organizations/#{organization_id}/feature-flags", auth: true, - params: options, - ), + params: options + ) ) parsed_response = JSON.parse(response.body) - feature_flags = parsed_response['data'].map do |feature_flag| + feature_flags = parsed_response["data"].map do |feature_flag| WorkOS::FeatureFlag.new(feature_flag.to_json) end WorkOS::Types::ListStruct.new( data: feature_flags, - list_metadata: parsed_response['list_metadata']&.transform_keys(&:to_sym), + list_metadata: parsed_response["list_metadata"]&.transform_keys(&:to_sym) ) end @@ -269,18 +268,18 @@ def list_organization_feature_flags(organization_id:, options: {}) def check_and_raise_organization_error(response:) begin body = JSON.parse(response.body) - return unless body['message'] + return unless body["message"] - message = body['message'] - request_id = response['x-request-id'] - rescue StandardError - message = 'Something went wrong' + message = body["message"] + request_id = response["x-request-id"] + rescue + message = "Something went wrong" end raise APIError.new( message: message, http_status: nil, - request_id: request_id, + request_id: request_id ) end end diff --git a/lib/workos/password_reset.rb b/lib/workos/password_reset.rb index be7db0cc..bff82840 100644 --- a/lib/workos/password_reset.rb +++ b/lib/workos/password_reset.rb @@ -8,7 +8,7 @@ class PasswordReset include HashProvider attr_accessor :id, :user_id, :email, :password_reset_token, - :password_reset_url, :expires_at, :created_at + :password_reset_url, :expires_at, :created_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -30,7 +30,7 @@ def to_json(*) password_reset_token: password_reset_token, password_reset_url: password_reset_url, expires_at: expires_at, - created_at: created_at, + created_at: created_at } end end diff --git a/lib/workos/passwordless.rb b/lib/workos/passwordless.rb index 7ac0c5fd..3dab658f 100644 --- a/lib/workos/passwordless.rb +++ b/lib/workos/passwordless.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'net/http' +require "net/http" module WorkOS # The Passwordless module provides convenience methods for working with @@ -34,19 +34,19 @@ class << self def create_session(options) response = execute_request( request: post_request( - path: '/passwordless/sessions', + path: "/passwordless/sessions", auth: true, - body: options, - ), + body: options + ) ) hash = JSON.parse(response.body) WorkOS::Types::PasswordlessSessionStruct.new( - id: hash['id'], - email: hash['email'], - expires_at: Date.parse(hash['expires_at']), - link: hash['link'], + id: hash["id"], + email: hash["email"], + expires_at: Date.parse(hash["expires_at"]), + link: hash["link"] ) end @@ -60,8 +60,8 @@ def send_session(session_id) response = execute_request( request: post_request( path: "/passwordless/sessions/#{session_id}/send", - auth: true, - ), + auth: true + ) ) JSON.parse(response.body) diff --git a/lib/workos/portal.rb b/lib/workos/portal.rb index 90fc37a9..00f0ee96 100644 --- a/lib/workos/portal.rb +++ b/lib/workos/portal.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'net/http' +require "net/http" module WorkOS # The Portal module provides resource methods for working with the Admin @@ -31,14 +31,14 @@ def generate_link(intent:, organization:, return_url: nil, success_url: nil) intent: intent, organization: organization, return_url: return_url, - success_url: success_url, + success_url: success_url }, - path: '/portal/generate_link', + path: "/portal/generate_link" ) response = execute_request(request: request) - JSON.parse(response.body)['link'] + JSON.parse(response.body)["link"] end private diff --git a/lib/workos/profile.rb b/lib/workos/profile.rb index 56c101e7..8afdf203 100644 --- a/lib/workos/profile.rb +++ b/lib/workos/profile.rb @@ -10,7 +10,7 @@ class Profile include HashProvider attr_accessor :id, :email, :first_name, :last_name, :role, :roles, :groups, :organization_id, - :connection_id, :connection_type, :idp_id, :custom_attributes, :raw_attributes + :connection_id, :connection_type, :idp_id, :custom_attributes, :raw_attributes # rubocop:disable Metrics/AbcSize def initialize(profile_json) @@ -33,7 +33,7 @@ def initialize(profile_json) # rubocop:enable Metrics/AbcSize def full_name - [first_name, last_name].compact.join(' ') + [first_name, last_name].compact.join(" ") end def to_json(*) @@ -50,7 +50,7 @@ def to_json(*) connection_type: connection_type, idp_id: idp_id, custom_attributes: custom_attributes, - raw_attributes: raw_attributes, + raw_attributes: raw_attributes } end end diff --git a/lib/workos/profile_and_token.rb b/lib/workos/profile_and_token.rb index 8031d90f..6109d2a3 100644 --- a/lib/workos/profile_and_token.rb +++ b/lib/workos/profile_and_token.rb @@ -19,7 +19,7 @@ def initialize(profile_and_token_json) def to_json(*) { access_token: access_token, - profile: profile.to_json, + profile: profile.to_json } end end diff --git a/lib/workos/refresh_authentication_response.rb b/lib/workos/refresh_authentication_response.rb index 76d5c04a..3a9b7eff 100644 --- a/lib/workos/refresh_authentication_response.rb +++ b/lib/workos/refresh_authentication_response.rb @@ -18,7 +18,7 @@ def initialize(authentication_response_json, session = nil) @impersonator = if (impersonator_json = json[:impersonator]) Impersonator.new(email: impersonator_json[:email], - reason: impersonator_json[:reason],) + reason: impersonator_json[:reason]) end @sealed_session = if session && session[:seal_session] @@ -28,10 +28,10 @@ def initialize(authentication_response_json, session = nil) refresh_token: refresh_token, user: user.to_json, organization_id: organization_id, - impersonator: impersonator.to_json, + impersonator: impersonator.to_json }, session[:cookie_password], - encryptor: session[:encryptor], + encryptor: session[:encryptor] ) end end @@ -44,7 +44,7 @@ def to_json(*) impersonator: impersonator.to_json, access_token: access_token, refresh_token: refresh_token, - sealed_session: sealed_session, + sealed_session: sealed_session } end end diff --git a/lib/workos/role.rb b/lib/workos/role.rb index e54db2a9..62749e5e 100644 --- a/lib/workos/role.rb +++ b/lib/workos/role.rb @@ -31,7 +31,7 @@ def to_json(*) permissions: permissions, type: type, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/session.rb b/lib/workos/session.rb index d61ce9d3..93f099bd 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -1,12 +1,11 @@ # frozen_string_literal: true -require 'jwt' -require 'uri' -require 'net/http' -require 'encryptor' -require 'securerandom' -require 'json' -require 'uri' +require "jwt" +require "uri" +require "net/http" +require "encryptor" +require "securerandom" +require "json" module WorkOS # The Session class provides helper methods for working with WorkOS sessions @@ -15,7 +14,7 @@ class Session attr_accessor :jwks, :jwks_algorithms, :user_management, :cookie_password, :session_data, :client_id, :encryptor def initialize(user_management:, client_id:, session_data:, cookie_password:, encryptor: nil) - raise ArgumentError, 'cookiePassword is required' if cookie_password.nil? || cookie_password.empty? + raise ArgumentError, "cookiePassword is required" if cookie_password.nil? || cookie_password.empty? @encryptor = encryptor || WorkOS::Encryptors::AesGcm.new validate_encryptor!(@encryptor) @@ -37,15 +36,15 @@ def initialize(user_management:, client_id:, session_data:, cookie_password:, en # @return [Hash] A hash containing the authentication response and a reason if the authentication failed # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity def authenticate(include_expired: false, &claim_extractor) - return { authenticated: false, reason: 'NO_SESSION_COOKIE_PROVIDED' } if @session_data.nil? + return {authenticated: false, reason: "NO_SESSION_COOKIE_PROVIDED"} if @session_data.nil? begin session = Session.unseal_data(@session_data, @cookie_password, encryptor: @encryptor) - rescue StandardError - return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } + rescue + return {authenticated: false, reason: "INVALID_SESSION_COOKIE"} end - return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } unless session[:access_token] + return {authenticated: false, reason: "INVALID_SESSION_COOKIE"} unless session[:access_token] begin decoded = JWT.decode( @@ -54,34 +53,34 @@ def authenticate(include_expired: false, &claim_extractor) true, algorithms: @jwks_algorithms, jwks: @jwks, - verify_expiration: false, + verify_expiration: false ).first - expired = decoded['exp'] && decoded['exp'] < Time.now.to_i + expired = decoded["exp"] && decoded["exp"] < Time.now.to_i # Early return for expired tokens when not including expired data (backward compatible) - return { authenticated: false, reason: 'INVALID_JWT' } if expired && !include_expired + return {authenticated: false, reason: "INVALID_JWT"} if expired && !include_expired # Return full data for valid tokens or when include_expired is true result = { authenticated: !expired, - session_id: decoded['sid'], - organization_id: decoded['org_id'], - role: decoded['role'], - roles: decoded['roles'], - permissions: decoded['permissions'], - entitlements: decoded['entitlements'], - feature_flags: decoded['feature_flags'], + session_id: decoded["sid"], + organization_id: decoded["org_id"], + role: decoded["role"], + roles: decoded["roles"], + permissions: decoded["permissions"], + entitlements: decoded["entitlements"], + feature_flags: decoded["feature_flags"], user: session[:user], impersonator: session[:impersonator], - reason: expired ? 'INVALID_JWT' : nil, + reason: expired ? "INVALID_JWT" : nil } result.merge!(claim_extractor.call(decoded)) if block_given? result rescue JWT::DecodeError - { authenticated: false, reason: 'INVALID_JWT' } - rescue StandardError => e - { authenticated: false, reason: e.message } + {authenticated: false, reason: "INVALID_JWT"} + rescue => e + {authenticated: false, reason: e.message} end end @@ -92,22 +91,22 @@ def authenticate(include_expired: false, &claim_extractor) # @return [Hash] A hash containing a new sealed session, the authentication response, # and a reason if the refresh failed def refresh(options = nil) - cookie_password = options.nil? || options[:cookie_password].nil? ? @cookie_password : options[:cookie_password] + cookie_password = (options.nil? || options[:cookie_password].nil?) ? @cookie_password : options[:cookie_password] begin session = Session.unseal_data(@session_data, cookie_password, encryptor: @encryptor) - rescue StandardError - return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } + rescue + return {authenticated: false, reason: "INVALID_SESSION_COOKIE"} end - return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } unless session[:refresh_token] && session[:user] + return {authenticated: false, reason: "INVALID_SESSION_COOKIE"} unless session[:refresh_token] && session[:user] begin auth_response = @user_management.authenticate_with_refresh_token( client_id: @client_id, refresh_token: session[:refresh_token], - organization_id: options.nil? || options[:organization_id].nil? ? nil : options[:organization_id], - session: { seal_session: true, cookie_password: cookie_password, encryptor: @encryptor }, + organization_id: (options.nil? || options[:organization_id].nil?) ? nil : options[:organization_id], + session: {seal_session: true, cookie_password: cookie_password, encryptor: @encryptor} ) @session_data = auth_response.sealed_session @@ -117,10 +116,10 @@ def refresh(options = nil) authenticated: true, sealed_session: auth_response.sealed_session, session: auth_response, - reason: nil, + reason: nil } - rescue StandardError => e - { authenticated: false, reason: e.message } + rescue => e + {authenticated: false, reason: e.message} end end # rubocop:enable Metrics/AbcSize @@ -165,7 +164,7 @@ def self.unseal_data(sealed_data, key, encryptor: nil) def validate_encryptor!(enc) return if enc.respond_to?(:seal) && enc.respond_to?(:unseal) - raise ArgumentError, 'encryptor must respond to #seal(data, key) and #unseal(sealed_data, key)' + raise ArgumentError, "encryptor must respond to #seal(data, key) and #unseal(sealed_data, key)" end # Creates a JWKS set from a remote JWKS URL @@ -179,7 +178,7 @@ def create_remote_jwk_set(uri) jwks = JWT::JWK::Set.new(jwks_hash) # filter jwks so it only returns the keys where 'use' is equal to 'sig' - jwks.keys.select! { |key| key[:use] == 'sig' } + jwks.keys.select! { |key| key[:use] == "sig" } jwks end diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index 87e90a33..fc736ba9 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require 'net/http' -require 'uri' +require "net/http" +require "uri" module WorkOS # The SSO module provides convenience methods for working with the WorkOS @@ -62,7 +62,7 @@ def authorization_url( provider: nil, connection: nil, organization: nil, - state: '' + state: "" ) if domain warn_deprecation '[DEPRECATION] `domain` is deprecated. @@ -73,20 +73,20 @@ def authorization_url( provider: provider, domain: domain, connection: connection, - organization: organization, + organization: organization ) query = URI.encode_www_form({ client_id: client_id, redirect_uri: redirect_uri, - response_type: 'code', + response_type: "code", state: state, domain: domain, domain_hint: domain_hint, login_hint: login_hint, provider: provider, connection: connection, - organization: organization, + organization: organization }.compact) "https://#{WorkOS.config.api_hostname}/sso/authorize?#{query}" @@ -96,10 +96,10 @@ def authorization_url( def get_profile(access_token:) response = execute_request( request: get_request( - path: '/sso/profile', + path: "/sso/profile", auth: true, - access_token: access_token, - ), + access_token: access_token + ) ) WorkOS::Profile.new(response.body) @@ -116,12 +116,12 @@ def profile_and_token(code:, client_id: nil) body = { client_id: client_id, client_secret: WorkOS.config.key!, - grant_type: 'authorization_code', - code: code, + grant_type: "authorization_code", + code: code } response = execute_request( - request: post_request(path: '/sso/token', body: body), + request: post_request(path: "/sso/token", body: body) ) WorkOS::ProfileAndToken.new(response.body) @@ -145,23 +145,23 @@ def profile_and_token(code:, client_id: nil) # # @return [Hash] def list_connections(options = {}) - options[:order] ||= 'desc' + options[:order] ||= "desc" response = execute_request( request: get_request( - path: '/connections', + path: "/connections", auth: true, - params: options, - ), + params: options + ) ) parsed_response = JSON.parse(response.body) - connections = parsed_response['data'].map do |connection| + connections = parsed_response["data"].map do |connection| ::WorkOS::Connection.new(connection.to_json) end WorkOS::Types::ListStruct.new( data: connections, - list_metadata: parsed_response['listMetadata'], + list_metadata: parsed_response["listMetadata"] ) end @@ -184,7 +184,7 @@ def list_connections(options = {}) def get_connection(id:) request = get_request( auth: true, - path: "/connections/#{id}", + path: "/connections/#{id}" ) response = execute_request(request: request) @@ -204,7 +204,7 @@ def get_connection(id:) def delete_connection(id:) request = delete_request( auth: true, - path: "/connections/#{id}", + path: "/connections/#{id}" ) response = execute_request(request: request) @@ -221,8 +221,8 @@ def validate_authorization_url_arguments( organization: ) if [domain, provider, connection, organization].all?(&:nil?) - raise ArgumentError, 'Either connection, domain, ' \ - 'provider, or organization is required.' + raise ArgumentError, "Either connection, domain, " \ + "provider, or organization is required." end return unless provider && !PROVIDERS.include?(provider) diff --git a/lib/workos/types.rb b/lib/workos/types.rb index 6b8cef87..4a91d299 100644 --- a/lib/workos/types.rb +++ b/lib/workos/types.rb @@ -3,10 +3,10 @@ module WorkOS # Types contains a few structs wrapping up common data structures. module Types - autoload :Provider, 'workos/types/provider' - autoload :Intent, 'workos/types/intent' - autoload :ListStruct, 'workos/types/list_struct' - autoload :PasswordlessSessionStruct, 'workos/types/passwordless_session_struct' - autoload :WidgetScope, 'workos/types/widget_scope' + autoload :Provider, "workos/types/provider" + autoload :Intent, "workos/types/intent" + autoload :ListStruct, "workos/types/list_struct" + autoload :PasswordlessSessionStruct, "workos/types/passwordless_session_struct" + autoload :WidgetScope, "workos/types/widget_scope" end end diff --git a/lib/workos/types/intent.rb b/lib/workos/types/intent.rb index 4a8e8728..c5ef657f 100644 --- a/lib/workos/types/intent.rb +++ b/lib/workos/types/intent.rb @@ -5,12 +5,12 @@ module Types # The Intent constants are declarations of a fixed set of values for # intents while generating an Admin Portal link. module Intent - AUDIT_LOGS = 'audit_logs' - CERTIFICATE_RENEWAL = 'certificate_renewal' - DOMAIN_VERIFICATION = 'domain_verification' - DSYNC = 'dsync' - LOG_STREAMS = 'log_streams' - SSO = 'sso' + AUDIT_LOGS = "audit_logs" + CERTIFICATE_RENEWAL = "certificate_renewal" + DOMAIN_VERIFICATION = "domain_verification" + DSYNC = "dsync" + LOG_STREAMS = "log_streams" + SSO = "sso" ALL = [AUDIT_LOGS, CERTIFICATE_RENEWAL, DOMAIN_VERIFICATION, DSYNC, LOG_STREAMS, SSO].freeze end diff --git a/lib/workos/types/provider.rb b/lib/workos/types/provider.rb index c0bbd2c0..374afce6 100644 --- a/lib/workos/types/provider.rb +++ b/lib/workos/types/provider.rb @@ -5,10 +5,10 @@ module Types # The Provider constants are declarations of a # fixed set of values for SSO Providers. module Provider - Apple = 'AppleOAuth' - GitHub = 'GitHubOAuth' - Google = 'GoogleOAuth' - Microsoft = 'MicrosoftOAuth' + Apple = "AppleOAuth" + GitHub = "GitHubOAuth" + Google = "GoogleOAuth" + Microsoft = "MicrosoftOAuth" ALL = [Apple, GitHub, Google, Microsoft].freeze end diff --git a/lib/workos/types/widget_scope.rb b/lib/workos/types/widget_scope.rb index d4097346..9e8c200e 100644 --- a/lib/workos/types/widget_scope.rb +++ b/lib/workos/types/widget_scope.rb @@ -5,9 +5,9 @@ module Types # The WidgetScope constants are declarations of a fixed set of values for # scopes while generating a widget token. module WidgetScope - USERS_TABLE_MANAGE = 'widgets:users-table:manage' - SSO_MANAGE = 'widgets:sso:manage' - DOMAIN_VERIFICATION_MANAGE = 'widgets:domain-verification:manage' + USERS_TABLE_MANAGE = "widgets:users-table:manage" + SSO_MANAGE = "widgets:sso:manage" + DOMAIN_VERIFICATION_MANAGE = "widgets:domain-verification:manage" ALL = [USERS_TABLE_MANAGE, SSO_MANAGE, DOMAIN_VERIFICATION_MANAGE].freeze end diff --git a/lib/workos/user.rb b/lib/workos/user.rb index 6e952815..353a89d4 100644 --- a/lib/workos/user.rb +++ b/lib/workos/user.rb @@ -8,7 +8,7 @@ class User include HashProvider attr_accessor :id, :email, :first_name, :last_name, :email_verified, - :profile_picture_url, :external_id, :locale, :last_sign_in_at, :created_at, :updated_at + :profile_picture_url, :external_id, :locale, :last_sign_in_at, :created_at, :updated_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -38,7 +38,7 @@ def to_json(*) locale: locale, last_sign_in_at: last_sign_in_at, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end end diff --git a/lib/workos/user_and_token.rb b/lib/workos/user_and_token.rb index 75a20aa9..c53e1d52 100644 --- a/lib/workos/user_and_token.rb +++ b/lib/workos/user_and_token.rb @@ -19,7 +19,7 @@ def initialize(user_and_token_json) def to_json(*) { token: token, - user: user.to_json, + user: user.to_json } end end diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 7cfbe96c..68cfd08b 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -1,23 +1,23 @@ # frozen_string_literal: true -require 'net/http' -require 'uri' +require "net/http" +require "uri" module WorkOS # The UserManagement module provides convenience methods for working with the # WorkOS User platform. You'll need a valid API key. module UserManagement - autoload :Session, 'workos/user_management/session' + autoload :Session, "workos/user_management/session" module Types # The ProviderEnum is a declaration of a # fixed set of values for User Management Providers. class Provider - Apple = 'AppleOAuth' - GitHub = 'GitHubOAuth' - Google = 'GoogleOAuth' - Microsoft = 'MicrosoftOAuth' - AuthKit = 'authkit' + Apple = "AppleOAuth" + GitHub = "GitHubOAuth" + Google = "GoogleOAuth" + Microsoft = "MicrosoftOAuth" + AuthKit = "authkit" ALL = [Apple, GitHub, Google, Microsoft, AuthKit].freeze end @@ -25,7 +25,7 @@ class Provider # The AuthFactorType is a declaration of a # fixed set of factor values to enroll class AuthFactorType - Totp = 'totp' + Totp = "totp" ALL = [Totp].freeze end @@ -51,7 +51,7 @@ def load_sealed_session(client_id:, session_data:, cookie_password:, encryptor: client_id: client_id, session_data: session_data, cookie_password: cookie_password, - encryptor: encryptor, + encryptor: encryptor ) end @@ -104,20 +104,19 @@ def authorization_url( provider: nil, connection_id: nil, organization_id: nil, - state: '', + state: "", provider_scopes: nil ) - validate_authorization_url_arguments( provider: provider, connection_id: connection_id, - organization_id: organization_id, + organization_id: organization_id ) query = URI.encode_www_form({ client_id: client_id, redirect_uri: redirect_uri, - response_type: 'code', + response_type: "code", state: state, domain_hint: domain_hint, login_hint: login_hint, @@ -125,7 +124,7 @@ def authorization_url( provider: provider, connection_id: connection_id, organization_id: organization_id, - provider_scopes: provider_scopes, + provider_scopes: provider_scopes }.compact) "https://#{WorkOS.config.api_hostname}/user_management/authorize?#{query}" @@ -141,8 +140,8 @@ def get_user(id:) response = execute_request( request: get_request( path: "/user_management/users/#{id}", - auth: true, - ), + auth: true + ) ) WorkOS::User.new(response.body) @@ -162,24 +161,24 @@ def get_user(id:) # # @return [WorkOS::User] def list_users(options = {}) - options[:order] ||= 'desc' + options[:order] ||= "desc" response = execute_request( request: get_request( - path: '/user_management/users', + path: "/user_management/users", auth: true, - params: options, - ), + params: options + ) ) parsed_response = JSON.parse(response.body) - users = parsed_response['data'].map do |user| + users = parsed_response["data"].map do |user| ::WorkOS::User.new(user.to_json) end WorkOS::Types::ListStruct.new( data: users, - list_metadata: parsed_response['list_metadata'], + list_metadata: parsed_response["list_metadata"] ) end @@ -207,7 +206,7 @@ def create_user( password_hash_type: nil ) request = post_request( - path: '/user_management/users', + path: "/user_management/users", body: { email: email, password: password, @@ -216,9 +215,9 @@ def create_user( email_verified: email_verified, external_id: external_id, password_hash: password_hash, - password_hash_type: password_hash_type, + password_hash_type: password_hash_type }.compact, - auth: true, + auth: true ) response = execute_request(request: request) @@ -264,9 +263,9 @@ def update_user( locale: locale, password: password, password_hash: password_hash, - password_hash_type: password_hash_type, + password_hash_type: password_hash_type }.reject { |_, v| v == :not_set }, - auth: true, + auth: true ) response = execute_request(request: request) @@ -284,8 +283,8 @@ def delete_user(id:) response = execute_request( request: delete_request( path: "/user_management/users/#{id}", - auth: true, - ), + auth: true + ) ) response.is_a? Net::HTTPSuccess @@ -317,7 +316,7 @@ def authenticate_with_password( response = execute_request( request: post_request( - path: '/user_management/authenticate', + path: "/user_management/authenticate", body: { client_id: client_id, client_secret: WorkOS.config.key!, @@ -326,9 +325,9 @@ def authenticate_with_password( ip_address: ip_address, user_agent: user_agent, invitation_token: invitation_token, - grant_type: 'password', - }, - ), + grant_type: "password" + } + ) ) WorkOS::AuthenticationResponse.new(response.body, session) @@ -359,7 +358,7 @@ def authenticate_with_code( response = execute_request( request: post_request( - path: '/user_management/authenticate', + path: "/user_management/authenticate", body: { code: code, client_id: client_id, @@ -367,9 +366,9 @@ def authenticate_with_code( ip_address: ip_address, user_agent: user_agent, invitation_token: invitation_token, - grant_type: 'authorization_code', - }, - ), + grant_type: "authorization_code" + } + ) ) WorkOS::AuthenticationResponse.new(response.body, session) @@ -398,17 +397,17 @@ def authenticate_with_refresh_token( response = execute_request( request: post_request( - path: '/user_management/authenticate', + path: "/user_management/authenticate", body: { refresh_token: refresh_token, client_id: client_id, client_secret: WorkOS.config.key!, ip_address: ip_address, user_agent: user_agent, - grant_type: 'refresh_token', - organization_id: organization_id, - }, - ), + grant_type: "refresh_token", + organization_id: organization_id + } + ) ) WorkOS::RefreshAuthenticationResponse.new(response.body, session) @@ -443,7 +442,7 @@ def authenticate_with_magic_auth( response = execute_request( request: post_request( - path: '/user_management/authenticate', + path: "/user_management/authenticate", body: { code: code, email: email, @@ -451,11 +450,11 @@ def authenticate_with_magic_auth( client_secret: WorkOS.config.key!, ip_address: ip_address, user_agent: user_agent, - grant_type: 'urn:workos:oauth:grant-type:magic-auth:code', + grant_type: "urn:workos:oauth:grant-type:magic-auth:code", link_authorization_code: link_authorization_code, - invitation_token: invitation_token, - }, - ), + invitation_token: invitation_token + } + ) ) WorkOS::AuthenticationResponse.new(response.body, session) @@ -485,17 +484,17 @@ def authenticate_with_organization_selection( response = execute_request( request: post_request( - path: '/user_management/authenticate', + path: "/user_management/authenticate", body: { client_id: client_id, client_secret: WorkOS.config.key!, ip_address: ip_address, user_agent: user_agent, - grant_type: 'urn:workos:oauth:grant-type:organization-selection', + grant_type: "urn:workos:oauth:grant-type:organization-selection", organization_id: organization_id, - pending_authentication_token: pending_authentication_token, - }, - ), + pending_authentication_token: pending_authentication_token + } + ) ) WorkOS::AuthenticationResponse.new(response.body, session) @@ -529,18 +528,18 @@ def authenticate_with_totp( response = execute_request( request: post_request( - path: '/user_management/authenticate', + path: "/user_management/authenticate", body: { code: code, client_id: client_id, client_secret: WorkOS.config.key!, pending_authentication_token: pending_authentication_token, - grant_type: 'urn:workos:oauth:grant-type:mfa-totp', + grant_type: "urn:workos:oauth:grant-type:mfa-totp", authentication_challenge_id: authentication_challenge_id, ip_address: ip_address, - user_agent: user_agent, - }, - ), + user_agent: user_agent + } + ) ) WorkOS::AuthenticationResponse.new(response.body, session) @@ -571,17 +570,17 @@ def authenticate_with_email_verification( response = execute_request( request: post_request( - path: '/user_management/authenticate', + path: "/user_management/authenticate", body: { code: code, client_id: client_id, pending_authentication_token: pending_authentication_token, client_secret: WorkOS.config.key!, - grant_type: 'urn:workos:oauth:grant-type:email-verification:code', + grant_type: "urn:workos:oauth:grant-type:email-verification:code", ip_address: ip_address, - user_agent: user_agent, - }, - ), + user_agent: user_agent + } + ) ) WorkOS::AuthenticationResponse.new(response.body, session) @@ -597,13 +596,13 @@ def authenticate_with_email_verification( # # @return String def get_logout_url(session_id:, return_to: nil) - params = { session_id: session_id } + params = {session_id: session_id} params[:return_to] = return_to if return_to URI::HTTPS.build( host: WorkOS.config.api_hostname, - path: '/user_management/sessions/logout', - query: URI.encode_www_form(params), + path: "/user_management/sessions/logout", + query: URI.encode_www_form(params) ).to_s end @@ -614,12 +613,12 @@ def get_logout_url(session_id:, return_to: nil) def revoke_session(session_id:) response = execute_request( request: post_request( - path: '/user_management/sessions/revoke', + path: "/user_management/sessions/revoke", body: { - session_id: session_id, + session_id: session_id }, - auth: true, - ), + auth: true + ) ) response.is_a? Net::HTTPSuccess @@ -635,7 +634,7 @@ def revoke_session(session_id:) def get_jwks_url(client_id) URI::HTTPS.build( host: WorkOS.config.api_hostname, - path: "/sso/jwks/#{client_id}", + path: "/sso/jwks/#{client_id}" ).to_s end @@ -648,8 +647,8 @@ def get_magic_auth(id:) response = execute_request( request: get_request( path: "/user_management/magic_auth/#{id}", - auth: true, - ), + auth: true + ) ) WorkOS::MagicAuth.new(response.body) @@ -664,13 +663,13 @@ def get_magic_auth(id:) def create_magic_auth(email:, invitation_token: nil) response = execute_request( request: post_request( - path: '/user_management/magic_auth', + path: "/user_management/magic_auth", body: { email: email, - invitation_token: invitation_token, + invitation_token: invitation_token }.compact, - auth: true, - ), + auth: true + ) ) WorkOS::MagicAuth.new(response.body) @@ -687,12 +686,12 @@ def send_magic_auth_code(email:) response = execute_request( request: post_request( - path: '/user_management/magic_auth/send', + path: "/user_management/magic_auth/send", body: { - email: email, + email: email }, - auth: true, - ), + auth: true + ) ) response.is_a? Net::HTTPSuccess @@ -711,7 +710,7 @@ def send_magic_auth_code(email:) # @return WorkOS::AuthenticationFactorAndChallenge def enroll_auth_factor(user_id:, type:, totp_issuer: nil, totp_user: nil, totp_secret: nil) validate_auth_factor_type( - type: type, + type: type ) response = execute_request( @@ -721,10 +720,10 @@ def enroll_auth_factor(user_id:, type:, totp_issuer: nil, totp_user: nil, totp_s type: type, totp_issuer: totp_issuer, totp_user: totp_user, - totp_secret: totp_secret, + totp_secret: totp_secret }.compact, - auth: true, - ), + auth: true + ) ) WorkOS::AuthenticationFactorAndChallenge.new(response.body) @@ -739,19 +738,19 @@ def list_auth_factors(user_id:) response = execute_request( request: get_request( path: "/user_management/users/#{user_id}/auth_factors", - auth: true, - ), + auth: true + ) ) parsed_response = JSON.parse(response.body) - auth_factors = parsed_response['data'].map do |auth_factor| + auth_factors = parsed_response["data"].map do |auth_factor| ::WorkOS::Factor.new(auth_factor.to_json) end WorkOS::Types::ListStruct.new( data: auth_factors, - list_metadata: parsed_response['list_metadata'], + list_metadata: parsed_response["list_metadata"] ) end @@ -768,24 +767,24 @@ def list_auth_factors(user_id:) # # @return [WorkOS::Types::ListStruct] def list_sessions(user_id:, options: {}) - options[:order] ||= 'desc' + options[:order] ||= "desc" response = execute_request( request: get_request( path: "/user_management/users/#{user_id}/sessions", auth: true, - params: options, - ), + params: options + ) ) parsed_response = JSON.parse(response.body) - sessions = parsed_response['data'].map do |session| + sessions = parsed_response["data"].map do |session| ::WorkOS::UserManagement::Session.new(session.to_json) end WorkOS::Types::ListStruct.new( data: sessions, - list_metadata: parsed_response['list_metadata'], + list_metadata: parsed_response["list_metadata"] ) end @@ -798,8 +797,8 @@ def get_email_verification(id:) response = execute_request( request: get_request( path: "/user_management/email_verification/#{id}", - auth: true, - ), + auth: true + ) ) WorkOS::EmailVerification.new(response.body) @@ -814,8 +813,8 @@ def send_verification_email(user_id:) response = execute_request( request: post_request( path: "/user_management/users/#{user_id}/email_verification/send", - auth: true, - ), + auth: true + ) ) WorkOS::UserResponse.new(response.body) @@ -832,10 +831,10 @@ def verify_email(user_id:, code:) request: post_request( path: "/user_management/users/#{user_id}/email_verification/confirm", body: { - code: code, + code: code }, - auth: true, - ), + auth: true + ) ) WorkOS::UserResponse.new(response.body) @@ -850,8 +849,8 @@ def get_password_reset(id:) response = execute_request( request: get_request( path: "/user_management/password_reset/#{id}", - auth: true, - ), + auth: true + ) ) WorkOS::PasswordReset.new(response.body) @@ -865,12 +864,12 @@ def get_password_reset(id:) def create_password_reset(email:) response = execute_request( request: post_request( - path: '/user_management/password_reset', + path: "/user_management/password_reset", body: { - email: email, + email: email }, - auth: true, - ), + auth: true + ) ) WorkOS::PasswordReset.new(response.body) @@ -887,12 +886,12 @@ def send_password_reset_email(email:, password_reset_url:) Please use `create_password_reset` instead. This method will be removed in a future major version.' request = post_request( - path: '/user_management/password_reset/send', + path: "/user_management/password_reset/send", body: { email: email, - password_reset_url: password_reset_url, + password_reset_url: password_reset_url }, - auth: true, + auth: true ) response = execute_request(request: request) @@ -909,13 +908,13 @@ def send_password_reset_email(email:, password_reset_url:) def reset_password(token:, new_password:) response = execute_request( request: post_request( - path: '/user_management/password_reset/confirm', + path: "/user_management/password_reset/confirm", body: { token: token, - new_password: new_password, + new_password: new_password }, - auth: true, - ), + auth: true + ) ) WorkOS::UserResponse.new(response.body).user @@ -930,8 +929,8 @@ def get_organization_membership(id:) response = execute_request( request: get_request( path: "/user_management/organization_memberships/#{id}", - auth: true, - ), + auth: true + ) ) WorkOS::OrganizationMembership.new(response.body) @@ -952,24 +951,24 @@ def get_organization_membership(id:) # # @return [WorkOS::OrganizationMembership] def list_organization_memberships(options = {}) - options[:order] ||= 'desc' + options[:order] ||= "desc" response = execute_request( request: get_request( - path: '/user_management/organization_memberships', + path: "/user_management/organization_memberships", auth: true, - params: options, - ), + params: options + ) ) parsed_response = JSON.parse(response.body) - organization_memberships = parsed_response['data'].map do |organization_membership| + organization_memberships = parsed_response["data"].map do |organization_membership| ::WorkOS::OrganizationMembership.new(organization_membership.to_json) end WorkOS::Types::ListStruct.new( data: organization_memberships, - list_metadata: parsed_response['list_metadata'], + list_metadata: parsed_response["list_metadata"] ) end @@ -982,20 +981,20 @@ def list_organization_memberships(options = {}) # # @return [WorkOS::OrganizationMembership] def create_organization_membership(user_id:, organization_id:, role_slug: nil, role_slugs: nil) - raise ArgumentError, 'Cannot specify both role_slug and role_slugs' if role_slug && role_slugs + raise ArgumentError, "Cannot specify both role_slug and role_slugs" if role_slug && role_slugs body = { user_id: user_id, - organization_id: organization_id, + organization_id: organization_id } body[:role_slugs] = role_slugs if role_slugs body[:role_slug] = role_slug if role_slug request = post_request( - path: '/user_management/organization_memberships', + path: "/user_management/organization_memberships", body: body.compact, - auth: true, + auth: true ) response = execute_request(request: request) @@ -1011,9 +1010,9 @@ def create_organization_membership(user_id:, organization_id:, role_slug: nil, r # # @return [WorkOS::OrganizationMembership] def update_organization_membership(id:, role_slug: nil, role_slugs: nil) - raise ArgumentError, 'Cannot specify both role_slug and role_slugs' if role_slug && role_slugs + raise ArgumentError, "Cannot specify both role_slug and role_slugs" if role_slug && role_slugs - body = { id: id } + body = {id: id} body[:role_slugs] = role_slugs if role_slugs body[:role_slug] = role_slug if role_slug @@ -1021,7 +1020,7 @@ def update_organization_membership(id:, role_slug: nil, role_slugs: nil) request = put_request( path: "/user_management/organization_memberships/#{id}", body: body.compact, - auth: true, + auth: true ) response = execute_request(request: request) @@ -1038,8 +1037,8 @@ def delete_organization_membership(id:) response = execute_request( request: delete_request( path: "/user_management/organization_memberships/#{id}", - auth: true, - ), + auth: true + ) ) response.is_a? Net::HTTPSuccess @@ -1054,8 +1053,8 @@ def deactivate_organization_membership(id:) response = execute_request( request: put_request( path: "/user_management/organization_memberships/#{id}/deactivate", - auth: true, - ), + auth: true + ) ) WorkOS::OrganizationMembership.new(response.body) @@ -1070,8 +1069,8 @@ def reactivate_organization_membership(id:) response = execute_request( request: put_request( path: "/user_management/organization_memberships/#{id}/reactivate", - auth: true, - ), + auth: true + ) ) WorkOS::OrganizationMembership.new(response.body) @@ -1086,8 +1085,8 @@ def get_invitation(id:) response = execute_request( request: get_request( path: "/user_management/invitations/#{id}", - auth: true, - ), + auth: true + ) ) WorkOS::Invitation.new(response.body) @@ -1102,8 +1101,8 @@ def find_invitation_by_token(token:) response = execute_request( request: get_request( path: "/user_management/invitations/by_token/#{token}", - auth: true, - ), + auth: true + ) ) WorkOS::Invitation.new(response.body) @@ -1123,24 +1122,24 @@ def find_invitation_by_token(token:) # # @return [WorkOS::Invitation] def list_invitations(options = {}) - options[:order] ||= 'desc' + options[:order] ||= "desc" response = execute_request( request: get_request( - path: '/user_management/invitations', + path: "/user_management/invitations", auth: true, - params: options, - ), + params: options + ) ) parsed_response = JSON.parse(response.body) - invitations = parsed_response['data'].map do |invitation| + invitations = parsed_response["data"].map do |invitation| ::WorkOS::Invitation.new(invitation.to_json) end WorkOS::Types::ListStruct.new( data: invitations, - list_metadata: parsed_response['list_metadata'], + list_metadata: parsed_response["list_metadata"] ) end @@ -1157,16 +1156,16 @@ def list_invitations(options = {}) def send_invitation(email:, organization_id: nil, expires_in_days: nil, inviter_user_id: nil, role_slug: nil) response = execute_request( request: post_request( - path: '/user_management/invitations', + path: "/user_management/invitations", body: { email: email, organization_id: organization_id, expires_in_days: expires_in_days, inviter_user_id: inviter_user_id, - role_slug: role_slug, + role_slug: role_slug }.compact, - auth: true, - ), + auth: true + ) ) WorkOS::Invitation.new(response.body) @@ -1180,7 +1179,7 @@ def send_invitation(email:, organization_id: nil, expires_in_days: nil, inviter_ def accept_invitation(id:) request = post_request( path: "/user_management/invitations/#{id}/accept", - auth: true, + auth: true ) response = execute_request(request: request) @@ -1196,7 +1195,7 @@ def accept_invitation(id:) def revoke_invitation(id:) request = post_request( path: "/user_management/invitations/#{id}/revoke", - auth: true, + auth: true ) response = execute_request(request: request) @@ -1212,7 +1211,7 @@ def revoke_invitation(id:) def resend_invitation(id:) request = post_request( path: "/user_management/invitations/#{id}/resend", - auth: true, + auth: true ) response = execute_request(request: request) @@ -1225,7 +1224,7 @@ def resend_invitation(id:) def validate_session(session) return unless session && (session[:seal_session] == true) && session[:cookie_password].nil? - raise ArgumentError, 'cookie_password is required when sealing session' + raise ArgumentError, "cookie_password is required when sealing session" end def validate_authorization_url_arguments( @@ -1234,8 +1233,8 @@ def validate_authorization_url_arguments( organization_id: ) if [provider, connection_id, organization_id].all?(&:nil?) - raise ArgumentError, 'Either connection ID, organization ID,' \ - ' or provider is required.' + raise ArgumentError, "Either connection ID, organization ID," \ + " or provider is required." end return unless provider && !PROVIDERS.include?(provider) diff --git a/lib/workos/user_management/session.rb b/lib/workos/user_management/session.rb index 7a9a5bef..def2023b 100644 --- a/lib/workos/user_management/session.rb +++ b/lib/workos/user_management/session.rb @@ -7,8 +7,9 @@ module UserManagement # in user space, and is instantiated internally but exposed. class Session include HashProvider + attr_accessor :id, :object, :user_id, :organization_id, :status, :auth_method, - :ip_address, :user_agent, :expires_at, :ended_at, :created_at, :updated_at + :ip_address, :user_agent, :expires_at, :ended_at, :created_at, :updated_at # rubocop:disable Metrics/AbcSize def initialize(json) @@ -42,7 +43,7 @@ def to_json(*) expires_at: expires_at, ended_at: ended_at, created_at: created_at, - updated_at: updated_at, + updated_at: updated_at } end diff --git a/lib/workos/user_response.rb b/lib/workos/user_response.rb index 5776256d..495948f1 100644 --- a/lib/workos/user_response.rb +++ b/lib/workos/user_response.rb @@ -15,7 +15,7 @@ def initialize(user_response_json) def to_json(*) { - user: user.to_json, + user: user.to_json } end end diff --git a/lib/workos/verify_challenge.rb b/lib/workos/verify_challenge.rb index 10ca7221..8cef355f 100644 --- a/lib/workos/verify_challenge.rb +++ b/lib/workos/verify_challenge.rb @@ -18,7 +18,7 @@ def initialize(json) def to_json(*) { challenge: challenge, - valid: valid, + valid: valid } end end diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 149c146e..f038c0fa 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '6.2.0' + VERSION = "6.2.0" end diff --git a/lib/workos/webhook.rb b/lib/workos/webhook.rb index 7a42d904..bdf92be0 100644 --- a/lib/workos/webhook.rb +++ b/lib/workos/webhook.rb @@ -23,7 +23,7 @@ def to_json(*) id: id, event: event, data: data, - created_at: created_at, + created_at: created_at } end end diff --git a/lib/workos/webhooks.rb b/lib/workos/webhooks.rb index 1f23044e..fc071503 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'openssl' +require "openssl" module WorkOS # The Webhooks module provides convenience methods for working with the WorkOS webhooks. @@ -72,15 +72,15 @@ def verify_header( ) begin timestamp, signature_hash = get_timestamp_and_signature_hash(sig_header: sig_header) - rescue StandardError + rescue raise WorkOS::SignatureVerificationError.new( - message: 'Unable to extract timestamp and signature hash from header', + message: "Unable to extract timestamp and signature hash from header" ) end if signature_hash.empty? raise WorkOS::SignatureVerificationError.new( - message: 'No signature hash found with expected scheme v1', + message: "No signature hash found with expected scheme v1" ) end @@ -88,14 +88,14 @@ def verify_header( if timestamp_to_time < Time.now - tolerance raise WorkOS::SignatureVerificationError.new( - message: 'Timestamp outside the tolerance zone', + message: "Timestamp outside the tolerance zone" ) end expected_sig = compute_signature(timestamp: timestamp, payload: payload, secret: secret) unless secure_compare(str_a: expected_sig, str_b: signature_hash) raise WorkOS::SignatureVerificationError.new( - message: 'Signature hash does not match the expected signature hash for payload', + message: "Signature hash does not match the expected signature hash for payload" ) end @@ -118,16 +118,16 @@ def verify_header( def get_timestamp_and_signature_hash( sig_header: ) - timestamp, signature_hash = sig_header.split(', ') + timestamp, signature_hash = sig_header.split(", ") if timestamp.nil? || signature_hash.nil? raise WorkOS::SignatureVerificationError.new( - message: 'Unable to extract timestamp and signature hash from header', + message: "Unable to extract timestamp and signature hash from header" ) end - timestamp = timestamp.sub('t=', '') - signature_hash = signature_hash.sub('v1=', '') + timestamp = timestamp.sub("t=", "") + signature_hash = signature_hash.sub("v1=", "") [timestamp, signature_hash] end @@ -156,7 +156,7 @@ def compute_signature( secret: ) unhashed_string = "#{timestamp}.#{payload}" - digest = OpenSSL::Digest.new('sha256') + digest = OpenSSL::Digest.new("sha256") OpenSSL::HMAC.hexdigest(digest, secret, unhashed_string) end diff --git a/lib/workos/widgets.rb b/lib/workos/widgets.rb index bd1e7bd5..39ed5d38 100644 --- a/lib/workos/widgets.rb +++ b/lib/workos/widgets.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'net/http' +require "net/http" module WorkOS # The Widgets module provides resource methods for working with the Widgets APIs @@ -23,14 +23,14 @@ def get_token(organization_id:, user_id:, scopes:) body: { organization_id: organization_id, user_id: user_id, - scopes: scopes, + scopes: scopes }, - path: '/widgets/token', + path: "/widgets/token" ) response = execute_request(request: request) - JSON.parse(response.body)['token'] + JSON.parse(response.body)["token"] end private @@ -38,7 +38,7 @@ def get_token(organization_id:, user_id:, scopes:) def validate_scopes(scopes) return if scopes.all? { |scope| WIDGET_SCOPES.include?(scope) } - raise ArgumentError, 'scopes contains an invalid value.' \ + raise ArgumentError, "scopes contains an invalid value." \ " Every item in `scopes` must be in #{WIDGET_SCOPES}" end end diff --git a/spec/lib/workos/audit_logs_spec.rb b/spec/lib/workos/audit_logs_spec.rb index df93b6b2..221c3ed4 100644 --- a/spec/lib/workos/audit_logs_spec.rb +++ b/spec/lib/workos/audit_logs_spec.rb @@ -1,82 +1,82 @@ # frozen_string_literal: true describe WorkOS::AuditLogs do - it_behaves_like 'client' + it_behaves_like "client" before do WorkOS.configure do |config| - config.key = 'example_api_key' + config.key = "example_api_key" end end - describe '.create_event' do - context 'with valid event payload' do + describe ".create_event" do + context "with valid event payload" do let(:valid_event) do { - action: 'user.signed_in', - occurred_at: '2022-08-22T15:04:19.704Z', + action: "user.signed_in", + occurred_at: "2022-08-22T15:04:19.704Z", actor: { - id: 'user_123', - type: 'user', - name: 'User', + id: "user_123", + type: "user", + name: "User", metadata: { - foo: 'bar', - }, + foo: "bar" + } }, targets: [{ - id: 'team_123', - type: 'team', - name: 'Team', + id: "team_123", + type: "team", + name: "Team", metadata: { - foo: 'bar', - }, + foo: "bar" + } }], context: { - location: '1.1.1.1', - user_agent: 'Mozilla', - }, + location: "1.1.1.1", + user_agent: "Mozilla" + } } end - context 'with idempotency key' do - it 'creates an event' do - VCR.use_cassette 'audit_logs/create_event_custom_idempotency_key', match_requests_on: %i[path body] do + context "with idempotency key" do + it "creates an event" do + VCR.use_cassette "audit_logs/create_event_custom_idempotency_key", match_requests_on: %i[path body] do response = described_class.create_event( - organization: 'org_123', + organization: "org_123", event: valid_event, - idempotency_key: 'idempotency_key', + idempotency_key: "idempotency_key" ) - expect(response.code).to eq '201' + expect(response.code).to eq "201" end end end - context 'without idempotency key' do - it 'creates an event' do - VCR.use_cassette 'audit_logs/create_event', match_requests_on: %i[path body] do + context "without idempotency key" do + it "creates an event" do + VCR.use_cassette "audit_logs/create_event", match_requests_on: %i[path body] do response = described_class.create_event( - organization: 'org_123', - event: valid_event, + organization: "org_123", + event: valid_event ) - expect(response.code).to eq '201' + expect(response.code).to eq "201" end end end - context 'with invalid event' do - it 'returns error' do - VCR.use_cassette 'audit_logs/create_event_invalid', match_requests_on: %i[path body] do + context "with invalid event" do + it "returns error" do + VCR.use_cassette "audit_logs/create_event_invalid", match_requests_on: %i[path body] do described_class.create_event( - organization: 'org_123', - event: valid_event, + organization: "org_123", + event: valid_event ) rescue WorkOS::InvalidRequestError => e expect( - e.message, - ).to eq 'Status 400, Invalid Audit Log event - request ID: 1cf9b8e7-5910-4a6d-a333-46bcf841422e' - expect(e.code).to eq 'invalid_audit_log' + e.message + ).to eq "Status 400, Invalid Audit Log event - request ID: 1cf9b8e7-5910-4a6d-a333-46bcf841422e" + expect(e.code).to eq "invalid_audit_log" expect(e.errors.count).to eq 1 end end @@ -84,66 +84,66 @@ end end - describe '.create_export' do - context 'without filters applied' do - it 'creates an event' do - VCR.use_cassette 'audit_logs/create_export', match_requests_on: %i[path body] do + describe ".create_export" do + context "without filters applied" do + it "creates an event" do + VCR.use_cassette "audit_logs/create_export", match_requests_on: %i[path body] do audit_log_export = described_class.create_export( - organization: 'org_123', - range_start: '2022-06-22T15:04:19.704Z', - range_end: '2022-08-22T15:04:19.704Z', + organization: "org_123", + range_start: "2022-06-22T15:04:19.704Z", + range_end: "2022-08-22T15:04:19.704Z" ) expect(audit_log_export).to have_attributes( - object: 'audit_log_export', - id: 'audit_log_export_123', - state: 'pending', + object: "audit_log_export", + id: "audit_log_export_123", + state: "pending", url: nil, - created_at: '2022-08-22T15:04:19.704Z', - updated_at: '2022-08-22T15:04:19.704Z', + created_at: "2022-08-22T15:04:19.704Z", + updated_at: "2022-08-22T15:04:19.704Z" ) end end end - context 'with filters applied' do - it 'creates an export' do - VCR.use_cassette 'audit_logs/create_export_with_filters', match_requests_on: %i[path body] do + context "with filters applied" do + it "creates an export" do + VCR.use_cassette "audit_logs/create_export_with_filters", match_requests_on: %i[path body] do audit_log_export = described_class.create_export( - organization: 'org_123', - range_start: '2022-06-22T15:04:19.704Z', - range_end: '2022-08-22T15:04:19.704Z', - actions: ['user.signed_in'], - actors: ['Jon Smith'], - actor_names: ['Jon Smith'], - actor_ids: ['user_123'], - targets: %w[user team], + organization: "org_123", + range_start: "2022-06-22T15:04:19.704Z", + range_end: "2022-08-22T15:04:19.704Z", + actions: ["user.signed_in"], + actors: ["Jon Smith"], + actor_names: ["Jon Smith"], + actor_ids: ["user_123"], + targets: %w[user team] ) - expect(audit_log_export.object).to eq 'audit_log_export' - expect(audit_log_export.id).to eq 'audit_log_export_123' - expect(audit_log_export.state).to eq 'pending' + expect(audit_log_export.object).to eq "audit_log_export" + expect(audit_log_export.id).to eq "audit_log_export_123" + expect(audit_log_export.state).to eq "pending" expect(audit_log_export.url).to eq nil - expect(audit_log_export.created_at).to eq '2022-08-22T15:04:19.704Z' - expect(audit_log_export.updated_at).to eq '2022-08-22T15:04:19.704Z' + expect(audit_log_export.created_at).to eq "2022-08-22T15:04:19.704Z" + expect(audit_log_export.updated_at).to eq "2022-08-22T15:04:19.704Z" end end end end - describe '.get_export' do - it 'returns an export' do - VCR.use_cassette 'audit_logs/get_export', match_requests_on: %i[path] do + describe ".get_export" do + it "returns an export" do + VCR.use_cassette "audit_logs/get_export", match_requests_on: %i[path] do audit_log_export = described_class.get_export( - id: 'audit_log_export_123', + id: "audit_log_export_123" ) - expect(audit_log_export.object).to eq 'audit_log_export' - expect(audit_log_export.id).to eq 'audit_log_export_123' - expect(audit_log_export.state).to eq 'ready' - expect(audit_log_export.url).to eq 'https://audit-logs.com/download.csv' - expect(audit_log_export.created_at).to eq '2022-08-22T15:04:19.704Z' - expect(audit_log_export.updated_at).to eq '2022-08-22T15:04:19.704Z' + expect(audit_log_export.object).to eq "audit_log_export" + expect(audit_log_export.id).to eq "audit_log_export_123" + expect(audit_log_export.state).to eq "ready" + expect(audit_log_export.url).to eq "https://audit-logs.com/download.csv" + expect(audit_log_export.created_at).to eq "2022-08-22T15:04:19.704Z" + expect(audit_log_export.updated_at).to eq "2022-08-22T15:04:19.704Z" end end end diff --git a/spec/lib/workos/cache_spec.rb b/spec/lib/workos/cache_spec.rb index 0c301cb7..f2f26ecb 100644 --- a/spec/lib/workos/cache_spec.rb +++ b/spec/lib/workos/cache_spec.rb @@ -3,92 +3,92 @@ describe WorkOS::Cache do before { described_class.clear } - describe '.write and .read' do - it 'stores and retrieves data' do - described_class.write('key', 'value') - expect(described_class.read('key')).to eq('value') + describe ".write and .read" do + it "stores and retrieves data" do + described_class.write("key", "value") + expect(described_class.read("key")).to eq("value") end - it 'returns nil if key does not exist' do - expect(described_class.read('missing')).to be_nil + it "returns nil if key does not exist" do + expect(described_class.read("missing")).to be_nil end end - describe '.fetch' do - it 'returns cached value when present and not expired' do - described_class.write('key', 'value') - fetch_value = described_class.fetch('key') { 'new_value' } - expect(fetch_value).to eq('value') + describe ".fetch" do + it "returns cached value when present and not expired" do + described_class.write("key", "value") + fetch_value = described_class.fetch("key") { "new_value" } + expect(fetch_value).to eq("value") end - it 'executes block and caches value when not present' do - fetch_value = described_class.fetch('key') { 'new_value' } - expect(fetch_value).to eq('new_value') + it "executes block and caches value when not present" do + fetch_value = described_class.fetch("key") { "new_value" } + expect(fetch_value).to eq("new_value") end - it 'executes block and caches value when force is true' do - described_class.write('key', 'value') - fetch_value = described_class.fetch('key', force: true) { 'new_value' } - expect(fetch_value).to eq('new_value') + it "executes block and caches value when force is true" do + described_class.write("key", "value") + fetch_value = described_class.fetch("key", force: true) { "new_value" } + expect(fetch_value).to eq("new_value") end end - describe 'expiration' do - it 'expires values after specified time' do - described_class.write('key', 'value', expires_in: 0.1) - expect(described_class.read('key')).to eq('value') + describe "expiration" do + it "expires values after specified time" do + described_class.write("key", "value", expires_in: 0.1) + expect(described_class.read("key")).to eq("value") sleep 0.2 - expect(described_class.read('key')).to be_nil + expect(described_class.read("key")).to be_nil end - it 'executes block and caches new value when expired' do - described_class.write('key', 'old_value', expires_in: 0.1) + it "executes block and caches new value when expired" do + described_class.write("key", "old_value", expires_in: 0.1) sleep 0.2 - fetch_value = described_class.fetch('key') { 'new_value' } - expect(fetch_value).to eq('new_value') + fetch_value = described_class.fetch("key") { "new_value" } + expect(fetch_value).to eq("new_value") end - it 'does not expire values when expires_in is nil' do - described_class.write('key', 'value', expires_in: nil) + it "does not expire values when expires_in is nil" do + described_class.write("key", "value", expires_in: nil) sleep 0.2 - expect(described_class.read('key')).to eq('value') + expect(described_class.read("key")).to eq("value") end end - describe '.exist?' do - it 'returns true if key exists' do - described_class.write('key', 'value') - expect(described_class.exist?('key')).to be true + describe ".exist?" do + it "returns true if key exists" do + described_class.write("key", "value") + expect(described_class.exist?("key")).to be true end - it 'returns false if expired' do - described_class.write('key', 'value', expires_in: 0.1) + it "returns false if expired" do + described_class.write("key", "value", expires_in: 0.1) sleep 0.2 - expect(described_class.exist?('key')).to be false + expect(described_class.exist?("key")).to be false end - it 'returns false if key does not exist' do - expect(described_class.exist?('missing')).to be false + it "returns false if key does not exist" do + expect(described_class.exist?("missing")).to be false end end - describe '.delete' do - it 'deletes key' do - described_class.write('key', 'value') - described_class.delete('key') - expect(described_class.read('key')).to be_nil + describe ".delete" do + it "deletes key" do + described_class.write("key", "value") + described_class.delete("key") + expect(described_class.read("key")).to be_nil end end - describe '.clear' do - it 'removes all keys from the cache' do - described_class.write('key1', 'value1') - described_class.write('key2', 'value2') + describe ".clear" do + it "removes all keys from the cache" do + described_class.write("key1", "value1") + described_class.write("key2", "value2") described_class.clear - expect(described_class.read('key1')).to be_nil - expect(described_class.read('key2')).to be_nil + expect(described_class.read("key1")).to be_nil + expect(described_class.read("key2")).to be_nil end end end diff --git a/spec/lib/workos/client.rb b/spec/lib/workos/client.rb index 24d630a5..1cd20536 100644 --- a/spec/lib/workos/client.rb +++ b/spec/lib/workos/client.rb @@ -2,15 +2,15 @@ # rubocop:disable Style/MultilineBlockChain describe WorkOS::Client do - describe '.client' do - it 'returns a 400 error with appropriate fields' do - VCR.use_cassette('user_management/authenticate_with_code/invalid') do + describe ".client" do + it "returns a 400 error with appropriate fields" do + VCR.use_cassette("user_management/authenticate_with_code/invalid") do expect do WorkOS::UserManagement.authenticate_with_code( - code: 'invalid', - client_id: 'client_123', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + code: "invalid", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) end.to raise_error do |error| expect(error).to be_a(WorkOS::InvalidRequestError) @@ -21,12 +21,12 @@ end end - it 'returns a 401 error with appropriate fields' do - VCR.use_cassette('base/execute_request_unauthenticated') do + it "returns a 401 error with appropriate fields" do + VCR.use_cassette("base/execute_request_unauthenticated") do expect do WorkOS::AuditLogs.create_event( - organization: 'org_123', - event: {}, + organization: "org_123", + event: {} ) end.to raise_error do |error| expect(error).to be_a(WorkOS::AuthenticationError) @@ -35,11 +35,11 @@ end end - it 'returns a 404 error with appropriate fields' do - VCR.use_cassette('user_management/get_email_verification/invalid') do + it "returns a 404 error with appropriate fields" do + VCR.use_cassette("user_management/get_email_verification/invalid") do expect do WorkOS::UserManagement.get_email_verification( - id: 'invalid', + id: "invalid" ) end.to raise_error do |error| expect(error).to be_a(WorkOS::NotFoundError) @@ -48,11 +48,11 @@ end end - it 'returns a 422 error with appropriate fields' do - VCR.use_cassette('user_management/create_user_invalid') do + it "returns a 422 error with appropriate fields" do + VCR.use_cassette("user_management/create_user_invalid") do expect do WorkOS::UserManagement.create_user( - email: 'invalid', + email: "invalid" ) end.to raise_error do |error| expect(error).to be_a(WorkOS::UnprocessableEntityError) diff --git a/spec/lib/workos/configuration_spec.rb b/spec/lib/workos/configuration_spec.rb index c5e8abbd..fc71fcab 100644 --- a/spec/lib/workos/configuration_spec.rb +++ b/spec/lib/workos/configuration_spec.rb @@ -1,30 +1,30 @@ # frozen_string_literal: true describe WorkOS do - describe '.configure' do - context 'with key and no timeout' do + describe ".configure" do + context "with key and no timeout" do before do WorkOS.configure do |config| - config.key = 'example_api_key' + config.key = "example_api_key" end end - it 'sets the key and default timeout configuration' do - expect(WorkOS.config.key).to eq('example_api_key') + it "sets the key and default timeout configuration" do + expect(WorkOS.config.key).to eq("example_api_key") expect(WorkOS.config.timeout).to eq(60) end end - context 'with key and timeout' do + context "with key and timeout" do before do WorkOS.configure do |config| - config.key = 'example_api_key' + config.key = "example_api_key" config.timeout = 120 end end - it 'sets the key and timeout configuration' do - expect(WorkOS.config.key).to eq('example_api_key') + it "sets the key and timeout configuration" do + expect(WorkOS.config.key).to eq("example_api_key") expect(WorkOS.config.timeout).to eq(120) end end @@ -32,27 +32,27 @@ end describe WorkOS::Configuration do - describe '.key!' do - context 'with key set' do + describe ".key!" do + context "with key set" do before do - WorkOS.config.key = 'example_api_key' + WorkOS.config.key = "example_api_key" end - it 'returns the key' do - expect(WorkOS.config.key!).to eq('example_api_key') + it "returns the key" do + expect(WorkOS.config.key!).to eq("example_api_key") end end - context 'with key not set' do + context "with key not set" do before do WorkOS.config.key = nil end - it 'throws an error' do + it "throws an error" do expect do WorkOS.config.key! end.to raise_error( - '`WorkOS.config.key` not set', + "`WorkOS.config.key` not set" ) end end diff --git a/spec/lib/workos/directory_sync_spec.rb b/spec/lib/workos/directory_sync_spec.rb index 2a2ad704..6fc7ac78 100644 --- a/spec/lib/workos/directory_sync_spec.rb +++ b/spec/lib/workos/directory_sync_spec.rb @@ -1,17 +1,17 @@ # frozen_string_literal: true describe WorkOS::DirectorySync do - it_behaves_like 'client' + it_behaves_like "client" - describe '.list_directories' do - context 'with no options' do - it 'returns directories and metadata' do + describe ".list_directories" do + context "with no options" do + it "returns directories and metadata" do expected_metadata = { - 'after' => nil, - 'before' => 'before-id', + "after" => nil, + "before" => "before-id" } - VCR.use_cassette 'directory_sync/list_directories/with_no_options' do + VCR.use_cassette "directory_sync/list_directories/with_no_options" do directories = described_class.list_directories expect(directories.data.size).to eq(10) @@ -20,46 +20,46 @@ end end - context 'with search option' do - it 'forms the proper request to the API' do + context "with search option" do + it "forms the proper request to the API" do request_args = [ - '/directories?search=Testing&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directories?search=Testing&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_directories/with_search' do + VCR.use_cassette "directory_sync/list_directories/with_search" do directories = described_class.list_directories( - search: 'Testing', + search: "Testing" ) expect(directories.data.size).to eq(2) - expect(directories.data[0].name).to include('Testing') + expect(directories.data[0].name).to include("Testing") end end end - context 'with the before option' do - it 'forms the proper request to the API' do + context "with the before option" do + it "forms the proper request to the API" do request_args = [ - '/directories?before=directory_01FGCPNV312FHFRCX0BYWHVSE1&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directories?before=directory_01FGCPNV312FHFRCX0BYWHVSE1&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_directories/with_before' do + VCR.use_cassette "directory_sync/list_directories/with_before" do directories = described_class.list_directories( - before: 'directory_01FGCPNV312FHFRCX0BYWHVSE1', + before: "directory_01FGCPNV312FHFRCX0BYWHVSE1" ) expect(directories.data.size).to eq(6) @@ -67,41 +67,41 @@ end end - context 'with the after option' do - it 'forms the proper request to the API' do + context "with the after option" do + it "forms the proper request to the API" do request_args = [ - '/directories?after=directory_01FGCPNV312FHFRCX0BYWHVSE1&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directories?after=directory_01FGCPNV312FHFRCX0BYWHVSE1&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_directories/with_after' do - directories = described_class.list_directories(after: 'directory_01FGCPNV312FHFRCX0BYWHVSE1') + VCR.use_cassette "directory_sync/list_directories/with_after" do + directories = described_class.list_directories(after: "directory_01FGCPNV312FHFRCX0BYWHVSE1") expect(directories.data.size).to eq(4) end end end - context 'with the limit option' do - it 'forms the proper request to the API' do + context "with the limit option" do + it "forms the proper request to the API" do request_args = [ - '/directories?limit=2&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directories?limit=2&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_directories/with_limit' do + VCR.use_cassette "directory_sync/list_directories/with_limit" do directories = described_class.list_directories(limit: 2) expect(directories.data.size).to eq(2) @@ -110,12 +110,12 @@ end end - describe '.delete_directory' do - context 'with valid id' do - it 'deletes a directory' do - VCR.use_cassette('directory_sync/delete_directory') do + describe ".delete_directory" do + context "with valid id" do + it "deletes a directory" do + VCR.use_cassette("directory_sync/delete_directory") do response = WorkOS::DirectorySync.delete_directory( - 'directory_01F2T098SKN5PCTVSJ7CWP70N5', + "directory_01F2T098SKN5PCTVSJ7CWP70N5" ) expect(response).to be(true) @@ -124,42 +124,42 @@ end end - describe '.get_directory' do - context 'with a valid id' do - it 'gets the directory details' do - VCR.use_cassette('directory_sync/get_directory_with_valid_id') do + describe ".get_directory" do + context "with a valid id" do + it "gets the directory details" do + VCR.use_cassette("directory_sync/get_directory_with_valid_id") do directory = WorkOS::DirectorySync.get_directory( - id: 'directory_01FK17DWRHH7APAFXT5B52PV0W', + id: "directory_01FK17DWRHH7APAFXT5B52PV0W" ) - expect(directory.id).to eq('directory_01FK17DWRHH7APAFXT5B52PV0W') - expect(directory.name).to eq('Testing Active Attribute') - expect(directory.domain).to eq('example.me') - expect(directory.type).to eq('azure scim v2.0') - expect(directory.state).to eq('linked') - expect(directory.organization_id).to eq('org_01F6Q6TFP7RD2PF6J03ANNWDKV') + expect(directory.id).to eq("directory_01FK17DWRHH7APAFXT5B52PV0W") + expect(directory.name).to eq("Testing Active Attribute") + expect(directory.domain).to eq("example.me") + expect(directory.type).to eq("azure scim v2.0") + expect(directory.state).to eq("linked") + expect(directory.organization_id).to eq("org_01F6Q6TFP7RD2PF6J03ANNWDKV") end end end - context 'with an invalid id' do - it 'raises an error' do - VCR.use_cassette('directory_sync/get_directory_with_invalid_id') do + context "with an invalid id" do + it "raises an error" do + VCR.use_cassette("directory_sync/get_directory_with_invalid_id") do expect do - WorkOS::DirectorySync.get_directory(id: 'invalid') + WorkOS::DirectorySync.get_directory(id: "invalid") end.to raise_error( WorkOS::NotFoundError, - "Status 404, Directory not found: 'invalid'. - request ID: ", + "Status 404, Directory not found: 'invalid'. - request ID: " ) end end end end - describe '.list_groups' do - context 'with no options' do - it 'raises an error' do - VCR.use_cassette('directory_sync/list_groups/with_no_options') do + describe ".list_groups" do + context "with no options" do + it "raises an error" do + VCR.use_cassette("directory_sync/list_groups/with_no_options") do expect do WorkOS::DirectorySync.list_groups end.to raise_error(WorkOS::UnprocessableEntityError) @@ -167,46 +167,46 @@ end end - context 'with directory option' do - it 'forms the proper request to the API' do + context "with directory option" do + it "forms the proper request to the API" do request_args = [ - '/directory_groups?directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directory_groups?directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_groups/with_directory' do + VCR.use_cassette "directory_sync/list_groups/with_directory" do groups = described_class.list_groups( - directory: 'directory_01G2Z8ADK5NPMVTWF48MVVE4HT', + directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" ) expect(groups.data.size).to eq(10) - expect(groups.data[0].name).to eq(groups.data[0]['name']) + expect(groups.data[0].name).to eq(groups.data[0]["name"]) end end end - context 'with user option' do - it 'forms the proper request to the API' do + context "with user option" do + it "forms the proper request to the API" do request_args = [ - '/directory_groups?user=directory_user_01G2Z8D4FDB28ZNSRRBVCF2E0P&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directory_groups?user=directory_user_01G2Z8D4FDB28ZNSRRBVCF2E0P&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_groups/with_user' do + VCR.use_cassette "directory_sync/list_groups/with_user" do groups = described_class.list_groups( - user: 'directory_user_01G2Z8D4FDB28ZNSRRBVCF2E0P', + user: "directory_user_01G2Z8D4FDB28ZNSRRBVCF2E0P" ) expect(groups.data.size).to eq(3) @@ -214,24 +214,24 @@ end end - context 'with the before option' do - it 'forms the proper request to the API' do + context "with the before option" do + it "forms the proper request to the API" do request_args = [ - '/directory_groups?before=directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG&' \ - 'directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directory_groups?before=directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG&" \ + "directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_groups/with_before' do + VCR.use_cassette "directory_sync/list_groups/with_before" do groups = described_class.list_groups( - before: 'directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG', - directory: 'directory_01G2Z8ADK5NPMVTWF48MVVE4HT', + before: "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG", + directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" ) expect(groups.data.size).to eq(10) @@ -239,24 +239,24 @@ end end - context 'with the after option' do - it 'forms the proper request to the API' do + context "with the after option" do + it "forms the proper request to the API" do request_args = [ - '/directory_groups?after=directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG&' \ - 'directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directory_groups?after=directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG&" \ + "directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_groups/with_after' do + VCR.use_cassette "directory_sync/list_groups/with_after" do groups = described_class.list_groups( - after: 'directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG', - directory: 'directory_01G2Z8ADK5NPMVTWF48MVVE4HT', + after: "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG", + directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" ) expect(groups.data.size).to eq(9) @@ -264,24 +264,24 @@ end end - context 'with the limit option' do - it 'forms the proper request to the API' do + context "with the limit option" do + it "forms the proper request to the API" do request_args = [ - '/directory_groups?limit=2&' \ - 'directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directory_groups?limit=2&" \ + "directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_groups/with_limit' do + VCR.use_cassette "directory_sync/list_groups/with_limit" do groups = described_class.list_groups( limit: 2, - directory: 'directory_01G2Z8ADK5NPMVTWF48MVVE4HT', + directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" ) expect(groups.data.size).to eq(2) @@ -290,10 +290,10 @@ end end - describe '.list_users' do - context 'with no options' do - it 'raises an error' do - VCR.use_cassette('directory_sync/list_users/with_no_options') do + describe ".list_users" do + context "with no options" do + it "raises an error" do + VCR.use_cassette("directory_sync/list_users/with_no_options") do expect do WorkOS::DirectorySync.list_users end.to raise_error(WorkOS::UnprocessableEntityError) @@ -301,46 +301,46 @@ end end - context 'with directory option' do - it 'forms the proper request to the API' do + context "with directory option" do + it "forms the proper request to the API" do request_args = [ - '/directory_users?directory=directory_01FAZYMST676QMTFN1DDJZZX87&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directory_users?directory=directory_01FAZYMST676QMTFN1DDJZZX87&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_users/with_directory' do + VCR.use_cassette "directory_sync/list_users/with_directory" do users = described_class.list_users( - directory: 'directory_01FAZYMST676QMTFN1DDJZZX87', + directory: "directory_01FAZYMST676QMTFN1DDJZZX87" ) expect(users.data.size).to eq(4) - expect(users.data[0].first_name).to eq(users.data[0]['first_name']) + expect(users.data[0].first_name).to eq(users.data[0]["first_name"]) end end end - context 'with group option' do - it 'forms the proper request to the API' do + context "with group option" do + it "forms the proper request to the API" do request_args = [ - '/directory_users?group=directory_group_01FBXGP79EJAYKW0WS9JCK1V6E&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directory_users?group=directory_group_01FBXGP79EJAYKW0WS9JCK1V6E&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_users/with_group' do + VCR.use_cassette "directory_sync/list_users/with_group" do users = described_class.list_users( - group: 'directory_group_01FBXGP79EJAYKW0WS9JCK1V6E', + group: "directory_group_01FBXGP79EJAYKW0WS9JCK1V6E" ) expect(users.data.size).to eq(1) @@ -348,24 +348,24 @@ end end - context 'with the before option' do - it 'forms the proper request to the API' do + context "with the before option" do + it "forms the proper request to the API" do request_args = [ - '/directory_users?before=directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF&'\ - 'directory=directory_01FAZYMST676QMTFN1DDJZZX87&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directory_users?before=directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF&" \ + "directory=directory_01FAZYMST676QMTFN1DDJZZX87&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_users/with_before' do + VCR.use_cassette "directory_sync/list_users/with_before" do users = described_class.list_users( - before: 'directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF', - directory: 'directory_01FAZYMST676QMTFN1DDJZZX87', + before: "directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF", + directory: "directory_01FAZYMST676QMTFN1DDJZZX87" ) expect(users.data.size).to eq(2) @@ -373,24 +373,24 @@ end end - context 'with the after option' do - it 'forms the proper request to the API' do + context "with the after option" do + it "forms the proper request to the API" do request_args = [ - '/directory_users?after=directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF&' \ - 'directory=directory_01FAZYMST676QMTFN1DDJZZX87&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directory_users?after=directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF&" \ + "directory=directory_01FAZYMST676QMTFN1DDJZZX87&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_users/with_after' do + VCR.use_cassette "directory_sync/list_users/with_after" do users = described_class.list_users( - after: 'directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF', - directory: 'directory_01FAZYMST676QMTFN1DDJZZX87', + after: "directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF", + directory: "directory_01FAZYMST676QMTFN1DDJZZX87" ) expect(users.data.size).to eq(1) @@ -398,24 +398,24 @@ end end - context 'with the limit option' do - it 'forms the proper request to the API' do + context "with the limit option" do + it "forms the proper request to the API" do request_args = [ - '/directory_users?limit=2&' \ - 'directory=directory_01FAZYMST676QMTFN1DDJZZX87&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/directory_users?limit=2&" \ + "directory=directory_01FAZYMST676QMTFN1DDJZZX87&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'directory_sync/list_users/with_limit' do + VCR.use_cassette "directory_sync/list_users/with_limit" do users = described_class.list_users( limit: 2, - directory: 'directory_01FAZYMST676QMTFN1DDJZZX87', + directory: "directory_01FAZYMST676QMTFN1DDJZZX87" ) expect(users.data.size).to eq(2) @@ -424,57 +424,57 @@ end end - describe '.get_group' do - context 'with valid id' do - it 'returns a group' do - VCR.use_cassette('directory_sync/get_group') do + describe ".get_group" do + context "with valid id" do + it "returns a group" do + VCR.use_cassette("directory_sync/get_group") do group = WorkOS::DirectorySync.get_group( - 'directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG', + "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG" ) - expect(group['directory_id']).to eq('directory_01G2Z8ADK5NPMVTWF48MVVE4HT') - expect(group['organization_id']).to eq('org_01EGS4P7QR31EZ4YWD1Z1XA176') - expect(group['idp_id']).to eq('01jlao4614two3d') - expect(group['name']).to eq('Sales') - expect(group.name).to eq('Sales') - expect(group['created_at']).to eq('2022-05-13T17:45:31.732Z') - expect(group['updated_at']).to eq('2022-07-13T17:45:42.618Z') + expect(group["directory_id"]).to eq("directory_01G2Z8ADK5NPMVTWF48MVVE4HT") + expect(group["organization_id"]).to eq("org_01EGS4P7QR31EZ4YWD1Z1XA176") + expect(group["idp_id"]).to eq("01jlao4614two3d") + expect(group["name"]).to eq("Sales") + expect(group.name).to eq("Sales") + expect(group["created_at"]).to eq("2022-05-13T17:45:31.732Z") + expect(group["updated_at"]).to eq("2022-07-13T17:45:42.618Z") end end end - context 'with invalid id' do - it 'raises an error' do - VCR.use_cassette('directory_sync/get_group_with_invalid_id') do + context "with invalid id" do + it "raises an error" do + VCR.use_cassette("directory_sync/get_group_with_invalid_id") do expect do - WorkOS::DirectorySync.get_group('invalid') - end.to raise_error(WorkOS:: NotFoundError) + WorkOS::DirectorySync.get_group("invalid") + end.to raise_error(WorkOS::NotFoundError) end end end end - describe '.get_user' do - context 'with valid id' do - it 'returns a user' do - VCR.use_cassette('directory_sync/get_user') do + describe ".get_user" do + context "with valid id" do + it "returns a user" do + VCR.use_cassette("directory_sync/get_user") do user = WorkOS::DirectorySync.get_user( - 'directory_user_01FAZYNPC8M0HRYTKFP2GNX852', + "directory_user_01FAZYNPC8M0HRYTKFP2GNX852" ) - expect(user['first_name']).to eq('Bob') - expect(user.directory_id).to eq('directory_01FAZYMST676QMTFN1DDJZZX87') - expect(user.organization_id).to eq('org_01FAZWCWR03DVWA83NCJYKKD54') - expect(user.first_name).to eq('Bob') + expect(user["first_name"]).to eq("Bob") + expect(user.directory_id).to eq("directory_01FAZYMST676QMTFN1DDJZZX87") + expect(user.organization_id).to eq("org_01FAZWCWR03DVWA83NCJYKKD54") + expect(user.first_name).to eq("Bob") end end end - context 'with invalid id' do - it 'raises an error' do - VCR.use_cassette('directory_sync/get_user_with_invalid_id') do + context "with invalid id" do + it "raises an error" do + VCR.use_cassette("directory_sync/get_user_with_invalid_id") do expect do - WorkOS::DirectorySync.get_user('invalid') + WorkOS::DirectorySync.get_user("invalid") end.to raise_error(WorkOS::NotFoundError) end end diff --git a/spec/lib/workos/directory_user_spec.rb b/spec/lib/workos/directory_user_spec.rb index e0c02150..66f24183 100644 --- a/spec/lib/workos/directory_user_spec.rb +++ b/spec/lib/workos/directory_user_spec.rb @@ -2,58 +2,58 @@ describe WorkOS::DirectoryUser do # rubocop:disable Layout/LineLength - describe '.get_primary_email' do - context 'with one primary email' do - it 'returns the primary email' do + describe ".get_primary_email" do + context "with one primary email" do + it "returns the primary email" do user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.primary_email).to eq('bob.fakename@workos.com') + expect(user.primary_email).to eq("bob.fakename@workos.com") end end - context 'with multiple primary emails' do - it 'returns the first email marked as primary' do + context "with multiple primary emails" do + it "returns the first email marked as primary" do user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":true,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.primary_email).to eq('bob.fakename@workos.com') + expect(user.primary_email).to eq("bob.fakename@workos.com") end end - context 'with no primary emails' do - it 'returns nil' do + context "with no primary emails" do + it "returns nil" do user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":false,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-07-13T17:45:42.618Z"}') expect(user.primary_email).to eq(nil) end end - context 'with an empty email array' do - it 'returns nil' do + context "with an empty email array" do + it "returns nil" do user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-07-13T17:45:42.618Z"}') expect(user.primary_email).to eq(nil) end end end - describe '.get_role' do - context 'with no role' do - it 'returns no role' do + describe ".get_role" do + context "with no role" do + it "returns no role" do user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') expect(user.role).to eq(nil) expect(user.roles).to eq(nil) end end - context 'with a single role' do - it 'returns the highest priority role slug and roles array' do + context "with a single role" do + it "returns the highest priority role slug and roles array" do user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"role":{"slug":"member"},"roles":[{"slug":"member"}],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.role).to eq({ slug: 'member' }) - expect(user.roles).to eq([{ slug: 'member' }]) + expect(user.role).to eq({slug: "member"}) + expect(user.roles).to eq([{slug: "member"}]) end end - context 'with multiple roles' do - it 'returns the highest priority role slug and roles array' do + context "with multiple roles" do + it "returns the highest priority role slug and roles array" do user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"role":{"slug":"admin"},"roles":[{"slug":"member"}, {"slug":"admin"}],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.role).to eq({ slug: 'admin' }) - expect(user.roles).to eq([{ slug: 'member' }, { slug: 'admin' }]) + expect(user.role).to eq({slug: "admin"}) + expect(user.roles).to eq([{slug: "member"}, {slug: "admin"}]) end end end diff --git a/spec/lib/workos/encryptors/aes_gcm_spec.rb b/spec/lib/workos/encryptors/aes_gcm_spec.rb index 911cfdde..f8abbed2 100644 --- a/spec/lib/workos/encryptors/aes_gcm_spec.rb +++ b/spec/lib/workos/encryptors/aes_gcm_spec.rb @@ -3,39 +3,39 @@ RSpec.describe WorkOS::Encryptors::AesGcm do subject(:encryptor) { described_class.new } - let(:key) { 'a' * 32 } - let(:data) { { access_token: 'tok_123', user: { id: 'user_01' } } } + let(:key) { "a" * 32 } + let(:data) { {access_token: "tok_123", user: {id: "user_01"}} } - describe '#seal' do - it 'returns a base64-encoded string' do + describe "#seal" do + it "returns a base64-encoded string" do sealed = encryptor.seal(data, key) expect(sealed).to be_a(String) expect { Base64.decode64(sealed) }.not_to raise_error end - it 'produces different output each time (random IV)' do + it "produces different output each time (random IV)" do sealed1 = encryptor.seal(data, key) sealed2 = encryptor.seal(data, key) expect(sealed1).not_to eq(sealed2) end end - describe '#unseal' do - it 'round-trips data correctly' do + describe "#unseal" do + it "round-trips data correctly" do sealed = encryptor.seal(data, key) unsealed = encryptor.unseal(sealed, key) expect(unsealed).to eq(data) end - it 'returns hash with symbolized keys' do - sealed = encryptor.seal({ 'string_key' => 'value' }, key) + it "returns hash with symbolized keys" do + sealed = encryptor.seal({"string_key" => "value"}, key) unsealed = encryptor.unseal(sealed, key) expect(unsealed.keys.first).to be_a(Symbol) end - it 'raises error with wrong key' do + it "raises error with wrong key" do sealed = encryptor.seal(data, key) - expect { encryptor.unseal(sealed, 'b' * 32) }.to raise_error(OpenSSL::Cipher::CipherError) + expect { encryptor.unseal(sealed, "b" * 32) }.to raise_error(OpenSSL::Cipher::CipherError) end end end diff --git a/spec/lib/workos/event_spec.rb b/spec/lib/workos/event_spec.rb index 213464dc..607f8426 100644 --- a/spec/lib/workos/event_spec.rb +++ b/spec/lib/workos/event_spec.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true describe WorkOS::Events do - it_behaves_like 'client' + it_behaves_like "client" - describe '.list_events' do - context 'with no options' do - it 'raises ArgumentError' do - VCR.use_cassette 'events/list_events_with_no_options' do + describe ".list_events" do + context "with no options" do + it "raises ArgumentError" do + VCR.use_cassette "events/list_events_with_no_options" do expect do described_class.list_events end.to raise_error(ArgumentError) @@ -14,21 +14,21 @@ end end - context 'with event option' do - it 'forms the proper request to the API' do + context "with event option" do + it "forms the proper request to the API" do request_args = [ - '/events?events=connection.activated', - 'Content-Type' => 'application/json' + "/events?events=connection.activated", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'events/list_events_with_event' do + VCR.use_cassette "events/list_events_with_event" do events = described_class.list_events( - events: ['connection.activated'], + events: ["connection.activated"] ) expect(events.data.size).to eq(1) @@ -36,22 +36,22 @@ end end - context 'with the after option' do - it 'forms the proper request to the API' do + context "with the after option" do + it "forms the proper request to the API" do request_args = [ - '/events?after=event_01FGCPNV312FHFRCX0BYWHVSE1&events=dsync.user.created', - 'Content-Type' => 'application/json' + "/events?after=event_01FGCPNV312FHFRCX0BYWHVSE1&events=dsync.user.created", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'events/list_events_with_after' do + VCR.use_cassette "events/list_events_with_after" do events = described_class.list_events( - after: 'event_01FGCPNV312FHFRCX0BYWHVSE1', - events: ['dsync.user.created'], + after: "event_01FGCPNV312FHFRCX0BYWHVSE1", + events: ["dsync.user.created"] ) expect(events.data.size).to eq(1) @@ -59,23 +59,23 @@ end end - context 'with the range_start and range_end options' do - it 'forms the proper request to the API' do + context "with the range_start and range_end options" do + it "forms the proper request to the API" do request_args = [ - '/events?events=dsync.user.created&range_start=2023-01-01T00%3A00%3A00Z&range_end=2023-01-03T00%3A00%3A00Z', - 'Content-Type' => 'application/json' + "/events?events=dsync.user.created&range_start=2023-01-01T00%3A00%3A00Z&range_end=2023-01-03T00%3A00%3A00Z", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'events/list_events_with_range' do + VCR.use_cassette "events/list_events_with_range" do events = described_class.list_events( - events: ['dsync.user.created'], - range_start: '2023-01-01T00:00:00Z', - range_end: '2023-01-03T00:00:00Z', + events: ["dsync.user.created"], + range_start: "2023-01-01T00:00:00Z", + range_end: "2023-01-03T00:00:00Z" ) expect(events.data.size).to eq(1) @@ -83,22 +83,22 @@ end end - context 'with the organization_id option' do - it 'forms the proper request to the API' do + context "with the organization_id option" do + it "forms the proper request to the API" do request_args = [ - '/events?events=dsync.user.created&organization_id=org_1234', - 'Content-Type' => 'application/json' + "/events?events=dsync.user.created&organization_id=org_1234", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'events/list_events_with_organization_id' do + VCR.use_cassette "events/list_events_with_organization_id" do events = described_class.list_events( - events: ['dsync.user.created'], - organization_id: 'org_1234', + events: ["dsync.user.created"], + organization_id: "org_1234" ) expect(events.data.size).to eq(1) diff --git a/spec/lib/workos/mfa_spec.rb b/spec/lib/workos/mfa_spec.rb index e13412ad..b3cbf43c 100644 --- a/spec/lib/workos/mfa_spec.rb +++ b/spec/lib/workos/mfa_spec.rb @@ -1,268 +1,268 @@ # frozen_string_literal: true describe WorkOS::MFA do - it_behaves_like 'client' + it_behaves_like "client" - describe '.enroll_factor' do - context 'with valid generic argument' do - it 'returns a valid factor object' do - VCR.use_cassette 'mfa/enroll_factor_generic_valid' do + describe ".enroll_factor" do + context "with valid generic argument" do + it "returns a valid factor object" do + VCR.use_cassette "mfa/enroll_factor_generic_valid" do factor = described_class.enroll_factor( - type: 'generic_otp', + type: "generic_otp" ) - expect(factor.type == 'generic_otp') + expect(factor.type == "generic_otp") end end end - context 'with valid totp arguments' do - it 'returns a valid factor object' do - VCR.use_cassette 'mfa/enroll_factor_totp_valid' do + context "with valid totp arguments" do + it "returns a valid factor object" do + VCR.use_cassette "mfa/enroll_factor_totp_valid" do factor = described_class.enroll_factor( - type: 'totp', - totp_issuer: 'WorkOS', - totp_user: 'some_user', + type: "totp", + totp_issuer: "WorkOS", + totp_user: "some_user" ) expect(factor.totp.instance_of?(Hash)) end end end - context 'with valid sms arguments' do - it 'returns a valid factor object' do - VCR.use_cassette 'mfa/enroll_factor_sms_valid' do + context "with valid sms arguments" do + it "returns a valid factor object" do + VCR.use_cassette "mfa/enroll_factor_sms_valid" do factor = described_class.enroll_factor( - type: 'sms', - phone_number: '55555555555', + type: "sms", + phone_number: "55555555555" ) expect(factor.sms.instance_of?(Hash)) end end end - context 'when type is not sms or totp' do - it 'returns an error' do + context "when type is not sms or totp" do + it "returns an error" do expect do described_class.enroll_factor( - type: 'invalid', - phone_number: '+15005550006', + type: "invalid", + phone_number: "+15005550006" ) end.to raise_error( ArgumentError, - "Type argument must be either 'sms' or 'totp'", + "Type argument must be either 'sms' or 'totp'" ) end end - context 'when type is totp but missing arguments' do - it 'returns an error' do + context "when type is totp but missing arguments" do + it "returns an error" do expect do described_class.enroll_factor( - type: 'totp', - totp_issuer: 'WorkOS', + type: "totp", + totp_issuer: "WorkOS" ) end.to raise_error( ArgumentError, - 'Incomplete arguments. Need to specify both totp_issuer and totp_user when type is totp', + "Incomplete arguments. Need to specify both totp_issuer and totp_user when type is totp" ) end end - context 'when type is sms and phone number is nil' do - it 'returns an error' do + context "when type is sms and phone number is nil" do + it "returns an error" do expect do described_class.enroll_factor( - type: 'sms', + type: "sms" ) end.to raise_error( ArgumentError, - 'Incomplete arguments. Need to specify phone_number when type is sms', + "Incomplete arguments. Need to specify phone_number when type is sms" ) end end end - describe '.challenge_factor' do - context 'challenge with totp' do - it 'returns challenge factor object for totp' do - VCR.use_cassette 'mfa/challenge_factor_totp_valid' do + describe ".challenge_factor" do + context "challenge with totp" do + it "returns challenge factor object for totp" do + VCR.use_cassette "mfa/challenge_factor_totp_valid" do challenge_factor = described_class.challenge_factor( - authentication_factor_id: 'auth_factor_01FZ4TS0MWPZR7GATS7KCXANQZ', + authentication_factor_id: "auth_factor_01FZ4TS0MWPZR7GATS7KCXANQZ" ) expect(challenge_factor.authentication_factor_id.class.instance_of?(String)) end end end - context 'challenge with sms' do - it 'returns a challenge factor object for sms' do - VCR.use_cassette 'mfa/challenge_factor_sms_valid' do + context "challenge with sms" do + it "returns a challenge factor object for sms" do + VCR.use_cassette "mfa/challenge_factor_sms_valid" do challenge_factor = described_class.challenge_factor( - authentication_factor_id: 'auth_factor_01FZ4TS14D1PHFNZ9GF6YD8M1F', - sms_template: 'Your code is {{code}}', + authentication_factor_id: "auth_factor_01FZ4TS14D1PHFNZ9GF6YD8M1F", + sms_template: "Your code is {{code}}" ) expect(challenge_factor.authentication_factor_id.instance_of?(String)) end end end - context 'challenge with generic' do - it 'returns a valid challenge factor object for generic otp' do - VCR.use_cassette 'mfa/challenge_factor_generic_valid' do + context "challenge with generic" do + it "returns a valid challenge factor object for generic otp" do + VCR.use_cassette "mfa/challenge_factor_generic_valid" do challenge_factor = described_class.challenge_factor( - authentication_factor_id: 'auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M', + authentication_factor_id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" ) expect(challenge_factor.code.instance_of?(String)) end end end - context 'challenge with totp mssing authentication_factor_id' do - it 'returns argument error' do + context "challenge with totp mssing authentication_factor_id" do + it "returns argument error" do expect do described_class.challenge_factor end.to raise_error( ArgumentError, - "Incomplete arguments: 'authentication_factor_id' is a required argument", + "Incomplete arguments: 'authentication_factor_id' is a required argument" ) end end end - describe '.verify_factor' do - it 'throws a warning' do - VCR.use_cassette 'mfa/verify_challenge_generic_valid' do + describe ".verify_factor" do + it "throws a warning" do + VCR.use_cassette "mfa/verify_challenge_generic_valid" do allow(Warning).to receive(:warn) described_class.verify_factor( - authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J', - code: '897792', + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" ) expect(Warning).to have_received(:warn).with( "[DEPRECATION] `verify_factor` is deprecated. Please use `verify_challenge` instead.\n", - any_args, + any_args ) end end - it 'calls verify_challenge' do - VCR.use_cassette 'mfa/verify_challenge_generic_valid' do + it "calls verify_challenge" do + VCR.use_cassette "mfa/verify_challenge_generic_valid" do verify_factor = described_class.verify_factor( - authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J', - code: '897792', + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" ) - expect(verify_factor.valid == 'true') + expect(verify_factor.valid == "true") end end end - describe '.verify_challenge' do - context 'with generic otp' do - context 'and the challenge has not been verified' do - it 'returns true if the code is correct' do - VCR.use_cassette 'mfa/verify_challenge_generic_valid' do + describe ".verify_challenge" do + context "with generic otp" do + context "and the challenge has not been verified" do + it "returns true if the code is correct" do + VCR.use_cassette "mfa/verify_challenge_generic_valid" do verify_challenge = described_class.verify_challenge( - authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J', - code: '897792', + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" ) - expect(verify_challenge.valid == 'true') + expect(verify_challenge.valid == "true") end end - it 'returns false if the code is incorrect' do - VCR.use_cassette 'mfa/verify_challenge_generic_valid_is_false' do + it "returns false if the code is incorrect" do + VCR.use_cassette "mfa/verify_challenge_generic_valid_is_false" do verify_challenge = described_class.verify_challenge( - authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J', - code: '897792', + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" ) - expect(verify_challenge.valid == 'false') + expect(verify_challenge.valid == "false") end end end - context 'and the challenge has already been verified' do - it 'returns an error' do - VCR.use_cassette 'mfa/verify_challenge_generic_invalid' do + context "and the challenge has already been verified" do + it "returns an error" do + VCR.use_cassette "mfa/verify_challenge_generic_invalid" do expect do described_class.verify_challenge( - authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J', - code: '897792', + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" ) end.to raise_error(WorkOS::UnprocessableEntityError) end end end - context 'and the challenge has expired' do - it 'returns an error' do - VCR.use_cassette 'mfa/verify_challenge_generic_expired' do + context "and the challenge has expired" do + it "returns an error" do + VCR.use_cassette "mfa/verify_challenge_generic_expired" do expect do described_class.verify_challenge( - authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J', - code: '897792', + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" ) end.to raise_error(WorkOS::UnprocessableEntityError) end end end - context 'with missing code argument' do - it 'returns an argument error' do + context "with missing code argument" do + it "returns an argument error" do expect do described_class.verify_challenge( - authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J', + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J" ) end.to raise_error( ArgumentError, - "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments", + "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments" ) end end - context 'with missing authentication_challenge_id argument' do - it 'returns an error' do + context "with missing authentication_challenge_id argument" do + it "returns an error" do expect do described_class.verify_challenge( - code: '897792', + code: "897792" ) end.to raise_error( ArgumentError, - "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments", + "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments" ) end end - context 'with missing code and authentication_challenge_id arguments' do - it 'returns an argument error' do + context "with missing code and authentication_challenge_id arguments" do + it "returns an argument error" do expect do described_class.verify_challenge end.to raise_error( ArgumentError, - "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments", + "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments" ) end end end end - describe '.get_factor' do - context 'with a valid id' do - it 'returns a factor' do - VCR.use_cassette 'mfa/get_factor_valid' do + describe ".get_factor" do + context "with a valid id" do + it "returns a factor" do + VCR.use_cassette "mfa/get_factor_valid" do factor = described_class.get_factor( - id: 'auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M', + id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" ) expect(factor.id.instance_of?(String)) end end end - context 'with an invalid id' do - it 'returns an error' do - VCR.use_cassette 'mfa/get_factor_invalid' do + context "with an invalid id" do + it "returns an error" do + VCR.use_cassette "mfa/get_factor_invalid" do expect do described_class.get_factor( - id: 'auth_factor_invalid', + id: "auth_factor_invalid" ) end.to raise_error(WorkOS::NotFoundError) end @@ -270,12 +270,12 @@ end end - describe '.delete_factor' do - context 'deletes facotr' do - it 'uses delete_factor to delete factor' do - VCR.use_cassette 'mfa/delete_factor' do + describe ".delete_factor" do + context "deletes facotr" do + it "uses delete_factor to delete factor" do + VCR.use_cassette "mfa/delete_factor" do response = described_class.delete_factor( - id: 'auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M', + id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" ) expect(response).to be(true) end diff --git a/spec/lib/workos/organizations_spec.rb b/spec/lib/workos/organizations_spec.rb index 5ce146d1..bf97980b 100644 --- a/spec/lib/workos/organizations_spec.rb +++ b/spec/lib/workos/organizations_spec.rb @@ -1,123 +1,123 @@ # frozen_string_literal: true describe WorkOS::Organizations do - it_behaves_like 'client' + it_behaves_like "client" - describe '.create_organization' do - context 'with valid payload' do - context 'with no idempotency key' do - it 'creates an organization' do - VCR.use_cassette 'organization/create' do + describe ".create_organization" do + context "with valid payload" do + context "with no idempotency key" do + it "creates an organization" do + VCR.use_cassette "organization/create" do organization = described_class.create_organization( - domains: ['example.io'], - name: 'Test Organization', + domains: ["example.io"], + name: "Test Organization" ) - expect(organization.id).to eq('org_01FCPEJXEZR4DSBA625YMGQT9N') - expect(organization.name).to eq('Test Organization') - expect(organization.domains.first[:domain]).to eq('example.io') + expect(organization.id).to eq("org_01FCPEJXEZR4DSBA625YMGQT9N") + expect(organization.name).to eq("Test Organization") + expect(organization.domains.first[:domain]).to eq("example.io") end end - context 'without domains' do - it 'creates an organization' do - VCR.use_cassette 'organization/create_without_domains' do + context "without domains" do + it "creates an organization" do + VCR.use_cassette "organization/create_without_domains" do organization = described_class.create_organization( - name: 'Test Organization', + name: "Test Organization" ) - expect(organization.id).to start_with('org_') - expect(organization.name).to eq('Test Organization') + expect(organization.id).to start_with("org_") + expect(organization.name).to eq("Test Organization") expect(organization.domains).to be_empty end end end - context 'with external_id' do - it 'creates an organization with external_id' do - VCR.use_cassette 'organization/create_with_external_id' do + context "with external_id" do + it "creates an organization with external_id" do + VCR.use_cassette "organization/create_with_external_id" do organization = described_class.create_organization( - name: 'Test Organization with External ID', - external_id: 'ext_org_123', + name: "Test Organization with External ID", + external_id: "ext_org_123" ) - expect(organization.id).to start_with('org_') - expect(organization.name).to eq('Test Organization with External ID') - expect(organization.external_id).to eq('ext_org_123') + expect(organization.id).to start_with("org_") + expect(organization.name).to eq("Test Organization with External ID") + expect(organization.external_id).to eq("ext_org_123") end end end - context 'with domains' do - it 'creates an organization and warns' do - VCR.use_cassette 'organization/create_with_domains' do + context "with domains" do + it "creates an organization and warns" do + VCR.use_cassette "organization/create_with_domains" do allow(Warning).to receive(:warn) organization = described_class.create_organization( - domains: ['example.io'], - name: 'Test Organization', + domains: ["example.io"], + name: "Test Organization" ) - expect(organization.id).to start_with('org_') - expect(organization.name).to eq('Test Organization') - expect(organization.domains.first[:domain]).to eq('example.io') + expect(organization.id).to start_with("org_") + expect(organization.name).to eq("Test Organization") + expect(organization.domains.first[:domain]).to eq("example.io") expect(Warning).to have_received(:warn).with( "[DEPRECATION] `domains` is deprecated. Use `domain_data` instead.\n", - any_args, + any_args ) end end end - context 'with domain_data' do - it 'creates an organization' do - VCR.use_cassette 'organization/create_with_domain_data' do + context "with domain_data" do + it "creates an organization" do + VCR.use_cassette "organization/create_with_domain_data" do organization = described_class.create_organization( - domain_data: [{ domain: 'example.io', state: 'verified' }], - name: 'Test Organization', + domain_data: [{domain: "example.io", state: "verified"}], + name: "Test Organization" ) - expect(organization.id).to start_with('org_') - expect(organization.name).to eq('Test Organization') + expect(organization.id).to start_with("org_") + expect(organization.name).to eq("Test Organization") expect(organization.domains.first).to include( - domain: 'example.io', state: 'verified', + domain: "example.io", state: "verified" ) end end end end - context 'with idempotency key' do - context 'when idempotency key is used once' do - it 'creates an organization' do - VCR.use_cassette 'organization/create_with_idempotency_key' do + context "with idempotency key" do + context "when idempotency key is used once" do + it "creates an organization" do + VCR.use_cassette "organization/create_with_idempotency_key" do organization = described_class.create_organization( - domains: ['example.io'], - name: 'Test Organization', - idempotency_key: 'key', + domains: ["example.io"], + name: "Test Organization", + idempotency_key: "key" ) - expect(organization.name).to eq('Test Organization') - expect(organization.domains.first[:domain]).to eq('example.io') + expect(organization.name).to eq("Test Organization") + expect(organization.domains.first[:domain]).to eq("example.io") end end end - context 'when idempotency key is used more than once' do - context 'with duplicate event payloads' do - it 'returns the already created organization' do - VCR.use_cassette 'organization/create_with_duplicate_idempotency_key_and_payload' do + context "when idempotency key is used more than once" do + context "with duplicate event payloads" do + it "returns the already created organization" do + VCR.use_cassette "organization/create_with_duplicate_idempotency_key_and_payload" do organization1 = described_class.create_organization( - domains: ['example.com'], - name: 'Test Organization', - idempotency_key: 'foo', + domains: ["example.com"], + name: "Test Organization", + idempotency_key: "foo" ) organization2 = described_class.create_organization( - domains: ['example.com'], - name: 'Test Organization', - idempotency_key: 'foo', + domains: ["example.com"], + name: "Test Organization", + idempotency_key: "foo" ) expect(organization1.id).to eq(organization2.id) @@ -125,24 +125,24 @@ end end - context 'with different event payloads' do - it 'raises an error' do - VCR.use_cassette 'organization/create_with_duplicate_idempotency_key_and_different_payload' do + context "with different event payloads" do + it "raises an error" do + VCR.use_cassette "organization/create_with_duplicate_idempotency_key_and_different_payload" do described_class.create_organization( - domains: ['example.me'], - name: 'Test Organization', - idempotency_key: 'bar', + domains: ["example.me"], + name: "Test Organization", + idempotency_key: "bar" ) expect do described_class.create_organization( - domains: ['example.me'], - name: 'Organization Test', - idempotency_key: 'bar', + domains: ["example.me"], + name: "Organization Test", + idempotency_key: "bar" ) end.to raise_error( WorkOS::InvalidRequestError, - /Status 400, Another idempotency key \(bar\) with different request parameters was found. Please use a different idempotency key./, + /Status 400, Another idempotency key \(bar\) with different request parameters was found. Please use a different idempotency key./ ) end end @@ -151,32 +151,32 @@ end end - context 'with an invalid payload' do - it 'returns an error' do - VCR.use_cassette 'organization/create_invalid' do + context "with an invalid payload" do + it "returns an error" do + VCR.use_cassette "organization/create_invalid" do expect do described_class.create_organization( - domains: ['example.com'], - name: 'Test Organization 2', + domains: ["example.com"], + name: "Test Organization 2" ) end.to raise_error( WorkOS::APIError, - /An Organization with the domain example.com already exists/, + /An Organization with the domain example.com already exists/ ) end end end end - describe '.list_organizations' do - context 'with no options' do - it 'returns organizations and metadata' do + describe ".list_organizations" do + context "with no options" do + it "returns organizations and metadata" do expected_metadata = { - 'after' => nil, - 'before' => 'before-id', + "after" => nil, + "before" => "before-id" } - VCR.use_cassette 'organization/list' do + VCR.use_cassette "organization/list" do organizations = described_class.list_organizations expect(organizations.data.size).to eq(6) @@ -185,22 +185,22 @@ end end - context 'with the before option' do - it 'forms the proper request to the API' do + context "with the before option" do + it "forms the proper request to the API" do request_args = [ - '/organizations?before=before-id&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/organizations?before=before-id&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'organization/list', match_requests_on: [:path] do + VCR.use_cassette "organization/list", match_requests_on: [:path] do organizations = described_class.list_organizations( - before: 'before-id', + before: "before-id" ) expect(organizations.data.size).to eq(6) @@ -208,41 +208,41 @@ end end - context 'with the after option' do - it 'forms the proper request to the API' do + context "with the after option" do + it "forms the proper request to the API" do request_args = [ - '/organizations?after=after-id&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/organizations?after=after-id&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'organization/list', match_requests_on: [:path] do - organizations = described_class.list_organizations(after: 'after-id') + VCR.use_cassette "organization/list", match_requests_on: [:path] do + organizations = described_class.list_organizations(after: "after-id") expect(organizations.data.size).to eq(6) end end end - context 'with the limit option' do - it 'forms the proper request to the API' do + context "with the limit option" do + it "forms the proper request to the API" do request_args = [ - '/organizations?limit=10&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/organizations?limit=10&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'organization/list', match_requests_on: [:path] do + VCR.use_cassette "organization/list", match_requests_on: [:path] do organizations = described_class.list_organizations(limit: 10) expect(organizations.data.size).to eq(6) @@ -251,125 +251,125 @@ end end - describe '.get_organization' do - context 'with a valid id' do - it 'gets the organization details' do - VCR.use_cassette('organization/get') do + describe ".get_organization" do + context "with a valid id" do + it "gets the organization details" do + VCR.use_cassette("organization/get") do organization = described_class.get_organization( - id: 'org_01F9293WD2PDEEV4Y625XPZVG7', + id: "org_01F9293WD2PDEEV4Y625XPZVG7" ) - expect(organization.id).to eq('org_01F9293WD2PDEEV4Y625XPZVG7') - expect(organization.name).to eq('Foo Corp') - expect(organization.domains.first[:domain]).to eq('foo-corp.com') + expect(organization.id).to eq("org_01F9293WD2PDEEV4Y625XPZVG7") + expect(organization.name).to eq("Foo Corp") + expect(organization.domains.first[:domain]).to eq("foo-corp.com") end end end - context 'with an invalid id' do - it 'raises an error' do - VCR.use_cassette('organization/get_invalid') do + context "with an invalid id" do + it "raises an error" do + VCR.use_cassette("organization/get_invalid") do expect do - described_class.get_organization(id: 'invalid') + described_class.get_organization(id: "invalid") end.to raise_error( WorkOS::NotFoundError, - 'Status 404, Not Found - request ID: ', + "Status 404, Not Found - request ID: " ) end end end end - describe '.update_organization' do - context 'with valid payload' do - it 'updates the organization' do - VCR.use_cassette 'organization/update' do + describe ".update_organization" do + context "with valid payload" do + it "updates the organization" do + VCR.use_cassette "organization/update" do organization = described_class.update_organization( - organization: 'org_01F6Q6TFP7RD2PF6J03ANNWDKV', - domains: ['example.me'], - name: 'Test Organization', + organization: "org_01F6Q6TFP7RD2PF6J03ANNWDKV", + domains: ["example.me"], + name: "Test Organization" ) - expect(organization.id).to eq('org_01F6Q6TFP7RD2PF6J03ANNWDKV') - expect(organization.name).to eq('Test Organization') - expect(organization.domains.first[:domain]).to eq('example.me') + expect(organization.id).to eq("org_01F6Q6TFP7RD2PF6J03ANNWDKV") + expect(organization.name).to eq("Test Organization") + expect(organization.domains.first[:domain]).to eq("example.me") end end end - context 'without a name' do - it 'updates the organization' do - VCR.use_cassette 'organization/update_without_name' do + context "without a name" do + it "updates the organization" do + VCR.use_cassette "organization/update_without_name" do organization = described_class.update_organization( - organization: 'org_01F6Q6TFP7RD2PF6J03ANNWDKV', - domains: ['example.me'], + organization: "org_01F6Q6TFP7RD2PF6J03ANNWDKV", + domains: ["example.me"] ) - expect(organization.id).to eq('org_01F6Q6TFP7RD2PF6J03ANNWDKV') - expect(organization.name).to eq('Test Organization') - expect(organization.domains.first[:domain]).to eq('example.me') + expect(organization.id).to eq("org_01F6Q6TFP7RD2PF6J03ANNWDKV") + expect(organization.name).to eq("Test Organization") + expect(organization.domains.first[:domain]).to eq("example.me") end end end - context 'with a stripe_customer_id' do - it 'updates the organization' do - VCR.use_cassette 'organization/update_with_stripe_customer_id' do + context "with a stripe_customer_id" do + it "updates the organization" do + VCR.use_cassette "organization/update_with_stripe_customer_id" do organization = described_class.update_organization( - organization: 'org_01JJ5H14CAA2SQ5G9HNN6TBZ05', - name: 'Test Organization', - stripe_customer_id: 'cus_123', + organization: "org_01JJ5H14CAA2SQ5G9HNN6TBZ05", + name: "Test Organization", + stripe_customer_id: "cus_123" ) - expect(organization.id).to eq('org_01JJ5H14CAA2SQ5G9HNN6TBZ05') - expect(organization.name).to eq('Test Organization') - expect(organization.stripe_customer_id).to eq('cus_123') + expect(organization.id).to eq("org_01JJ5H14CAA2SQ5G9HNN6TBZ05") + expect(organization.name).to eq("Test Organization") + expect(organization.stripe_customer_id).to eq("cus_123") end end end - context 'with an external_id' do - it 'updates the organization' do - VCR.use_cassette 'organization/update_with_external_id' do + context "with an external_id" do + it "updates the organization" do + VCR.use_cassette "organization/update_with_external_id" do organization = described_class.update_organization( - organization: 'org_01K0SQV0S6EPWK2ZDEFD1CP1JC', - name: 'Test Organization', - external_id: 'ext_org_456', + organization: "org_01K0SQV0S6EPWK2ZDEFD1CP1JC", + name: "Test Organization", + external_id: "ext_org_456" ) - expect(organization.id).to eq('org_01K0SQV0S6EPWK2ZDEFD1CP1JC') - expect(organization.name).to eq('Test Organization') - expect(organization.external_id).to eq('ext_org_456') + expect(organization.id).to eq("org_01K0SQV0S6EPWK2ZDEFD1CP1JC") + expect(organization.name).to eq("Test Organization") + expect(organization.external_id).to eq("ext_org_456") end end end - context 'can set external_id to null explicitly' do - it 'includes external_id null in request body' do + context "can set external_id to null explicitly" do + it "includes external_id null in request body" do original_method = described_class.method(:put_request) allow(described_class).to receive(:put_request) do |kwargs| original_method.call(**kwargs) end - VCR.use_cassette 'organization/update_with_external_id_null' do + VCR.use_cassette "organization/update_with_external_id_null" do described_class.update_organization( - organization: 'org_01K0SQV0S6EPWK2ZDEFD1CP1JC', - name: 'Test Organization', - external_id: nil, + organization: "org_01K0SQV0S6EPWK2ZDEFD1CP1JC", + name: "Test Organization", + external_id: nil ) end # Verify the spy captured the right call expect(described_class).to have_received(:put_request).with( - hash_including(body: hash_including(external_id: nil)), + hash_including(body: hash_including(external_id: nil)) ) end end end - describe '.delete_organization' do - context 'with a valid id' do - it 'returns true' do - VCR.use_cassette('organization/delete') do + describe ".delete_organization" do + context "with a valid id" do + it "returns true" do + VCR.use_cassette("organization/delete") do response = described_class.delete_organization( - id: 'org_01F4A8TD0B4N1Y9SJ8SH635HDB', + id: "org_01F4A8TD0B4N1Y9SJ8SH635HDB" ) expect(response).to be(true) @@ -377,91 +377,91 @@ end end - context 'with an invalid id' do - it 'returns false' do - VCR.use_cassette('organization/delete_invalid') do + context "with an invalid id" do + it "returns false" do + VCR.use_cassette("organization/delete_invalid") do expect do - described_class.delete_organization(id: 'invalid') + described_class.delete_organization(id: "invalid") end.to raise_error( WorkOS::NotFoundError, - 'Status 404, Not Found - request ID: ', + "Status 404, Not Found - request ID: " ) end end end end - describe '.list_organization_roles' do - context 'with no options' do - it 'returns roles for organization' do + describe ".list_organization_roles" do + context "with no options" do + it "returns roles for organization" do expected_metadata = { after: nil, - before: nil, + before: nil } - VCR.use_cassette 'organization/list_organization_roles' do - roles = described_class.list_organization_roles(organization_id: 'org_01JEXP6Z3X7HE4CB6WQSH9ZAFE') + VCR.use_cassette "organization/list_organization_roles" do + roles = described_class.list_organization_roles(organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE") expect(roles.data.size).to eq(7) expect(roles.list_metadata).to eq(expected_metadata) end end - it 'returns properly initialized Role objects with all attributes' do - VCR.use_cassette 'organization/list_organization_roles' do - roles = described_class.list_organization_roles(organization_id: 'org_01JEXP6Z3X7HE4CB6WQSH9ZAFE') + it "returns properly initialized Role objects with all attributes" do + VCR.use_cassette "organization/list_organization_roles" do + roles = described_class.list_organization_roles(organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE") first_role = roles.data.first expect(first_role).to be_a(WorkOS::Role) - expect(first_role.id).to eq('role_01HS1C7GRJE08PBR3M6Y0ZYGDZ') - expect(first_role.name).to eq('Admin') - expect(first_role.slug).to eq('admin') - expect(first_role.description).to eq('Write access to every resource available') - expect(first_role.permissions).to eq(['admin:all', 'read:users', 'write:users', 'manage:roles']) - expect(first_role.type).to eq('EnvironmentRole') - expect(first_role.created_at).to eq('2024-03-15T15:38:29.521Z') - expect(first_role.updated_at).to eq('2024-11-14T17:08:00.556Z') + expect(first_role.id).to eq("role_01HS1C7GRJE08PBR3M6Y0ZYGDZ") + expect(first_role.name).to eq("Admin") + expect(first_role.slug).to eq("admin") + expect(first_role.description).to eq("Write access to every resource available") + expect(first_role.permissions).to eq(["admin:all", "read:users", "write:users", "manage:roles"]) + expect(first_role.type).to eq("EnvironmentRole") + expect(first_role.created_at).to eq("2024-03-15T15:38:29.521Z") + expect(first_role.updated_at).to eq("2024-11-14T17:08:00.556Z") end end - it 'handles roles with empty permissions arrays' do - VCR.use_cassette 'organization/list_organization_roles' do - roles = described_class.list_organization_roles(organization_id: 'org_01JEXP6Z3X7HE4CB6WQSH9ZAFE') + it "handles roles with empty permissions arrays" do + VCR.use_cassette "organization/list_organization_roles" do + roles = described_class.list_organization_roles(organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE") - platform_manager_role = roles.data.find { |role| role.slug == 'org-platform-manager' } + platform_manager_role = roles.data.find { |role| role.slug == "org-platform-manager" } expect(platform_manager_role).to be_a(WorkOS::Role) expect(platform_manager_role.permissions).to eq([]) end end - it 'properly serializes Role objects including permissions' do - VCR.use_cassette 'organization/list_organization_roles' do - roles = described_class.list_organization_roles(organization_id: 'org_01JEXP6Z3X7HE4CB6WQSH9ZAFE') + it "properly serializes Role objects including permissions" do + VCR.use_cassette "organization/list_organization_roles" do + roles = described_class.list_organization_roles(organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE") - billing_role = roles.data.find { |role| role.slug == 'billing' } + billing_role = roles.data.find { |role| role.slug == "billing" } serialized = billing_role.to_json - expect(serialized[:id]).to eq('role_01JA8GJZRDSZEB9289DQXJ3N9Z') - expect(serialized[:name]).to eq('Billing Manager') - expect(serialized[:slug]).to eq('billing') - expect(serialized[:permissions]).to eq(['read:billing', 'write:billing']) - expect(serialized[:type]).to eq('EnvironmentRole') + expect(serialized[:id]).to eq("role_01JA8GJZRDSZEB9289DQXJ3N9Z") + expect(serialized[:name]).to eq("Billing Manager") + expect(serialized[:slug]).to eq("billing") + expect(serialized[:permissions]).to eq(["read:billing", "write:billing"]) + expect(serialized[:type]).to eq("EnvironmentRole") end end end end - describe '.list_organization_feature_flags' do - context 'with no options' do - it 'returns feature flags for organization' do + describe ".list_organization_feature_flags" do + context "with no options" do + it "returns feature flags for organization" do expected_metadata = { after: nil, - before: nil, + before: nil } - VCR.use_cassette 'organization/list_organization_feature_flags' do + VCR.use_cassette "organization/list_organization_feature_flags" do feature_flags = described_class.list_organization_feature_flags( - organization_id: 'org_01HX7Q7R12H1JMAKN75SH2G529', + organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529" ) expect(feature_flags.data.size).to eq(2) @@ -470,23 +470,23 @@ end end - context 'with the before option' do - it 'forms the proper request to the API' do + context "with the before option" do + it "forms the proper request to the API" do request_args = [ - '/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?before=before-id&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?before=before-id&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'organization/list_organization_feature_flags', match_requests_on: [:path] do + VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do feature_flags = described_class.list_organization_feature_flags( - organization_id: 'org_01HX7Q7R12H1JMAKN75SH2G529', - options: { before: 'before-id' }, + organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", + options: {before: "before-id"} ) expect(feature_flags.data.size).to eq(2) @@ -494,23 +494,23 @@ end end - context 'with the after option' do - it 'forms the proper request to the API' do + context "with the after option" do + it "forms the proper request to the API" do request_args = [ - '/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?after=after-id&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?after=after-id&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'organization/list_organization_feature_flags', match_requests_on: [:path] do + VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do feature_flags = described_class.list_organization_feature_flags( - organization_id: 'org_01HX7Q7R12H1JMAKN75SH2G529', - options: { after: 'after-id' }, + organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", + options: {after: "after-id"} ) expect(feature_flags.data.size).to eq(2) @@ -518,23 +518,23 @@ end end - context 'with the limit option' do - it 'forms the proper request to the API' do + context "with the limit option" do + it "forms the proper request to the API" do request_args = [ - '/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?limit=10&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?limit=10&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'organization/list_organization_feature_flags', match_requests_on: [:path] do + VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do feature_flags = described_class.list_organization_feature_flags( - organization_id: 'org_01HX7Q7R12H1JMAKN75SH2G529', - options: { limit: 10 }, + organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", + options: {limit: 10} ) expect(feature_flags.data.size).to eq(2) @@ -542,23 +542,23 @@ end end - context 'with multiple pagination options' do - it 'forms the proper request to the API' do + context "with multiple pagination options" do + it "forms the proper request to the API" do request_args = [ - '/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?after=after-id&'\ - 'limit=5&order=asc', - 'Content-Type' => 'application/json' + "/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?after=after-id&" \ + "limit=5&order=asc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'organization/list_organization_feature_flags', match_requests_on: [:path] do + VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do feature_flags = described_class.list_organization_feature_flags( - organization_id: 'org_01HX7Q7R12H1JMAKN75SH2G529', - options: { after: 'after-id', limit: 5, order: 'asc' }, + organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", + options: {after: "after-id", limit: 5, order: "asc"} ) expect(feature_flags.data.size).to eq(2) diff --git a/spec/lib/workos/passwordless_spec.rb b/spec/lib/workos/passwordless_spec.rb index d3d5fe19..0dfed070 100644 --- a/spec/lib/workos/passwordless_spec.rb +++ b/spec/lib/workos/passwordless_spec.rb @@ -1,73 +1,73 @@ # frozen_string_literal: true describe WorkOS::Passwordless do - it_behaves_like 'client' + it_behaves_like "client" - describe '.create_session' do - context 'with valid options payload' do + describe ".create_session" do + context "with valid options payload" do let(:valid_options) do { - email: 'demo@workos-okta.com', - type: 'MagicLink', - redirect_uri: 'foo.com/auth/callback', + email: "demo@workos-okta.com", + type: "MagicLink", + redirect_uri: "foo.com/auth/callback" } end - it 'creates a session' do - VCR.use_cassette('passwordless/create_session') do + it "creates a session" do + VCR.use_cassette("passwordless/create_session") do response = described_class.create_session(valid_options) - expect(response.email).to eq 'demo@workos-okta.com' + expect(response.email).to eq "demo@workos-okta.com" end end end - context 'with invalid event payload' do + context "with invalid event payload" do let(:invalid_options) do {} end - it 'raises an error' do - VCR.use_cassette('passwordless/create_session_invalid') do + it "raises an error" do + VCR.use_cassette("passwordless/create_session_invalid") do expect do described_class.create_session(invalid_options) end.to raise_error( WorkOS::UnprocessableEntityError, - /Status 422, Validation failed \(email: email must be a string; type: type must be a valid enum value\)/, + /Status 422, Validation failed \(email: email must be a string; type: type must be a valid enum value\)/ ) end end end end - describe '.send_session' do - context 'with valid session id' do + describe ".send_session" do + context "with valid session id" do let(:valid_options) do { - email: 'demo@workos-okta.com', - type: 'MagicLink', + email: "demo@workos-okta.com", + type: "MagicLink" } end - it 'send a session' do - VCR.use_cassette('passwordless/send_session') do + it "send a session" do + VCR.use_cassette("passwordless/send_session") do response = described_class.send_session( - 'passwordless_session_01EJC0F4KH42T11Y2DHPEB09BM', + "passwordless_session_01EJC0F4KH42T11Y2DHPEB09BM" ) - expect(response['success']).to eq true + expect(response["success"]).to eq true end end end - context 'with invalid session id' do - it 'raises an error' do - VCR.use_cassette('passwordless/send_session_invalid') do + context "with invalid session id" do + it "raises an error" do + VCR.use_cassette("passwordless/send_session_invalid") do expect do - described_class.send_session('session_123') + described_class.send_session("session_123") end.to raise_error( WorkOS::UnprocessableEntityError, - /Status 422, The passwordless session 'session_123' has expired or is invalid./, + /Status 422, The passwordless session 'session_123' has expired or is invalid./ ) end end diff --git a/spec/lib/workos/portal_spec.rb b/spec/lib/workos/portal_spec.rb index c04210f6..9c7bb06e 100644 --- a/spec/lib/workos/portal_spec.rb +++ b/spec/lib/workos/portal_spec.rb @@ -1,114 +1,114 @@ # frozen_string_literal: true describe WorkOS::Portal do - it_behaves_like 'client' + it_behaves_like "client" - describe '.generate_link' do - let(:organization) { 'org_01EHQMYV6MBK39QC5PZXHY59C3' } + describe ".generate_link" do + let(:organization) { "org_01EHQMYV6MBK39QC5PZXHY59C3" } - describe 'with a valid organization' do - context 'with the sso intent' do - it 'returns an Admin Portal link' do - VCR.use_cassette 'portal/generate_link_sso' do + describe "with a valid organization" do + context "with the sso intent" do + it "returns an Admin Portal link" do + VCR.use_cassette "portal/generate_link_sso" do portal_link = described_class.generate_link( - intent: 'sso', - organization: organization, + intent: "sso", + organization: organization ) expect(portal_link).to eq( - 'https://id.workos.com/portal/launch?secret=secret', + "https://id.workos.com/portal/launch?secret=secret" ) end end end - describe 'with the dsync intent' do - it 'returns an Admin Portal link' do - VCR.use_cassette 'portal/generate_link_dsync' do + describe "with the dsync intent" do + it "returns an Admin Portal link" do + VCR.use_cassette "portal/generate_link_dsync" do portal_link = described_class.generate_link( - intent: 'dsync', - organization: organization, + intent: "dsync", + organization: organization ) expect(portal_link).to eq( - 'https://id.workos.com/portal/launch?secret=secret', + "https://id.workos.com/portal/launch?secret=secret" ) end end end - describe 'with the audit_logs intent' do - it 'returns an Admin Portal link' do - VCR.use_cassette 'portal/generate_link_audit_logs', match_requests_on: %i[path body] do + describe "with the audit_logs intent" do + it "returns an Admin Portal link" do + VCR.use_cassette "portal/generate_link_audit_logs", match_requests_on: %i[path body] do portal_link = described_class.generate_link( - intent: 'audit_logs', - organization: organization, + intent: "audit_logs", + organization: organization ) expect(portal_link).to eq( - 'https://id.workos.com/portal/launch?secret=secret', + "https://id.workos.com/portal/launch?secret=secret" ) end end end - describe 'with the certificate_renewal intent' do - it 'returns an Admin Portal link' do - VCR.use_cassette 'portal/generate_link_certificate_renewal', match_requests_on: %i[path body] do + describe "with the certificate_renewal intent" do + it "returns an Admin Portal link" do + VCR.use_cassette "portal/generate_link_certificate_renewal", match_requests_on: %i[path body] do portal_link = described_class.generate_link( - intent: 'certificate_renewal', - organization: organization, + intent: "certificate_renewal", + organization: organization ) expect(portal_link).to eq( - 'https://id.workos.com/portal/launch?secret=secret', + "https://id.workos.com/portal/launch?secret=secret" ) end end end end - describe 'with the domain_verification intent' do - it 'returns an Admin Portal link' do - VCR.use_cassette 'portal/generate_link_domain_verification', match_requests_on: %i[path body] do + describe "with the domain_verification intent" do + it "returns an Admin Portal link" do + VCR.use_cassette "portal/generate_link_domain_verification", match_requests_on: %i[path body] do portal_link = described_class.generate_link( - intent: 'domain_verification', - organization: organization, + intent: "domain_verification", + organization: organization ) expect(portal_link).to eq( - 'https://id.workos.com/portal/launch?secret=secret', + "https://id.workos.com/portal/launch?secret=secret" ) end end end - describe 'with an invalid organization' do - it 'raises an error' do - VCR.use_cassette 'portal/generate_link_invalid' do + describe "with an invalid organization" do + it "raises an error" do + VCR.use_cassette "portal/generate_link_invalid" do expect do described_class.generate_link( - intent: 'sso', - organization: 'bogus-id', + intent: "sso", + organization: "bogus-id" ) end.to raise_error( WorkOS::InvalidRequestError, - /Could not find an organization with the id, bogus-id/, + /Could not find an organization with the id, bogus-id/ ) end end end - describe 'with an invalid intent' do - it 'raises an error' do + describe "with an invalid intent" do + it "raises an error" do expect do described_class.generate_link( - intent: 'bogus-intent', - organization: organization, + intent: "bogus-intent", + organization: organization ) end.to raise_error( ArgumentError, - /bogus-intent is not a valid value/, + /bogus-intent is not a valid value/ ) end end diff --git a/spec/lib/workos/role_spec.rb b/spec/lib/workos/role_spec.rb index 8d4d8f75..5f9ea193 100644 --- a/spec/lib/workos/role_spec.rb +++ b/spec/lib/workos/role_spec.rb @@ -1,69 +1,69 @@ # frozen_string_literal: true describe WorkOS::Role do - describe '.initialize' do - context 'with full role data including permissions' do - it 'initializes all attributes correctly' do + describe ".initialize" do + context "with full role data including permissions" do + it "initializes all attributes correctly" do role_json = { - id: 'role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY', - name: 'Admin', - slug: 'admin', - description: 'Administrator role with full access', - permissions: ['read:users', 'write:users', 'admin:all'], - type: 'system', - created_at: '2022-05-13T17:45:31.732Z', - updated_at: '2022-07-13T17:45:42.618Z', + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "Admin", + slug: "admin", + description: "Administrator role with full access", + permissions: ["read:users", "write:users", "admin:all"], + type: "system", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" }.to_json role = described_class.new(role_json) - expect(role.id).to eq('role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY') - expect(role.name).to eq('Admin') - expect(role.slug).to eq('admin') - expect(role.description).to eq('Administrator role with full access') - expect(role.permissions).to eq(['read:users', 'write:users', 'admin:all']) - expect(role.type).to eq('system') - expect(role.created_at).to eq('2022-05-13T17:45:31.732Z') - expect(role.updated_at).to eq('2022-07-13T17:45:42.618Z') + expect(role.id).to eq("role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY") + expect(role.name).to eq("Admin") + expect(role.slug).to eq("admin") + expect(role.description).to eq("Administrator role with full access") + expect(role.permissions).to eq(["read:users", "write:users", "admin:all"]) + expect(role.type).to eq("system") + expect(role.created_at).to eq("2022-05-13T17:45:31.732Z") + expect(role.updated_at).to eq("2022-07-13T17:45:42.618Z") end end - context 'with role data without permissions' do - it 'initializes permissions as empty array' do + context "with role data without permissions" do + it "initializes permissions as empty array" do role_json = { - id: 'role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY', - name: 'User', - slug: 'user', - description: 'Basic user role', - type: 'custom', - created_at: '2022-05-13T17:45:31.732Z', - updated_at: '2022-07-13T17:45:42.618Z', + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "User", + slug: "user", + description: "Basic user role", + type: "custom", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" }.to_json role = described_class.new(role_json) - expect(role.id).to eq('role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY') - expect(role.name).to eq('User') - expect(role.slug).to eq('user') - expect(role.description).to eq('Basic user role') + expect(role.id).to eq("role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY") + expect(role.name).to eq("User") + expect(role.slug).to eq("user") + expect(role.description).to eq("Basic user role") expect(role.permissions).to eq([]) - expect(role.type).to eq('custom') - expect(role.created_at).to eq('2022-05-13T17:45:31.732Z') - expect(role.updated_at).to eq('2022-07-13T17:45:42.618Z') + expect(role.type).to eq("custom") + expect(role.created_at).to eq("2022-05-13T17:45:31.732Z") + expect(role.updated_at).to eq("2022-07-13T17:45:42.618Z") end end - context 'with role data with null permissions' do - it 'initializes permissions as empty array' do + context "with role data with null permissions" do + it "initializes permissions as empty array" do role_json = { - id: 'role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY', - name: 'User', - slug: 'user', - description: 'Basic user role', + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "User", + slug: "user", + description: "Basic user role", permissions: nil, - type: 'custom', - created_at: '2022-05-13T17:45:31.732Z', - updated_at: '2022-07-13T17:45:42.618Z', + type: "custom", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" }.to_json role = described_class.new(role_json) @@ -72,17 +72,17 @@ end end - context 'with role data with empty permissions array' do - it 'preserves empty permissions array' do + context "with role data with empty permissions array" do + it "preserves empty permissions array" do role_json = { - id: 'role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY', - name: 'User', - slug: 'user', - description: 'Basic user role', + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "User", + slug: "user", + description: "Basic user role", permissions: [], - type: 'custom', - created_at: '2022-05-13T17:45:31.732Z', - updated_at: '2022-07-13T17:45:42.618Z', + type: "custom", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" }.to_json role = described_class.new(role_json) @@ -92,44 +92,44 @@ end end - describe '.to_json' do - context 'with role that has permissions' do - it 'includes permissions in serialized output' do + describe ".to_json" do + context "with role that has permissions" do + it "includes permissions in serialized output" do role_json = { - id: 'role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY', - name: 'Admin', - slug: 'admin', - description: 'Administrator role', - permissions: ['read:all', 'write:all'], - type: 'system', - created_at: '2022-05-13T17:45:31.732Z', - updated_at: '2022-07-13T17:45:42.618Z', + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "Admin", + slug: "admin", + description: "Administrator role", + permissions: ["read:all", "write:all"], + type: "system", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" }.to_json role = described_class.new(role_json) serialized = role.to_json - expect(serialized[:id]).to eq('role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY') - expect(serialized[:name]).to eq('Admin') - expect(serialized[:slug]).to eq('admin') - expect(serialized[:description]).to eq('Administrator role') - expect(serialized[:permissions]).to eq(['read:all', 'write:all']) - expect(serialized[:type]).to eq('system') - expect(serialized[:created_at]).to eq('2022-05-13T17:45:31.732Z') - expect(serialized[:updated_at]).to eq('2022-07-13T17:45:42.618Z') + expect(serialized[:id]).to eq("role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY") + expect(serialized[:name]).to eq("Admin") + expect(serialized[:slug]).to eq("admin") + expect(serialized[:description]).to eq("Administrator role") + expect(serialized[:permissions]).to eq(["read:all", "write:all"]) + expect(serialized[:type]).to eq("system") + expect(serialized[:created_at]).to eq("2022-05-13T17:45:31.732Z") + expect(serialized[:updated_at]).to eq("2022-07-13T17:45:42.618Z") end end - context 'with role that has no permissions' do - it 'includes empty permissions array in serialized output' do + context "with role that has no permissions" do + it "includes empty permissions array in serialized output" do role_json = { - id: 'role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY', - name: 'User', - slug: 'user', - description: 'Basic user role', - type: 'custom', - created_at: '2022-05-13T17:45:31.732Z', - updated_at: '2022-07-13T17:45:42.618Z', + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "User", + slug: "user", + description: "Basic user role", + type: "custom", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" }.to_json role = described_class.new(role_json) diff --git a/spec/lib/workos/session_spec.rb b/spec/lib/workos/session_spec.rb index f6e9c2e6..eda09ced 100644 --- a/spec/lib/workos/session_spec.rb +++ b/spec/lib/workos/session_spec.rb @@ -1,55 +1,55 @@ # frozen_string_literal: true describe WorkOS::Session do - let(:client_id) { 'test_client_id' } - let(:cookie_password) { 'test_very_long_cookie_password__' } - let(:session_data) { 'test_session_data' } - let(:jwks_url) { 'https://api.workos.com/sso/jwks/client_123' } - let(:jwk) { JWT::JWK.new(OpenSSL::PKey::RSA.new(2048), { kid: 'sso_oidc_key_pair_123', use: 'sig', alg: 'RS256' }) } - let(:jwks_hash) { { keys: [jwk.export] }.to_json } + let(:client_id) { "test_client_id" } + let(:cookie_password) { "test_very_long_cookie_password__" } + let(:session_data) { "test_session_data" } + let(:jwks_url) { "https://api.workos.com/sso/jwks/client_123" } + let(:jwk) { JWT::JWK.new(OpenSSL::PKey::RSA.new(2048), {kid: "sso_oidc_key_pair_123", use: "sig", alg: "RS256"}) } + let(:jwks_hash) { {keys: [jwk.export]}.to_json } before do allow(Net::HTTP).to receive(:get).and_return(jwks_hash) end - describe 'initialize' do - let(:user_management) { instance_double('UserManagement') } + describe "initialize" do + let(:user_management) { instance_double("UserManagement") } before do allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url) end - describe 'JWKS caching' do + describe "JWKS caching" do before do WorkOS::Cache.clear end - it 'caches and returns JWKS' do + it "caches and returns JWKS" do expect(Net::HTTP).to receive(:get).once session1 = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) session2 = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) expect(session1.jwks.map(&:export)).to eq(session2.jwks.map(&:export)) end - it 'fetches JWKS from remote when cache is expired' do + it "fetches JWKS from remote when cache is expired" do expect(Net::HTTP).to receive(:get).twice session1 = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) allow(Time).to receive(:now).and_return(Time.now + 301) @@ -58,359 +58,359 @@ user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) expect(session1.jwks.map(&:export)).to eq(session2.jwks.map(&:export)) end end - it 'raises an error if cookie_password is nil or empty' do + it "raises an error if cookie_password is nil or empty" do expect do WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: nil, + cookie_password: nil ) - end.to raise_error(ArgumentError, 'cookiePassword is required') + end.to raise_error(ArgumentError, "cookiePassword is required") expect do WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: '', + cookie_password: "" ) - end.to raise_error(ArgumentError, 'cookiePassword is required') + end.to raise_error(ArgumentError, "cookiePassword is required") end - it 'initializes with valid parameters' do + it "initializes with valid parameters" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) expect(session.user_management).to eq(user_management) expect(session.client_id).to eq(client_id) expect(session.session_data).to eq(session_data) expect(session.cookie_password).to eq(cookie_password) expect(session.jwks.map(&:export)).to eq(JSON.parse(jwks_hash, symbolize_names: true)[:keys]) - expect(session.jwks_algorithms).to eq(['RS256']) + expect(session.jwks_algorithms).to eq(["RS256"]) end end - describe '.authenticate' do - let(:user_management) { instance_double('UserManagement') } + describe ".authenticate" do + let(:user_management) { instance_double("UserManagement") } let(:payload) do { - sid: 'session_id', - org_id: 'org_id', - role: 'role', - roles: ['role'], - permissions: ['read'], - exp: Time.now.to_i + 3600, + sid: "session_id", + org_id: "org_id", + role: "role", + roles: ["role"], + permissions: ["read"], + exp: Time.now.to_i + 3600 } end - let(:valid_access_token) { JWT.encode(payload, jwk.signing_key, jwk[:alg], { kid: jwk[:kid] }) } + let(:valid_access_token) { JWT.encode(payload, jwk.signing_key, jwk[:alg], {kid: jwk[:kid]}) } let(:session_data) do WorkOS::Session.seal_data({ - access_token: valid_access_token, - user: 'user', - impersonator: 'impersonator', - }, cookie_password,) + access_token: valid_access_token, + user: "user", + impersonator: "impersonator" + }, cookie_password) end before do allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url) end - it 'returns NO_SESSION_COOKIE_PROVIDED if session_data is nil' do + it "returns NO_SESSION_COOKIE_PROVIDED if session_data is nil" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: nil, - cookie_password: cookie_password, + cookie_password: cookie_password ) result = session.authenticate - expect(result).to eq({ authenticated: false, reason: 'NO_SESSION_COOKIE_PROVIDED' }) + expect(result).to eq({authenticated: false, reason: "NO_SESSION_COOKIE_PROVIDED"}) end - it 'returns INVALID_SESSION_COOKIE if session_data is invalid' do + it "returns INVALID_SESSION_COOKIE if session_data is invalid" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, - session_data: 'invalid_data', - cookie_password: cookie_password, + session_data: "invalid_data", + cookie_password: cookie_password ) result = session.authenticate - expect(result).to eq({ authenticated: false, reason: 'INVALID_SESSION_COOKIE' }) + expect(result).to eq({authenticated: false, reason: "INVALID_SESSION_COOKIE"}) end - it 'returns INVALID_JWT if access_token is invalid' do - invalid_session_data = WorkOS::Session.seal_data({ access_token: 'invalid_token' }, cookie_password) + it "returns INVALID_JWT if access_token is invalid" do + invalid_session_data = WorkOS::Session.seal_data({access_token: "invalid_token"}, cookie_password) session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: invalid_session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) result = session.authenticate - expect(result).to eq({ authenticated: false, reason: 'INVALID_JWT' }) + expect(result).to eq({authenticated: false, reason: "INVALID_JWT"}) end - it 'returns INVALID_JWT without token data when session is expired' do + it "returns INVALID_JWT without token data when session is expired" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) allow(Time).to receive(:now).and_return(Time.at(9_999_999_999)) result = session.authenticate - expect(result).to eq({ authenticated: false, reason: 'INVALID_JWT' }) + expect(result).to eq({authenticated: false, reason: "INVALID_JWT"}) end - it 'returns INVALID_JWT with full token data when session is expired and include_expired is true' do + it "returns INVALID_JWT with full token data when session is expired and include_expired is true" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) allow(Time).to receive(:now).and_return(Time.at(9_999_999_999)) result = session.authenticate(include_expired: true) expect(result).to eq({ - authenticated: false, - session_id: 'session_id', - organization_id: 'org_id', - role: 'role', - roles: ['role'], - permissions: ['read'], - feature_flags: nil, - entitlements: nil, - user: 'user', - impersonator: 'impersonator', - reason: 'INVALID_JWT', - }) + authenticated: false, + session_id: "session_id", + organization_id: "org_id", + role: "role", + roles: ["role"], + permissions: ["read"], + feature_flags: nil, + entitlements: nil, + user: "user", + impersonator: "impersonator", + reason: "INVALID_JWT" + }) end - it 'authenticates successfully with valid session_data' do + it "authenticates successfully with valid session_data" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) result = session.authenticate expect(result).to eq({ - authenticated: true, - session_id: 'session_id', - organization_id: 'org_id', - role: 'role', - roles: ['role'], - permissions: ['read'], - feature_flags: nil, - entitlements: nil, - user: 'user', - impersonator: 'impersonator', - reason: nil, - }) + authenticated: true, + session_id: "session_id", + organization_id: "org_id", + role: "role", + roles: ["role"], + permissions: ["read"], + feature_flags: nil, + entitlements: nil, + user: "user", + impersonator: "impersonator", + reason: nil + }) end - it 'merges custom claims from claim_extractor block' do - custom_payload = payload.merge(custom_claim: 'custom_value', another_claim: 123) - custom_access_token = JWT.encode(custom_payload, jwk.signing_key, jwk[:alg], { kid: jwk[:kid] }) + it "merges custom claims from claim_extractor block" do + custom_payload = payload.merge(custom_claim: "custom_value", another_claim: 123) + custom_access_token = JWT.encode(custom_payload, jwk.signing_key, jwk[:alg], {kid: jwk[:kid]}) custom_session_data = WorkOS::Session.seal_data({ - access_token: custom_access_token, - user: 'user', - impersonator: 'impersonator', - }, cookie_password,) + access_token: custom_access_token, + user: "user", + impersonator: "impersonator" + }, cookie_password) session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: custom_session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) result = session.authenticate do |jwt| - { my_custom_claim: jwt['custom_claim'], my_other_claim: jwt['another_claim'] } + {my_custom_claim: jwt["custom_claim"], my_other_claim: jwt["another_claim"]} end expect(result[:authenticated]).to be true - expect(result[:my_custom_claim]).to eq('custom_value') + expect(result[:my_custom_claim]).to eq("custom_value") expect(result[:my_other_claim]).to eq(123) end - describe 'with entitlements' do + describe "with entitlements" do let(:payload) do { - sid: 'session_id', - org_id: 'org_id', - role: 'role', - roles: ['role'], - permissions: ['read'], - entitlements: ['billing'], - exp: Time.now.to_i + 3600, + sid: "session_id", + org_id: "org_id", + role: "role", + roles: ["role"], + permissions: ["read"], + entitlements: ["billing"], + exp: Time.now.to_i + 3600 } end - it 'includes entitlements in the result' do + it "includes entitlements in the result" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) result = session.authenticate expect(result).to eq({ - authenticated: true, - session_id: 'session_id', - organization_id: 'org_id', - role: 'role', - roles: ['role'], - permissions: ['read'], - entitlements: ['billing'], - feature_flags: nil, - user: 'user', - impersonator: 'impersonator', - reason: nil, - }) + authenticated: true, + session_id: "session_id", + organization_id: "org_id", + role: "role", + roles: ["role"], + permissions: ["read"], + entitlements: ["billing"], + feature_flags: nil, + user: "user", + impersonator: "impersonator", + reason: nil + }) end end - describe 'with feature flags' do + describe "with feature flags" do let(:payload) do { - sid: 'session_id', - org_id: 'org_id', - role: 'role', - roles: ['role'], - permissions: ['read'], - feature_flags: ['new_feature_enabled'], - exp: Time.now.to_i + 3600, + sid: "session_id", + org_id: "org_id", + role: "role", + roles: ["role"], + permissions: ["read"], + feature_flags: ["new_feature_enabled"], + exp: Time.now.to_i + 3600 } end - it 'includes feature flags in the result' do + it "includes feature flags in the result" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) result = session.authenticate expect(result).to eq({ - authenticated: true, - session_id: 'session_id', - organization_id: 'org_id', - role: 'role', - roles: ['role'], - permissions: ['read'], - entitlements: nil, - feature_flags: ['new_feature_enabled'], - user: 'user', - impersonator: 'impersonator', - reason: nil, - }) + authenticated: true, + session_id: "session_id", + organization_id: "org_id", + role: "role", + roles: ["role"], + permissions: ["read"], + entitlements: nil, + feature_flags: ["new_feature_enabled"], + user: "user", + impersonator: "impersonator", + reason: nil + }) end end end - describe '.refresh' do - let(:user_management) { instance_double('UserManagement') } - let(:refresh_token) { 'test_refresh_token' } - let(:session_data) { WorkOS::Session.seal_data({ refresh_token: refresh_token, user: 'user' }, cookie_password) } - let(:auth_response) { double('AuthResponse', sealed_session: 'new_sealed_session') } + describe ".refresh" do + let(:user_management) { instance_double("UserManagement") } + let(:refresh_token) { "test_refresh_token" } + let(:session_data) { WorkOS::Session.seal_data({refresh_token: refresh_token, user: "user"}, cookie_password) } + let(:auth_response) { double("AuthResponse", sealed_session: "new_sealed_session") } before do allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url) allow(user_management).to receive(:authenticate_with_refresh_token).and_return(auth_response) end - it 'returns INVALID_SESSION_COOKIE if session_data is invalid' do + it "returns INVALID_SESSION_COOKIE if session_data is invalid" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, - session_data: 'invalid_data', - cookie_password: cookie_password, + session_data: "invalid_data", + cookie_password: cookie_password ) result = session.refresh - expect(result).to eq({ authenticated: false, reason: 'INVALID_SESSION_COOKIE' }) + expect(result).to eq({authenticated: false, reason: "INVALID_SESSION_COOKIE"}) end - it 'refreshes the session successfully with valid session_data' do + it "refreshes the session successfully with valid session_data" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) result = session.refresh expect(result).to eq({ - authenticated: true, - sealed_session: 'new_sealed_session', - session: auth_response, - reason: nil, - }) + authenticated: true, + sealed_session: "new_sealed_session", + session: auth_response, + reason: nil + }) end end - describe '.get_logout_url' do + describe ".get_logout_url" do let(:session) do WorkOS::Session.new( user_management: WorkOS::UserManagement, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) end - context 'when authentication is successful' do + context "when authentication is successful" do before do allow(session).to receive(:authenticate).and_return({ - authenticated: true, - session_id: 'session_123abc', - reason: nil, - }) + authenticated: true, + session_id: "session_123abc", + reason: nil + }) end - it 'returns the logout URL' do - expect(session.get_logout_url).to eq('https://api.workos.com/user_management/sessions/logout?session_id=session_123abc') + it "returns the logout URL" do + expect(session.get_logout_url).to eq("https://api.workos.com/user_management/sessions/logout?session_id=session_123abc") end - context 'when given a return_to URL' do - it 'returns the logout URL with the return_to parameter' do - expect(session.get_logout_url(return_to: 'https://example.com/signed-out')).to eq( - 'https://api.workos.com/user_management/sessions/logout?session_id=session_123abc&return_to=https%3A%2F%2Fexample.com%2Fsigned-out', + context "when given a return_to URL" do + it "returns the logout URL with the return_to parameter" do + expect(session.get_logout_url(return_to: "https://example.com/signed-out")).to eq( + "https://api.workos.com/user_management/sessions/logout?session_id=session_123abc&return_to=https%3A%2F%2Fexample.com%2Fsigned-out" ) end end end - context 'when authentication fails' do + context "when authentication fails" do before do allow(session).to receive(:authenticate).and_return({ - authenticated: false, - reason: 'Invalid session', - }) + authenticated: false, + reason: "Invalid session" + }) end - it 'raises an error' do + it "raises an error" do expect { session.get_logout_url }.to raise_error( - RuntimeError, 'Failed to extract session ID for logout URL: Invalid session', + RuntimeError, "Failed to extract session ID for logout URL: Invalid session" ) end end end - describe 'custom encryptor' do - let(:user_management) { instance_double('UserManagement') } + describe "custom encryptor" do + let(:user_management) { instance_double("UserManagement") } let(:custom_encryptor) do Class.new do def seal(data, _key) @@ -418,7 +418,7 @@ def seal(data, _key) end def unseal(sealed_data, _key) - json = sealed_data.sub('CUSTOM:', '') + json = sealed_data.sub("CUSTOM:", "") JSON.parse(json, symbolize_names: true) end end.new @@ -428,46 +428,46 @@ def unseal(sealed_data, _key) allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url) end - it 'uses custom encryptor for seal_data' do - sealed = WorkOS::Session.seal_data({ foo: 'bar' }, 'key', encryptor: custom_encryptor) - expect(sealed).to start_with('CUSTOM:') + it "uses custom encryptor for seal_data" do + sealed = WorkOS::Session.seal_data({foo: "bar"}, "key", encryptor: custom_encryptor) + expect(sealed).to start_with("CUSTOM:") end - it 'uses custom encryptor for unseal_data' do + it "uses custom encryptor for unseal_data" do sealed = 'CUSTOM:{"foo":"bar"}' - unsealed = WorkOS::Session.unseal_data(sealed, 'key', encryptor: custom_encryptor) - expect(unsealed).to eq({ foo: 'bar' }) + unsealed = WorkOS::Session.unseal_data(sealed, "key", encryptor: custom_encryptor) + expect(unsealed).to eq({foo: "bar"}) end - it 'accepts custom encryptor in initialize' do + it "accepts custom encryptor in initialize" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, cookie_password: cookie_password, - encryptor: custom_encryptor, + encryptor: custom_encryptor ) expect(session.encryptor).to eq(custom_encryptor) end - it 'defaults to AesGcm encryptor when none provided' do + it "defaults to AesGcm encryptor when none provided" do session = WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, - cookie_password: cookie_password, + cookie_password: cookie_password ) expect(session.encryptor).to be_a(WorkOS::Encryptors::AesGcm) end - it 'raises ArgumentError for invalid encryptor' do + it "raises ArgumentError for invalid encryptor" do expect do WorkOS::Session.new( user_management: user_management, client_id: client_id, session_data: session_data, cookie_password: cookie_password, - encryptor: Object.new, + encryptor: Object.new ) end.to raise_error(ArgumentError, /must respond to/) end diff --git a/spec/lib/workos/sso_spec.rb b/spec/lib/workos/sso_spec.rb index 0af30aed..605b7b52 100644 --- a/spec/lib/workos/sso_spec.rb +++ b/spec/lib/workos/sso_spec.rb @@ -1,327 +1,327 @@ # frozen_string_literal: true -require 'securerandom' +require "securerandom" describe WorkOS::SSO do - it_behaves_like 'client' + it_behaves_like "client" - describe '.authorization_url' do - context 'with a domain' do + describe ".authorization_url" do + context "with a domain" do let(:args) do { - domain: 'foo.com', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + domain: "foo.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \ - 'edit%22%7D&domain=foo.com', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ + "edit%22%7D&domain=foo.com" ) end end - context 'with a provider' do + context "with a provider" do let(:args) do { - provider: 'GoogleOAuth', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + provider: "GoogleOAuth", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \ - 'edit%22%7D&provider=GoogleOAuth', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ + "edit%22%7D&provider=GoogleOAuth" ) end end - context 'with a connection' do + context "with a connection" do let(:args) do { - connection: 'connection_123', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + connection: "connection_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \ - 'edit%22%7D&connection=connection_123', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ + "edit%22%7D&connection=connection_123" ) end end - context 'with a domain' do + context "with a domain" do let(:args) do { - domain: 'foo.com', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + domain: "foo.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \ - 'edit%22%7D&domain=foo.com', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ + "edit%22%7D&domain=foo.com" ) end end - context 'with a domain_hint' do + context "with a domain_hint" do let(:args) do { - connection: 'connection_123', - domain_hint: 'foo.com', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + connection: "connection_123", + domain_hint: "foo.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2' \ - 'Fedit%22%7D&domain_hint=foo.com&connection=connection_123', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2" \ + "Fedit%22%7D&domain_hint=foo.com&connection=connection_123" ) end end - context 'with a login_hint' do + context "with a login_hint" do let(:args) do { - connection: 'connection_123', - login_hint: 'foo@workos.com', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + connection: "connection_123", + login_hint: "foo@workos.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2' \ - 'Fedit%22%7D&login_hint=foo%40workos.com&connection=connection_123', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2" \ + "Fedit%22%7D&login_hint=foo%40workos.com&connection=connection_123" ) end end - context 'with an organization' do + context "with an organization" do let(:args) do { - organization: 'org_123', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + organization: "org_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \ - 'edit%22%7D&organization=org_123', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ + "edit%22%7D&organization=org_123" ) end end - context 'with neither connection, domain, provider, or organization' do + context "with neither connection, domain, provider, or organization" do let(:args) do { - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'raises an error' do + it "raises an error" do expect do described_class.authorization_url(**args) end.to raise_error( ArgumentError, - 'Either connection, domain, provider, or organization is required.', + "Either connection, domain, provider, or organization is required." ) end end - context 'with an invalid provider' do + context "with an invalid provider" do let(:args) do { - provider: 'Okta', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + provider: "Okta", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'raises an error' do + it "raises an error" do expect do described_class.authorization_url(**args) end.to raise_error( ArgumentError, - 'Okta is not a valid value. `provider` must be in ' \ - '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth"]', + "Okta is not a valid value. `provider` must be in " \ + '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth"]' ) end end end - describe '.get_profile' do + describe ".get_profile" do # rubocop:disable Metrics/BlockLength - it 'returns a profile' do - VCR.use_cassette 'sso/profile' do - profile = described_class.get_profile(access_token: 'access_token') + it "returns a profile" do + VCR.use_cassette "sso/profile" do + profile = described_class.get_profile(access_token: "access_token") expectation = { - connection_id: 'conn_01E83FVYZHY7DM4S9503JHV0R5', - connection_type: 'GoogleOAuth', - email: 'bob.loblaw@workos.com', - first_name: 'Bob', - id: 'prof_01EEJTY9SZ1R350RB7B73SNBKF', - idp_id: '116485463307139932699', - last_name: 'Loblaw', + connection_id: "conn_01E83FVYZHY7DM4S9503JHV0R5", + connection_type: "GoogleOAuth", + email: "bob.loblaw@workos.com", + first_name: "Bob", + id: "prof_01EEJTY9SZ1R350RB7B73SNBKF", + idp_id: "116485463307139932699", + last_name: "Loblaw", role: { - slug: 'member', + slug: "member" }, roles: [{ - slug: 'member', + slug: "member" }], groups: nil, - organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB', + organization_id: "org_01FG53X8636WSNW2WEKB2C31ZB", custom_attributes: {}, raw_attributes: { - email: 'bob.loblaw@workos.com', - family_name: 'Loblaw', - given_name: 'Bob', - hd: 'workos.com', - id: '116485463307139932699', - locale: 'en', - name: 'Bob Loblaw', - picture: 'https://lh3.googleusercontent.com/a-/AOh14GyO2hLlgZvteDQ3Ldi3_-RteZLya0hWH7247Cam=s96-c', - verified_email: true, - }, + email: "bob.loblaw@workos.com", + family_name: "Loblaw", + given_name: "Bob", + hd: "workos.com", + id: "116485463307139932699", + locale: "en", + name: "Bob Loblaw", + picture: "https://lh3.googleusercontent.com/a-/AOh14GyO2hLlgZvteDQ3Ldi3_-RteZLya0hWH7247Cam=s96-c", + verified_email: true + } } expect(profile.to_json).to eq(expectation) end @@ -329,11 +329,11 @@ # rubocop:enable Metrics/BlockLength end - describe '.profile_and_token' do + describe ".profile_and_token" do let(:args) do { code: SecureRandom.hex(10), - client_id: 'workos-proj-123', + client_id: "workos-proj-123" } end @@ -342,98 +342,98 @@ client_id: args[:client_id], client_secret: WorkOS.config.key, code: args[:code], - grant_type: 'authorization_code', + grant_type: "authorization_code" } end - let(:user_agent) { 'user-agent-string' } - let(:headers) { { 'User-Agent' => user_agent } } + let(:user_agent) { "user-agent-string" } + let(:headers) { {"User-Agent" => user_agent} } before do allow(described_class).to receive(:user_agent).and_return(user_agent) end - context 'with a successful response' do + context "with a successful response" do let(:response_body) { File.read("#{SPEC_ROOT}/support/profile.txt") } before do - stub_request(:post, 'https://api.workos.com/sso/token'). - with(headers: headers, body: request_body). - to_return(status: 200, body: response_body) + stub_request(:post, "https://api.workos.com/sso/token") + .with(headers: headers, body: request_body) + .to_return(status: 200, body: response_body) end - it 'includes the SDK Version header' do + it "includes the SDK Version header" do described_class.profile_and_token(**args) - expect(a_request(:post, 'https://api.workos.com/sso/token'). - with(headers: headers, body: request_body)).to have_been_made + expect(a_request(:post, "https://api.workos.com/sso/token") + .with(headers: headers, body: request_body)).to have_been_made end - it 'returns a WorkOS::ProfileAndToken' do + it "returns a WorkOS::ProfileAndToken" do profile_and_token = described_class.profile_and_token(**args) expect(profile_and_token).to be_a(WorkOS::ProfileAndToken) expectation = { - connection_id: 'conn_01EMH8WAK20T42N2NBMNBCYHAG', - connection_type: 'OktaSAML', - email: 'demo@workos-okta.com', - first_name: 'WorkOS', - id: 'prof_01DRA1XNSJDZ19A31F183ECQW5', - idp_id: '00u1klkowm8EGah2H357', - last_name: 'Demo', + connection_id: "conn_01EMH8WAK20T42N2NBMNBCYHAG", + connection_type: "OktaSAML", + email: "demo@workos-okta.com", + first_name: "WorkOS", + id: "prof_01DRA1XNSJDZ19A31F183ECQW5", + idp_id: "00u1klkowm8EGah2H357", + last_name: "Demo", role: { - slug: 'admin', + slug: "admin" }, roles: [{ - slug: 'admin', + slug: "admin" }], groups: %w[Admins Developers], - organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB', + organization_id: "org_01FG53X8636WSNW2WEKB2C31ZB", custom_attributes: { - license: 'professional', + license: "professional" }, raw_attributes: { - email: 'demo@workos-okta.com', - first_name: 'WorkOS', - id: 'prof_01DRA1XNSJDZ19A31F183ECQW5', - idp_id: '00u1klkowm8EGah2H357', - last_name: 'Demo', + email: "demo@workos-okta.com", + first_name: "WorkOS", + id: "prof_01DRA1XNSJDZ19A31F183ECQW5", + idp_id: "00u1klkowm8EGah2H357", + last_name: "Demo", groups: %w[Admins Developers], - license: 'professional', - }, + license: "professional" + } } - expect(profile_and_token.access_token).to eq('01DVX6QBS3EG6FHY2ESAA5Q65X') + expect(profile_and_token.access_token).to eq("01DVX6QBS3EG6FHY2ESAA5Q65X") expect(profile_and_token.profile.to_json).to eq(expectation) end end - context 'with an unprocessable request' do + context "with an unprocessable request" do before do - stub_request(:post, 'https://api.workos.com/sso/token'). - with(headers: headers, body: request_body). - to_return( - headers: { 'X-Request-ID' => 'request-id' }, + stub_request(:post, "https://api.workos.com/sso/token") + .with(headers: headers, body: request_body) + .to_return( + headers: {"X-Request-ID" => "request-id"}, status: 422, - body: { "error": 'some error', "error_description": 'some error description' }.to_json, + body: {error: "some error", error_description: "some error description"}.to_json ) end - it 'raises an exception with request ID' do + it "raises an exception with request ID" do expect do described_class.profile_and_token(**args) end.to raise_error( WorkOS::UnprocessableEntityError, - 'Status 422, some error - request ID: request-id', + "Status 422, some error - request ID: request-id" ) end - it 'raises an exception with proper error object attributes' do + it "raises an exception with proper error object attributes" do expect do described_class.profile_and_token(**args) end.to raise_error(WorkOS::UnprocessableEntityError) end - it 'includes proper error attributes' do + it "includes proper error attributes" do error = begin described_class.profile_and_token(**args) rescue WorkOS::UnprocessableEntityError => e @@ -441,40 +441,40 @@ end expect(error.http_status).to eq(422) - expect(error.request_id).to eq('request-id') - expect(error.error).to eq('some error') - expect(error.message).to include('some error') + expect(error.request_id).to eq("request-id") + expect(error.error).to eq("some error") + expect(error.message).to include("some error") end end - context 'with detailed field validation errors' do + context "with detailed field validation errors" do before do - stub_request(:post, 'https://api.workos.com/sso/token'). - with(headers: headers, body: request_body). - to_return( - headers: { 'X-Request-ID' => 'request-id' }, + stub_request(:post, "https://api.workos.com/sso/token") + .with(headers: headers, body: request_body) + .to_return( + headers: {"X-Request-ID" => "request-id"}, status: 422, body: { - "message": 'Validation failed', - "code": 'invalid_request_parameters', - "errors": [ + message: "Validation failed", + code: "invalid_request_parameters", + errors: [ { - "field": 'code', - "code": 'missing_required_parameter', - "message": 'The code parameter is required', + field: "code", + code: "missing_required_parameter", + message: "The code parameter is required" } - ], - }.to_json, + ] + }.to_json ) end - it 'raises an exception with detailed field errors' do + it "raises an exception with detailed field errors" do expect do described_class.profile_and_token(**args) end.to raise_error(WorkOS::UnprocessableEntityError) end - it 'includes detailed field error attributes' do + it "includes detailed field error attributes" do error = begin described_class.profile_and_token(**args) rescue WorkOS::UnprocessableEntityError => e @@ -482,46 +482,46 @@ end expect(error.http_status).to eq(422) - expect(error.request_id).to eq('request-id') - expect(error.code).to eq('invalid_request_parameters') + expect(error.request_id).to eq("request-id") + expect(error.code).to eq("invalid_request_parameters") expect(error.errors).not_to be_nil - expect(error.errors).to include('code: missing_required_parameter') - expect(error.message).to include('Validation failed') - expect(error.message).to include('(code: missing_required_parameter)') + expect(error.errors).to include("code: missing_required_parameter") + expect(error.message).to include("Validation failed") + expect(error.message).to include("(code: missing_required_parameter)") end end - context 'with an expired code' do + context "with an expired code" do before do - stub_request(:post, 'https://api.workos.com/sso/token'). - with(body: request_body). - to_return( + stub_request(:post, "https://api.workos.com/sso/token") + .with(body: request_body) + .to_return( status: 400, - headers: { 'X-Request-ID' => 'request-id' }, + headers: {"X-Request-ID" => "request-id"}, body: { - "error": 'invalid_grant', - "error_description": "The code '01DVX3C5Z367SFHR8QNDMK7V24' has expired or is invalid.", - }.to_json, + error: "invalid_grant", + error_description: "The code '01DVX3C5Z367SFHR8QNDMK7V24' has expired or is invalid." + }.to_json ) end - it 'raises an exception' do + it "raises an exception" do expect do described_class.profile_and_token(**args) end.to raise_error( WorkOS::InvalidRequestError, "Status 400, error: invalid_grant, error_description: The code '01DVX3C5Z367SFHR8QNDMK7V24'" \ - ' has expired or is invalid. - request ID: request-id', + " has expired or is invalid. - request ID: request-id" ) end - it 'raises an exception with proper error object attributes' do + it "raises an exception with proper error object attributes" do expect do described_class.profile_and_token(**args) end.to raise_error(WorkOS::InvalidRequestError) end - it 'includes proper error attributes' do + it "includes proper error attributes" do error = begin described_class.profile_and_token(**args) rescue WorkOS::InvalidRequestError => e @@ -529,23 +529,23 @@ end expect(error.http_status).to eq(400) - expect(error.request_id).to eq('request-id') - expect(error.error).to eq('invalid_grant') + expect(error.request_id).to eq("request-id") + expect(error.error).to eq("invalid_grant") expect(error.error_description).to eq("The code '01DVX3C5Z367SFHR8QNDMK7V24' has expired or is invalid.") - expect(error.message).to include('invalid_grant') + expect(error.message).to include("invalid_grant") end end end - describe '.list_connections' do - context 'with no options' do - it 'returns connections and metadata' do + describe ".list_connections" do + context "with no options" do + it "returns connections and metadata" do expected_metadata = { - 'after' => nil, - 'before' => 'before_id', + "after" => nil, + "before" => "before_id" } - VCR.use_cassette 'sso/list_connections/with_no_options' do + VCR.use_cassette "sso/list_connections/with_no_options" do connections = described_class.list_connections expect(connections.data.size).to eq(6) @@ -554,46 +554,46 @@ end end - context 'with connection_type option' do - it 'forms the proper request to the API' do + context "with connection_type option" do + it "forms the proper request to the API" do request_args = [ - '/connections?connection_type=OktaSAML&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/connections?connection_type=OktaSAML&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'sso/list_connections/with_connection_type' do + VCR.use_cassette "sso/list_connections/with_connection_type" do connections = described_class.list_connections( - connection_type: 'OktaSAML', + connection_type: "OktaSAML" ) expect(connections.data.size).to eq(10) - expect(connections.data.first.connection_type).to eq('OktaSAML') + expect(connections.data.first.connection_type).to eq("OktaSAML") end end end - context 'with domain option' do - it 'forms the proper request to the API' do + context "with domain option" do + it "forms the proper request to the API" do request_args = [ - '/connections?domain=foo-corp.com&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/connections?domain=foo-corp.com&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'sso/list_connections/with_domain' do + VCR.use_cassette "sso/list_connections/with_domain" do connections = described_class.list_connections( - domain: 'foo-corp.com', + domain: "foo-corp.com" ) expect(connections.data.size).to eq(1) @@ -601,48 +601,48 @@ end end - context 'with organization_id option' do - it 'forms the proper request to the API' do + context "with organization_id option" do + it "forms the proper request to the API" do request_args = [ - '/connections?organization_id=org_01F9293WD2PDEEV4Y625XPZVG7&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/connections?organization_id=org_01F9293WD2PDEEV4Y625XPZVG7&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'sso/list_connections/with_organization_id' do + VCR.use_cassette "sso/list_connections/with_organization_id" do connections = described_class.list_connections( - organization_id: 'org_01F9293WD2PDEEV4Y625XPZVG7', + organization_id: "org_01F9293WD2PDEEV4Y625XPZVG7" ) expect(connections.data.size).to eq(1) expect(connections.data.first.organization_id).to eq( - 'org_01F9293WD2PDEEV4Y625XPZVG7', + "org_01F9293WD2PDEEV4Y625XPZVG7" ) end end end - context 'with limit option' do - it 'forms the proper request to the API' do + context "with limit option" do + it "forms the proper request to the API" do request_args = [ - '/connections?limit=2&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/connections?limit=2&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'sso/list_connections/with_limit' do + VCR.use_cassette "sso/list_connections/with_limit" do connections = described_class.list_connections( - limit: 2, + limit: 2 ) expect(connections.data.size).to eq(2) @@ -650,22 +650,22 @@ end end - context 'with before option' do - it 'forms the proper request to the API' do + context "with before option" do + it "forms the proper request to the API" do request_args = [ - '/connections?before=conn_01FA3WGCWPCCY1V2FGES2FDNP7&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/connections?before=conn_01FA3WGCWPCCY1V2FGES2FDNP7&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'sso/list_connections/with_before' do + VCR.use_cassette "sso/list_connections/with_before" do connections = described_class.list_connections( - before: 'conn_01FA3WGCWPCCY1V2FGES2FDNP7', + before: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" ) expect(connections.data.size).to eq(3) @@ -673,22 +673,22 @@ end end - context 'with after option' do - it 'forms the proper request to the API' do + context "with after option" do + it "forms the proper request to the API" do request_args = [ - '/connections?after=conn_01FA3WGCWPCCY1V2FGES2FDNP7&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/connections?after=conn_01FA3WGCWPCCY1V2FGES2FDNP7&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'sso/list_connections/with_after' do + VCR.use_cassette "sso/list_connections/with_after" do connections = described_class.list_connections( - after: 'conn_01FA3WGCWPCCY1V2FGES2FDNP7', + after: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" ) expect(connections.data.size).to eq(2) @@ -697,42 +697,42 @@ end end - describe '.get_connection' do - context 'with a valid id' do - it 'gets the connection details' do - VCR.use_cassette('sso/get_connection_with_valid_id') do + describe ".get_connection" do + context "with a valid id" do + it "gets the connection details" do + VCR.use_cassette("sso/get_connection_with_valid_id") do connection = WorkOS::SSO.get_connection( - id: 'conn_01FA3WGCWPCCY1V2FGES2FDNP7', + id: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" ) - expect(connection.id).to eq('conn_01FA3WGCWPCCY1V2FGES2FDNP7') - expect(connection.connection_type).to eq('OktaSAML') - expect(connection.name).to eq('Foo Corp') - expect(connection.domains.first[:domain]).to eq('foo-corp.com') + expect(connection.id).to eq("conn_01FA3WGCWPCCY1V2FGES2FDNP7") + expect(connection.connection_type).to eq("OktaSAML") + expect(connection.name).to eq("Foo Corp") + expect(connection.domains.first[:domain]).to eq("foo-corp.com") end end end - context 'with an invalid id' do - it 'raises an error' do - VCR.use_cassette('sso/get_connection_with_invalid_id') do + context "with an invalid id" do + it "raises an error" do + VCR.use_cassette("sso/get_connection_with_invalid_id") do expect do - WorkOS::SSO.get_connection(id: 'invalid') + WorkOS::SSO.get_connection(id: "invalid") end.to raise_error( WorkOS::NotFoundError, - 'Status 404, Not Found - request ID: ', + "Status 404, Not Found - request ID: " ) end end end end - describe '.delete_connection' do - context 'with a valid id' do - it 'returns true' do - VCR.use_cassette('sso/delete_connection_with_valid_id') do + describe ".delete_connection" do + context "with a valid id" do + it "returns true" do + VCR.use_cassette("sso/delete_connection_with_valid_id") do response = WorkOS::SSO.delete_connection( - id: 'conn_01EX55FRVN1V2PCA9YWTMZQMMQ', + id: "conn_01EX55FRVN1V2PCA9YWTMZQMMQ" ) expect(response).to be(true) @@ -740,14 +740,14 @@ end end - context 'with an invalid id' do - it 'returns false' do - VCR.use_cassette('sso/delete_connection_with_invalid_id') do + context "with an invalid id" do + it "returns false" do + VCR.use_cassette("sso/delete_connection_with_invalid_id") do expect do - WorkOS::SSO.delete_connection(id: 'invalid') + WorkOS::SSO.delete_connection(id: "invalid") end.to raise_error( WorkOS::NotFoundError, - 'Status 404, Not Found - request ID: ', + "Status 404, Not Found - request ID: " ) end end diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index b9485f9c..2892cf01 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -1,325 +1,325 @@ # frozen_string_literal: true describe WorkOS::UserManagement do - it_behaves_like 'client' + it_behaves_like "client" - describe '.authorization_url' do - context 'with a provider' do + describe ".authorization_url" do + context "with a provider" do let(:args) do { - provider: 'authkit', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + provider: "authkit", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \ - 'edit%22%7D&provider=authkit', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ + "edit%22%7D&provider=authkit" ) end - context 'with provider_scopes' do - it 'returns a valid authorization URL that includes provider_scopes' do + context "with provider_scopes" do + it "returns a valid authorization URL that includes provider_scopes" do url = WorkOS::UserManagement.authorization_url( - provider: 'GoogleOAuth', + provider: "GoogleOAuth", provider_scopes: %w[custom-scope-1 custom-scope-2], - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s ) expect(url).to eq( - 'https://api.workos.com/user_management/authorize?' \ - 'client_id=workos-proj-123' \ - '&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code' \ - '&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \ - 'edit%22%7D' \ - '&provider=GoogleOAuth' \ - '&provider_scopes=custom-scope-1' \ - '&provider_scopes=custom-scope-2', + "https://api.workos.com/user_management/authorize?" \ + "client_id=workos-proj-123" \ + "&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code" \ + "&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ + "edit%22%7D" \ + "&provider=GoogleOAuth" \ + "&provider_scopes=custom-scope-1" \ + "&provider_scopes=custom-scope-2" ) end end end - context 'with a connection selector' do + context "with a connection selector" do let(:args) do { - connection_id: 'connection_123', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + connection_id: "connection_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \ - 'edit%22%7D&connection_id=connection_123', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ + "edit%22%7D&connection_id=connection_123" ) end end - context 'with an organization selector' do + context "with an organization selector" do let(:args) do { - organization_id: 'org_123', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + organization_id: "org_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \ - 'edit%22%7D&organization_id=org_123', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ + "edit%22%7D&organization_id=org_123" ) end end - context 'with a domain hint' do + context "with a domain hint" do let(:args) do { - connection_id: 'connection_123', - domain_hint: 'foo.com', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + connection_id: "connection_123", + domain_hint: "foo.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2' \ - 'Fedit%22%7D&domain_hint=foo.com&connection_id=connection_123', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2" \ + "Fedit%22%7D&domain_hint=foo.com&connection_id=connection_123" ) end end - context 'with a login hint' do + context "with a login hint" do let(:args) do { - connection_id: 'connection_123', - login_hint: 'foo@workos.com', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + connection_id: "connection_123", + login_hint: "foo@workos.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2' \ - 'Fedit%22%7D&login_hint=foo%40workos.com&connection_id=connection_123', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2" \ + "Fedit%22%7D&login_hint=foo%40workos.com&connection_id=connection_123" ) end end - context 'with a screen hint' do + context "with a screen hint" do let(:args) do { - provider: 'authkit', - screen_hint: 'sign_up', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + provider: "authkit", + screen_hint: "sign_up", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'returns a valid URL' do + it "returns a valid URL" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url)).to be_a URI end - it 'returns the expected hostname' do + it "returns the expected hostname" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) end - it 'returns the expected query string' do + it "returns the expected query string" do authorization_url = described_class.authorization_url(**args) expect(URI.parse(authorization_url).query).to eq( - 'client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback' \ - '&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F' \ - 'edit%22%7D&screen_hint=sign_up&provider=authkit', + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ + "edit%22%7D&screen_hint=sign_up&provider=authkit" ) end end - context 'with neither connection_id, organization_id or provider' do + context "with neither connection_id, organization_id or provider" do let(:args) do { - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'raises an error' do + it "raises an error" do expect do described_class.authorization_url(**args) end.to raise_error( ArgumentError, - 'Either connection ID, organization ID, or provider is required.', + "Either connection ID, organization ID, or provider is required." ) end end - context 'with an invalid provider' do + context "with an invalid provider" do let(:args) do { - provider: 'Okta', - client_id: 'workos-proj-123', - redirect_uri: 'foo.com/auth/callback', + provider: "Okta", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", state: { - next_page: '/dashboard/edit', - }.to_s, + next_page: "/dashboard/edit" + }.to_s } end - it 'raises an error' do + it "raises an error" do expect do described_class.authorization_url(**args) end.to raise_error( ArgumentError, - 'Okta is not a valid value. `provider` must be in ' \ - '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth", "authkit"]', + "Okta is not a valid value. `provider` must be in " \ + '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth", "authkit"]' ) end end end - describe '.get_user' do - context 'with a valid id' do - it 'returns a user' do - VCR.use_cassette 'user_management/get_user' do + describe ".get_user" do + context "with a valid id" do + it "returns a user" do + VCR.use_cassette "user_management/get_user" do user = described_class.get_user( - id: 'user_01HP0B4ZV2FWWVY0BF16GFDAER', + id: "user_01HP0B4ZV2FWWVY0BF16GFDAER" ) expect(user.id.instance_of?(String)) expect(user.instance_of?(WorkOS::User)) - expect(user.first_name).to eq('Bob') - expect(user.last_name).to eq('Loblaw') - expect(user.email).to eq('bob@example.com') + expect(user.first_name).to eq("Bob") + expect(user.last_name).to eq("Loblaw") + expect(user.email).to eq("bob@example.com") expect(user.email_verified).to eq(false) expect(user.profile_picture_url).to eq(nil) - expect(user.last_sign_in_at).to eq('2024-02-06T23:13:18.137Z') + expect(user.last_sign_in_at).to eq("2024-02-06T23:13:18.137Z") end end end - context 'with an invalid id' do - it 'returns an error' do + context "with an invalid id" do + it "returns an error" do expect do described_class.get_user( - id: 'invalid_user_id', + id: "invalid_user_id" ).to raise_error(WorkOS::APIError) end end end end - describe '.list_users' do - context 'with no options' do - it 'returns a list of users' do + describe ".list_users" do + context "with no options" do + it "returns a list of users" do expected_metadata = { - 'after' => nil, - 'before' => 'before-id', + "after" => nil, + "before" => "before-id" } - VCR.use_cassette 'user_management/list_users/no_options' do + VCR.use_cassette "user_management/list_users/no_options" do users = described_class.list_users expect(users.data.size).to eq(2) @@ -328,95 +328,95 @@ end end - context 'with options' do - it 'returns a list of matching users' do + context "with options" do + it "returns a list of matching users" do request_args = [ - '/user_management/users?email=lucy.lawless%40example.com&'\ - 'order=desc&'\ - 'limit=5', - 'Content-Type' => 'application/json' + "/user_management/users?email=lucy.lawless%40example.com&" \ + "order=desc&" \ + "limit=5", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'user_management/list_users/with_options' do + VCR.use_cassette "user_management/list_users/with_options" do users = described_class.list_users( - email: 'lucy.lawless@example.com', - order: 'desc', - limit: '5', + email: "lucy.lawless@example.com", + order: "desc", + limit: "5" ) expect(users.data.size).to eq(1) - expect(users.data[0].email).to eq('lucy.lawless@example.com') + expect(users.data[0].email).to eq("lucy.lawless@example.com") end end end end - describe '.create_user' do - context 'with a valid payload' do - it 'creates a user' do - VCR.use_cassette 'user_management/create_user_valid' do + describe ".create_user" do + context "with a valid payload" do + it "creates a user" do + VCR.use_cassette "user_management/create_user_valid" do user = described_class.create_user( - email: 'foo@example.com', - first_name: 'Foo', - last_name: 'Bar', - email_verified: true, + email: "foo@example.com", + first_name: "Foo", + last_name: "Bar", + email_verified: true ) - expect(user.first_name).to eq('Foo') - expect(user.last_name).to eq('Bar') - expect(user.email).to eq('foo@example.com') + expect(user.first_name).to eq("Foo") + expect(user.last_name).to eq("Bar") + expect(user.email).to eq("foo@example.com") end end - it 'only sends non-nil values in request body' do + it "only sends non-nil values in request body" do expect(described_class).to receive(:post_request) do |options| body = options[:body] - expect(body).to eq({ email: 'test@example.com', first_name: 'John' }) + expect(body).to eq({email: "test@example.com", first_name: "John"}) expect(body).not_to have_key(:last_name) expect(body).not_to have_key(:email_verified) - double('request') - end.and_return(double('request')) + double("request") + end.and_return(double("request")) expect(described_class).to receive(:execute_request).and_return( - double('response', body: '{"id": "test_user", "email": "test@example.com"}'), + double("response", body: '{"id": "test_user", "email": "test@example.com"}') ) described_class.create_user( - email: 'test@example.com', - first_name: 'John', + email: "test@example.com", + first_name: "John" ) end - it 'creates a user with external_id' do - VCR.use_cassette 'user_management/create_user_with_external_id' do + it "creates a user with external_id" do + VCR.use_cassette "user_management/create_user_with_external_id" do user = described_class.create_user( - email: 'external@example.com', - first_name: 'External', - last_name: 'User', - external_id: 'ext_user_123', + email: "external@example.com", + first_name: "External", + last_name: "User", + external_id: "ext_user_123" ) - expect(user.first_name).to eq('External') - expect(user.last_name).to eq('User') - expect(user.email).to eq('external@example.com') - expect(user.external_id).to eq('ext_user_123') + expect(user.first_name).to eq("External") + expect(user.last_name).to eq("User") + expect(user.email).to eq("external@example.com") + expect(user.external_id).to eq("ext_user_123") end end - context 'with an invalid payload' do - it 'returns an error' do - VCR.use_cassette 'user_management/create_user_invalid' do + context "with an invalid payload" do + it "returns an error" do + VCR.use_cassette "user_management/create_user_invalid" do expect do - described_class.create_user(email: '') + described_class.create_user(email: "") end.to raise_error( WorkOS::UnprocessableEntityError, - /email_string_required/, + /email_string_required/ ) end end @@ -424,94 +424,94 @@ end end - describe '.update_user' do - context 'with a valid payload' do - it 'update_user a user' do - VCR.use_cassette 'user_management/update_user/valid' do + describe ".update_user" do + context "with a valid payload" do + it "update_user a user" do + VCR.use_cassette "user_management/update_user/valid" do user = described_class.update_user( - id: 'user_01H7TVSKS45SDHN5V9XPSM6H44', - first_name: 'Jane', - last_name: 'Doe', + id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + first_name: "Jane", + last_name: "Doe", email_verified: false, - external_id: '123', + external_id: "123" ) - expect(user.first_name).to eq('Jane') - expect(user.last_name).to eq('Doe') + expect(user.first_name).to eq("Jane") + expect(user.last_name).to eq("Doe") expect(user.email_verified).to eq(false) - expect(user.external_id).to eq('123') + expect(user.external_id).to eq("123") end end - it 'can update user locale' do - VCR.use_cassette 'user_management/update_user/locale' do + it "can update user locale" do + VCR.use_cassette "user_management/update_user/locale" do user = described_class.update_user( - id: 'user_01K78B3ZB5B7119MYEXTQE5KNE', - locale: 'en-US', + id: "user_01K78B3ZB5B7119MYEXTQE5KNE", + locale: "en-US" ) - expect(user.locale).to eq('en-US') + expect(user.locale).to eq("en-US") end end - it 'can update email addresses' do - VCR.use_cassette 'user_management/update_user/email' do + it "can update email addresses" do + VCR.use_cassette "user_management/update_user/email" do user = described_class.update_user( - id: 'user_01H7TVSKS45SDHN5V9XPSM6H44', - email: 'jane@example.com', + id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + email: "jane@example.com" ) - expect(user.email).to eq('jane@example.com') + expect(user.email).to eq("jane@example.com") expect(user.email_verified).to eq(false) end end - it 'only sends non-nil values in request body' do + it "only sends non-nil values in request body" do # Mock the request to inspect what's being sent expect(described_class).to receive(:put_request) do |options| # Verify that the body only contains non-nil values body = options[:body] - expect(body).to eq({ email_verified: true }) + expect(body).to eq({email_verified: true}) expect(body).not_to have_key(:first_name) expect(body).not_to have_key(:last_name) expect(body).not_to have_key(:email) expect(body).not_to have_key(:locale) # Return a mock request object - double('request') - end.and_return(double('request')) + double("request") + end.and_return(double("request")) expect(described_class).to receive(:execute_request).and_return( - double('response', body: '{"id": "test_user", "email_verified": true}'), + double("response", body: '{"id": "test_user", "email_verified": true}') ) described_class.update_user( - id: 'user_01H7TVSKS45SDHN5V9XPSM6H44', - email_verified: true, + id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + email_verified: true ) end - it 'can set external_id to null explicitly' do + it "can set external_id to null explicitly" do original_method = described_class.method(:put_request) allow(described_class).to receive(:put_request) do |kwargs| original_method.call(**kwargs) end - VCR.use_cassette 'user_management/update_user_external_id_null' do + VCR.use_cassette "user_management/update_user_external_id_null" do described_class.update_user( - id: 'user_01K0SR53HJ58M957MYAB6TDZ9X', - first_name: 'John', - external_id: nil, + id: "user_01K0SR53HJ58M957MYAB6TDZ9X", + first_name: "John", + external_id: nil ) end expect(described_class).to have_received(:put_request).with( - hash_including(body: hash_including(external_id: nil)), + hash_including(body: hash_including(external_id: nil)) ) end - context 'with an invalid payload' do - it 'returns an error' do - VCR.use_cassette 'user_management/update_user/invalid' do + context "with an invalid payload" do + it "returns an error" do + VCR.use_cassette "user_management/update_user/invalid" do expect do - described_class.update_user(id: 'invalid') + described_class.update_user(id: "invalid") end.to raise_error(WorkOS::NotFoundError, /User not found/) end end @@ -519,12 +519,12 @@ end end - describe '.delete_user' do - context 'with a valid id' do - it 'returns true' do - VCR.use_cassette('user_management/delete_user/valid') do + describe ".delete_user" do + context "with a valid id" do + it "returns true" do + VCR.use_cassette("user_management/delete_user/valid") do response = WorkOS::UserManagement.delete_user( - id: 'user_01H7WRJBPAAHX1BYRQHEK7QC4A', + id: "user_01H7WRJBPAAHX1BYRQHEK7QC4A" ) expect(response).to be(true) @@ -532,129 +532,129 @@ end end - context 'with an invalid id' do - it 'raises an error' do - VCR.use_cassette('user_management/delete_user/invalid') do + context "with an invalid id" do + it "raises an error" do + VCR.use_cassette("user_management/delete_user/invalid") do expect do - WorkOS::UserManagement.delete_user(id: 'invalid') + WorkOS::UserManagement.delete_user(id: "invalid") end.to raise_error(WorkOS::NotFoundError, /User not found/) end end end end - describe '.authenticate_with_password' do - context 'with a valid password' do - it 'returns user' do - VCR.use_cassette('user_management/authenticate_with_password/valid', tag: :token) do + describe ".authenticate_with_password" do + context "with a valid password" do + it "returns user" do + VCR.use_cassette("user_management/authenticate_with_password/valid", tag: :token) do authentication_response = WorkOS::UserManagement.authenticate_with_password( - email: 'test@workos.app', - password: '7YtYic00VWcXatPb', - client_id: 'client_123', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + email: "test@workos.app", + password: "7YtYic00VWcXatPb", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) - expect(authentication_response.user.id).to eq('user_01H7TVSKS45SDHN5V9XPSM6H44') + expect(authentication_response.user.id).to eq("user_01H7TVSKS45SDHN5V9XPSM6H44") end end end - context 'with an invalid user' do - it 'raises an error' do - VCR.use_cassette('user_management/authenticate_with_password/invalid') do + context "with an invalid user" do + it "raises an error" do + VCR.use_cassette("user_management/authenticate_with_password/invalid") do expect do WorkOS::UserManagement.authenticate_with_password( - email: 'invalid@workos.app', - password: 'invalid', - client_id: 'client_123', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + email: "invalid@workos.app", + password: "invalid", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) end.to raise_error(WorkOS::NotFoundError, /User not found/) end end end - context 'with an unverified user' do - it 'raises a ForbiddenRequestError' do - VCR.use_cassette('user_management/authenticate_with_password/unverified') do + context "with an unverified user" do + it "raises a ForbiddenRequestError" do + VCR.use_cassette("user_management/authenticate_with_password/unverified") do expect do WorkOS::UserManagement.authenticate_with_password( - email: 'unverified@workos.app', - password: '7YtYic00VWcXatPb', - client_id: 'client_123', + email: "unverified@workos.app", + password: "7YtYic00VWcXatPb", + client_id: "client_123" ) end.to raise_error(WorkOS::ForbiddenRequestError, /Email ownership must be verified before authentication/) end end end - context 'with an invitation_token' do - it 'includes invitation_token in the request body' do + context "with an invitation_token" do + it "includes invitation_token in the request body" do expect(described_class).to receive(:post_request) do |options| body = options[:body] - expect(body[:invitation_token]).to eq('invitation_token_123') + expect(body[:invitation_token]).to eq("invitation_token_123") - double('request') - end.and_return(double('request')) + double("request") + end.and_return(double("request")) expect(described_class).to receive(:execute_request).and_return( - double('response', body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}'), + double("response", body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}') ) described_class.authenticate_with_password( - email: 'test@workos.app', - password: 'password123', - client_id: 'client_123', - invitation_token: 'invitation_token_123', + email: "test@workos.app", + password: "password123", + client_id: "client_123", + invitation_token: "invitation_token_123" ) end end end - describe '.authenticate_with_code' do - context 'with a valid code' do - it 'returns user' do - VCR.use_cassette('user_management/authenticate_with_code/valid') do + describe ".authenticate_with_code" do + context "with a valid code" do + it "returns user" do + VCR.use_cassette("user_management/authenticate_with_code/valid") do authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: '01H93ZZHA0JBHFJH9RR11S83YN', - client_id: 'client_123', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) - expect(authentication_response.user.id).to eq('user_01H93ZY4F80YZRRS6N59Z2HFVS') - expect(authentication_response.access_token).to eq('') - expect(authentication_response.refresh_token).to eq('') + expect(authentication_response.user.id).to eq("user_01H93ZY4F80YZRRS6N59Z2HFVS") + expect(authentication_response.access_token).to eq("") + expect(authentication_response.refresh_token).to eq("") end end - context 'when oauth_tokens is present in the api response' do - it 'returns an oauth_tokens object' do - VCR.use_cassette('user_management/authenticate_with_code/valid_with_oauth_tokens') do + context "when oauth_tokens is present in the api response" do + it "returns an oauth_tokens object" do + VCR.use_cassette("user_management/authenticate_with_code/valid_with_oauth_tokens") do authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: '01H93ZZHA0JBHFJH9RR11S83YN', - client_id: 'client_123', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) expect(authentication_response.oauth_tokens).to be_a(WorkOS::OAuthTokens) - expect(authentication_response.oauth_tokens.access_token).to eq('oauth_access_token') - expect(authentication_response.oauth_tokens.refresh_token).to eq('oauth_refresh_token') + expect(authentication_response.oauth_tokens.access_token).to eq("oauth_access_token") + expect(authentication_response.oauth_tokens.refresh_token).to eq("oauth_refresh_token") expect(authentication_response.oauth_tokens.scopes).to eq(%w[read write]) expect(authentication_response.oauth_tokens.expires_at).to eq(1_234_567_890) end end end - context 'when oauth_tokens is not present in the api response' do - it 'returns nil oauth_tokens' do - VCR.use_cassette('user_management/authenticate_with_code/valid') do + context "when oauth_tokens is not present in the api response" do + it "returns nil oauth_tokens" do + VCR.use_cassette("user_management/authenticate_with_code/valid") do authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: '01H93ZZHA0JBHFJH9RR11S83YN', - client_id: 'client_123', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) expect(authentication_response.oauth_tokens).to be_nil @@ -662,86 +662,86 @@ end end - context 'when the user is being impersonated' do - it 'contains the impersonator metadata' do - VCR.use_cassette('user_management/authenticate_with_code/valid_with_impersonator') do + context "when the user is being impersonated" do + it "contains the impersonator metadata" do + VCR.use_cassette("user_management/authenticate_with_code/valid_with_impersonator") do authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: '01HRX85ATQB2MN40K4FZ9C2HFR', - client_id: 'client_01GS91XFB2YPR1C0NR5SH758Q0', + code: "01HRX85ATQB2MN40K4FZ9C2HFR", + client_id: "client_01GS91XFB2YPR1C0NR5SH758Q0" ) expect(authentication_response.impersonator).to have_attributes( - email: 'admin@foocorp.com', - reason: 'For testing.', + email: "admin@foocorp.com", + reason: "For testing." ) end end end end - context 'with an invalid code' do - it 'raises an error' do - VCR.use_cassette('user_management/authenticate_with_code/invalid') do + context "with an invalid code" do + it "raises an error" do + VCR.use_cassette("user_management/authenticate_with_code/invalid") do expect do WorkOS::UserManagement.authenticate_with_code( - code: 'invalid', - client_id: 'client_123', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + code: "invalid", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) end end end - context 'with an invitation_token' do - it 'includes invitation_token in the request body' do + context "with an invitation_token" do + it "includes invitation_token in the request body" do expect(described_class).to receive(:post_request) do |options| body = options[:body] - expect(body[:invitation_token]).to eq('invitation_token_123') + expect(body[:invitation_token]).to eq("invitation_token_123") - double('request') - end.and_return(double('request')) + double("request") + end.and_return(double("request")) expect(described_class).to receive(:execute_request).and_return( - double('response', body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}'), + double("response", body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}') ) described_class.authenticate_with_code( - code: '01H93ZZHA0JBHFJH9RR11S83YN', - client_id: 'client_123', - invitation_token: 'invitation_token_123', + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + invitation_token: "invitation_token_123" ) end end end - describe '.authenticate_with_refresh_token' do - context 'with a valid refresh_token' do - it 'returns user' do - VCR.use_cassette('user_management/authenticate_with_refresh_token/valid', tag: :token) do + describe ".authenticate_with_refresh_token" do + context "with a valid refresh_token" do + it "returns user" do + VCR.use_cassette("user_management/authenticate_with_refresh_token/valid", tag: :token) do authentication_response = WorkOS::UserManagement.authenticate_with_refresh_token( - refresh_token: 'some_refresh_token', - client_id: 'client_123', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + refresh_token: "some_refresh_token", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) - expect(authentication_response.access_token).to eq('') - expect(authentication_response.refresh_token).to eq('') - expect(authentication_response.user.id).to eq('user_01H93WD0R0KWF8Q7BK02C0RPYJ') + expect(authentication_response.access_token).to eq("") + expect(authentication_response.refresh_token).to eq("") + expect(authentication_response.user.id).to eq("user_01H93WD0R0KWF8Q7BK02C0RPYJ") end end end - context 'with an invalid refresh_token' do - it 'raises an error' do - VCR.use_cassette('user_management/authenticate_with_refresh_code/invalid', tag: :token) do + context "with an invalid refresh_token" do + it "raises an error" do + VCR.use_cassette("user_management/authenticate_with_refresh_code/invalid", tag: :token) do expect do WorkOS::UserManagement.authenticate_with_refresh_token( - refresh_token: 'invalid', - client_id: 'client_123', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + refresh_token: "invalid", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) end @@ -749,84 +749,84 @@ end end - describe '.authenticate_with_magic_auth' do - context 'with a valid code' do - it 'returns user' do - VCR.use_cassette('user_management/authenticate_with_magic_auth/valid', tag: :token) do + describe ".authenticate_with_magic_auth" do + context "with a valid code" do + it "returns user" do + VCR.use_cassette("user_management/authenticate_with_magic_auth/valid", tag: :token) do authentication_response = WorkOS::UserManagement.authenticate_with_magic_auth( - code: '452079', - client_id: 'project_01EGKAEB7G5N88E83MF99J785F', - email: 'test@workos.com', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + code: "452079", + client_id: "project_01EGKAEB7G5N88E83MF99J785F", + email: "test@workos.com", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) - expect(authentication_response.user.id).to eq('user_01H93WD0R0KWF8Q7BK02C0RPYJ') + expect(authentication_response.user.id).to eq("user_01H93WD0R0KWF8Q7BK02C0RPYJ") end end end - context 'with an invalid code' do - it 'returns an error' do - VCR.use_cassette('user_management/authenticate_with_magic_auth/invalid', tag: :token) do + context "with an invalid code" do + it "returns an error" do + VCR.use_cassette("user_management/authenticate_with_magic_auth/invalid", tag: :token) do expect do WorkOS::UserManagement.authenticate_with_magic_auth( - code: 'invalid', - client_id: 'client_123', - email: 'test@workos.com', + code: "invalid", + client_id: "client_123", + email: "test@workos.com" ) end.to raise_error(WorkOS::NotFoundError, /User not found/) end end end - context 'with an invitation_token' do - it 'includes invitation_token in the request body' do + context "with an invitation_token" do + it "includes invitation_token in the request body" do expect(described_class).to receive(:post_request) do |options| body = options[:body] - expect(body[:invitation_token]).to eq('invitation_token_123') + expect(body[:invitation_token]).to eq("invitation_token_123") - double('request') - end.and_return(double('request')) + double("request") + end.and_return(double("request")) expect(described_class).to receive(:execute_request).and_return( - double('response', body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}'), + double("response", body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}') ) described_class.authenticate_with_magic_auth( - code: '452079', - client_id: 'client_123', - email: 'test@workos.com', - invitation_token: 'invitation_token_123', + code: "452079", + client_id: "client_123", + email: "test@workos.com", + invitation_token: "invitation_token_123" ) end end end - describe '.authenticate_with_organization_selection' do - context 'with a valid code' do - it 'returns user' do - VCR.use_cassette('user_management/authenticate_with_organization_selection/valid', tag: :token) do + describe ".authenticate_with_organization_selection" do + context "with a valid code" do + it "returns user" do + VCR.use_cassette("user_management/authenticate_with_organization_selection/valid", tag: :token) do authentication_response = WorkOS::UserManagement.authenticate_with_organization_selection( - client_id: 'project_01EGKAEB7G5N88E83MF99J785F', - organization_id: 'org_01H5JQDV7R7ATEYZDEG0W5PRYS', - pending_authentication_token: 'pending_authentication_token_1234', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + client_id: "project_01EGKAEB7G5N88E83MF99J785F", + organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", + pending_authentication_token: "pending_authentication_token_1234", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) - expect(authentication_response.user.id).to eq('user_01H93WD0R0KWF8Q7BK02C0RPYJ') - expect(authentication_response.organization_id).to eq('org_01H5JQDV7R7ATEYZDEG0W5PRYS') + expect(authentication_response.user.id).to eq("user_01H93WD0R0KWF8Q7BK02C0RPYJ") + expect(authentication_response.organization_id).to eq("org_01H5JQDV7R7ATEYZDEG0W5PRYS") end end end - context 'with an invalid token' do - it 'returns an error' do - VCR.use_cassette('user_management/authenticate_with_organization_selection/invalid', tag: :token) do + context "with an invalid token" do + it "returns an error" do + VCR.use_cassette("user_management/authenticate_with_organization_selection/invalid", tag: :token) do expect do WorkOS::UserManagement.authenticate_with_organization_selection( - organization_id: 'invalid_org_id', - client_id: 'project_01EGKAEB7G5N88E83MF99J785F', - pending_authentication_token: 'pending_authentication_token_1234', + organization_id: "invalid_org_id", + client_id: "project_01EGKAEB7G5N88E83MF99J785F", + pending_authentication_token: "pending_authentication_token_1234" ) end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) end @@ -834,34 +834,34 @@ end end - describe '.authenticate_with_totp' do - context 'with a valid code' do - it 'returns user' do - VCR.use_cassette('user_management/authenticate_with_totp/valid', tag: :token) do + describe ".authenticate_with_totp" do + context "with a valid code" do + it "returns user" do + VCR.use_cassette("user_management/authenticate_with_totp/valid", tag: :token) do authentication_response = WorkOS::UserManagement.authenticate_with_totp( - code: '01H93ZZHA0JBHFJH9RR11S83YN', - client_id: 'client_123', - pending_authentication_token: 'pending_authentication_token_1234', - authentication_challenge_id: 'authentication_challenge_id', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + pending_authentication_token: "pending_authentication_token_1234", + authentication_challenge_id: "authentication_challenge_id", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) - expect(authentication_response.user.id).to eq('user_01H93ZY4F80YZRRS6N59Z2HFVS') + expect(authentication_response.user.id).to eq("user_01H93ZY4F80YZRRS6N59Z2HFVS") end end end - context 'with an invalid code' do - it 'raises an error' do - VCR.use_cassette('user_management/authenticate_with_totp/invalid', tag: :token) do + context "with an invalid code" do + it "raises an error" do + VCR.use_cassette("user_management/authenticate_with_totp/invalid", tag: :token) do expect do WorkOS::UserManagement.authenticate_with_totp( - code: 'invalid', - client_id: 'client_123', - pending_authentication_token: 'pending_authentication_token_1234', - authentication_challenge_id: 'authentication_challenge_id', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + code: "invalid", + client_id: "client_123", + pending_authentication_token: "pending_authentication_token_1234", + authentication_challenge_id: "authentication_challenge_id", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) end @@ -869,32 +869,32 @@ end end - describe '.authenticate_with_email_verification' do - context 'with a valid code' do - it 'returns user' do - VCR.use_cassette('user_management/authenticate_with_email_verification/valid', tag: :token) do + describe ".authenticate_with_email_verification" do + context "with a valid code" do + it "returns user" do + VCR.use_cassette("user_management/authenticate_with_email_verification/valid", tag: :token) do authentication_response = WorkOS::UserManagement.authenticate_with_email_verification( - code: '01H93ZZHA0JBHFJH9RR11S83YN', - client_id: 'client_123', - pending_authentication_token: 'pending_authentication_token_1234', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + pending_authentication_token: "pending_authentication_token_1234", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) - expect(authentication_response.user.id).to eq('user_01H93ZY4F80YZRRS6N59Z2HFVS') + expect(authentication_response.user.id).to eq("user_01H93ZY4F80YZRRS6N59Z2HFVS") end end end - context 'with an invalid code' do - it 'raises an error' do - VCR.use_cassette('user_management/authenticate_with_email_verification/invalid', tag: :token) do + context "with an invalid code" do + it "raises an error" do + VCR.use_cassette("user_management/authenticate_with_email_verification/invalid", tag: :token) do expect do WorkOS::UserManagement.authenticate_with_email_verification( - code: 'invalid', - client_id: 'client_123', - pending_authentication_token: 'pending_authentication_token_1234', - ip_address: '200.240.210.16', - user_agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36', + code: "invalid", + client_id: "client_123", + pending_authentication_token: "pending_authentication_token_1234", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" ) end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) end @@ -902,12 +902,12 @@ end end - describe '.get_magic_auth' do - context 'with a valid id' do - it 'returns a magic_auth object' do - VCR.use_cassette 'user_management/get_magic_auth/valid' do + describe ".get_magic_auth" do + context "with a valid id" do + it "returns a magic_auth object" do + VCR.use_cassette "user_management/get_magic_auth/valid" do magic_auth = described_class.get_magic_auth( - id: 'magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9', + id: "magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9" ) expect(magic_auth.id.instance_of?(String)) @@ -916,126 +916,126 @@ end end - context 'with an invalid id' do - it 'raises an error' do - VCR.use_cassette('user_management/get_magic_auth/invalid') do + context "with an invalid id" do + it "raises an error" do + VCR.use_cassette("user_management/get_magic_auth/invalid") do expect do - WorkOS::UserManagement.get_magic_auth(id: 'invalid') + WorkOS::UserManagement.get_magic_auth(id: "invalid") end.to raise_error(WorkOS::NotFoundError, /MagicAuth not found/) end end end end - describe '.create_magic_auth' do - context 'with valid payload' do - it 'creates a magic_auth' do - VCR.use_cassette 'user_management/create_magic_auth/valid' do + describe ".create_magic_auth" do + context "with valid payload" do + it "creates a magic_auth" do + VCR.use_cassette "user_management/create_magic_auth/valid" do magic_auth = described_class.create_magic_auth( - email: 'test@workos.com', + email: "test@workos.com" ) - expect(magic_auth.id).to eq('magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9') - expect(magic_auth.email).to eq('test@workos.com') + expect(magic_auth.id).to eq("magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9") + expect(magic_auth.email).to eq("test@workos.com") end end end end - describe '.send_magic_auth_code' do - context 'with valid parameters' do - it 'sends a magic link to the email address' do - VCR.use_cassette 'user_management/send_magic_auth_code/valid' do + describe ".send_magic_auth_code" do + context "with valid parameters" do + it "sends a magic link to the email address" do + VCR.use_cassette "user_management/send_magic_auth_code/valid" do described_class.send_magic_auth_code( - email: 'test@gmail.com', + email: "test@gmail.com" ) end end end end - describe '.enroll_auth_factor' do - context 'with a valid user_id and auth factor type' do - it 'returns an auth factor and challenge' do - VCR.use_cassette('user_management/enroll_auth_factor/valid') do + describe ".enroll_auth_factor" do + context "with a valid user_id and auth factor type" do + it "returns an auth factor and challenge" do + VCR.use_cassette("user_management/enroll_auth_factor/valid") do authentication_response = WorkOS::UserManagement.enroll_auth_factor( - user_id: 'user_01H7TVSKS45SDHN5V9XPSM6H44', - type: 'totp', - totp_secret: 'secret-test', + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + type: "totp", + totp_secret: "secret-test" ) - expect(authentication_response.authentication_factor.id).to eq('auth_factor_01H96FETXENNY99ARX0GRC804C') - expect(authentication_response.authentication_challenge.id).to eq('auth_challenge_01H96FETXGTW1QMBSBT2T36PW0') + expect(authentication_response.authentication_factor.id).to eq("auth_factor_01H96FETXENNY99ARX0GRC804C") + expect(authentication_response.authentication_challenge.id).to eq("auth_challenge_01H96FETXGTW1QMBSBT2T36PW0") end end - it 'only sends non-nil values in request body' do + it "only sends non-nil values in request body" do expect(described_class).to receive(:post_request) do |options| body = options[:body] - expect(body).to eq({ type: 'totp', totp_issuer: 'Test App' }) + expect(body).to eq({type: "totp", totp_issuer: "Test App"}) expect(body).not_to have_key(:totp_user) expect(body).not_to have_key(:totp_secret) - double('request') - end.and_return(double('request')) + double("request") + end.and_return(double("request")) expect(described_class).to receive(:execute_request).and_return( - double('response', - body: '{"authentication_factor": {"id": "test"}, "authentication_challenge": {"id": "test"}}',), + double("response", + body: '{"authentication_factor": {"id": "test"}, "authentication_challenge": {"id": "test"}}') ) described_class.enroll_auth_factor( - user_id: 'user_123', - type: 'totp', - totp_issuer: 'Test App', + user_id: "user_123", + type: "totp", + totp_issuer: "Test App" ) end end - context 'with an incorrect user id' do - it 'raises an error' do - VCR.use_cassette('user_management/enroll_auth_factor/invalid') do + context "with an incorrect user id" do + it "raises an error" do + VCR.use_cassette("user_management/enroll_auth_factor/invalid") do expect do WorkOS::UserManagement.enroll_auth_factor( - user_id: 'user_01H7TVSKS45SDHN5V9XPSM6H44', - type: 'totp', + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + type: "totp" ) end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) end end end - context 'with an invalid auth factor type' do - it 'raises an error' do + context "with an invalid auth factor type" do + it "raises an error" do expect do - described_class.enroll_auth_factor(user_id: 'user_01H7TVSKS45SDHN5V9XPSM6H44', - type: 'invalid-factor',) + described_class.enroll_auth_factor(user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + type: "invalid-factor") end.to raise_error( ArgumentError, - 'invalid-factor is not a valid value. `type` must be in ["totp"]', + 'invalid-factor is not a valid value. `type` must be in ["totp"]' ) end end end - describe '.list_auth_factors' do - context 'with a valid user_id' do - it 'returns a list of auth factors' do - VCR.use_cassette('user_management/list_auth_factors/valid') do + describe ".list_auth_factors" do + context "with a valid user_id" do + it "returns a list of auth factors" do + VCR.use_cassette("user_management/list_auth_factors/valid") do authentication_response = WorkOS::UserManagement.list_auth_factors( - user_id: 'user_01H7TVSKS45SDHN5V9XPSM6H44', + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" ) - expect(authentication_response.data.first.id).to eq('auth_factor_01H96FETXENNY99ARX0GRC804C') + expect(authentication_response.data.first.id).to eq("auth_factor_01H96FETXENNY99ARX0GRC804C") end end end - context 'with an incorrect user id' do - it 'raises an error' do - VCR.use_cassette('user_management/list_auth_factors/invalid') do + context "with an incorrect user id" do + it "raises an error" do + VCR.use_cassette("user_management/list_auth_factors/invalid") do expect do WorkOS::UserManagement.list_auth_factors( - user_id: 'user_01H7TVSKS45SDHN5V9XPSM6H44', + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" ) end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) end @@ -1043,12 +1043,12 @@ end end - describe '.get_email_verification' do - context 'with a valid id' do - it 'returns an email_verification object' do - VCR.use_cassette 'user_management/get_email_verification/valid' do + describe ".get_email_verification" do + context "with a valid id" do + it "returns an email_verification object" do + VCR.use_cassette "user_management/get_email_verification/valid" do email_verification = described_class.get_email_verification( - id: 'email_verification_01HYK9VKNJQ0MJDXEXQP0DA1VK', + id: "email_verification_01HYK9VKNJQ0MJDXEXQP0DA1VK" ) expect(email_verification.id.instance_of?(String)) @@ -1057,35 +1057,35 @@ end end - context 'with an invalid id' do - it 'raises an error' do - VCR.use_cassette('user_management/get_email_verification/invalid') do + context "with an invalid id" do + it "raises an error" do + VCR.use_cassette("user_management/get_email_verification/invalid") do expect do - WorkOS::UserManagement.get_email_verification(id: 'invalid') + WorkOS::UserManagement.get_email_verification(id: "invalid") end.to raise_error(WorkOS::NotFoundError, /Email Verification not found/) end end end end - describe '.send_verification_email' do - context 'with valid parameters' do - it 'sends an email to that user and the magic auth challenge' do - VCR.use_cassette 'user_management/send_verification_email/valid' do + describe ".send_verification_email" do + context "with valid parameters" do + it "sends an email to that user and the magic auth challenge" do + VCR.use_cassette "user_management/send_verification_email/valid" do verification_response = described_class.send_verification_email( - user_id: 'user_01H93WD0R0KWF8Q7BK02C0RPYJ', + user_id: "user_01H93WD0R0KWF8Q7BK02C0RPYJ" ) - expect(verification_response.user.id).to eq('user_01H93WD0R0KWF8Q7BK02C0RPYJ') + expect(verification_response.user.id).to eq("user_01H93WD0R0KWF8Q7BK02C0RPYJ") end end end - context 'when the user does not exist' do - it 'returns an error' do - VCR.use_cassette 'user_management/send_verification_email/invalid' do + context "when the user does not exist" do + it "returns an error" do + VCR.use_cassette "user_management/send_verification_email/invalid" do expect do described_class.send_verification_email( - user_id: 'bad_id', + user_id: "bad_id" ) end.to raise_error(WorkOS::NotFoundError, /User not found/) end @@ -1093,41 +1093,41 @@ end end - describe '.verify_email' do - context 'with valid parameters' do - it 'verifies the email and returns the user' do - VCR.use_cassette 'user_management/verify_email/valid' do + describe ".verify_email" do + context "with valid parameters" do + it "verifies the email and returns the user" do + VCR.use_cassette "user_management/verify_email/valid" do verify_response = described_class.verify_email( - code: '333495', - user_id: 'user_01H968BR1R84DSPYS9QR5PM6RZ', + code: "333495", + user_id: "user_01H968BR1R84DSPYS9QR5PM6RZ" ) - expect(verify_response.user.id).to eq('user_01H968BR1R84DSPYS9QR5PM6RZ') + expect(verify_response.user.id).to eq("user_01H968BR1R84DSPYS9QR5PM6RZ") end end end - context 'with invalid parameters' do - context 'when the id does not exist' do - it 'raises an error' do - VCR.use_cassette 'user_management/verify_email/invalid_magic_auth_challenge' do + context "with invalid parameters" do + context "when the id does not exist" do + it "raises an error" do + VCR.use_cassette "user_management/verify_email/invalid_magic_auth_challenge" do expect do described_class.verify_email( - code: '659770', - user_id: 'bad_id', + code: "659770", + user_id: "bad_id" ) end.to raise_error(WorkOS::NotFoundError, /User not found/) end end end - context 'when the code is incorrect' do - it 'raises an error' do - VCR.use_cassette 'user_management/verify_email/invalid_code' do + context "when the code is incorrect" do + it "raises an error" do + VCR.use_cassette "user_management/verify_email/invalid_code" do expect do described_class.verify_email( - code: '000000', - user_id: 'user_01H93WD0R0KWF8Q7BK02C0RPYJ', + code: "000000", + user_id: "user_01H93WD0R0KWF8Q7BK02C0RPYJ" ) end.to raise_error(WorkOS::InvalidRequestError, /Email verification code is incorrect/) end @@ -1136,12 +1136,12 @@ end end - describe '.get_password_reset' do - context 'with a valid id' do - it 'returns a password_reset object' do - VCR.use_cassette 'user_management/get_password_reset/valid' do + describe ".get_password_reset" do + context "with a valid id" do + it "returns a password_reset object" do + VCR.use_cassette "user_management/get_password_reset/valid" do password_reset = described_class.get_password_reset( - id: 'password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT', + id: "password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT" ) expect(password_reset.id.instance_of?(String)) @@ -1150,39 +1150,39 @@ end end - context 'with an invalid id' do - it 'raises an error' do - VCR.use_cassette('user_management/get_password_reset/invalid') do + context "with an invalid id" do + it "raises an error" do + VCR.use_cassette("user_management/get_password_reset/invalid") do expect do - WorkOS::UserManagement.get_password_reset(id: 'invalid') + WorkOS::UserManagement.get_password_reset(id: "invalid") end.to raise_error(WorkOS::NotFoundError, /Password Reset not found/) end end end end - describe '.create_password_reset' do - context 'with valid payload' do - it 'creates a password_reset object' do - VCR.use_cassette 'user_management/create_password_reset/valid' do + describe ".create_password_reset" do + context "with valid payload" do + it "creates a password_reset object" do + VCR.use_cassette "user_management/create_password_reset/valid" do password_reset = described_class.create_password_reset( - email: 'test@workos.com', + email: "test@workos.com" ) - expect(password_reset.id).to eq('password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT') - expect(password_reset.email).to eq('test@workos.com') + expect(password_reset.id).to eq("password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT") + expect(password_reset.email).to eq("test@workos.com") end end end end - describe '.send_password_reset_email' do - context 'with a valid payload' do - it 'sends a password reset email' do - VCR.use_cassette 'user_management/send_password_reset_email/valid' do + describe ".send_password_reset_email" do + context "with a valid payload" do + it "sends a password reset email" do + VCR.use_cassette "user_management/send_password_reset_email/valid" do response = described_class.send_password_reset_email( - email: 'lucy.lawless@example.com', - password_reset_url: 'https://example.com/reset', + email: "lucy.lawless@example.com", + password_reset_url: "https://example.com/reset" ) expect(response).to be(true) @@ -1190,60 +1190,60 @@ end end - context 'with an invalid payload' do - it 'returns an error' do - VCR.use_cassette 'user_management/send_password_reset_email/invalid' do + context "with an invalid payload" do + it "returns an error" do + VCR.use_cassette "user_management/send_password_reset_email/invalid" do expect do described_class.send_password_reset_email( - email: 'foo@bar.com', - password_reset_url: '', + email: "foo@bar.com", + password_reset_url: "" ) end.to raise_error( WorkOS::UnprocessableEntityError, - /password_reset_url_string_required/, + /password_reset_url_string_required/ ) end end end end - describe '.reset_password' do - context 'with a valid payload' do - it 'resets the password and returns the user' do - VCR.use_cassette 'user_management/reset_password/valid' do + describe ".reset_password" do + context "with a valid payload" do + it "resets the password and returns the user" do + VCR.use_cassette "user_management/reset_password/valid" do user = described_class.reset_password( - token: 'eEgAgvAE0blvU1zWV3yWVAD22', - new_password: 'very_cool_new_pa$$word', + token: "eEgAgvAE0blvU1zWV3yWVAD22", + new_password: "very_cool_new_pa$$word" ) - expect(user.email).to eq('lucy.lawless@example.com') + expect(user.email).to eq("lucy.lawless@example.com") end end end - context 'with an invalid payload' do - it 'returns an error' do - VCR.use_cassette 'user_management/reset_password/invalid' do + context "with an invalid payload" do + it "returns an error" do + VCR.use_cassette "user_management/reset_password/invalid" do expect do described_class.reset_password( - token: 'bogus_token', - new_password: 'new_password', + token: "bogus_token", + new_password: "new_password" ) end.to raise_error( WorkOS::NotFoundError, - /Could not locate user with provided token/, + /Could not locate user with provided token/ ) end end end end - describe '.get_organization_membership' do - context 'with a valid id' do - it 'returns a organization membership' do - VCR.use_cassette 'user_management/get_organization_membership' do + describe ".get_organization_membership" do + context "with a valid id" do + it "returns a organization membership" do + VCR.use_cassette "user_management/get_organization_membership" do organization_membership = described_class.get_organization_membership( - id: 'om_01H5JQDV7R7ATEYZDEG0W5PRYS', + id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS" ) expect(organization_membership.id.instance_of?(String)) @@ -1252,26 +1252,26 @@ end end - context 'with an invalid id' do - it 'returns an error' do + context "with an invalid id" do + it "returns an error" do expect do described_class.get_organization_membership( - id: 'invalid_organization_membership_id', + id: "invalid_organization_membership_id" ).to raise_error(WorkOS::APIError) end end end end - describe '.list_organization_memberships' do - context 'with no options' do - it 'returns a list of users' do + describe ".list_organization_memberships" do + context "with no options" do + it "returns a list of users" do expected_metadata = { - 'after' => nil, - 'before' => 'before-id', + "after" => nil, + "before" => "before-id" } - VCR.use_cassette 'user_management/list_organization_memberships/no_options' do + VCR.use_cassette "user_management/list_organization_memberships/no_options" do organization_memberships = described_class.list_organization_memberships expect(organization_memberships.data.size).to eq(2) @@ -1280,116 +1280,116 @@ end end - context 'with options' do - it 'returns a list of matching users' do + context "with options" do + it "returns a list of matching users" do request_args = [ - '/user_management/organization_memberships?user_id=user_01H5JQDV7R7ATEYZDEG0W5PRYS&'\ - 'order=desc&limit=5', - 'Content-Type' => 'application/json' + "/user_management/organization_memberships?user_id=user_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ + "order=desc&limit=5", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'user_management/list_organization_memberships/with_options' do + VCR.use_cassette "user_management/list_organization_memberships/with_options" do organization_memberships = described_class.list_organization_memberships( - user_id: 'user_01H5JQDV7R7ATEYZDEG0W5PRYS', - order: 'desc', - limit: '5', + user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", + order: "desc", + limit: "5" ) expect(organization_memberships.data.size).to eq(1) - expect(organization_memberships.data[0].user_id).to eq('user_01H5JQDV7R7ATEYZDEG0W5PRYS') + expect(organization_memberships.data[0].user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") end end end - context 'with statuses option' do - it 'returns a list of matching users' do + context "with statuses option" do + it "returns a list of matching users" do request_args = [ - '/user_management/organization_memberships?user_id=user_01HXYSZBKQE2N3NHBKZHDP1X5X&'\ - 'statuses=active&statuses=inactive&order=desc&limit=5', - 'Content-Type' => 'application/json' + "/user_management/organization_memberships?user_id=user_01HXYSZBKQE2N3NHBKZHDP1X5X&" \ + "statuses=active&statuses=inactive&order=desc&limit=5", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'user_management/list_organization_memberships/with_statuses_option' do + VCR.use_cassette "user_management/list_organization_memberships/with_statuses_option" do organization_memberships = described_class.list_organization_memberships( - user_id: 'user_01HXYSZBKQE2N3NHBKZHDP1X5X', + user_id: "user_01HXYSZBKQE2N3NHBKZHDP1X5X", statuses: %w[active inactive], - order: 'desc', - limit: '5', + order: "desc", + limit: "5" ) expect(organization_memberships.data.size).to eq(1) - expect(organization_memberships.data[0].user_id).to eq('user_01HXYSZBKQE2N3NHBKZHDP1X5X') + expect(organization_memberships.data[0].user_id).to eq("user_01HXYSZBKQE2N3NHBKZHDP1X5X") end end end end - describe '.create_organization_membership' do - context 'with a valid payload' do - it 'creates an organization membership' do - VCR.use_cassette 'user_management/create_organization_membership/valid' do + describe ".create_organization_membership" do + context "with a valid payload" do + it "creates an organization membership" do + VCR.use_cassette "user_management/create_organization_membership/valid" do organization_membership = described_class.create_organization_membership( - user_id: 'user_01H5JQDV7R7ATEYZDEG0W5PRYS', - organization_id: 'org_01H5JQDV7R7ATEYZDEG0W5PRYS', + user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", + organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS" ) - expect(organization_membership.organization_id).to eq('organization_01H5JQDV7R7ATEYZDEG0W5PRYS') - expect(organization_membership.user_id).to eq('user_01H5JQDV7R7ATEYZDEG0W5PRYS') - expect(organization_membership.role).to eq({ slug: 'member' }) + expect(organization_membership.organization_id).to eq("organization_01H5JQDV7R7ATEYZDEG0W5PRYS") + expect(organization_membership.user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") + expect(organization_membership.role).to eq({slug: "member"}) end end end - context 'with an invalid payload' do - it 'returns an error' do - VCR.use_cassette 'user_management/create_organization_membership/invalid' do + context "with an invalid payload" do + it "returns an error" do + VCR.use_cassette "user_management/create_organization_membership/invalid" do expect do - described_class.create_organization_membership(user_id: '', organization_id: '') + described_class.create_organization_membership(user_id: "", organization_id: "") end.to raise_error( WorkOS::UnprocessableEntityError, - /user_id_string_required/, + /user_id_string_required/ ) end end end - context 'with a role slug' do - it 'creates an organization with the given role slug ' do - VCR.use_cassette 'user_management/create_organization_membership/valid' do + context "with a role slug" do + it "creates an organization with the given role slug " do + VCR.use_cassette "user_management/create_organization_membership/valid" do organization_membership = described_class.create_organization_membership( - user_id: 'user_01H5JQDV7R7ATEYZDEG0W5PRYS', - organization_id: 'org_01H5JQDV7R7ATEYZDEG0W5PRYS', - role_slug: 'member', + user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", + organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", + role_slug: "member" ) - expect(organization_membership.organization_id).to eq('organization_01H5JQDV7R7ATEYZDEG0W5PRYS') - expect(organization_membership.user_id).to eq('user_01H5JQDV7R7ATEYZDEG0W5PRYS') - expect(organization_membership.role).to eq({ slug: 'member' }) + expect(organization_membership.organization_id).to eq("organization_01H5JQDV7R7ATEYZDEG0W5PRYS") + expect(organization_membership.user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") + expect(organization_membership.role).to eq({slug: "member"}) end end end - context 'with role slugs' do - it 'creates an organization membership with multiple roles' do - VCR.use_cassette 'user_management/create_organization_membership/valid_multiple_roles' do + context "with role slugs" do + it "creates an organization membership with multiple roles" do + VCR.use_cassette "user_management/create_organization_membership/valid_multiple_roles" do organization_membership = described_class.create_organization_membership( - user_id: 'user_01H5JQDV7R7ATEYZDEG0W5PRYS', - organization_id: 'org_01H5JQDV7R7ATEYZDEG0W5PRYS', - role_slugs: %w[admin member], + user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", + organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", + role_slugs: %w[admin member] ) - expect(organization_membership.organization_id).to eq('organization_01H5JQDV7R7ATEYZDEG0W5PRYS') - expect(organization_membership.user_id).to eq('user_01H5JQDV7R7ATEYZDEG0W5PRYS') + expect(organization_membership.organization_id).to eq("organization_01H5JQDV7R7ATEYZDEG0W5PRYS") + expect(organization_membership.user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") expect(organization_membership.roles).to be_an(Array) expect(organization_membership.roles.length).to eq(2) end @@ -1397,42 +1397,42 @@ end end - describe '.update_organization_membership' do - context 'with a valid id' do - it 'returns true' do - VCR.use_cassette('user_management/update_organization_membership/valid') do + describe ".update_organization_membership" do + context "with a valid id" do + it "returns true" do + VCR.use_cassette("user_management/update_organization_membership/valid") do organization_membership = WorkOS::UserManagement.update_organization_membership( - id: 'om_01H5JQDV7R7ATEYZDEG0W5PRYS', - role_slug: 'admin', + id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS", + role_slug: "admin" ) - expect(organization_membership.organization_id).to eq('organization_01H5JQDV7R7ATEYZDEG0W5PRYS') - expect(organization_membership.user_id).to eq('user_01H5JQDV7R7ATEYZDEG0W5PRYS') - expect(organization_membership.role).to eq({ slug: 'admin' }) + expect(organization_membership.organization_id).to eq("organization_01H5JQDV7R7ATEYZDEG0W5PRYS") + expect(organization_membership.user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") + expect(organization_membership.role).to eq({slug: "admin"}) end end end - context 'with an invalid id' do - it 'raises an error' do - VCR.use_cassette('user_management/update_organization_membership/invalid') do + context "with an invalid id" do + it "raises an error" do + VCR.use_cassette("user_management/update_organization_membership/invalid") do expect do - WorkOS::UserManagement.update_organization_membership(id: 'invalid', role_slug: 'admin') + WorkOS::UserManagement.update_organization_membership(id: "invalid", role_slug: "admin") end.to raise_error(WorkOS::NotFoundError, /Organization Membership not found/) end end end - context 'with role slugs' do - it 'updates an organization membership with multiple roles' do - VCR.use_cassette('user_management/update_organization_membership/valid_multiple_roles') do + context "with role slugs" do + it "updates an organization membership with multiple roles" do + VCR.use_cassette("user_management/update_organization_membership/valid_multiple_roles") do organization_membership = WorkOS::UserManagement.update_organization_membership( - id: 'om_01H5JQDV7R7ATEYZDEG0W5PRYS', - role_slugs: %w[admin editor], + id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS", + role_slugs: %w[admin editor] ) - expect(organization_membership.organization_id).to eq('organization_01H5JQDV7R7ATEYZDEG0W5PRYS') - expect(organization_membership.user_id).to eq('user_01H5JQDV7R7ATEYZDEG0W5PRYS') + expect(organization_membership.organization_id).to eq("organization_01H5JQDV7R7ATEYZDEG0W5PRYS") + expect(organization_membership.user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") expect(organization_membership.roles).to be_an(Array) expect(organization_membership.roles.length).to eq(2) end @@ -1440,12 +1440,12 @@ end end - describe '.delete_organization_membership' do - context 'with a valid id' do - it 'returns true' do - VCR.use_cassette('user_management/delete_organization_membership/valid') do + describe ".delete_organization_membership" do + context "with a valid id" do + it "returns true" do + VCR.use_cassette("user_management/delete_organization_membership/valid") do response = WorkOS::UserManagement.delete_organization_membership( - id: 'om_01H5JQDV7R7ATEYZDEG0W5PRYS', + id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS" ) expect(response).to be(true) @@ -1453,23 +1453,23 @@ end end - context 'with an invalid id' do - it 'raises an error' do - VCR.use_cassette('user_management/delete_organization_membership/invalid') do + context "with an invalid id" do + it "raises an error" do + VCR.use_cassette("user_management/delete_organization_membership/invalid") do expect do - WorkOS::UserManagement.delete_organization_membership(id: 'invalid') + WorkOS::UserManagement.delete_organization_membership(id: "invalid") end.to raise_error(WorkOS::NotFoundError, /Organization Membership not found/) end end end end - describe '.deactivate_organization_membership' do - context 'with a valid id' do - it 'returns a organization membership' do - VCR.use_cassette 'user_management/deactivate_organization_membership' do + describe ".deactivate_organization_membership" do + context "with a valid id" do + it "returns a organization membership" do + VCR.use_cassette "user_management/deactivate_organization_membership" do organization_membership = described_class.deactivate_organization_membership( - id: 'om_01HXYT0G3H5QG9YTSHSHFZQE6D', + id: "om_01HXYT0G3H5QG9YTSHSHFZQE6D" ) expect(organization_membership.id.instance_of?(String)) @@ -1478,23 +1478,23 @@ end end - context 'with an invalid id' do - it 'returns an error' do + context "with an invalid id" do + it "returns an error" do expect do described_class.deactivate_organization_membership( - id: 'invalid_organization_membership_id', + id: "invalid_organization_membership_id" ).to raise_error(WorkOS::APIError) end end end end - describe '.reactivate_organization_membership' do - context 'with a valid id' do - it 'returns a organization membership' do - VCR.use_cassette 'user_management/reactivate_organization_membership' do + describe ".reactivate_organization_membership" do + context "with a valid id" do + it "returns a organization membership" do + VCR.use_cassette "user_management/reactivate_organization_membership" do organization_membership = described_class.reactivate_organization_membership( - id: 'om_01HXYT0G3H5QG9YTSHSHFZQE6D', + id: "om_01HXYT0G3H5QG9YTSHSHFZQE6D" ) expect(organization_membership.id.instance_of?(String)) @@ -1503,23 +1503,23 @@ end end - context 'with an invalid id' do - it 'returns an error' do + context "with an invalid id" do + it "returns an error" do expect do described_class.reactivate_organization_membership( - id: 'invalid_organization_membership_id', + id: "invalid_organization_membership_id" ).to raise_error(WorkOS::APIError) end end end end - describe '.get_invitation' do - context 'with a valid id' do - it 'returns an invitation' do - VCR.use_cassette 'user_management/get_invitation/valid' do + describe ".get_invitation" do + context "with a valid id" do + it "returns an invitation" do + VCR.use_cassette "user_management/get_invitation/valid" do invitation = described_class.get_invitation( - id: 'invitation_01H5JQDV7R7ATEYZDEG0W5PRYS', + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" ) expect(invitation.id.instance_of?(String)) @@ -1528,23 +1528,23 @@ end end - context 'with an invalid id' do - it 'raises an error' do - VCR.use_cassette('user_management/get_invitation/invalid') do + context "with an invalid id" do + it "raises an error" do + VCR.use_cassette("user_management/get_invitation/invalid") do expect do - WorkOS::UserManagement.get_invitation(id: 'invalid') + WorkOS::UserManagement.get_invitation(id: "invalid") end.to raise_error(WorkOS::NotFoundError, /Invitation not found/) end end end end - describe '.find_invitation_by_token' do - context 'with a valid id' do - it 'returns an invitation' do - VCR.use_cassette 'user_management/find_invitation_by_token/valid' do + describe ".find_invitation_by_token" do + context "with a valid id" do + it "returns an invitation" do + VCR.use_cassette "user_management/find_invitation_by_token/valid" do invitation = described_class.find_invitation_by_token( - token: 'iUV3XbYajpJlbpw1Qt3ZKlaKx', + token: "iUV3XbYajpJlbpw1Qt3ZKlaKx" ) expect(invitation.id.instance_of?(String)) @@ -1553,26 +1553,26 @@ end end - context 'with an invalid id' do - it 'raises an error' do - VCR.use_cassette('user_management/find_invitation_by_token/invalid') do + context "with an invalid id" do + it "raises an error" do + VCR.use_cassette("user_management/find_invitation_by_token/invalid") do expect do - WorkOS::UserManagement.find_invitation_by_token(token: 'invalid') + WorkOS::UserManagement.find_invitation_by_token(token: "invalid") end.to raise_error(WorkOS::NotFoundError, /Invitation not found/) end end end end - describe '.list_invitations' do - context 'with no options' do - it 'returns invitations and metadata' do + describe ".list_invitations" do + context "with no options" do + it "returns invitations and metadata" do expected_metadata = { - 'after' => nil, - 'before' => 'before_id', + "after" => nil, + "before" => "before_id" } - VCR.use_cassette 'user_management/list_invitations/with_no_options' do + VCR.use_cassette "user_management/list_invitations/with_no_options" do invitations = described_class.list_invitations expect(invitations.data.size).to eq(5) @@ -1581,48 +1581,48 @@ end end - context 'with organization_id option' do - it 'forms the proper request to the API' do + context "with organization_id option" do + it "forms the proper request to the API" do request_args = [ - '/user_management/invitations?organization_id=org_01H5JQDV7R7ATEYZDEG0W5PRYS&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/user_management/invitations?organization_id=org_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'user_management/list_invitations/with_organization_id' do + VCR.use_cassette "user_management/list_invitations/with_organization_id" do invitations = described_class.list_invitations( - organization_id: 'org_01H5JQDV7R7ATEYZDEG0W5PRYS', + organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS" ) expect(invitations.data.size).to eq(1) expect(invitations.data.first.organization_id).to eq( - 'org_01H5JQDV7R7ATEYZDEG0W5PRYS', + "org_01H5JQDV7R7ATEYZDEG0W5PRYS" ) end end end - context 'with limit option' do - it 'forms the proper request to the API' do + context "with limit option" do + it "forms the proper request to the API" do request_args = [ - '/user_management/invitations?limit=2&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/user_management/invitations?limit=2&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'user_management/list_invitations/with_limit' do + VCR.use_cassette "user_management/list_invitations/with_limit" do invitations = described_class.list_invitations( - limit: 2, + limit: 2 ) expect(invitations.data.size).to eq(3) @@ -1630,22 +1630,22 @@ end end - context 'with before option' do - it 'forms the proper request to the API' do + context "with before option" do + it "forms the proper request to the API" do request_args = [ - '/user_management/invitations?before=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/user_management/invitations?before=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'user_management/list_invitations/with_before' do + VCR.use_cassette "user_management/list_invitations/with_before" do invitations = described_class.list_invitations( - before: 'invitation_01H5JQDV7R7ATEYZDEG0W5PRYS', + before: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" ) expect(invitations.data.size).to eq(2) @@ -1653,22 +1653,22 @@ end end - context 'with after option' do - it 'forms the proper request to the API' do + context "with after option" do + it "forms the proper request to the API" do request_args = [ - '/user_management/invitations?after=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&'\ - 'order=desc', - 'Content-Type' => 'application/json' + "/user_management/invitations?after=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ + "order=desc", + "Content-Type" => "application/json" ] expected_request = Net::HTTP::Get.new(*request_args) - expect(Net::HTTP::Get).to receive(:new).with(*request_args). - and_return(expected_request) + expect(Net::HTTP::Get).to receive(:new).with(*request_args) + .and_return(expected_request) - VCR.use_cassette 'user_management/list_invitations/with_after' do + VCR.use_cassette "user_management/list_invitations/with_after" do invitations = described_class.list_invitations( - after: 'invitation_01H5JQDV7R7ATEYZDEG0W5PRYS', + after: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" ) expect(invitations.data.size).to eq(2) @@ -1677,243 +1677,243 @@ end end - describe '.send_invitation' do - context 'with valid payload' do - it 'sends an invitation' do - VCR.use_cassette 'user_management/send_invitation/valid' do + describe ".send_invitation" do + context "with valid payload" do + it "sends an invitation" do + VCR.use_cassette "user_management/send_invitation/valid" do invitation = described_class.send_invitation( - email: 'test@workos.com', + email: "test@workos.com" ) - expect(invitation.id).to eq('invitation_01H5JQDV7R7ATEYZDEG0W5PRYS') - expect(invitation.email).to eq('test@workos.com') + expect(invitation.id).to eq("invitation_01H5JQDV7R7ATEYZDEG0W5PRYS") + expect(invitation.email).to eq("test@workos.com") end end - it 'only sends non-nil values in request body' do + it "only sends non-nil values in request body" do expect(described_class).to receive(:post_request) do |options| body = options[:body] - expect(body).to eq({ email: 'test@workos.com', organization_id: 'org_123' }) + expect(body).to eq({email: "test@workos.com", organization_id: "org_123"}) expect(body).not_to have_key(:expires_in_days) expect(body).not_to have_key(:inviter_user_id) expect(body).not_to have_key(:role_slug) - double('request') - end.and_return(double('request')) + double("request") + end.and_return(double("request")) expect(described_class).to receive(:execute_request).and_return( - double('response', body: '{"id": "test_invitation"}'), + double("response", body: '{"id": "test_invitation"}') ) described_class.send_invitation( - email: 'test@workos.com', - organization_id: 'org_123', + email: "test@workos.com", + organization_id: "org_123" ) end end - context 'with an invalid payload' do - it 'returns an error' do - VCR.use_cassette 'user_management/send_invitation/invalid' do + context "with an invalid payload" do + it "returns an error" do + VCR.use_cassette "user_management/send_invitation/invalid" do expect do described_class.send_invitation( - email: 'invalid@workos.com', + email: "invalid@workos.com" ) end.to raise_error( WorkOS::APIError, - /An Invitation with the email invalid@workos.com already exists/, + /An Invitation with the email invalid@workos.com already exists/ ) end end end end - describe '.accept_invitation' do - context 'with a valid id' do - it 'accepts invitation' do + describe ".accept_invitation" do + context "with a valid id" do + it "accepts invitation" do expect(described_class).to receive(:post_request) do |options| - expect(options[:path]).to eq('/user_management/invitations/invitation_123/accept') + expect(options[:path]).to eq("/user_management/invitations/invitation_123/accept") expect(options[:auth]).to be true - double('request') - end.and_return(double('request')) + double("request") + end.and_return(double("request")) response_body = { - id: 'invitation_123', - email: 'test@workos.com', - state: 'accepted', + id: "invitation_123", + email: "test@workos.com", + state: "accepted" }.to_json expect(described_class).to receive(:execute_request).and_return( - double('response', body: response_body), + double("response", body: response_body) ) invitation = described_class.accept_invitation( - id: 'invitation_123', + id: "invitation_123" ) - expect(invitation.id).to eq('invitation_123') - expect(invitation.email).to eq('test@workos.com') - expect(invitation.state).to eq('accepted') + expect(invitation.id).to eq("invitation_123") + expect(invitation.email).to eq("test@workos.com") + expect(invitation.state).to eq("accepted") end end - context 'with an invalid id' do - it 'returns an error' do + context "with an invalid id" do + it "returns an error" do expect(described_class).to receive(:post_request) do |options| - expect(options[:path]).to eq('/user_management/invitations/invalid_id/accept') + expect(options[:path]).to eq("/user_management/invitations/invalid_id/accept") expect(options[:auth]).to be true - double('request') - end.and_return(double('request')) + double("request") + end.and_return(double("request")) expect(described_class).to receive(:execute_request).and_raise( - WorkOS::NotFoundError.new(message: 'Invitation not found'), + WorkOS::NotFoundError.new(message: "Invitation not found") ) expect do - described_class.accept_invitation(id: 'invalid_id') + described_class.accept_invitation(id: "invalid_id") end.to raise_error( WorkOS::NotFoundError, - /Invitation not found/, + /Invitation not found/ ) end end - context 'when invitation has already been accepted' do - it 'returns an error' do + context "when invitation has already been accepted" do + it "returns an error" do expect(described_class).to receive(:post_request) do |options| - expect(options[:path]).to eq('/user_management/invitations/invitation_123/accept') + expect(options[:path]).to eq("/user_management/invitations/invitation_123/accept") expect(options[:auth]).to be true - double('request') - end.and_return(double('request')) + double("request") + end.and_return(double("request")) expect(described_class).to receive(:execute_request).and_raise( - WorkOS::InvalidRequestError.new(message: 'Invite has already been accepted'), + WorkOS::InvalidRequestError.new(message: "Invite has already been accepted") ) expect do - described_class.accept_invitation(id: 'invitation_123') + described_class.accept_invitation(id: "invitation_123") end.to raise_error( WorkOS::InvalidRequestError, - /Invite has already been accepted/, + /Invite has already been accepted/ ) end end end - describe '.revoke_invitation' do - context 'with valid payload' do - it 'revokes invitation' do - VCR.use_cassette 'user_management/revoke_invitation/valid' do + describe ".revoke_invitation" do + context "with valid payload" do + it "revokes invitation" do + VCR.use_cassette "user_management/revoke_invitation/valid" do invitation = described_class.revoke_invitation( - id: 'invitation_01H5JQDV7R7ATEYZDEG0W5PRYS', + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" ) - expect(invitation.id).to eq('invitation_01H5JQDV7R7ATEYZDEG0W5PRYS') - expect(invitation.email).to eq('test@workos.com') + expect(invitation.id).to eq("invitation_01H5JQDV7R7ATEYZDEG0W5PRYS") + expect(invitation.email).to eq("test@workos.com") end end end - context 'with an invalid payload' do - it 'returns an error' do - VCR.use_cassette 'user_management/revoke_invitation/invalid' do + context "with an invalid payload" do + it "returns an error" do + VCR.use_cassette "user_management/revoke_invitation/invalid" do expect do described_class.revoke_invitation( - id: 'invalid_id', + id: "invalid_id" ) end.to raise_error( WorkOS::NotFoundError, - /Invitation not found/, + /Invitation not found/ ) end end end end - describe '.resend_invitation' do - context 'with valid payload' do - it 'resends invitation' do - VCR.use_cassette 'user_management/resend_invitation/valid' do + describe ".resend_invitation" do + context "with valid payload" do + it "resends invitation" do + VCR.use_cassette "user_management/resend_invitation/valid" do invitation = described_class.resend_invitation( - id: 'invitation_01H5JQDV7R7ATEYZDEG0W5PRYS', + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" ) - expect(invitation.id).to eq('invitation_01H5JQDV7R7ATEYZDEG0W5PRYS') - expect(invitation.email).to eq('test@workos.com') + expect(invitation.id).to eq("invitation_01H5JQDV7R7ATEYZDEG0W5PRYS") + expect(invitation.email).to eq("test@workos.com") end end end - context 'with an invalid id' do - it 'returns an error' do - VCR.use_cassette 'user_management/resend_invitation/invalid' do + context "with an invalid id" do + it "returns an error" do + VCR.use_cassette "user_management/resend_invitation/invalid" do expect do described_class.resend_invitation( - id: 'invalid_id', + id: "invalid_id" ) end.to raise_error( WorkOS::NotFoundError, - /Invitation not found/, + /Invitation not found/ ) end end end - context 'when invitation has expired' do - it 'returns an error' do - VCR.use_cassette 'user_management/resend_invitation/expired' do + context "when invitation has expired" do + it "returns an error" do + VCR.use_cassette "user_management/resend_invitation/expired" do expect do described_class.resend_invitation( - id: 'invitation_01H5JQDV7R7ATEYZDEG0W5PRYS', + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" ) end.to raise_error( WorkOS::InvalidRequestError, - /Invite has expired/, + /Invite has expired/ ) end end end - context 'when invitation has been revoked' do - it 'returns an error' do - VCR.use_cassette 'user_management/resend_invitation/revoked' do + context "when invitation has been revoked" do + it "returns an error" do + VCR.use_cassette "user_management/resend_invitation/revoked" do expect do described_class.resend_invitation( - id: 'invitation_01H5JQDV7R7ATEYZDEG0W5PRYS', + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" ) end.to raise_error( WorkOS::InvalidRequestError, - /Invite has been revoked/, + /Invite has been revoked/ ) end end end - context 'when invitation has already been accepted' do - it 'returns an error' do - VCR.use_cassette 'user_management/resend_invitation/accepted' do + context "when invitation has already been accepted" do + it "returns an error" do + VCR.use_cassette "user_management/resend_invitation/accepted" do expect do described_class.resend_invitation( - id: 'invitation_01H5JQDV7R7ATEYZDEG0W5PRYS', + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" ) end.to raise_error( WorkOS::InvalidRequestError, - /Invite has already been accepted/, + /Invite has already been accepted/ ) end end end end - describe '.revoke_session' do - context 'with valid payload' do - it 'revokes session' do - VCR.use_cassette 'user_management/revoke_session/valid' do + describe ".revoke_session" do + context "with valid payload" do + it "revokes session" do + VCR.use_cassette "user_management/revoke_session/valid" do result = described_class.revoke_session( - session_id: 'session_01HRX85ATNADY1GQ053AHRFFN6', + session_id: "session_01HRX85ATNADY1GQ053AHRFFN6" ) expect(result).to be true @@ -1921,53 +1921,53 @@ end end - context 'with a non-existant session' do - it 'returns an error' do - VCR.use_cassette 'user_management/revoke_session/not_found' do + context "with a non-existant session" do + it "returns an error" do + VCR.use_cassette "user_management/revoke_session/not_found" do expect do described_class.revoke_session( - session_id: 'session_01H5JQDV7R7ATEYZDEG0W5PRYS', + session_id: "session_01H5JQDV7R7ATEYZDEG0W5PRYS" ) end.to raise_error( WorkOS::NotFoundError, - /Session not found/, + /Session not found/ ) end end end end - describe '.list_sessions' do - context 'with a valid user_id' do - it 'returns a list of sessions' do - VCR.use_cassette('user_management/list_sessions/valid') do + describe ".list_sessions" do + context "with a valid user_id" do + it "returns a list of sessions" do + VCR.use_cassette("user_management/list_sessions/valid") do result = described_class.list_sessions( - user_id: 'user_01H7TVSKS45SDHN5V9XPSM6H44', + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" ) expect(result.data).to be_an(Array) expect(result.data.first).to be_a(WorkOS::UserManagement::Session) - expect(result.data.first.id).to eq('session_01H96FETXGTW2S0V5V9XPSM6H44') - expect(result.data.first.status).to eq('active') - expect(result.data.first.auth_method).to eq('password') + expect(result.data.first.id).to eq("session_01H96FETXGTW2S0V5V9XPSM6H44") + expect(result.data.first.status).to eq("active") + expect(result.data.first.auth_method).to eq("password") end end - it 'returns sessions that can be revoked' do - VCR.use_cassette('user_management/list_sessions/valid') do + it "returns sessions that can be revoked" do + VCR.use_cassette("user_management/list_sessions/valid") do result = described_class.list_sessions( - user_id: 'user_01H7TVSKS45SDHN5V9XPSM6H44', + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" ) session = result.data.first expect(described_class).to receive(:post_request) do |options| - expect(options[:path]).to eq('/user_management/sessions/revoke') - expect(options[:body]).to eq({ session_id: 'session_01H96FETXGTW2S0V5V9XPSM6H44' }) + expect(options[:path]).to eq("/user_management/sessions/revoke") + expect(options[:body]).to eq({session_id: "session_01H96FETXGTW2S0V5V9XPSM6H44"}) expect(options[:auth]).to be true - end.and_return(double('request')) + end.and_return(double("request")) expect(described_class).to receive(:execute_request).and_return( - double('response', is_a?: true), + double("response", is_a?: true) ) expect(session.revoke).to be true @@ -1976,23 +1976,23 @@ end end - describe '.get_logout_url' do - it 'returns a logout url for the given session ID' do + describe ".get_logout_url" do + it "returns a logout url for the given session ID" do result = described_class.get_logout_url( - session_id: 'session_01HRX85ATNADY1GQ053AHRFFN6', + session_id: "session_01HRX85ATNADY1GQ053AHRFFN6" ) - expect(result).to eq 'https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6' + expect(result).to eq "https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6" end - context 'when a `return_to` is given' do - it 'returns a logout url with the `return_to` query parameter' do + context "when a `return_to` is given" do + it "returns a logout url with the `return_to` query parameter" do result = described_class.get_logout_url( - session_id: 'session_01HRX85ATNADY1GQ053AHRFFN6', - return_to: 'https://example.com/signed-out', + session_id: "session_01HRX85ATNADY1GQ053AHRFFN6", + return_to: "https://example.com/signed-out" ) - expect(result).to eq 'https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6&return_to=https%3A%2F%2Fexample.com%2Fsigned-out' + expect(result).to eq "https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6&return_to=https%3A%2F%2Fexample.com%2Fsigned-out" end end end diff --git a/spec/lib/workos/webhooks_spec.rb b/spec/lib/workos/webhooks_spec.rb index 6154bd57..ade93cc9 100644 --- a/spec/lib/workos/webhooks_spec.rb +++ b/spec/lib/workos/webhooks_spec.rb @@ -1,232 +1,232 @@ # frozen_string_literal: true -require 'json' -require 'openssl' +require "json" +require "openssl" describe WorkOS::Webhooks do before(:each) do @payload = File.read("#{SPEC_ROOT}/support/webhook_payload.txt") - @secret = 'secret' + @secret = "secret" @timestamp = Time.at(Time.now.to_i * 1000) unhashed_string = "#{@timestamp.to_i}.#{@payload}" - digest = OpenSSL::Digest.new('sha256') + digest = OpenSSL::Digest.new("sha256") @signature_hash = OpenSSL::HMAC.hexdigest(digest, @secret, unhashed_string) @expectation = { - id: 'directory_user_01FAEAJCR3ZBZ30D8BD1924TVG', - state: 'active', + id: "directory_user_01FAEAJCR3ZBZ30D8BD1924TVG", + state: "active", emails: [{ - type: 'work', - value: 'blair@foo-corp.com', - primary: true, + type: "work", + value: "blair@foo-corp.com", + primary: true }], - idp_id: '00u1e8mutl6wlH3lL4x7', - object: 'directory_user', - username: 'blair@foo-corp.com', - last_name: 'Lunchford', - first_name: 'Blair', - directory_id: 'directory_01F9M7F68PZP8QXP8G7X5QRHS7', + idp_id: "00u1e8mutl6wlH3lL4x7", + object: "directory_user", + username: "blair@foo-corp.com", + last_name: "Lunchford", + first_name: "Blair", + directory_id: "directory_01F9M7F68PZP8QXP8G7X5QRHS7", raw_attributes: { name: { - givenName: 'Blair', - familyName: 'Lunchford', - middleName: 'Elizabeth', - honorificPrefix: 'Ms.', + givenName: "Blair", + familyName: "Lunchford", + middleName: "Elizabeth", + honorificPrefix: "Ms." }, - title: 'Developer Success Engineer', + title: "Developer Success Engineer", active: true, emails: [{ - type: 'work', - value: 'blair@foo-corp.com', - primary: true, + type: "work", + value: "blair@foo-corp.com", + primary: true }], groups: [], - locale: 'en-US', + locale: "en-US", schemas: [ - 'urn:ietf:params:scim:schemas:core:2.0:User', - 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User' + "urn:ietf:params:scim:schemas:core:2.0:User", + "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" ], - userName: 'blair@foo-corp.com', + userName: "blair@foo-corp.com", addresses: [{ - region: 'CA', + region: "CA", primary: true, - locality: 'San Francisco', - postalCode: '94016', + locality: "San Francisco", + postalCode: "94016" }], - externalId: '00u1e8mutl6wlH3lL4x7', - displayName: 'Blair Lunchford', + externalId: "00u1e8mutl6wlH3lL4x7", + displayName: "Blair Lunchford", "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": { manager: { - value: '2', - displayName: 'Kate Chapman', + value: "2", + displayName: "Kate Chapman" }, - division: 'Engineering', - department: 'Customer Success', - }, - }, + division: "Engineering", + department: "Customer Success" + } + } } end # rubocop:disable Metrics/BlockLength - shared_examples 'WorkOS-Signature header failures' do - context 'with an empty header' do - it 'raises an error' do + shared_examples "WorkOS-Signature header failures" do + context "with an empty header" do + it "raises an error" do expect do described_class.construct_event( payload: @payload, - sig_header: '', - secret: @secret, + sig_header: "", + secret: @secret ) end.to raise_error( WorkOS::SignatureVerificationError, - 'Unable to extract timestamp and signature hash from header', + "Unable to extract timestamp and signature hash from header" ) end end - context 'with an empty signature hash' do - it 'raises an error' do + context "with an empty signature hash" do + it "raises an error" do expect do described_class.construct_event( payload: @payload, sig_header: "t=#{@timestamp.to_i}, v1=", - secret: @secret, + secret: @secret ) end.to raise_error( WorkOS::SignatureVerificationError, - 'No signature hash found with expected scheme v1', + "No signature hash found with expected scheme v1" ) end end - context 'with an incorrect signature hash' do - it 'raises an error' do + context "with an incorrect signature hash" do + it "raises an error" do expect do described_class.construct_event( payload: @payload, sig_header: "t=#{@timestamp.to_i}, v1=99999", - secret: @secret, + secret: @secret ) end.to raise_error( WorkOS::SignatureVerificationError, - 'Signature hash does not match the expected signature hash for payload', + "Signature hash does not match the expected signature hash for payload" ) end end - context 'with an incorrect payload' do - it 'raises an error' do + context "with an incorrect payload" do + it "raises an error" do expect do described_class.construct_event( - payload: 'invalid', + payload: "invalid", sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret, + secret: @secret ) end.to raise_error( WorkOS::SignatureVerificationError, - 'Signature hash does not match the expected signature hash for payload', + "Signature hash does not match the expected signature hash for payload" ) end end - context 'with an incorrect webhook secret' do - it 'raises an error' do + context "with an incorrect webhook secret" do + it "raises an error" do expect do described_class.construct_event( payload: @payload, sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: 'invalid', + secret: "invalid" ) end.to raise_error( WorkOS::SignatureVerificationError, - 'Signature hash does not match the expected signature hash for payload', + "Signature hash does not match the expected signature hash for payload" ) end end - context 'with a timestamp outside tolerance' do - it 'raises an error' do + context "with a timestamp outside tolerance" do + it "raises an error" do expect do described_class.construct_event( payload: @payload, sig_header: "t=#{@timestamp.to_i - (200 * 1000)}, v1=#{@signature_hash}", - secret: @secret, + secret: @secret ) end.to raise_error( WorkOS::SignatureVerificationError, - 'Timestamp outside the tolerance zone', + "Timestamp outside the tolerance zone" ) end end end # rubocop:enable Metrics/BlockLength - describe '.construct_event' do - it_behaves_like 'WorkOS-Signature header failures' + describe ".construct_event" do + it_behaves_like "WorkOS-Signature header failures" - context 'with the correct payload, sig_header, and secret' do - it 'returns a webhook event' do + context "with the correct payload, sig_header, and secret" do + it "returns a webhook event" do webhook = described_class.construct_event( payload: @payload, sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret, + secret: @secret ) expect(webhook.data).to eq(@expectation) - expect(webhook.event).to eq('dsync.user.created') - expect(webhook.id).to eq('wh_123') + expect(webhook.event).to eq("dsync.user.created") + expect(webhook.id).to eq("wh_123") end end - context 'with the correct payload, sig_header, secret, and tolerance' do - it 'returns a webhook event' do + context "with the correct payload, sig_header, secret, and tolerance" do + it "returns a webhook event" do webhook = described_class.construct_event( payload: @payload, sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", secret: @secret, - tolerance: 300, + tolerance: 300 ) expect(webhook.data).to eq(@expectation) - expect(webhook.event).to eq('dsync.user.created') - expect(webhook.id).to eq('wh_123') + expect(webhook.event).to eq("dsync.user.created") + expect(webhook.id).to eq("wh_123") end end end - describe '.verify_header' do - it_behaves_like 'WorkOS-Signature header failures' + describe ".verify_header" do + it_behaves_like "WorkOS-Signature header failures" - it 'returns true when the signature is valid' do + it "returns true when the signature is valid" do described_class.verify_header( payload: @payload, sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret, + secret: @secret ) end end - describe '.get_timestamp_and_signature_hash' do - it_behaves_like 'WorkOS-Signature header failures' + describe ".get_timestamp_and_signature_hash" do + it_behaves_like "WorkOS-Signature header failures" - it 'returns the timestamp and signature when the signature is valid' do + it "returns the timestamp and signature when the signature is valid" do timestamp_int = @timestamp.to_i timestamp_and_signature = described_class.get_timestamp_and_signature_hash( - sig_header: "t=#{timestamp_int}, v1=#{@signature_hash}", + sig_header: "t=#{timestamp_int}, v1=#{@signature_hash}" ) expect(timestamp_and_signature).to eq([timestamp_int.to_s, @signature_hash]) end end - describe '.compute_signature' do - it_behaves_like 'WorkOS-Signature header failures' + describe ".compute_signature" do + it_behaves_like "WorkOS-Signature header failures" - it 'returns the computed signature' do + it "returns the computed signature" do timestamp_int = @timestamp.to_i signature = described_class.compute_signature( timestamp: timestamp_int.to_s, payload: @payload, - secret: @secret, + secret: @secret ) expect(signature).to eq(@signature_hash) diff --git a/spec/lib/workos/widgets_spec.rb b/spec/lib/workos/widgets_spec.rb index 80bb328d..e602cacb 100644 --- a/spec/lib/workos/widgets_spec.rb +++ b/spec/lib/workos/widgets_spec.rb @@ -1,71 +1,71 @@ # frozen_string_literal: true describe WorkOS::Widgets do - it_behaves_like 'client' + it_behaves_like "client" - describe '.get_token' do - let(:organization_id) { 'org_01JCP9G67MNAH0KC4B72XZ67M7' } - let(:user_id) { 'user_01JCP9H4SHS4N3J6XTKDT7JNPE' } + describe ".get_token" do + let(:organization_id) { "org_01JCP9G67MNAH0KC4B72XZ67M7" } + let(:user_id) { "user_01JCP9H4SHS4N3J6XTKDT7JNPE" } - describe 'with a valid organization_id and user_id and scopes' do - it 'returns a widget token' do - VCR.use_cassette 'widgets/get_token' do + describe "with a valid organization_id and user_id and scopes" do + it "returns a widget token" do + VCR.use_cassette "widgets/get_token" do token = described_class.get_token( organization_id: organization_id, user_id: user_id, - scopes: ['widgets:users-table:manage'], + scopes: ["widgets:users-table:manage"] ) - expect(token).to start_with('eyJhbGciOiJSUzI1NiIsImtpZ') + expect(token).to start_with("eyJhbGciOiJSUzI1NiIsImtpZ") end end end - describe 'with an invalid organization_id' do - it 'raises an error' do - VCR.use_cassette 'widgets/get_token_invalid_organization_id' do + describe "with an invalid organization_id" do + it "raises an error" do + VCR.use_cassette "widgets/get_token_invalid_organization_id" do expect do described_class.get_token( - organization_id: 'bogus-id', + organization_id: "bogus-id", user_id: user_id, - scopes: ['widgets:users-table:manage'], + scopes: ["widgets:users-table:manage"] ) end.to raise_error( WorkOS::NotFoundError, - /Organization not found: 'bogus-id'/, + /Organization not found: 'bogus-id'/ ) end end end - describe 'with an invalid user_id' do - it 'raises an error' do - VCR.use_cassette 'widgets/get_token_invalid_user_id' do + describe "with an invalid user_id" do + it "raises an error" do + VCR.use_cassette "widgets/get_token_invalid_user_id" do expect do described_class.get_token( organization_id: organization_id, - user_id: 'bogus-id', - scopes: ['widgets:users-table:manage'], + user_id: "bogus-id", + scopes: ["widgets:users-table:manage"] ) end.to raise_error( WorkOS::NotFoundError, - /User not found: 'bogus-id'/, + /User not found: 'bogus-id'/ ) end end end - describe 'with invalid scopes' do - it 'raises an error' do + describe "with invalid scopes" do + it "raises an error" do expect do described_class.get_token( organization_id: organization_id, user_id: user_id, - scopes: ['bogus-scope'], + scopes: ["bogus-scope"] ) end.to raise_error( ArgumentError, - /scopes contains an invalid value/, + /scopes contains an invalid value/ ) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ae48b876..6f88e946 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,27 +1,27 @@ # frozen_string_literal: true -$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib') +$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib") $LOAD_PATH << File.join(File.dirname(__FILE__)) -require 'rubygems' -require 'rspec' -require 'webmock/rspec' -require 'workos' -require 'vcr' +require "rubygems" +require "rspec" +require "webmock/rspec" +require "workos" +require "vcr" # Support -Dir['./spec/support/**/*.rb'].sort.each { |f| require f } +Dir["./spec/support/**/*.rb"].sort.each { |f| require f } SPEC_ROOT = File.dirname __FILE__ VCR.configure do |config| - config.cassette_library_dir = 'spec/support/fixtures/vcr_cassettes' - config.filter_sensitive_data('') { WorkOS.config.key } - config.filter_sensitive_data('', :token) do |interaction| - JSON.parse(interaction.response.body)['access_token'] + config.cassette_library_dir = "spec/support/fixtures/vcr_cassettes" + config.filter_sensitive_data("") { WorkOS.config.key } + config.filter_sensitive_data("", :token) do |interaction| + JSON.parse(interaction.response.body)["access_token"] end - config.filter_sensitive_data('', :token) do |interaction| - JSON.parse(interaction.response.body)['refresh_token'] + config.filter_sensitive_data("", :token) do |interaction| + JSON.parse(interaction.response.body)["refresh_token"] end config.hook_into :webmock end @@ -48,6 +48,6 @@ def stub_request(*args) end end) - config.before(:all) { WorkOS.config.key ||= '' } + config.before(:all) { WorkOS.config.key ||= "" } config.before(:each) { VCR.turn_on! } end diff --git a/spec/support/shared_examples/client.rb b/spec/support/shared_examples/client.rb index dc2a7dab..e5f23065 100644 --- a/spec/support/shared_examples/client.rb +++ b/spec/support/shared_examples/client.rb @@ -1,26 +1,26 @@ # frozen_string_literal: true -RSpec.shared_examples 'client' do +RSpec.shared_examples "client" do subject(:client) { described_class.client } it { is_expected.to be_kind_of(Net::HTTP) } - it 'assigns use_ssl' do + it "assigns use_ssl" do expect(client.use_ssl?).to be true end - it 'returns new instance' do + it "returns new instance" do expect(described_class.client.object_id).to_not eq described_class.client.object_id end - if RUBY_VERSION >= '2.6.0' - it 'sets the timeouts, including the write timeout' do + if RUBY_VERSION >= "2.6.0" + it "sets the timeouts, including the write timeout" do expect(described_class.client.open_timeout).to_not be_nil expect(described_class.client.read_timeout).to_not be_nil expect(described_class.client.write_timeout).to_not be_nil end else - it 'sets the open and read timeouts, but not the write timeout' do + it "sets the open and read timeouts, but not the write timeout" do expect(described_class.client.open_timeout).to_not be_nil expect(described_class.client.read_timeout).to_not be_nil expect(described_class.client.write_timeout).to be_nil diff --git a/workos.gemspec b/workos.gemspec index f9357d7a..b089f844 100644 --- a/workos.gemspec +++ b/workos.gemspec @@ -14,11 +14,10 @@ Gem::Specification.new do |spec| spec.homepage = 'https://github.com/workos-inc/workos-ruby' spec.license = 'MIT' spec.metadata = { - 'documentation_uri' => 'https://docs.workos.com/sdk/ruby', + 'documentation_uri' => 'https://docs.workos.com/sdk/ruby' } spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] spec.add_dependency 'encryptor', '~> 3.0' @@ -27,7 +26,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler', '>= 2.0.1' spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec', '~> 3.9.0' - spec.add_development_dependency 'rubocop', '~> 1.71' + spec.add_development_dependency 'standard', '~> 1.49' spec.add_development_dependency 'vcr', '~> 6.0' spec.add_development_dependency 'webmock' From 73e5c23d551e8dea892c957423420942370bdd10 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Wed, 15 Apr 2026 13:21:38 -0400 Subject: [PATCH 03/12] switch to minitest and standardrb --- .github/workflows/ci.yml | 9 +- .github/workflows/lint.yml | 5 +- .ruby-version | 1 + .standard.yml | 9 - Gemfile.lock | 24 +- Rakefile | 10 +- renovate.json | 29 + spec/lib/workos/audit_logs_spec.rb | 150 -- spec/lib/workos/cache_spec.rb | 94 - spec/lib/workos/client.rb | 67 - spec/lib/workos/configuration_spec.rb | 60 - spec/lib/workos/directory_sync_spec.rb | 483 ---- spec/lib/workos/directory_user_spec.rb | 61 - spec/lib/workos/encryptors/aes_gcm_spec.rb | 41 - spec/lib/workos/event_spec.rb | 109 - spec/lib/workos/mfa_spec.rb | 285 --- spec/lib/workos/organizations_spec.rb | 569 ----- spec/lib/workos/passwordless_spec.rb | 76 - spec/lib/workos/portal_spec.rb | 116 - spec/lib/workos/role_spec.rb | 142 -- spec/lib/workos/session_spec.rb | 475 ---- spec/lib/workos/sso_spec.rb | 756 ------- spec/lib/workos/user_management_spec.rb | 1999 ----------------- spec/lib/workos/webhooks_spec.rb | 235 -- spec/lib/workos/widgets_spec.rb | 73 - spec/spec_helper.rb | 53 - spec/support/shared_examples/client.rb | 29 - {spec/support => test/fixtures}/profile.txt | 0 .../vcr_cassettes/audit_logs/create_event.yml | 0 .../create_event_custom_idempotency_key.yml | 0 .../audit_logs/create_event_invalid.yml | 0 .../audit_logs/create_export.yml | 0 .../audit_logs/create_export_with_filters.yml | 0 .../vcr_cassettes/audit_logs/get_export.yml | 0 .../audit_trail/create_event.yml | 0 .../create_event_custom_idempotency_key.yml | 0 .../audit_trail/create_event_invalid.yml | 0 ..._duplicate_idempotency_key_and_payload.yml | 0 ...cate_idempotency_key_different_payload.yml | 0 .../vcr_cassettes/audit_trail/get_events.yml | 0 .../base/execute_request_unauthenticated.yml | 0 .../directory_sync/delete_directory.yml | 0 .../get_directory_with_invalid_id.yml | 0 .../get_directory_with_valid_id.yml | 0 .../directory_sync/get_group.yml | 0 .../get_group_with_invalid_id.yml | 0 .../vcr_cassettes/directory_sync/get_user.yml | 0 .../get_user_with_invalid_id.yml | 0 .../list_directories/with_after.yml | 0 .../list_directories/with_before.yml | 0 .../list_directories/with_domain.yml | 0 .../list_directories/with_limit.yml | 0 .../list_directories/with_no_options.yml | 0 .../list_directories/with_search.yml | 0 .../directory_sync/list_groups/with_after.yml | 0 .../list_groups/with_before.yml | 0 .../list_groups/with_directory.yml | 0 .../directory_sync/list_groups/with_limit.yml | 0 .../list_groups/with_no_options.yml | 0 .../directory_sync/list_groups/with_user.yml | 0 .../directory_sync/list_users/with_after.yml | 0 .../directory_sync/list_users/with_before.yml | 0 .../list_users/with_directory.yml | 0 .../directory_sync/list_users/with_group.yml | 0 .../directory_sync/list_users/with_limit.yml | 0 .../list_users/with_no_options.yml | 0 .../events/list_events_with_after.yml | 0 .../events/list_events_with_event.yml | 0 .../events/list_events_with_no_options.yml | 0 .../list_events_with_organization_id.yml | 0 .../events/list_events_with_range.yml | 0 .../mfa/challenge_factor_generic_valid.yml | 0 .../mfa/challenge_factor_sms_valid.yml | 0 .../mfa/challenge_factor_totp_valid.yml | 0 .../vcr_cassettes/mfa/delete_factor.yml | 0 .../mfa/enroll_factor_generic_valid.yml | 0 .../mfa/enroll_factor_sms_valid.yml | 0 .../mfa/enroll_factor_totp_valid.yml | 0 .../vcr_cassettes/mfa/get_factor_invalid.yml | 0 .../vcr_cassettes/mfa/get_factor_valid.yml | 0 .../mfa/verify_challenge_generic_expired.yml | 0 .../mfa/verify_challenge_generic_invalid.yml | 0 .../mfa/verify_challenge_generic_valid.yml | 0 ...erify_challenge_generic_valid_is_false.yml | 0 .../vcr_cassettes/organization/create.yml | 0 .../organization/create_invalid.yml | 0 .../organization/create_with_domain_data.yml | 0 .../organization/create_with_domains.yml | 0 ..._idempotency_key_and_different_payload.yml | 0 ..._duplicate_idempotency_key_and_payload.yml | 0 .../organization/create_with_external_id.yml | 0 .../create_with_idempotency_key.yml | 0 .../organization/create_without_domains.yml | 0 .../vcr_cassettes/organization/delete.yml | 0 .../organization/delete_invalid.yml | 0 .../vcr_cassettes/organization/get.yml | 0 .../organization/get_invalid.yml | 0 .../vcr_cassettes/organization/list.yml | 0 .../list_organization_feature_flags.yml | 0 .../organization/list_organization_roles.yml | 0 .../vcr_cassettes/organization/update.yml | 0 .../organization/update_with_external_id.yml | 0 .../update_with_external_id_null.yml | 0 .../update_with_stripe_customer_id.yml | 0 .../organization/update_without_name.yml | 0 .../passwordless/create_session.yml | 0 .../passwordless/create_session_invalid.yml | 0 .../passwordless/send_session.yml | 0 .../passwordless/send_session_invalid.yml | 0 .../portal/generate_link_audit_logs.yml | 0 .../generate_link_certificate_renewal.yml | 0 .../generate_link_domain_verification.yml | 0 .../portal/generate_link_dsync.yml | 0 .../portal/generate_link_invalid.yml | 0 .../portal/generate_link_sso.yml | 0 .../sso/delete_connection_with_invalid_id.yml | 0 .../sso/delete_connection_with_valid_id.yml | 0 .../sso/get_connection_with_invalid_id.yml | 0 .../sso/get_connection_with_valid_id.yml | 0 .../sso/list_connections/with_after.yml | 0 .../sso/list_connections/with_before.yml | 0 .../list_connections/with_connection_type.yml | 0 .../sso/list_connections/with_domain.yml | 0 .../sso/list_connections/with_limit.yml | 0 .../sso/list_connections/with_no_options.yml | 0 .../list_connections/with_organization_id.yml | 0 .../fixtures/vcr_cassettes/sso/profile.yml | 0 .../authenticate_with_code/invalid.yml | 0 .../authenticate_with_code/valid.yml | 0 .../valid_with_impersonator.yml | 0 .../valid_with_oauth_tokens.yml | 0 .../invalid.yml | 0 .../valid.yml | 0 .../authenticate_with_magic_auth/invalid.yml | 0 .../authenticate_with_magic_auth/valid.yml | 0 .../invalid.yml | 0 .../valid.yml | 0 .../authenticate_with_password/invalid.yml | 0 .../authenticate_with_password/unverified.yml | 0 .../authenticate_with_password/valid.yml | 0 .../invalid.yml | 0 .../authenticate_with_refresh_token/valid.yml | 0 .../authenticate_with_totp/invalid.yml | 0 .../authenticate_with_totp/valid.yml | 0 .../confirm_password_reset/invalid.yml | 0 .../confirm_password_reset/valid.yml | 0 .../create_magic_auth/valid.yml | 0 .../invalid.yml | 0 .../create_organization_membership/valid.yml | 0 .../valid_multiple_roles.yml | 0 .../create_password_reset/valid.yml | 0 .../user_management/create_user_invalid.yml | 0 .../user_management/create_user_valid.yml | 0 .../create_user_with_external_id.yml | 0 .../deactivate_organization_membership.yml | 0 .../invalid.yml | 0 .../delete_organization_membership/valid.yml | 0 .../user_management/delete_user/invalid.yml | 0 .../user_management/delete_user/valid.yml | 0 .../enroll_auth_factor/invalid.yml | 0 .../enroll_auth_factor/valid.yml | 0 .../find_invitation_by_token/invalid.yml | 0 .../find_invitation_by_token/valid.yml | 0 .../get_email_verification/invalid.yml | 0 .../get_email_verification/valid.yml | 0 .../get_invitation/invalid.yml | 0 .../user_management/get_invitation/valid.yml | 0 .../get_magic_auth/invalid.yml | 0 .../user_management/get_magic_auth/valid.yml | 0 .../get_organization_membership.yml | 0 .../get_password_reset/invalid.yml | 0 .../get_password_reset/valid.yml | 0 .../user_management/get_user.yml | 0 .../list_auth_factors/invalid.yml | 0 .../list_auth_factors/valid.yml | 0 .../list_invitations/with_after.yml | 0 .../list_invitations/with_before.yml | 0 .../list_invitations/with_limit.yml | 0 .../list_invitations/with_no_options.yml | 0 .../list_invitations/with_organization_id.yml | 0 .../no_options.yml | 0 .../with_options.yml | 0 .../with_statuses_option.yml | 0 .../user_management/list_sessions/valid.yml | 0 .../user_management/list_users/no_options.yml | 0 .../list_users/with_options.yml | 0 .../reactivate_organization_membership.yml | 0 .../resend_invitation/accepted.yml | 0 .../resend_invitation/expired.yml | 0 .../resend_invitation/invalid.yml | 0 .../resend_invitation/revoked.yml | 0 .../resend_invitation/valid.yml | 0 .../reset_password/invalid.yml | 0 .../user_management/reset_password/valid.yml | 0 .../revoke_invitation/invalid.yml | 0 .../revoke_invitation/valid.yml | 0 .../revoke_session/not_found.yml | 0 .../user_management/revoke_session/valid.yml | 0 .../send_invitation/invalid.yml | 0 .../user_management/send_invitation/valid.yml | 0 .../send_magic_auth_code/valid.yml | 0 .../send_password_reset_email/invalid.yml | 0 .../send_password_reset_email/valid.yml | 0 .../send_verification_email/invalid.yml | 0 .../send_verification_email/valid.yml | 0 .../invalid.yml | 0 .../update_organization_membership/valid.yml | 0 .../valid_multiple_roles.yml | 0 .../user_management/update_user/email.yml | 0 .../user_management/update_user/invalid.yml | 0 .../user_management/update_user/locale.yml | 0 .../user_management/update_user/valid.yml | 0 .../update_user_external_id_null.yml | 0 .../update_user_password/invalid.yml | 0 .../update_user_password/valid.yml | 0 .../verify_email/invalid_code.yml | 0 .../invalid_magic_auth_challenge.yml | 0 .../user_management/verify_email/valid.yml | 0 .../vcr_cassettes/widgets/get_token.yml | 0 .../get_token_invalid_organization_id.yml | 0 .../widgets/get_token_invalid_user_id.yml | 0 .../fixtures}/webhook_payload.txt | 0 test/test_helper.rb | 39 + test/workos/encryptors/test_aes_gcm.rb | 43 + test/workos/test_audit_logs.rb | 132 ++ test/workos/test_cache.rb | 87 + test/workos/test_client.rb | 61 + test/workos/test_configuration.rb | 44 + test/workos/test_directory_sync.rb | 261 +++ test/workos/test_directory_user.rb | 45 + test/workos/test_event.rb | 57 + test/workos/test_mfa.rb | 216 ++ test/workos/test_organizations.rb | 406 ++++ test/workos/test_passwordless.rb | 51 + test/workos/test_portal.rb | 87 + test/workos/test_role.rb | 128 ++ test/workos/test_session.rb | 472 ++++ test/workos/test_sso.rb | 657 ++++++ test/workos/test_user_management.rb | 1820 +++++++++++++++ test/workos/test_webhooks.rb | 403 ++++ test/workos/test_widgets.rb | 60 + workos.gemspec | 40 +- 242 files changed, 5136 insertions(+), 5933 deletions(-) create mode 100644 .ruby-version delete mode 100644 spec/lib/workos/audit_logs_spec.rb delete mode 100644 spec/lib/workos/cache_spec.rb delete mode 100644 spec/lib/workos/client.rb delete mode 100644 spec/lib/workos/configuration_spec.rb delete mode 100644 spec/lib/workos/directory_sync_spec.rb delete mode 100644 spec/lib/workos/directory_user_spec.rb delete mode 100644 spec/lib/workos/encryptors/aes_gcm_spec.rb delete mode 100644 spec/lib/workos/event_spec.rb delete mode 100644 spec/lib/workos/mfa_spec.rb delete mode 100644 spec/lib/workos/organizations_spec.rb delete mode 100644 spec/lib/workos/passwordless_spec.rb delete mode 100644 spec/lib/workos/portal_spec.rb delete mode 100644 spec/lib/workos/role_spec.rb delete mode 100644 spec/lib/workos/session_spec.rb delete mode 100644 spec/lib/workos/sso_spec.rb delete mode 100644 spec/lib/workos/user_management_spec.rb delete mode 100644 spec/lib/workos/webhooks_spec.rb delete mode 100644 spec/lib/workos/widgets_spec.rb delete mode 100644 spec/spec_helper.rb delete mode 100644 spec/support/shared_examples/client.rb rename {spec/support => test/fixtures}/profile.txt (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_logs/create_event.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_logs/create_export.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_logs/get_export.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_trail/create_event.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/audit_trail/get_events.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/delete_directory.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/get_group.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/get_user.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/events/list_events_with_after.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/events/list_events_with_event.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/events/list_events_with_no_options.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/events/list_events_with_range.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/delete_factor.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/get_factor_valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/create.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/create_invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/create_with_domain_data.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/create_with_domains.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/create_with_external_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/create_without_domains.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/delete.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/delete_invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/get.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/get_invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/list.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/list_organization_roles.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/update.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/update_with_external_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/organization/update_without_name.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/passwordless/create_session.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/passwordless/send_session.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/portal/generate_link_dsync.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/portal/generate_link_invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/portal/generate_link_sso.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/list_connections/with_after.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/list_connections/with_before.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/sso/profile.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/create_user_invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/create_user_valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/delete_user/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/get_organization_membership.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/get_user.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_users/no_options.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/list_users/with_options.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/reset_password/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/update_user/email.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/update_user/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/update_user/locale.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/update_user/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/user_management/verify_email/valid.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/widgets/get_token.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml (100%) rename {spec/support => test}/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml (100%) rename {spec/support => test/fixtures}/webhook_payload.txt (100%) create mode 100644 test/test_helper.rb create mode 100644 test/workos/encryptors/test_aes_gcm.rb create mode 100644 test/workos/test_audit_logs.rb create mode 100644 test/workos/test_cache.rb create mode 100644 test/workos/test_client.rb create mode 100644 test/workos/test_configuration.rb create mode 100644 test/workos/test_directory_sync.rb create mode 100644 test/workos/test_directory_user.rb create mode 100644 test/workos/test_event.rb create mode 100644 test/workos/test_mfa.rb create mode 100644 test/workos/test_organizations.rb create mode 100644 test/workos/test_passwordless.rb create mode 100644 test/workos/test_portal.rb create mode 100644 test/workos/test_role.rb create mode 100644 test/workos/test_session.rb create mode 100644 test/workos/test_sso.rb create mode 100644 test/workos/test_user_management.rb create mode 100644 test/workos/test_webhooks.rb create mode 100644 test/workos/test_widgets.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4d752a3..8ddf090b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,9 @@ jobs: strategy: matrix: ruby: - - '3.1' - - '3.2' + - '3.3' + - '3.4' + - '4.0' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0 @@ -26,6 +27,6 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Spec + - name: Test run: | - bundle exec rspec + bundle exec rake test diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index eb35be6c..a8411cbe 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,15 +12,14 @@ defaults: jobs: standard: - name: Standard Ruby + name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0 with: - ruby-version: '3.2' bundler-cache: true - - name: Standard + - name: Run Standardrb run: | bundle exec standardrb diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..b9b3b0de --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.3.11 diff --git a/.standard.yml b/.standard.yml index e8acb923..49bff5f1 100644 --- a/.standard.yml +++ b/.standard.yml @@ -1,10 +1 @@ ruby_version: 3.3 - -ignore: - - "lib/workos/types/provider.rb": - - Naming/ConstantName - - "lib/workos/user_management.rb": - - Naming/ConstantName - - Metrics/ParameterLists - - "spec/**/*_spec.rb": - - Metrics/BlockLength diff --git a/Gemfile.lock b/Gemfile.lock index 521f2115..ce0246a0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,7 +16,6 @@ GEM crack (1.0.1) bigdecimal rexml - diff-lcs (1.6.2) encryptor (3.0.0) hashdiff (1.2.1) json (2.19.3) @@ -24,6 +23,7 @@ GEM base64 language_server-protocol (3.17.0.5) lint_roller (1.1.0) + minitest (5.27.0) parallel (1.28.0) parser (3.3.11.1) ast (~> 2.4.1) @@ -35,19 +35,6 @@ GEM rake (13.4.1) regexp_parser (2.12.0) rexml (3.4.4) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.3) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.4) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.4) rubocop (1.84.2) json (~> 2.3) language_server-protocol (~> 3.17.0.2) @@ -94,8 +81,8 @@ PLATFORMS DEPENDENCIES bundler (>= 2.0.1) + minitest (~> 5.25) rake - rspec (~> 3.9.0) standard (~> 1.49) vcr (~> 6.0) webmock @@ -107,13 +94,13 @@ CHECKSUMS base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b bigdecimal (4.1.1) sha256=1c09efab961da45203c8316b0cdaec0ff391dfadb952dd459584b63ebf8054ca crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e - diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962 encryptor (3.0.0) sha256=abf23f94ab4d864b8cea85b43f3432044a60001982cda7c33c1cd90da8db1969 hashdiff (1.2.1) sha256=9c079dbc513dfc8833ab59c0c2d8f230fa28499cc5efb4b8dd276cf931457cd1 json (2.19.3) sha256=289b0bb53052a1fa8c34ab33cc750b659ba14a5c45f3fcf4b18762dc67c78646 jwt (3.1.2) sha256=af6991f19a6bb4060d618d9add7a66f0eeb005ac0bc017cd01f63b42e122d535 language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87 + minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5 parallel (1.28.0) sha256=33e6de1484baf2524792d178b0913fc8eb94c628d6cfe45599ad4458c638c970 parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54 prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85 @@ -123,11 +110,6 @@ CHECKSUMS rake (13.4.1) sha256=b4e81bd6a748308a6799619d824ec6a23cd1acd07d9ec41e5f2ebfb2294447c8 regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 - rspec (3.9.0) sha256=90a037a7cc02365d7c112201881839aafbc875a88094423bc8cba778c98bfac3 - rspec-core (3.9.3) sha256=704f3af166bb8d763199742d94f0be3027c0f26d61a2f2156d99d0444248082d - rspec-expectations (3.9.4) sha256=58248bcc7ca1cde7255aa2436d27a1a6133d8d235409011b5256a24ce050583e - rspec-mocks (3.9.1) sha256=b9820ed35afbc552b4448ccb98984ffe20e92bff6760dbd60f4fec503d6e75a7 - rspec-support (3.9.4) sha256=f4333c6df9413909aa652e8460588b36e8bb62e76e51e94c039e1b4bc3e4e645 rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035 rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834 diff --git a/Rakefile b/Rakefile index b6ae7341..b3021e54 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1,12 @@ # frozen_string_literal: true require "bundler/gem_tasks" -require "rspec/core/rake_task" +require "rake/testtask" -RSpec::Core::RakeTask.new(:spec) +Rake::TestTask.new(:test) do |t| + t.libs << "test" + t.libs << "lib" + t.test_files = FileList["test/**/test_*.rb"] +end -task default: :spec +task default: :test diff --git a/renovate.json b/renovate.json index c30540d2..1fb0729d 100644 --- a/renovate.json +++ b/renovate.json @@ -9,6 +9,13 @@ "timezone": "UTC", "rebaseWhen": "conflicted", "packageRules": [ + { + "matchManagers": [ + "github-actions" + ], + "pinDigests": true, + "extractVersion": "^v(?\\d+\\.\\d+\\.\\d+)$" + }, { "matchUpdateTypes": [ "minor", @@ -28,6 +35,28 @@ "digest" ], "automerge": false + }, + { + "matchManagers": [ + "github-actions" + ], + "matchUpdateTypes": [ + "minor", + "patch", + "digest" + ], + "groupName": "github-actions", + "automerge": true + }, + { + "matchManagers": [ + "github-actions" + ], + "matchUpdateTypes": [ + "major" + ], + "groupName": "github-actions (major)", + "automerge": false } ] } diff --git a/spec/lib/workos/audit_logs_spec.rb b/spec/lib/workos/audit_logs_spec.rb deleted file mode 100644 index 221c3ed4..00000000 --- a/spec/lib/workos/audit_logs_spec.rb +++ /dev/null @@ -1,150 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::AuditLogs do - it_behaves_like "client" - - before do - WorkOS.configure do |config| - config.key = "example_api_key" - end - end - - describe ".create_event" do - context "with valid event payload" do - let(:valid_event) do - { - action: "user.signed_in", - occurred_at: "2022-08-22T15:04:19.704Z", - actor: { - id: "user_123", - type: "user", - name: "User", - metadata: { - foo: "bar" - } - }, - targets: [{ - id: "team_123", - type: "team", - name: "Team", - metadata: { - foo: "bar" - } - }], - context: { - location: "1.1.1.1", - user_agent: "Mozilla" - } - } - end - - context "with idempotency key" do - it "creates an event" do - VCR.use_cassette "audit_logs/create_event_custom_idempotency_key", match_requests_on: %i[path body] do - response = described_class.create_event( - organization: "org_123", - event: valid_event, - idempotency_key: "idempotency_key" - ) - - expect(response.code).to eq "201" - end - end - end - - context "without idempotency key" do - it "creates an event" do - VCR.use_cassette "audit_logs/create_event", match_requests_on: %i[path body] do - response = described_class.create_event( - organization: "org_123", - event: valid_event - ) - - expect(response.code).to eq "201" - end - end - end - - context "with invalid event" do - it "returns error" do - VCR.use_cassette "audit_logs/create_event_invalid", match_requests_on: %i[path body] do - described_class.create_event( - organization: "org_123", - event: valid_event - ) - rescue WorkOS::InvalidRequestError => e - expect( - e.message - ).to eq "Status 400, Invalid Audit Log event - request ID: 1cf9b8e7-5910-4a6d-a333-46bcf841422e" - expect(e.code).to eq "invalid_audit_log" - expect(e.errors.count).to eq 1 - end - end - end - end - end - - describe ".create_export" do - context "without filters applied" do - it "creates an event" do - VCR.use_cassette "audit_logs/create_export", match_requests_on: %i[path body] do - audit_log_export = described_class.create_export( - organization: "org_123", - range_start: "2022-06-22T15:04:19.704Z", - range_end: "2022-08-22T15:04:19.704Z" - ) - - expect(audit_log_export).to have_attributes( - object: "audit_log_export", - id: "audit_log_export_123", - state: "pending", - url: nil, - created_at: "2022-08-22T15:04:19.704Z", - updated_at: "2022-08-22T15:04:19.704Z" - ) - end - end - end - - context "with filters applied" do - it "creates an export" do - VCR.use_cassette "audit_logs/create_export_with_filters", match_requests_on: %i[path body] do - audit_log_export = described_class.create_export( - organization: "org_123", - range_start: "2022-06-22T15:04:19.704Z", - range_end: "2022-08-22T15:04:19.704Z", - actions: ["user.signed_in"], - actors: ["Jon Smith"], - actor_names: ["Jon Smith"], - actor_ids: ["user_123"], - targets: %w[user team] - ) - - expect(audit_log_export.object).to eq "audit_log_export" - expect(audit_log_export.id).to eq "audit_log_export_123" - expect(audit_log_export.state).to eq "pending" - expect(audit_log_export.url).to eq nil - expect(audit_log_export.created_at).to eq "2022-08-22T15:04:19.704Z" - expect(audit_log_export.updated_at).to eq "2022-08-22T15:04:19.704Z" - end - end - end - end - - describe ".get_export" do - it "returns an export" do - VCR.use_cassette "audit_logs/get_export", match_requests_on: %i[path] do - audit_log_export = described_class.get_export( - id: "audit_log_export_123" - ) - - expect(audit_log_export.object).to eq "audit_log_export" - expect(audit_log_export.id).to eq "audit_log_export_123" - expect(audit_log_export.state).to eq "ready" - expect(audit_log_export.url).to eq "https://audit-logs.com/download.csv" - expect(audit_log_export.created_at).to eq "2022-08-22T15:04:19.704Z" - expect(audit_log_export.updated_at).to eq "2022-08-22T15:04:19.704Z" - end - end - end -end diff --git a/spec/lib/workos/cache_spec.rb b/spec/lib/workos/cache_spec.rb deleted file mode 100644 index f2f26ecb..00000000 --- a/spec/lib/workos/cache_spec.rb +++ /dev/null @@ -1,94 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::Cache do - before { described_class.clear } - - describe ".write and .read" do - it "stores and retrieves data" do - described_class.write("key", "value") - expect(described_class.read("key")).to eq("value") - end - - it "returns nil if key does not exist" do - expect(described_class.read("missing")).to be_nil - end - end - - describe ".fetch" do - it "returns cached value when present and not expired" do - described_class.write("key", "value") - fetch_value = described_class.fetch("key") { "new_value" } - expect(fetch_value).to eq("value") - end - - it "executes block and caches value when not present" do - fetch_value = described_class.fetch("key") { "new_value" } - expect(fetch_value).to eq("new_value") - end - - it "executes block and caches value when force is true" do - described_class.write("key", "value") - fetch_value = described_class.fetch("key", force: true) { "new_value" } - expect(fetch_value).to eq("new_value") - end - end - - describe "expiration" do - it "expires values after specified time" do - described_class.write("key", "value", expires_in: 0.1) - expect(described_class.read("key")).to eq("value") - sleep 0.2 - expect(described_class.read("key")).to be_nil - end - - it "executes block and caches new value when expired" do - described_class.write("key", "old_value", expires_in: 0.1) - sleep 0.2 - fetch_value = described_class.fetch("key") { "new_value" } - expect(fetch_value).to eq("new_value") - end - - it "does not expire values when expires_in is nil" do - described_class.write("key", "value", expires_in: nil) - sleep 0.2 - expect(described_class.read("key")).to eq("value") - end - end - - describe ".exist?" do - it "returns true if key exists" do - described_class.write("key", "value") - expect(described_class.exist?("key")).to be true - end - - it "returns false if expired" do - described_class.write("key", "value", expires_in: 0.1) - sleep 0.2 - expect(described_class.exist?("key")).to be false - end - - it "returns false if key does not exist" do - expect(described_class.exist?("missing")).to be false - end - end - - describe ".delete" do - it "deletes key" do - described_class.write("key", "value") - described_class.delete("key") - expect(described_class.read("key")).to be_nil - end - end - - describe ".clear" do - it "removes all keys from the cache" do - described_class.write("key1", "value1") - described_class.write("key2", "value2") - - described_class.clear - - expect(described_class.read("key1")).to be_nil - expect(described_class.read("key2")).to be_nil - end - end -end diff --git a/spec/lib/workos/client.rb b/spec/lib/workos/client.rb deleted file mode 100644 index 1cd20536..00000000 --- a/spec/lib/workos/client.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -# rubocop:disable Style/MultilineBlockChain -describe WorkOS::Client do - describe ".client" do - it "returns a 400 error with appropriate fields" do - VCR.use_cassette("user_management/authenticate_with_code/invalid") do - expect do - WorkOS::UserManagement.authenticate_with_code( - code: "invalid", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end.to raise_error do |error| - expect(error).to be_a(WorkOS::InvalidRequestError) - expect(error.error).not_to be_nil - expect(error.error_description).not_to be_nil - expect(error.data).not_to be_nil - end - end - end - - it "returns a 401 error with appropriate fields" do - VCR.use_cassette("base/execute_request_unauthenticated") do - expect do - WorkOS::AuditLogs.create_event( - organization: "org_123", - event: {} - ) - end.to raise_error do |error| - expect(error).to be_a(WorkOS::AuthenticationError) - expect(error.message).not_to be_nil - end - end - end - - it "returns a 404 error with appropriate fields" do - VCR.use_cassette("user_management/get_email_verification/invalid") do - expect do - WorkOS::UserManagement.get_email_verification( - id: "invalid" - ) - end.to raise_error do |error| - expect(error).to be_a(WorkOS::NotFoundError) - expect(error.message).not_to be_nil - end - end - end - - it "returns a 422 error with appropriate fields" do - VCR.use_cassette("user_management/create_user_invalid") do - expect do - WorkOS::UserManagement.create_user( - email: "invalid" - ) - end.to raise_error do |error| - expect(error).to be_a(WorkOS::UnprocessableEntityError) - expect(error.message).not_to be_nil - expect(error.errors).not_to be_nil - expect(error.code).not_to be_nil - end - end - end - end -end -# rubocop:enable Style/MultilineBlockChain diff --git a/spec/lib/workos/configuration_spec.rb b/spec/lib/workos/configuration_spec.rb deleted file mode 100644 index fc71fcab..00000000 --- a/spec/lib/workos/configuration_spec.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS do - describe ".configure" do - context "with key and no timeout" do - before do - WorkOS.configure do |config| - config.key = "example_api_key" - end - end - - it "sets the key and default timeout configuration" do - expect(WorkOS.config.key).to eq("example_api_key") - expect(WorkOS.config.timeout).to eq(60) - end - end - - context "with key and timeout" do - before do - WorkOS.configure do |config| - config.key = "example_api_key" - config.timeout = 120 - end - end - - it "sets the key and timeout configuration" do - expect(WorkOS.config.key).to eq("example_api_key") - expect(WorkOS.config.timeout).to eq(120) - end - end - end -end - -describe WorkOS::Configuration do - describe ".key!" do - context "with key set" do - before do - WorkOS.config.key = "example_api_key" - end - - it "returns the key" do - expect(WorkOS.config.key!).to eq("example_api_key") - end - end - - context "with key not set" do - before do - WorkOS.config.key = nil - end - - it "throws an error" do - expect do - WorkOS.config.key! - end.to raise_error( - "`WorkOS.config.key` not set" - ) - end - end - end -end diff --git a/spec/lib/workos/directory_sync_spec.rb b/spec/lib/workos/directory_sync_spec.rb deleted file mode 100644 index 6fc7ac78..00000000 --- a/spec/lib/workos/directory_sync_spec.rb +++ /dev/null @@ -1,483 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::DirectorySync do - it_behaves_like "client" - - describe ".list_directories" do - context "with no options" do - it "returns directories and metadata" do - expected_metadata = { - "after" => nil, - "before" => "before-id" - } - - VCR.use_cassette "directory_sync/list_directories/with_no_options" do - directories = described_class.list_directories - - expect(directories.data.size).to eq(10) - expect(directories.list_metadata).to eq(expected_metadata) - end - end - end - - context "with search option" do - it "forms the proper request to the API" do - request_args = [ - "/directories?search=Testing&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_directories/with_search" do - directories = described_class.list_directories( - search: "Testing" - ) - - expect(directories.data.size).to eq(2) - expect(directories.data[0].name).to include("Testing") - end - end - end - - context "with the before option" do - it "forms the proper request to the API" do - request_args = [ - "/directories?before=directory_01FGCPNV312FHFRCX0BYWHVSE1&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_directories/with_before" do - directories = described_class.list_directories( - before: "directory_01FGCPNV312FHFRCX0BYWHVSE1" - ) - - expect(directories.data.size).to eq(6) - end - end - end - - context "with the after option" do - it "forms the proper request to the API" do - request_args = [ - "/directories?after=directory_01FGCPNV312FHFRCX0BYWHVSE1&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_directories/with_after" do - directories = described_class.list_directories(after: "directory_01FGCPNV312FHFRCX0BYWHVSE1") - - expect(directories.data.size).to eq(4) - end - end - end - - context "with the limit option" do - it "forms the proper request to the API" do - request_args = [ - "/directories?limit=2&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_directories/with_limit" do - directories = described_class.list_directories(limit: 2) - - expect(directories.data.size).to eq(2) - end - end - end - end - - describe ".delete_directory" do - context "with valid id" do - it "deletes a directory" do - VCR.use_cassette("directory_sync/delete_directory") do - response = WorkOS::DirectorySync.delete_directory( - "directory_01F2T098SKN5PCTVSJ7CWP70N5" - ) - - expect(response).to be(true) - end - end - end - end - - describe ".get_directory" do - context "with a valid id" do - it "gets the directory details" do - VCR.use_cassette("directory_sync/get_directory_with_valid_id") do - directory = WorkOS::DirectorySync.get_directory( - id: "directory_01FK17DWRHH7APAFXT5B52PV0W" - ) - - expect(directory.id).to eq("directory_01FK17DWRHH7APAFXT5B52PV0W") - expect(directory.name).to eq("Testing Active Attribute") - expect(directory.domain).to eq("example.me") - expect(directory.type).to eq("azure scim v2.0") - expect(directory.state).to eq("linked") - expect(directory.organization_id).to eq("org_01F6Q6TFP7RD2PF6J03ANNWDKV") - end - end - end - - context "with an invalid id" do - it "raises an error" do - VCR.use_cassette("directory_sync/get_directory_with_invalid_id") do - expect do - WorkOS::DirectorySync.get_directory(id: "invalid") - end.to raise_error( - WorkOS::NotFoundError, - "Status 404, Directory not found: 'invalid'. - request ID: " - ) - end - end - end - end - - describe ".list_groups" do - context "with no options" do - it "raises an error" do - VCR.use_cassette("directory_sync/list_groups/with_no_options") do - expect do - WorkOS::DirectorySync.list_groups - end.to raise_error(WorkOS::UnprocessableEntityError) - end - end - end - - context "with directory option" do - it "forms the proper request to the API" do - request_args = [ - "/directory_groups?directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_groups/with_directory" do - groups = described_class.list_groups( - directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" - ) - - expect(groups.data.size).to eq(10) - expect(groups.data[0].name).to eq(groups.data[0]["name"]) - end - end - end - - context "with user option" do - it "forms the proper request to the API" do - request_args = [ - "/directory_groups?user=directory_user_01G2Z8D4FDB28ZNSRRBVCF2E0P&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_groups/with_user" do - groups = described_class.list_groups( - user: "directory_user_01G2Z8D4FDB28ZNSRRBVCF2E0P" - ) - - expect(groups.data.size).to eq(3) - end - end - end - - context "with the before option" do - it "forms the proper request to the API" do - request_args = [ - "/directory_groups?before=directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG&" \ - "directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_groups/with_before" do - groups = described_class.list_groups( - before: "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG", - directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" - ) - - expect(groups.data.size).to eq(10) - end - end - end - - context "with the after option" do - it "forms the proper request to the API" do - request_args = [ - "/directory_groups?after=directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG&" \ - "directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_groups/with_after" do - groups = described_class.list_groups( - after: "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG", - directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" - ) - - expect(groups.data.size).to eq(9) - end - end - end - - context "with the limit option" do - it "forms the proper request to the API" do - request_args = [ - "/directory_groups?limit=2&" \ - "directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_groups/with_limit" do - groups = described_class.list_groups( - limit: 2, - directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" - ) - - expect(groups.data.size).to eq(2) - end - end - end - end - - describe ".list_users" do - context "with no options" do - it "raises an error" do - VCR.use_cassette("directory_sync/list_users/with_no_options") do - expect do - WorkOS::DirectorySync.list_users - end.to raise_error(WorkOS::UnprocessableEntityError) - end - end - end - - context "with directory option" do - it "forms the proper request to the API" do - request_args = [ - "/directory_users?directory=directory_01FAZYMST676QMTFN1DDJZZX87&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_users/with_directory" do - users = described_class.list_users( - directory: "directory_01FAZYMST676QMTFN1DDJZZX87" - ) - - expect(users.data.size).to eq(4) - expect(users.data[0].first_name).to eq(users.data[0]["first_name"]) - end - end - end - - context "with group option" do - it "forms the proper request to the API" do - request_args = [ - "/directory_users?group=directory_group_01FBXGP79EJAYKW0WS9JCK1V6E&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_users/with_group" do - users = described_class.list_users( - group: "directory_group_01FBXGP79EJAYKW0WS9JCK1V6E" - ) - - expect(users.data.size).to eq(1) - end - end - end - - context "with the before option" do - it "forms the proper request to the API" do - request_args = [ - "/directory_users?before=directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF&" \ - "directory=directory_01FAZYMST676QMTFN1DDJZZX87&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_users/with_before" do - users = described_class.list_users( - before: "directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF", - directory: "directory_01FAZYMST676QMTFN1DDJZZX87" - ) - - expect(users.data.size).to eq(2) - end - end - end - - context "with the after option" do - it "forms the proper request to the API" do - request_args = [ - "/directory_users?after=directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF&" \ - "directory=directory_01FAZYMST676QMTFN1DDJZZX87&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_users/with_after" do - users = described_class.list_users( - after: "directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF", - directory: "directory_01FAZYMST676QMTFN1DDJZZX87" - ) - - expect(users.data.size).to eq(1) - end - end - end - - context "with the limit option" do - it "forms the proper request to the API" do - request_args = [ - "/directory_users?limit=2&" \ - "directory=directory_01FAZYMST676QMTFN1DDJZZX87&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "directory_sync/list_users/with_limit" do - users = described_class.list_users( - limit: 2, - directory: "directory_01FAZYMST676QMTFN1DDJZZX87" - ) - - expect(users.data.size).to eq(2) - end - end - end - end - - describe ".get_group" do - context "with valid id" do - it "returns a group" do - VCR.use_cassette("directory_sync/get_group") do - group = WorkOS::DirectorySync.get_group( - "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG" - ) - - expect(group["directory_id"]).to eq("directory_01G2Z8ADK5NPMVTWF48MVVE4HT") - expect(group["organization_id"]).to eq("org_01EGS4P7QR31EZ4YWD1Z1XA176") - expect(group["idp_id"]).to eq("01jlao4614two3d") - expect(group["name"]).to eq("Sales") - expect(group.name).to eq("Sales") - expect(group["created_at"]).to eq("2022-05-13T17:45:31.732Z") - expect(group["updated_at"]).to eq("2022-07-13T17:45:42.618Z") - end - end - end - - context "with invalid id" do - it "raises an error" do - VCR.use_cassette("directory_sync/get_group_with_invalid_id") do - expect do - WorkOS::DirectorySync.get_group("invalid") - end.to raise_error(WorkOS::NotFoundError) - end - end - end - end - - describe ".get_user" do - context "with valid id" do - it "returns a user" do - VCR.use_cassette("directory_sync/get_user") do - user = WorkOS::DirectorySync.get_user( - "directory_user_01FAZYNPC8M0HRYTKFP2GNX852" - ) - - expect(user["first_name"]).to eq("Bob") - expect(user.directory_id).to eq("directory_01FAZYMST676QMTFN1DDJZZX87") - expect(user.organization_id).to eq("org_01FAZWCWR03DVWA83NCJYKKD54") - expect(user.first_name).to eq("Bob") - end - end - end - - context "with invalid id" do - it "raises an error" do - VCR.use_cassette("directory_sync/get_user_with_invalid_id") do - expect do - WorkOS::DirectorySync.get_user("invalid") - end.to raise_error(WorkOS::NotFoundError) - end - end - end - end -end diff --git a/spec/lib/workos/directory_user_spec.rb b/spec/lib/workos/directory_user_spec.rb deleted file mode 100644 index 66f24183..00000000 --- a/spec/lib/workos/directory_user_spec.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::DirectoryUser do - # rubocop:disable Layout/LineLength - describe ".get_primary_email" do - context "with one primary email" do - it "returns the primary email" do - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.primary_email).to eq("bob.fakename@workos.com") - end - end - - context "with multiple primary emails" do - it "returns the first email marked as primary" do - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":true,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.primary_email).to eq("bob.fakename@workos.com") - end - end - - context "with no primary emails" do - it "returns nil" do - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":false,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.primary_email).to eq(nil) - end - end - - context "with an empty email array" do - it "returns nil" do - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.primary_email).to eq(nil) - end - end - end - - describe ".get_role" do - context "with no role" do - it "returns no role" do - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.role).to eq(nil) - expect(user.roles).to eq(nil) - end - end - - context "with a single role" do - it "returns the highest priority role slug and roles array" do - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"role":{"slug":"member"},"roles":[{"slug":"member"}],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.role).to eq({slug: "member"}) - expect(user.roles).to eq([{slug: "member"}]) - end - end - - context "with multiple roles" do - it "returns the highest priority role slug and roles array" do - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"role":{"slug":"admin"},"roles":[{"slug":"member"}, {"slug":"admin"}],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.role).to eq({slug: "admin"}) - expect(user.roles).to eq([{slug: "member"}, {slug: "admin"}]) - end - end - end - # rubocop:enable Layout/LineLength -end diff --git a/spec/lib/workos/encryptors/aes_gcm_spec.rb b/spec/lib/workos/encryptors/aes_gcm_spec.rb deleted file mode 100644 index f8abbed2..00000000 --- a/spec/lib/workos/encryptors/aes_gcm_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe WorkOS::Encryptors::AesGcm do - subject(:encryptor) { described_class.new } - - let(:key) { "a" * 32 } - let(:data) { {access_token: "tok_123", user: {id: "user_01"}} } - - describe "#seal" do - it "returns a base64-encoded string" do - sealed = encryptor.seal(data, key) - expect(sealed).to be_a(String) - expect { Base64.decode64(sealed) }.not_to raise_error - end - - it "produces different output each time (random IV)" do - sealed1 = encryptor.seal(data, key) - sealed2 = encryptor.seal(data, key) - expect(sealed1).not_to eq(sealed2) - end - end - - describe "#unseal" do - it "round-trips data correctly" do - sealed = encryptor.seal(data, key) - unsealed = encryptor.unseal(sealed, key) - expect(unsealed).to eq(data) - end - - it "returns hash with symbolized keys" do - sealed = encryptor.seal({"string_key" => "value"}, key) - unsealed = encryptor.unseal(sealed, key) - expect(unsealed.keys.first).to be_a(Symbol) - end - - it "raises error with wrong key" do - sealed = encryptor.seal(data, key) - expect { encryptor.unseal(sealed, "b" * 32) }.to raise_error(OpenSSL::Cipher::CipherError) - end - end -end diff --git a/spec/lib/workos/event_spec.rb b/spec/lib/workos/event_spec.rb deleted file mode 100644 index 607f8426..00000000 --- a/spec/lib/workos/event_spec.rb +++ /dev/null @@ -1,109 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::Events do - it_behaves_like "client" - - describe ".list_events" do - context "with no options" do - it "raises ArgumentError" do - VCR.use_cassette "events/list_events_with_no_options" do - expect do - described_class.list_events - end.to raise_error(ArgumentError) - end - end - end - - context "with event option" do - it "forms the proper request to the API" do - request_args = [ - "/events?events=connection.activated", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "events/list_events_with_event" do - events = described_class.list_events( - events: ["connection.activated"] - ) - - expect(events.data.size).to eq(1) - end - end - end - - context "with the after option" do - it "forms the proper request to the API" do - request_args = [ - "/events?after=event_01FGCPNV312FHFRCX0BYWHVSE1&events=dsync.user.created", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "events/list_events_with_after" do - events = described_class.list_events( - after: "event_01FGCPNV312FHFRCX0BYWHVSE1", - events: ["dsync.user.created"] - ) - - expect(events.data.size).to eq(1) - end - end - end - - context "with the range_start and range_end options" do - it "forms the proper request to the API" do - request_args = [ - "/events?events=dsync.user.created&range_start=2023-01-01T00%3A00%3A00Z&range_end=2023-01-03T00%3A00%3A00Z", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "events/list_events_with_range" do - events = described_class.list_events( - events: ["dsync.user.created"], - range_start: "2023-01-01T00:00:00Z", - range_end: "2023-01-03T00:00:00Z" - ) - - expect(events.data.size).to eq(1) - end - end - end - - context "with the organization_id option" do - it "forms the proper request to the API" do - request_args = [ - "/events?events=dsync.user.created&organization_id=org_1234", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "events/list_events_with_organization_id" do - events = described_class.list_events( - events: ["dsync.user.created"], - organization_id: "org_1234" - ) - - expect(events.data.size).to eq(1) - end - end - end - end -end diff --git a/spec/lib/workos/mfa_spec.rb b/spec/lib/workos/mfa_spec.rb deleted file mode 100644 index b3cbf43c..00000000 --- a/spec/lib/workos/mfa_spec.rb +++ /dev/null @@ -1,285 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::MFA do - it_behaves_like "client" - - describe ".enroll_factor" do - context "with valid generic argument" do - it "returns a valid factor object" do - VCR.use_cassette "mfa/enroll_factor_generic_valid" do - factor = described_class.enroll_factor( - type: "generic_otp" - ) - expect(factor.type == "generic_otp") - end - end - end - - context "with valid totp arguments" do - it "returns a valid factor object" do - VCR.use_cassette "mfa/enroll_factor_totp_valid" do - factor = described_class.enroll_factor( - type: "totp", - totp_issuer: "WorkOS", - totp_user: "some_user" - ) - expect(factor.totp.instance_of?(Hash)) - end - end - end - - context "with valid sms arguments" do - it "returns a valid factor object" do - VCR.use_cassette "mfa/enroll_factor_sms_valid" do - factor = described_class.enroll_factor( - type: "sms", - phone_number: "55555555555" - ) - expect(factor.sms.instance_of?(Hash)) - end - end - end - - context "when type is not sms or totp" do - it "returns an error" do - expect do - described_class.enroll_factor( - type: "invalid", - phone_number: "+15005550006" - ) - end.to raise_error( - ArgumentError, - "Type argument must be either 'sms' or 'totp'" - ) - end - end - - context "when type is totp but missing arguments" do - it "returns an error" do - expect do - described_class.enroll_factor( - type: "totp", - totp_issuer: "WorkOS" - ) - end.to raise_error( - ArgumentError, - "Incomplete arguments. Need to specify both totp_issuer and totp_user when type is totp" - ) - end - end - context "when type is sms and phone number is nil" do - it "returns an error" do - expect do - described_class.enroll_factor( - type: "sms" - ) - end.to raise_error( - ArgumentError, - "Incomplete arguments. Need to specify phone_number when type is sms" - ) - end - end - end - - describe ".challenge_factor" do - context "challenge with totp" do - it "returns challenge factor object for totp" do - VCR.use_cassette "mfa/challenge_factor_totp_valid" do - challenge_factor = described_class.challenge_factor( - authentication_factor_id: "auth_factor_01FZ4TS0MWPZR7GATS7KCXANQZ" - ) - expect(challenge_factor.authentication_factor_id.class.instance_of?(String)) - end - end - end - - context "challenge with sms" do - it "returns a challenge factor object for sms" do - VCR.use_cassette "mfa/challenge_factor_sms_valid" do - challenge_factor = described_class.challenge_factor( - authentication_factor_id: "auth_factor_01FZ4TS14D1PHFNZ9GF6YD8M1F", - sms_template: "Your code is {{code}}" - ) - expect(challenge_factor.authentication_factor_id.instance_of?(String)) - end - end - end - - context "challenge with generic" do - it "returns a valid challenge factor object for generic otp" do - VCR.use_cassette "mfa/challenge_factor_generic_valid" do - challenge_factor = described_class.challenge_factor( - authentication_factor_id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" - ) - expect(challenge_factor.code.instance_of?(String)) - end - end - end - - context "challenge with totp mssing authentication_factor_id" do - it "returns argument error" do - expect do - described_class.challenge_factor - end.to raise_error( - ArgumentError, - "Incomplete arguments: 'authentication_factor_id' is a required argument" - ) - end - end - end - - describe ".verify_factor" do - it "throws a warning" do - VCR.use_cassette "mfa/verify_challenge_generic_valid" do - allow(Warning).to receive(:warn) - - described_class.verify_factor( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - - expect(Warning).to have_received(:warn).with( - "[DEPRECATION] `verify_factor` is deprecated. Please use `verify_challenge` instead.\n", - any_args - ) - end - end - - it "calls verify_challenge" do - VCR.use_cassette "mfa/verify_challenge_generic_valid" do - verify_factor = described_class.verify_factor( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - expect(verify_factor.valid == "true") - end - end - end - - describe ".verify_challenge" do - context "with generic otp" do - context "and the challenge has not been verified" do - it "returns true if the code is correct" do - VCR.use_cassette "mfa/verify_challenge_generic_valid" do - verify_challenge = described_class.verify_challenge( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - expect(verify_challenge.valid == "true") - end - end - - it "returns false if the code is incorrect" do - VCR.use_cassette "mfa/verify_challenge_generic_valid_is_false" do - verify_challenge = described_class.verify_challenge( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - expect(verify_challenge.valid == "false") - end - end - end - - context "and the challenge has already been verified" do - it "returns an error" do - VCR.use_cassette "mfa/verify_challenge_generic_invalid" do - expect do - described_class.verify_challenge( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - end.to raise_error(WorkOS::UnprocessableEntityError) - end - end - end - - context "and the challenge has expired" do - it "returns an error" do - VCR.use_cassette "mfa/verify_challenge_generic_expired" do - expect do - described_class.verify_challenge( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - end.to raise_error(WorkOS::UnprocessableEntityError) - end - end - end - - context "with missing code argument" do - it "returns an argument error" do - expect do - described_class.verify_challenge( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J" - ) - end.to raise_error( - ArgumentError, - "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments" - ) - end - end - - context "with missing authentication_challenge_id argument" do - it "returns an error" do - expect do - described_class.verify_challenge( - code: "897792" - ) - end.to raise_error( - ArgumentError, - "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments" - ) - end - end - - context "with missing code and authentication_challenge_id arguments" do - it "returns an argument error" do - expect do - described_class.verify_challenge - end.to raise_error( - ArgumentError, - "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments" - ) - end - end - end - end - - describe ".get_factor" do - context "with a valid id" do - it "returns a factor" do - VCR.use_cassette "mfa/get_factor_valid" do - factor = described_class.get_factor( - id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" - ) - expect(factor.id.instance_of?(String)) - end - end - end - - context "with an invalid id" do - it "returns an error" do - VCR.use_cassette "mfa/get_factor_invalid" do - expect do - described_class.get_factor( - id: "auth_factor_invalid" - ) - end.to raise_error(WorkOS::NotFoundError) - end - end - end - end - - describe ".delete_factor" do - context "deletes facotr" do - it "uses delete_factor to delete factor" do - VCR.use_cassette "mfa/delete_factor" do - response = described_class.delete_factor( - id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" - ) - expect(response).to be(true) - end - end - end - end -end diff --git a/spec/lib/workos/organizations_spec.rb b/spec/lib/workos/organizations_spec.rb deleted file mode 100644 index bf97980b..00000000 --- a/spec/lib/workos/organizations_spec.rb +++ /dev/null @@ -1,569 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::Organizations do - it_behaves_like "client" - - describe ".create_organization" do - context "with valid payload" do - context "with no idempotency key" do - it "creates an organization" do - VCR.use_cassette "organization/create" do - organization = described_class.create_organization( - domains: ["example.io"], - name: "Test Organization" - ) - - expect(organization.id).to eq("org_01FCPEJXEZR4DSBA625YMGQT9N") - expect(organization.name).to eq("Test Organization") - expect(organization.domains.first[:domain]).to eq("example.io") - end - end - - context "without domains" do - it "creates an organization" do - VCR.use_cassette "organization/create_without_domains" do - organization = described_class.create_organization( - name: "Test Organization" - ) - - expect(organization.id).to start_with("org_") - expect(organization.name).to eq("Test Organization") - expect(organization.domains).to be_empty - end - end - end - - context "with external_id" do - it "creates an organization with external_id" do - VCR.use_cassette "organization/create_with_external_id" do - organization = described_class.create_organization( - name: "Test Organization with External ID", - external_id: "ext_org_123" - ) - - expect(organization.id).to start_with("org_") - expect(organization.name).to eq("Test Organization with External ID") - expect(organization.external_id).to eq("ext_org_123") - end - end - end - - context "with domains" do - it "creates an organization and warns" do - VCR.use_cassette "organization/create_with_domains" do - allow(Warning).to receive(:warn) - - organization = described_class.create_organization( - domains: ["example.io"], - name: "Test Organization" - ) - - expect(organization.id).to start_with("org_") - expect(organization.name).to eq("Test Organization") - expect(organization.domains.first[:domain]).to eq("example.io") - - expect(Warning).to have_received(:warn).with( - "[DEPRECATION] `domains` is deprecated. Use `domain_data` instead.\n", - any_args - ) - end - end - end - - context "with domain_data" do - it "creates an organization" do - VCR.use_cassette "organization/create_with_domain_data" do - organization = described_class.create_organization( - domain_data: [{domain: "example.io", state: "verified"}], - name: "Test Organization" - ) - - expect(organization.id).to start_with("org_") - expect(organization.name).to eq("Test Organization") - expect(organization.domains.first).to include( - domain: "example.io", state: "verified" - ) - end - end - end - end - - context "with idempotency key" do - context "when idempotency key is used once" do - it "creates an organization" do - VCR.use_cassette "organization/create_with_idempotency_key" do - organization = described_class.create_organization( - domains: ["example.io"], - name: "Test Organization", - idempotency_key: "key" - ) - - expect(organization.name).to eq("Test Organization") - expect(organization.domains.first[:domain]).to eq("example.io") - end - end - end - - context "when idempotency key is used more than once" do - context "with duplicate event payloads" do - it "returns the already created organization" do - VCR.use_cassette "organization/create_with_duplicate_idempotency_key_and_payload" do - organization1 = described_class.create_organization( - domains: ["example.com"], - name: "Test Organization", - idempotency_key: "foo" - ) - - organization2 = described_class.create_organization( - domains: ["example.com"], - name: "Test Organization", - idempotency_key: "foo" - ) - - expect(organization1.id).to eq(organization2.id) - end - end - end - - context "with different event payloads" do - it "raises an error" do - VCR.use_cassette "organization/create_with_duplicate_idempotency_key_and_different_payload" do - described_class.create_organization( - domains: ["example.me"], - name: "Test Organization", - idempotency_key: "bar" - ) - - expect do - described_class.create_organization( - domains: ["example.me"], - name: "Organization Test", - idempotency_key: "bar" - ) - end.to raise_error( - WorkOS::InvalidRequestError, - /Status 400, Another idempotency key \(bar\) with different request parameters was found. Please use a different idempotency key./ - ) - end - end - end - end - end - end - - context "with an invalid payload" do - it "returns an error" do - VCR.use_cassette "organization/create_invalid" do - expect do - described_class.create_organization( - domains: ["example.com"], - name: "Test Organization 2" - ) - end.to raise_error( - WorkOS::APIError, - /An Organization with the domain example.com already exists/ - ) - end - end - end - end - - describe ".list_organizations" do - context "with no options" do - it "returns organizations and metadata" do - expected_metadata = { - "after" => nil, - "before" => "before-id" - } - - VCR.use_cassette "organization/list" do - organizations = described_class.list_organizations - - expect(organizations.data.size).to eq(6) - expect(organizations.list_metadata).to eq(expected_metadata) - end - end - end - - context "with the before option" do - it "forms the proper request to the API" do - request_args = [ - "/organizations?before=before-id&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "organization/list", match_requests_on: [:path] do - organizations = described_class.list_organizations( - before: "before-id" - ) - - expect(organizations.data.size).to eq(6) - end - end - end - - context "with the after option" do - it "forms the proper request to the API" do - request_args = [ - "/organizations?after=after-id&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "organization/list", match_requests_on: [:path] do - organizations = described_class.list_organizations(after: "after-id") - - expect(organizations.data.size).to eq(6) - end - end - end - - context "with the limit option" do - it "forms the proper request to the API" do - request_args = [ - "/organizations?limit=10&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "organization/list", match_requests_on: [:path] do - organizations = described_class.list_organizations(limit: 10) - - expect(organizations.data.size).to eq(6) - end - end - end - end - - describe ".get_organization" do - context "with a valid id" do - it "gets the organization details" do - VCR.use_cassette("organization/get") do - organization = described_class.get_organization( - id: "org_01F9293WD2PDEEV4Y625XPZVG7" - ) - - expect(organization.id).to eq("org_01F9293WD2PDEEV4Y625XPZVG7") - expect(organization.name).to eq("Foo Corp") - expect(organization.domains.first[:domain]).to eq("foo-corp.com") - end - end - end - - context "with an invalid id" do - it "raises an error" do - VCR.use_cassette("organization/get_invalid") do - expect do - described_class.get_organization(id: "invalid") - end.to raise_error( - WorkOS::NotFoundError, - "Status 404, Not Found - request ID: " - ) - end - end - end - end - - describe ".update_organization" do - context "with valid payload" do - it "updates the organization" do - VCR.use_cassette "organization/update" do - organization = described_class.update_organization( - organization: "org_01F6Q6TFP7RD2PF6J03ANNWDKV", - domains: ["example.me"], - name: "Test Organization" - ) - - expect(organization.id).to eq("org_01F6Q6TFP7RD2PF6J03ANNWDKV") - expect(organization.name).to eq("Test Organization") - expect(organization.domains.first[:domain]).to eq("example.me") - end - end - end - context "without a name" do - it "updates the organization" do - VCR.use_cassette "organization/update_without_name" do - organization = described_class.update_organization( - organization: "org_01F6Q6TFP7RD2PF6J03ANNWDKV", - domains: ["example.me"] - ) - - expect(organization.id).to eq("org_01F6Q6TFP7RD2PF6J03ANNWDKV") - expect(organization.name).to eq("Test Organization") - expect(organization.domains.first[:domain]).to eq("example.me") - end - end - end - context "with a stripe_customer_id" do - it "updates the organization" do - VCR.use_cassette "organization/update_with_stripe_customer_id" do - organization = described_class.update_organization( - organization: "org_01JJ5H14CAA2SQ5G9HNN6TBZ05", - name: "Test Organization", - stripe_customer_id: "cus_123" - ) - - expect(organization.id).to eq("org_01JJ5H14CAA2SQ5G9HNN6TBZ05") - expect(organization.name).to eq("Test Organization") - expect(organization.stripe_customer_id).to eq("cus_123") - end - end - end - context "with an external_id" do - it "updates the organization" do - VCR.use_cassette "organization/update_with_external_id" do - organization = described_class.update_organization( - organization: "org_01K0SQV0S6EPWK2ZDEFD1CP1JC", - name: "Test Organization", - external_id: "ext_org_456" - ) - - expect(organization.id).to eq("org_01K0SQV0S6EPWK2ZDEFD1CP1JC") - expect(organization.name).to eq("Test Organization") - expect(organization.external_id).to eq("ext_org_456") - end - end - end - - context "can set external_id to null explicitly" do - it "includes external_id null in request body" do - original_method = described_class.method(:put_request) - allow(described_class).to receive(:put_request) do |kwargs| - original_method.call(**kwargs) - end - - VCR.use_cassette "organization/update_with_external_id_null" do - described_class.update_organization( - organization: "org_01K0SQV0S6EPWK2ZDEFD1CP1JC", - name: "Test Organization", - external_id: nil - ) - end - - # Verify the spy captured the right call - expect(described_class).to have_received(:put_request).with( - hash_including(body: hash_including(external_id: nil)) - ) - end - end - end - - describe ".delete_organization" do - context "with a valid id" do - it "returns true" do - VCR.use_cassette("organization/delete") do - response = described_class.delete_organization( - id: "org_01F4A8TD0B4N1Y9SJ8SH635HDB" - ) - - expect(response).to be(true) - end - end - end - - context "with an invalid id" do - it "returns false" do - VCR.use_cassette("organization/delete_invalid") do - expect do - described_class.delete_organization(id: "invalid") - end.to raise_error( - WorkOS::NotFoundError, - "Status 404, Not Found - request ID: " - ) - end - end - end - end - - describe ".list_organization_roles" do - context "with no options" do - it "returns roles for organization" do - expected_metadata = { - after: nil, - before: nil - } - - VCR.use_cassette "organization/list_organization_roles" do - roles = described_class.list_organization_roles(organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE") - - expect(roles.data.size).to eq(7) - expect(roles.list_metadata).to eq(expected_metadata) - end - end - - it "returns properly initialized Role objects with all attributes" do - VCR.use_cassette "organization/list_organization_roles" do - roles = described_class.list_organization_roles(organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE") - - first_role = roles.data.first - expect(first_role).to be_a(WorkOS::Role) - expect(first_role.id).to eq("role_01HS1C7GRJE08PBR3M6Y0ZYGDZ") - expect(first_role.name).to eq("Admin") - expect(first_role.slug).to eq("admin") - expect(first_role.description).to eq("Write access to every resource available") - expect(first_role.permissions).to eq(["admin:all", "read:users", "write:users", "manage:roles"]) - expect(first_role.type).to eq("EnvironmentRole") - expect(first_role.created_at).to eq("2024-03-15T15:38:29.521Z") - expect(first_role.updated_at).to eq("2024-11-14T17:08:00.556Z") - end - end - - it "handles roles with empty permissions arrays" do - VCR.use_cassette "organization/list_organization_roles" do - roles = described_class.list_organization_roles(organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE") - - platform_manager_role = roles.data.find { |role| role.slug == "org-platform-manager" } - expect(platform_manager_role).to be_a(WorkOS::Role) - expect(platform_manager_role.permissions).to eq([]) - end - end - - it "properly serializes Role objects including permissions" do - VCR.use_cassette "organization/list_organization_roles" do - roles = described_class.list_organization_roles(organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE") - - billing_role = roles.data.find { |role| role.slug == "billing" } - serialized = billing_role.to_json - - expect(serialized[:id]).to eq("role_01JA8GJZRDSZEB9289DQXJ3N9Z") - expect(serialized[:name]).to eq("Billing Manager") - expect(serialized[:slug]).to eq("billing") - expect(serialized[:permissions]).to eq(["read:billing", "write:billing"]) - expect(serialized[:type]).to eq("EnvironmentRole") - end - end - end - end - - describe ".list_organization_feature_flags" do - context "with no options" do - it "returns feature flags for organization" do - expected_metadata = { - after: nil, - before: nil - } - - VCR.use_cassette "organization/list_organization_feature_flags" do - feature_flags = described_class.list_organization_feature_flags( - organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529" - ) - - expect(feature_flags.data.size).to eq(2) - expect(feature_flags.list_metadata).to eq(expected_metadata) - end - end - end - - context "with the before option" do - it "forms the proper request to the API" do - request_args = [ - "/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?before=before-id&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do - feature_flags = described_class.list_organization_feature_flags( - organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", - options: {before: "before-id"} - ) - - expect(feature_flags.data.size).to eq(2) - end - end - end - - context "with the after option" do - it "forms the proper request to the API" do - request_args = [ - "/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?after=after-id&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do - feature_flags = described_class.list_organization_feature_flags( - organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", - options: {after: "after-id"} - ) - - expect(feature_flags.data.size).to eq(2) - end - end - end - - context "with the limit option" do - it "forms the proper request to the API" do - request_args = [ - "/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?limit=10&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do - feature_flags = described_class.list_organization_feature_flags( - organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", - options: {limit: 10} - ) - - expect(feature_flags.data.size).to eq(2) - end - end - end - - context "with multiple pagination options" do - it "forms the proper request to the API" do - request_args = [ - "/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?after=after-id&" \ - "limit=5&order=asc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do - feature_flags = described_class.list_organization_feature_flags( - organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", - options: {after: "after-id", limit: 5, order: "asc"} - ) - - expect(feature_flags.data.size).to eq(2) - end - end - end - end -end diff --git a/spec/lib/workos/passwordless_spec.rb b/spec/lib/workos/passwordless_spec.rb deleted file mode 100644 index 0dfed070..00000000 --- a/spec/lib/workos/passwordless_spec.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::Passwordless do - it_behaves_like "client" - - describe ".create_session" do - context "with valid options payload" do - let(:valid_options) do - { - email: "demo@workos-okta.com", - type: "MagicLink", - redirect_uri: "foo.com/auth/callback" - } - end - - it "creates a session" do - VCR.use_cassette("passwordless/create_session") do - response = described_class.create_session(valid_options) - - expect(response.email).to eq "demo@workos-okta.com" - end - end - end - - context "with invalid event payload" do - let(:invalid_options) do - {} - end - - it "raises an error" do - VCR.use_cassette("passwordless/create_session_invalid") do - expect do - described_class.create_session(invalid_options) - end.to raise_error( - WorkOS::UnprocessableEntityError, - /Status 422, Validation failed \(email: email must be a string; type: type must be a valid enum value\)/ - ) - end - end - end - end - - describe ".send_session" do - context "with valid session id" do - let(:valid_options) do - { - email: "demo@workos-okta.com", - type: "MagicLink" - } - end - - it "send a session" do - VCR.use_cassette("passwordless/send_session") do - response = described_class.send_session( - "passwordless_session_01EJC0F4KH42T11Y2DHPEB09BM" - ) - - expect(response["success"]).to eq true - end - end - end - - context "with invalid session id" do - it "raises an error" do - VCR.use_cassette("passwordless/send_session_invalid") do - expect do - described_class.send_session("session_123") - end.to raise_error( - WorkOS::UnprocessableEntityError, - /Status 422, The passwordless session 'session_123' has expired or is invalid./ - ) - end - end - end - end -end diff --git a/spec/lib/workos/portal_spec.rb b/spec/lib/workos/portal_spec.rb deleted file mode 100644 index 9c7bb06e..00000000 --- a/spec/lib/workos/portal_spec.rb +++ /dev/null @@ -1,116 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::Portal do - it_behaves_like "client" - - describe ".generate_link" do - let(:organization) { "org_01EHQMYV6MBK39QC5PZXHY59C3" } - - describe "with a valid organization" do - context "with the sso intent" do - it "returns an Admin Portal link" do - VCR.use_cassette "portal/generate_link_sso" do - portal_link = described_class.generate_link( - intent: "sso", - organization: organization - ) - - expect(portal_link).to eq( - "https://id.workos.com/portal/launch?secret=secret" - ) - end - end - end - - describe "with the dsync intent" do - it "returns an Admin Portal link" do - VCR.use_cassette "portal/generate_link_dsync" do - portal_link = described_class.generate_link( - intent: "dsync", - organization: organization - ) - - expect(portal_link).to eq( - "https://id.workos.com/portal/launch?secret=secret" - ) - end - end - end - - describe "with the audit_logs intent" do - it "returns an Admin Portal link" do - VCR.use_cassette "portal/generate_link_audit_logs", match_requests_on: %i[path body] do - portal_link = described_class.generate_link( - intent: "audit_logs", - organization: organization - ) - - expect(portal_link).to eq( - "https://id.workos.com/portal/launch?secret=secret" - ) - end - end - end - - describe "with the certificate_renewal intent" do - it "returns an Admin Portal link" do - VCR.use_cassette "portal/generate_link_certificate_renewal", match_requests_on: %i[path body] do - portal_link = described_class.generate_link( - intent: "certificate_renewal", - organization: organization - ) - - expect(portal_link).to eq( - "https://id.workos.com/portal/launch?secret=secret" - ) - end - end - end - end - - describe "with the domain_verification intent" do - it "returns an Admin Portal link" do - VCR.use_cassette "portal/generate_link_domain_verification", match_requests_on: %i[path body] do - portal_link = described_class.generate_link( - intent: "domain_verification", - organization: organization - ) - - expect(portal_link).to eq( - "https://id.workos.com/portal/launch?secret=secret" - ) - end - end - end - - describe "with an invalid organization" do - it "raises an error" do - VCR.use_cassette "portal/generate_link_invalid" do - expect do - described_class.generate_link( - intent: "sso", - organization: "bogus-id" - ) - end.to raise_error( - WorkOS::InvalidRequestError, - /Could not find an organization with the id, bogus-id/ - ) - end - end - end - - describe "with an invalid intent" do - it "raises an error" do - expect do - described_class.generate_link( - intent: "bogus-intent", - organization: organization - ) - end.to raise_error( - ArgumentError, - /bogus-intent is not a valid value/ - ) - end - end - end -end diff --git a/spec/lib/workos/role_spec.rb b/spec/lib/workos/role_spec.rb deleted file mode 100644 index 5f9ea193..00000000 --- a/spec/lib/workos/role_spec.rb +++ /dev/null @@ -1,142 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::Role do - describe ".initialize" do - context "with full role data including permissions" do - it "initializes all attributes correctly" do - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "Admin", - slug: "admin", - description: "Administrator role with full access", - permissions: ["read:users", "write:users", "admin:all"], - type: "system", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = described_class.new(role_json) - - expect(role.id).to eq("role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY") - expect(role.name).to eq("Admin") - expect(role.slug).to eq("admin") - expect(role.description).to eq("Administrator role with full access") - expect(role.permissions).to eq(["read:users", "write:users", "admin:all"]) - expect(role.type).to eq("system") - expect(role.created_at).to eq("2022-05-13T17:45:31.732Z") - expect(role.updated_at).to eq("2022-07-13T17:45:42.618Z") - end - end - - context "with role data without permissions" do - it "initializes permissions as empty array" do - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "User", - slug: "user", - description: "Basic user role", - type: "custom", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = described_class.new(role_json) - - expect(role.id).to eq("role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY") - expect(role.name).to eq("User") - expect(role.slug).to eq("user") - expect(role.description).to eq("Basic user role") - expect(role.permissions).to eq([]) - expect(role.type).to eq("custom") - expect(role.created_at).to eq("2022-05-13T17:45:31.732Z") - expect(role.updated_at).to eq("2022-07-13T17:45:42.618Z") - end - end - - context "with role data with null permissions" do - it "initializes permissions as empty array" do - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "User", - slug: "user", - description: "Basic user role", - permissions: nil, - type: "custom", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = described_class.new(role_json) - - expect(role.permissions).to eq([]) - end - end - - context "with role data with empty permissions array" do - it "preserves empty permissions array" do - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "User", - slug: "user", - description: "Basic user role", - permissions: [], - type: "custom", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = described_class.new(role_json) - - expect(role.permissions).to eq([]) - end - end - end - - describe ".to_json" do - context "with role that has permissions" do - it "includes permissions in serialized output" do - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "Admin", - slug: "admin", - description: "Administrator role", - permissions: ["read:all", "write:all"], - type: "system", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = described_class.new(role_json) - serialized = role.to_json - - expect(serialized[:id]).to eq("role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY") - expect(serialized[:name]).to eq("Admin") - expect(serialized[:slug]).to eq("admin") - expect(serialized[:description]).to eq("Administrator role") - expect(serialized[:permissions]).to eq(["read:all", "write:all"]) - expect(serialized[:type]).to eq("system") - expect(serialized[:created_at]).to eq("2022-05-13T17:45:31.732Z") - expect(serialized[:updated_at]).to eq("2022-07-13T17:45:42.618Z") - end - end - - context "with role that has no permissions" do - it "includes empty permissions array in serialized output" do - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "User", - slug: "user", - description: "Basic user role", - type: "custom", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = described_class.new(role_json) - serialized = role.to_json - - expect(serialized[:permissions]).to eq([]) - end - end - end -end diff --git a/spec/lib/workos/session_spec.rb b/spec/lib/workos/session_spec.rb deleted file mode 100644 index eda09ced..00000000 --- a/spec/lib/workos/session_spec.rb +++ /dev/null @@ -1,475 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::Session do - let(:client_id) { "test_client_id" } - let(:cookie_password) { "test_very_long_cookie_password__" } - let(:session_data) { "test_session_data" } - let(:jwks_url) { "https://api.workos.com/sso/jwks/client_123" } - let(:jwk) { JWT::JWK.new(OpenSSL::PKey::RSA.new(2048), {kid: "sso_oidc_key_pair_123", use: "sig", alg: "RS256"}) } - let(:jwks_hash) { {keys: [jwk.export]}.to_json } - - before do - allow(Net::HTTP).to receive(:get).and_return(jwks_hash) - end - - describe "initialize" do - let(:user_management) { instance_double("UserManagement") } - - before do - allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url) - end - - describe "JWKS caching" do - before do - WorkOS::Cache.clear - end - - it "caches and returns JWKS" do - expect(Net::HTTP).to receive(:get).once - session1 = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - - session2 = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - - expect(session1.jwks.map(&:export)).to eq(session2.jwks.map(&:export)) - end - - it "fetches JWKS from remote when cache is expired" do - expect(Net::HTTP).to receive(:get).twice - session1 = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - - allow(Time).to receive(:now).and_return(Time.now + 301) - - session2 = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - - expect(session1.jwks.map(&:export)).to eq(session2.jwks.map(&:export)) - end - end - - it "raises an error if cookie_password is nil or empty" do - expect do - WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: nil - ) - end.to raise_error(ArgumentError, "cookiePassword is required") - - expect do - WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: "" - ) - end.to raise_error(ArgumentError, "cookiePassword is required") - end - - it "initializes with valid parameters" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - expect(session.user_management).to eq(user_management) - expect(session.client_id).to eq(client_id) - expect(session.session_data).to eq(session_data) - expect(session.cookie_password).to eq(cookie_password) - expect(session.jwks.map(&:export)).to eq(JSON.parse(jwks_hash, symbolize_names: true)[:keys]) - expect(session.jwks_algorithms).to eq(["RS256"]) - end - end - - describe ".authenticate" do - let(:user_management) { instance_double("UserManagement") } - let(:payload) do - { - sid: "session_id", - org_id: "org_id", - role: "role", - roles: ["role"], - permissions: ["read"], - exp: Time.now.to_i + 3600 - } - end - let(:valid_access_token) { JWT.encode(payload, jwk.signing_key, jwk[:alg], {kid: jwk[:kid]}) } - let(:session_data) do - WorkOS::Session.seal_data({ - access_token: valid_access_token, - user: "user", - impersonator: "impersonator" - }, cookie_password) - end - - before do - allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url) - end - - it "returns NO_SESSION_COOKIE_PROVIDED if session_data is nil" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: nil, - cookie_password: cookie_password - ) - result = session.authenticate - expect(result).to eq({authenticated: false, reason: "NO_SESSION_COOKIE_PROVIDED"}) - end - - it "returns INVALID_SESSION_COOKIE if session_data is invalid" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: "invalid_data", - cookie_password: cookie_password - ) - result = session.authenticate - expect(result).to eq({authenticated: false, reason: "INVALID_SESSION_COOKIE"}) - end - - it "returns INVALID_JWT if access_token is invalid" do - invalid_session_data = WorkOS::Session.seal_data({access_token: "invalid_token"}, cookie_password) - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: invalid_session_data, - cookie_password: cookie_password - ) - result = session.authenticate - expect(result).to eq({authenticated: false, reason: "INVALID_JWT"}) - end - - it "returns INVALID_JWT without token data when session is expired" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) - allow(Time).to receive(:now).and_return(Time.at(9_999_999_999)) - result = session.authenticate - expect(result).to eq({authenticated: false, reason: "INVALID_JWT"}) - end - - it "returns INVALID_JWT with full token data when session is expired and include_expired is true" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) - allow(Time).to receive(:now).and_return(Time.at(9_999_999_999)) - result = session.authenticate(include_expired: true) - expect(result).to eq({ - authenticated: false, - session_id: "session_id", - organization_id: "org_id", - role: "role", - roles: ["role"], - permissions: ["read"], - feature_flags: nil, - entitlements: nil, - user: "user", - impersonator: "impersonator", - reason: "INVALID_JWT" - }) - end - - it "authenticates successfully with valid session_data" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) - result = session.authenticate - expect(result).to eq({ - authenticated: true, - session_id: "session_id", - organization_id: "org_id", - role: "role", - roles: ["role"], - permissions: ["read"], - feature_flags: nil, - entitlements: nil, - user: "user", - impersonator: "impersonator", - reason: nil - }) - end - - it "merges custom claims from claim_extractor block" do - custom_payload = payload.merge(custom_claim: "custom_value", another_claim: 123) - custom_access_token = JWT.encode(custom_payload, jwk.signing_key, jwk[:alg], {kid: jwk[:kid]}) - custom_session_data = WorkOS::Session.seal_data({ - access_token: custom_access_token, - user: "user", - impersonator: "impersonator" - }, cookie_password) - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: custom_session_data, - cookie_password: cookie_password - ) - allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) - result = session.authenticate do |jwt| - {my_custom_claim: jwt["custom_claim"], my_other_claim: jwt["another_claim"]} - end - expect(result[:authenticated]).to be true - expect(result[:my_custom_claim]).to eq("custom_value") - expect(result[:my_other_claim]).to eq(123) - end - - describe "with entitlements" do - let(:payload) do - { - sid: "session_id", - org_id: "org_id", - role: "role", - roles: ["role"], - permissions: ["read"], - entitlements: ["billing"], - exp: Time.now.to_i + 3600 - } - end - - it "includes entitlements in the result" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) - result = session.authenticate - expect(result).to eq({ - authenticated: true, - session_id: "session_id", - organization_id: "org_id", - role: "role", - roles: ["role"], - permissions: ["read"], - entitlements: ["billing"], - feature_flags: nil, - user: "user", - impersonator: "impersonator", - reason: nil - }) - end - end - - describe "with feature flags" do - let(:payload) do - { - sid: "session_id", - org_id: "org_id", - role: "role", - roles: ["role"], - permissions: ["read"], - feature_flags: ["new_feature_enabled"], - exp: Time.now.to_i + 3600 - } - end - - it "includes feature flags in the result" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) - result = session.authenticate - expect(result).to eq({ - authenticated: true, - session_id: "session_id", - organization_id: "org_id", - role: "role", - roles: ["role"], - permissions: ["read"], - entitlements: nil, - feature_flags: ["new_feature_enabled"], - user: "user", - impersonator: "impersonator", - reason: nil - }) - end - end - end - - describe ".refresh" do - let(:user_management) { instance_double("UserManagement") } - let(:refresh_token) { "test_refresh_token" } - let(:session_data) { WorkOS::Session.seal_data({refresh_token: refresh_token, user: "user"}, cookie_password) } - let(:auth_response) { double("AuthResponse", sealed_session: "new_sealed_session") } - - before do - allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url) - allow(user_management).to receive(:authenticate_with_refresh_token).and_return(auth_response) - end - - it "returns INVALID_SESSION_COOKIE if session_data is invalid" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: "invalid_data", - cookie_password: cookie_password - ) - result = session.refresh - expect(result).to eq({authenticated: false, reason: "INVALID_SESSION_COOKIE"}) - end - - it "refreshes the session successfully with valid session_data" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - result = session.refresh - expect(result).to eq({ - authenticated: true, - sealed_session: "new_sealed_session", - session: auth_response, - reason: nil - }) - end - end - - describe ".get_logout_url" do - let(:session) do - WorkOS::Session.new( - user_management: WorkOS::UserManagement, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - end - - context "when authentication is successful" do - before do - allow(session).to receive(:authenticate).and_return({ - authenticated: true, - session_id: "session_123abc", - reason: nil - }) - end - - it "returns the logout URL" do - expect(session.get_logout_url).to eq("https://api.workos.com/user_management/sessions/logout?session_id=session_123abc") - end - - context "when given a return_to URL" do - it "returns the logout URL with the return_to parameter" do - expect(session.get_logout_url(return_to: "https://example.com/signed-out")).to eq( - "https://api.workos.com/user_management/sessions/logout?session_id=session_123abc&return_to=https%3A%2F%2Fexample.com%2Fsigned-out" - ) - end - end - end - - context "when authentication fails" do - before do - allow(session).to receive(:authenticate).and_return({ - authenticated: false, - reason: "Invalid session" - }) - end - - it "raises an error" do - expect { session.get_logout_url }.to raise_error( - RuntimeError, "Failed to extract session ID for logout URL: Invalid session" - ) - end - end - end - - describe "custom encryptor" do - let(:user_management) { instance_double("UserManagement") } - let(:custom_encryptor) do - Class.new do - def seal(data, _key) - "CUSTOM:#{JSON.generate(data)}" - end - - def unseal(sealed_data, _key) - json = sealed_data.sub("CUSTOM:", "") - JSON.parse(json, symbolize_names: true) - end - end.new - end - - before do - allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url) - end - - it "uses custom encryptor for seal_data" do - sealed = WorkOS::Session.seal_data({foo: "bar"}, "key", encryptor: custom_encryptor) - expect(sealed).to start_with("CUSTOM:") - end - - it "uses custom encryptor for unseal_data" do - sealed = 'CUSTOM:{"foo":"bar"}' - unsealed = WorkOS::Session.unseal_data(sealed, "key", encryptor: custom_encryptor) - expect(unsealed).to eq({foo: "bar"}) - end - - it "accepts custom encryptor in initialize" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password, - encryptor: custom_encryptor - ) - expect(session.encryptor).to eq(custom_encryptor) - end - - it "defaults to AesGcm encryptor when none provided" do - session = WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password - ) - expect(session.encryptor).to be_a(WorkOS::Encryptors::AesGcm) - end - - it "raises ArgumentError for invalid encryptor" do - expect do - WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password, - encryptor: Object.new - ) - end.to raise_error(ArgumentError, /must respond to/) - end - end -end diff --git a/spec/lib/workos/sso_spec.rb b/spec/lib/workos/sso_spec.rb deleted file mode 100644 index 605b7b52..00000000 --- a/spec/lib/workos/sso_spec.rb +++ /dev/null @@ -1,756 +0,0 @@ -# frozen_string_literal: true - -require "securerandom" - -describe WorkOS::SSO do - it_behaves_like "client" - - describe ".authorization_url" do - context "with a domain" do - let(:args) do - { - domain: "foo.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ - "edit%22%7D&domain=foo.com" - ) - end - end - - context "with a provider" do - let(:args) do - { - provider: "GoogleOAuth", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ - "edit%22%7D&provider=GoogleOAuth" - ) - end - end - - context "with a connection" do - let(:args) do - { - connection: "connection_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ - "edit%22%7D&connection=connection_123" - ) - end - end - - context "with a domain" do - let(:args) do - { - domain: "foo.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ - "edit%22%7D&domain=foo.com" - ) - end - end - - context "with a domain_hint" do - let(:args) do - { - connection: "connection_123", - domain_hint: "foo.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2" \ - "Fedit%22%7D&domain_hint=foo.com&connection=connection_123" - ) - end - end - - context "with a login_hint" do - let(:args) do - { - connection: "connection_123", - login_hint: "foo@workos.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2" \ - "Fedit%22%7D&login_hint=foo%40workos.com&connection=connection_123" - ) - end - end - - context "with an organization" do - let(:args) do - { - organization: "org_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ - "edit%22%7D&organization=org_123" - ) - end - end - - context "with neither connection, domain, provider, or organization" do - let(:args) do - { - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "raises an error" do - expect do - described_class.authorization_url(**args) - end.to raise_error( - ArgumentError, - "Either connection, domain, provider, or organization is required." - ) - end - end - - context "with an invalid provider" do - let(:args) do - { - provider: "Okta", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "raises an error" do - expect do - described_class.authorization_url(**args) - end.to raise_error( - ArgumentError, - "Okta is not a valid value. `provider` must be in " \ - '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth"]' - ) - end - end - end - - describe ".get_profile" do - # rubocop:disable Metrics/BlockLength - it "returns a profile" do - VCR.use_cassette "sso/profile" do - profile = described_class.get_profile(access_token: "access_token") - - expectation = { - connection_id: "conn_01E83FVYZHY7DM4S9503JHV0R5", - connection_type: "GoogleOAuth", - email: "bob.loblaw@workos.com", - first_name: "Bob", - id: "prof_01EEJTY9SZ1R350RB7B73SNBKF", - idp_id: "116485463307139932699", - last_name: "Loblaw", - role: { - slug: "member" - }, - roles: [{ - slug: "member" - }], - groups: nil, - organization_id: "org_01FG53X8636WSNW2WEKB2C31ZB", - custom_attributes: {}, - raw_attributes: { - email: "bob.loblaw@workos.com", - family_name: "Loblaw", - given_name: "Bob", - hd: "workos.com", - id: "116485463307139932699", - locale: "en", - name: "Bob Loblaw", - picture: "https://lh3.googleusercontent.com/a-/AOh14GyO2hLlgZvteDQ3Ldi3_-RteZLya0hWH7247Cam=s96-c", - verified_email: true - } - } - expect(profile.to_json).to eq(expectation) - end - end - # rubocop:enable Metrics/BlockLength - end - - describe ".profile_and_token" do - let(:args) do - { - code: SecureRandom.hex(10), - client_id: "workos-proj-123" - } - end - - let(:request_body) do - { - client_id: args[:client_id], - client_secret: WorkOS.config.key, - code: args[:code], - grant_type: "authorization_code" - } - end - let(:user_agent) { "user-agent-string" } - let(:headers) { {"User-Agent" => user_agent} } - - before do - allow(described_class).to receive(:user_agent).and_return(user_agent) - end - - context "with a successful response" do - let(:response_body) { File.read("#{SPEC_ROOT}/support/profile.txt") } - - before do - stub_request(:post, "https://api.workos.com/sso/token") - .with(headers: headers, body: request_body) - .to_return(status: 200, body: response_body) - end - - it "includes the SDK Version header" do - described_class.profile_and_token(**args) - - expect(a_request(:post, "https://api.workos.com/sso/token") - .with(headers: headers, body: request_body)).to have_been_made - end - - it "returns a WorkOS::ProfileAndToken" do - profile_and_token = described_class.profile_and_token(**args) - expect(profile_and_token).to be_a(WorkOS::ProfileAndToken) - - expectation = { - connection_id: "conn_01EMH8WAK20T42N2NBMNBCYHAG", - connection_type: "OktaSAML", - email: "demo@workos-okta.com", - first_name: "WorkOS", - id: "prof_01DRA1XNSJDZ19A31F183ECQW5", - idp_id: "00u1klkowm8EGah2H357", - last_name: "Demo", - role: { - slug: "admin" - }, - roles: [{ - slug: "admin" - }], - groups: %w[Admins Developers], - organization_id: "org_01FG53X8636WSNW2WEKB2C31ZB", - custom_attributes: { - license: "professional" - }, - raw_attributes: { - email: "demo@workos-okta.com", - first_name: "WorkOS", - id: "prof_01DRA1XNSJDZ19A31F183ECQW5", - idp_id: "00u1klkowm8EGah2H357", - last_name: "Demo", - groups: %w[Admins Developers], - license: "professional" - } - } - - expect(profile_and_token.access_token).to eq("01DVX6QBS3EG6FHY2ESAA5Q65X") - expect(profile_and_token.profile.to_json).to eq(expectation) - end - end - - context "with an unprocessable request" do - before do - stub_request(:post, "https://api.workos.com/sso/token") - .with(headers: headers, body: request_body) - .to_return( - headers: {"X-Request-ID" => "request-id"}, - status: 422, - body: {error: "some error", error_description: "some error description"}.to_json - ) - end - - it "raises an exception with request ID" do - expect do - described_class.profile_and_token(**args) - end.to raise_error( - WorkOS::UnprocessableEntityError, - "Status 422, some error - request ID: request-id" - ) - end - - it "raises an exception with proper error object attributes" do - expect do - described_class.profile_and_token(**args) - end.to raise_error(WorkOS::UnprocessableEntityError) - end - - it "includes proper error attributes" do - error = begin - described_class.profile_and_token(**args) - rescue WorkOS::UnprocessableEntityError => e - e - end - - expect(error.http_status).to eq(422) - expect(error.request_id).to eq("request-id") - expect(error.error).to eq("some error") - expect(error.message).to include("some error") - end - end - - context "with detailed field validation errors" do - before do - stub_request(:post, "https://api.workos.com/sso/token") - .with(headers: headers, body: request_body) - .to_return( - headers: {"X-Request-ID" => "request-id"}, - status: 422, - body: { - message: "Validation failed", - code: "invalid_request_parameters", - errors: [ - { - field: "code", - code: "missing_required_parameter", - message: "The code parameter is required" - } - ] - }.to_json - ) - end - - it "raises an exception with detailed field errors" do - expect do - described_class.profile_and_token(**args) - end.to raise_error(WorkOS::UnprocessableEntityError) - end - - it "includes detailed field error attributes" do - error = begin - described_class.profile_and_token(**args) - rescue WorkOS::UnprocessableEntityError => e - e - end - - expect(error.http_status).to eq(422) - expect(error.request_id).to eq("request-id") - expect(error.code).to eq("invalid_request_parameters") - expect(error.errors).not_to be_nil - expect(error.errors).to include("code: missing_required_parameter") - expect(error.message).to include("Validation failed") - expect(error.message).to include("(code: missing_required_parameter)") - end - end - - context "with an expired code" do - before do - stub_request(:post, "https://api.workos.com/sso/token") - .with(body: request_body) - .to_return( - status: 400, - headers: {"X-Request-ID" => "request-id"}, - body: { - error: "invalid_grant", - error_description: "The code '01DVX3C5Z367SFHR8QNDMK7V24' has expired or is invalid." - }.to_json - ) - end - - it "raises an exception" do - expect do - described_class.profile_and_token(**args) - end.to raise_error( - WorkOS::InvalidRequestError, - "Status 400, error: invalid_grant, error_description: The code '01DVX3C5Z367SFHR8QNDMK7V24'" \ - " has expired or is invalid. - request ID: request-id" - ) - end - - it "raises an exception with proper error object attributes" do - expect do - described_class.profile_and_token(**args) - end.to raise_error(WorkOS::InvalidRequestError) - end - - it "includes proper error attributes" do - error = begin - described_class.profile_and_token(**args) - rescue WorkOS::InvalidRequestError => e - e - end - - expect(error.http_status).to eq(400) - expect(error.request_id).to eq("request-id") - expect(error.error).to eq("invalid_grant") - expect(error.error_description).to eq("The code '01DVX3C5Z367SFHR8QNDMK7V24' has expired or is invalid.") - expect(error.message).to include("invalid_grant") - end - end - end - - describe ".list_connections" do - context "with no options" do - it "returns connections and metadata" do - expected_metadata = { - "after" => nil, - "before" => "before_id" - } - - VCR.use_cassette "sso/list_connections/with_no_options" do - connections = described_class.list_connections - - expect(connections.data.size).to eq(6) - expect(connections.list_metadata).to eq(expected_metadata) - end - end - end - - context "with connection_type option" do - it "forms the proper request to the API" do - request_args = [ - "/connections?connection_type=OktaSAML&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "sso/list_connections/with_connection_type" do - connections = described_class.list_connections( - connection_type: "OktaSAML" - ) - - expect(connections.data.size).to eq(10) - expect(connections.data.first.connection_type).to eq("OktaSAML") - end - end - end - - context "with domain option" do - it "forms the proper request to the API" do - request_args = [ - "/connections?domain=foo-corp.com&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "sso/list_connections/with_domain" do - connections = described_class.list_connections( - domain: "foo-corp.com" - ) - - expect(connections.data.size).to eq(1) - end - end - end - - context "with organization_id option" do - it "forms the proper request to the API" do - request_args = [ - "/connections?organization_id=org_01F9293WD2PDEEV4Y625XPZVG7&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "sso/list_connections/with_organization_id" do - connections = described_class.list_connections( - organization_id: "org_01F9293WD2PDEEV4Y625XPZVG7" - ) - - expect(connections.data.size).to eq(1) - expect(connections.data.first.organization_id).to eq( - "org_01F9293WD2PDEEV4Y625XPZVG7" - ) - end - end - end - - context "with limit option" do - it "forms the proper request to the API" do - request_args = [ - "/connections?limit=2&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "sso/list_connections/with_limit" do - connections = described_class.list_connections( - limit: 2 - ) - - expect(connections.data.size).to eq(2) - end - end - end - - context "with before option" do - it "forms the proper request to the API" do - request_args = [ - "/connections?before=conn_01FA3WGCWPCCY1V2FGES2FDNP7&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "sso/list_connections/with_before" do - connections = described_class.list_connections( - before: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" - ) - - expect(connections.data.size).to eq(3) - end - end - end - - context "with after option" do - it "forms the proper request to the API" do - request_args = [ - "/connections?after=conn_01FA3WGCWPCCY1V2FGES2FDNP7&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "sso/list_connections/with_after" do - connections = described_class.list_connections( - after: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" - ) - - expect(connections.data.size).to eq(2) - end - end - end - end - - describe ".get_connection" do - context "with a valid id" do - it "gets the connection details" do - VCR.use_cassette("sso/get_connection_with_valid_id") do - connection = WorkOS::SSO.get_connection( - id: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" - ) - - expect(connection.id).to eq("conn_01FA3WGCWPCCY1V2FGES2FDNP7") - expect(connection.connection_type).to eq("OktaSAML") - expect(connection.name).to eq("Foo Corp") - expect(connection.domains.first[:domain]).to eq("foo-corp.com") - end - end - end - - context "with an invalid id" do - it "raises an error" do - VCR.use_cassette("sso/get_connection_with_invalid_id") do - expect do - WorkOS::SSO.get_connection(id: "invalid") - end.to raise_error( - WorkOS::NotFoundError, - "Status 404, Not Found - request ID: " - ) - end - end - end - end - - describe ".delete_connection" do - context "with a valid id" do - it "returns true" do - VCR.use_cassette("sso/delete_connection_with_valid_id") do - response = WorkOS::SSO.delete_connection( - id: "conn_01EX55FRVN1V2PCA9YWTMZQMMQ" - ) - - expect(response).to be(true) - end - end - end - - context "with an invalid id" do - it "returns false" do - VCR.use_cassette("sso/delete_connection_with_invalid_id") do - expect do - WorkOS::SSO.delete_connection(id: "invalid") - end.to raise_error( - WorkOS::NotFoundError, - "Status 404, Not Found - request ID: " - ) - end - end - end - end -end diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb deleted file mode 100644 index 2892cf01..00000000 --- a/spec/lib/workos/user_management_spec.rb +++ /dev/null @@ -1,1999 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::UserManagement do - it_behaves_like "client" - - describe ".authorization_url" do - context "with a provider" do - let(:args) do - { - provider: "authkit", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ - "edit%22%7D&provider=authkit" - ) - end - - context "with provider_scopes" do - it "returns a valid authorization URL that includes provider_scopes" do - url = WorkOS::UserManagement.authorization_url( - provider: "GoogleOAuth", - provider_scopes: %w[custom-scope-1 custom-scope-2], - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - ) - - expect(url).to eq( - "https://api.workos.com/user_management/authorize?" \ - "client_id=workos-proj-123" \ - "&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code" \ - "&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ - "edit%22%7D" \ - "&provider=GoogleOAuth" \ - "&provider_scopes=custom-scope-1" \ - "&provider_scopes=custom-scope-2" - ) - end - end - end - - context "with a connection selector" do - let(:args) do - { - connection_id: "connection_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ - "edit%22%7D&connection_id=connection_123" - ) - end - end - - context "with an organization selector" do - let(:args) do - { - organization_id: "org_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ - "edit%22%7D&organization_id=org_123" - ) - end - end - - context "with a domain hint" do - let(:args) do - { - connection_id: "connection_123", - domain_hint: "foo.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2" \ - "Fedit%22%7D&domain_hint=foo.com&connection_id=connection_123" - ) - end - end - - context "with a login hint" do - let(:args) do - { - connection_id: "connection_123", - login_hint: "foo@workos.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2" \ - "Fedit%22%7D&login_hint=foo%40workos.com&connection_id=connection_123" - ) - end - end - - context "with a screen hint" do - let(:args) do - { - provider: "authkit", - screen_hint: "sign_up", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "returns a valid URL" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url)).to be_a URI - end - - it "returns the expected hostname" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).host).to eq(WorkOS.config.api_hostname) - end - - it "returns the expected query string" do - authorization_url = described_class.authorization_url(**args) - - expect(URI.parse(authorization_url).query).to eq( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdashboard%2F" \ - "edit%22%7D&screen_hint=sign_up&provider=authkit" - ) - end - end - - context "with neither connection_id, organization_id or provider" do - let(:args) do - { - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "raises an error" do - expect do - described_class.authorization_url(**args) - end.to raise_error( - ArgumentError, - "Either connection ID, organization ID, or provider is required." - ) - end - end - - context "with an invalid provider" do - let(:args) do - { - provider: "Okta", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: { - next_page: "/dashboard/edit" - }.to_s - } - end - it "raises an error" do - expect do - described_class.authorization_url(**args) - end.to raise_error( - ArgumentError, - "Okta is not a valid value. `provider` must be in " \ - '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth", "authkit"]' - ) - end - end - end - - describe ".get_user" do - context "with a valid id" do - it "returns a user" do - VCR.use_cassette "user_management/get_user" do - user = described_class.get_user( - id: "user_01HP0B4ZV2FWWVY0BF16GFDAER" - ) - - expect(user.id.instance_of?(String)) - expect(user.instance_of?(WorkOS::User)) - expect(user.first_name).to eq("Bob") - expect(user.last_name).to eq("Loblaw") - expect(user.email).to eq("bob@example.com") - expect(user.email_verified).to eq(false) - expect(user.profile_picture_url).to eq(nil) - expect(user.last_sign_in_at).to eq("2024-02-06T23:13:18.137Z") - end - end - end - - context "with an invalid id" do - it "returns an error" do - expect do - described_class.get_user( - id: "invalid_user_id" - ).to raise_error(WorkOS::APIError) - end - end - end - end - - describe ".list_users" do - context "with no options" do - it "returns a list of users" do - expected_metadata = { - "after" => nil, - "before" => "before-id" - } - - VCR.use_cassette "user_management/list_users/no_options" do - users = described_class.list_users - - expect(users.data.size).to eq(2) - expect(users.list_metadata).to eq(expected_metadata) - end - end - end - - context "with options" do - it "returns a list of matching users" do - request_args = [ - "/user_management/users?email=lucy.lawless%40example.com&" \ - "order=desc&" \ - "limit=5", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "user_management/list_users/with_options" do - users = described_class.list_users( - email: "lucy.lawless@example.com", - order: "desc", - limit: "5" - ) - - expect(users.data.size).to eq(1) - expect(users.data[0].email).to eq("lucy.lawless@example.com") - end - end - end - end - - describe ".create_user" do - context "with a valid payload" do - it "creates a user" do - VCR.use_cassette "user_management/create_user_valid" do - user = described_class.create_user( - email: "foo@example.com", - first_name: "Foo", - last_name: "Bar", - email_verified: true - ) - - expect(user.first_name).to eq("Foo") - expect(user.last_name).to eq("Bar") - expect(user.email).to eq("foo@example.com") - end - end - - it "only sends non-nil values in request body" do - expect(described_class).to receive(:post_request) do |options| - body = options[:body] - expect(body).to eq({email: "test@example.com", first_name: "John"}) - expect(body).not_to have_key(:last_name) - expect(body).not_to have_key(:email_verified) - - double("request") - end.and_return(double("request")) - - expect(described_class).to receive(:execute_request).and_return( - double("response", body: '{"id": "test_user", "email": "test@example.com"}') - ) - - described_class.create_user( - email: "test@example.com", - first_name: "John" - ) - end - - it "creates a user with external_id" do - VCR.use_cassette "user_management/create_user_with_external_id" do - user = described_class.create_user( - email: "external@example.com", - first_name: "External", - last_name: "User", - external_id: "ext_user_123" - ) - - expect(user.first_name).to eq("External") - expect(user.last_name).to eq("User") - expect(user.email).to eq("external@example.com") - expect(user.external_id).to eq("ext_user_123") - end - end - - context "with an invalid payload" do - it "returns an error" do - VCR.use_cassette "user_management/create_user_invalid" do - expect do - described_class.create_user(email: "") - end.to raise_error( - WorkOS::UnprocessableEntityError, - /email_string_required/ - ) - end - end - end - end - end - - describe ".update_user" do - context "with a valid payload" do - it "update_user a user" do - VCR.use_cassette "user_management/update_user/valid" do - user = described_class.update_user( - id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - first_name: "Jane", - last_name: "Doe", - email_verified: false, - external_id: "123" - ) - expect(user.first_name).to eq("Jane") - expect(user.last_name).to eq("Doe") - expect(user.email_verified).to eq(false) - expect(user.external_id).to eq("123") - end - end - - it "can update user locale" do - VCR.use_cassette "user_management/update_user/locale" do - user = described_class.update_user( - id: "user_01K78B3ZB5B7119MYEXTQE5KNE", - locale: "en-US" - ) - expect(user.locale).to eq("en-US") - end - end - - it "can update email addresses" do - VCR.use_cassette "user_management/update_user/email" do - user = described_class.update_user( - id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - email: "jane@example.com" - ) - expect(user.email).to eq("jane@example.com") - expect(user.email_verified).to eq(false) - end - end - - it "only sends non-nil values in request body" do - # Mock the request to inspect what's being sent - expect(described_class).to receive(:put_request) do |options| - # Verify that the body only contains non-nil values - body = options[:body] - expect(body).to eq({email_verified: true}) - expect(body).not_to have_key(:first_name) - expect(body).not_to have_key(:last_name) - expect(body).not_to have_key(:email) - expect(body).not_to have_key(:locale) - - # Return a mock request object - double("request") - end.and_return(double("request")) - - expect(described_class).to receive(:execute_request).and_return( - double("response", body: '{"id": "test_user", "email_verified": true}') - ) - - described_class.update_user( - id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - email_verified: true - ) - end - - it "can set external_id to null explicitly" do - original_method = described_class.method(:put_request) - allow(described_class).to receive(:put_request) do |kwargs| - original_method.call(**kwargs) - end - - VCR.use_cassette "user_management/update_user_external_id_null" do - described_class.update_user( - id: "user_01K0SR53HJ58M957MYAB6TDZ9X", - first_name: "John", - external_id: nil - ) - end - - expect(described_class).to have_received(:put_request).with( - hash_including(body: hash_including(external_id: nil)) - ) - end - - context "with an invalid payload" do - it "returns an error" do - VCR.use_cassette "user_management/update_user/invalid" do - expect do - described_class.update_user(id: "invalid") - end.to raise_error(WorkOS::NotFoundError, /User not found/) - end - end - end - end - end - - describe ".delete_user" do - context "with a valid id" do - it "returns true" do - VCR.use_cassette("user_management/delete_user/valid") do - response = WorkOS::UserManagement.delete_user( - id: "user_01H7WRJBPAAHX1BYRQHEK7QC4A" - ) - - expect(response).to be(true) - end - end - end - - context "with an invalid id" do - it "raises an error" do - VCR.use_cassette("user_management/delete_user/invalid") do - expect do - WorkOS::UserManagement.delete_user(id: "invalid") - end.to raise_error(WorkOS::NotFoundError, /User not found/) - end - end - end - end - - describe ".authenticate_with_password" do - context "with a valid password" do - it "returns user" do - VCR.use_cassette("user_management/authenticate_with_password/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_password( - email: "test@workos.app", - password: "7YtYic00VWcXatPb", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - expect(authentication_response.user.id).to eq("user_01H7TVSKS45SDHN5V9XPSM6H44") - end - end - end - - context "with an invalid user" do - it "raises an error" do - VCR.use_cassette("user_management/authenticate_with_password/invalid") do - expect do - WorkOS::UserManagement.authenticate_with_password( - email: "invalid@workos.app", - password: "invalid", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end.to raise_error(WorkOS::NotFoundError, /User not found/) - end - end - end - - context "with an unverified user" do - it "raises a ForbiddenRequestError" do - VCR.use_cassette("user_management/authenticate_with_password/unverified") do - expect do - WorkOS::UserManagement.authenticate_with_password( - email: "unverified@workos.app", - password: "7YtYic00VWcXatPb", - client_id: "client_123" - ) - end.to raise_error(WorkOS::ForbiddenRequestError, /Email ownership must be verified before authentication/) - end - end - end - - context "with an invitation_token" do - it "includes invitation_token in the request body" do - expect(described_class).to receive(:post_request) do |options| - body = options[:body] - expect(body[:invitation_token]).to eq("invitation_token_123") - - double("request") - end.and_return(double("request")) - - expect(described_class).to receive(:execute_request).and_return( - double("response", body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}') - ) - - described_class.authenticate_with_password( - email: "test@workos.app", - password: "password123", - client_id: "client_123", - invitation_token: "invitation_token_123" - ) - end - end - end - - describe ".authenticate_with_code" do - context "with a valid code" do - it "returns user" do - VCR.use_cassette("user_management/authenticate_with_code/valid") do - authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - expect(authentication_response.user.id).to eq("user_01H93ZY4F80YZRRS6N59Z2HFVS") - expect(authentication_response.access_token).to eq("") - expect(authentication_response.refresh_token).to eq("") - end - end - - context "when oauth_tokens is present in the api response" do - it "returns an oauth_tokens object" do - VCR.use_cassette("user_management/authenticate_with_code/valid_with_oauth_tokens") do - authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - - expect(authentication_response.oauth_tokens).to be_a(WorkOS::OAuthTokens) - expect(authentication_response.oauth_tokens.access_token).to eq("oauth_access_token") - expect(authentication_response.oauth_tokens.refresh_token).to eq("oauth_refresh_token") - expect(authentication_response.oauth_tokens.scopes).to eq(%w[read write]) - expect(authentication_response.oauth_tokens.expires_at).to eq(1_234_567_890) - end - end - end - - context "when oauth_tokens is not present in the api response" do - it "returns nil oauth_tokens" do - VCR.use_cassette("user_management/authenticate_with_code/valid") do - authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - - expect(authentication_response.oauth_tokens).to be_nil - end - end - end - - context "when the user is being impersonated" do - it "contains the impersonator metadata" do - VCR.use_cassette("user_management/authenticate_with_code/valid_with_impersonator") do - authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: "01HRX85ATQB2MN40K4FZ9C2HFR", - client_id: "client_01GS91XFB2YPR1C0NR5SH758Q0" - ) - - expect(authentication_response.impersonator).to have_attributes( - email: "admin@foocorp.com", - reason: "For testing." - ) - end - end - end - end - - context "with an invalid code" do - it "raises an error" do - VCR.use_cassette("user_management/authenticate_with_code/invalid") do - expect do - WorkOS::UserManagement.authenticate_with_code( - code: "invalid", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) - end - end - end - - context "with an invitation_token" do - it "includes invitation_token in the request body" do - expect(described_class).to receive(:post_request) do |options| - body = options[:body] - expect(body[:invitation_token]).to eq("invitation_token_123") - - double("request") - end.and_return(double("request")) - - expect(described_class).to receive(:execute_request).and_return( - double("response", body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}') - ) - - described_class.authenticate_with_code( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - invitation_token: "invitation_token_123" - ) - end - end - end - - describe ".authenticate_with_refresh_token" do - context "with a valid refresh_token" do - it "returns user" do - VCR.use_cassette("user_management/authenticate_with_refresh_token/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_refresh_token( - refresh_token: "some_refresh_token", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - expect(authentication_response.access_token).to eq("") - expect(authentication_response.refresh_token).to eq("") - expect(authentication_response.user.id).to eq("user_01H93WD0R0KWF8Q7BK02C0RPYJ") - end - end - end - - context "with an invalid refresh_token" do - it "raises an error" do - VCR.use_cassette("user_management/authenticate_with_refresh_code/invalid", tag: :token) do - expect do - WorkOS::UserManagement.authenticate_with_refresh_token( - refresh_token: "invalid", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) - end - end - end - end - - describe ".authenticate_with_magic_auth" do - context "with a valid code" do - it "returns user" do - VCR.use_cassette("user_management/authenticate_with_magic_auth/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_magic_auth( - code: "452079", - client_id: "project_01EGKAEB7G5N88E83MF99J785F", - email: "test@workos.com", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - expect(authentication_response.user.id).to eq("user_01H93WD0R0KWF8Q7BK02C0RPYJ") - end - end - end - - context "with an invalid code" do - it "returns an error" do - VCR.use_cassette("user_management/authenticate_with_magic_auth/invalid", tag: :token) do - expect do - WorkOS::UserManagement.authenticate_with_magic_auth( - code: "invalid", - client_id: "client_123", - email: "test@workos.com" - ) - end.to raise_error(WorkOS::NotFoundError, /User not found/) - end - end - end - - context "with an invitation_token" do - it "includes invitation_token in the request body" do - expect(described_class).to receive(:post_request) do |options| - body = options[:body] - expect(body[:invitation_token]).to eq("invitation_token_123") - - double("request") - end.and_return(double("request")) - - expect(described_class).to receive(:execute_request).and_return( - double("response", body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}') - ) - - described_class.authenticate_with_magic_auth( - code: "452079", - client_id: "client_123", - email: "test@workos.com", - invitation_token: "invitation_token_123" - ) - end - end - end - - describe ".authenticate_with_organization_selection" do - context "with a valid code" do - it "returns user" do - VCR.use_cassette("user_management/authenticate_with_organization_selection/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_organization_selection( - client_id: "project_01EGKAEB7G5N88E83MF99J785F", - organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", - pending_authentication_token: "pending_authentication_token_1234", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - expect(authentication_response.user.id).to eq("user_01H93WD0R0KWF8Q7BK02C0RPYJ") - expect(authentication_response.organization_id).to eq("org_01H5JQDV7R7ATEYZDEG0W5PRYS") - end - end - end - - context "with an invalid token" do - it "returns an error" do - VCR.use_cassette("user_management/authenticate_with_organization_selection/invalid", tag: :token) do - expect do - WorkOS::UserManagement.authenticate_with_organization_selection( - organization_id: "invalid_org_id", - client_id: "project_01EGKAEB7G5N88E83MF99J785F", - pending_authentication_token: "pending_authentication_token_1234" - ) - end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) - end - end - end - end - - describe ".authenticate_with_totp" do - context "with a valid code" do - it "returns user" do - VCR.use_cassette("user_management/authenticate_with_totp/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_totp( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - pending_authentication_token: "pending_authentication_token_1234", - authentication_challenge_id: "authentication_challenge_id", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - expect(authentication_response.user.id).to eq("user_01H93ZY4F80YZRRS6N59Z2HFVS") - end - end - end - - context "with an invalid code" do - it "raises an error" do - VCR.use_cassette("user_management/authenticate_with_totp/invalid", tag: :token) do - expect do - WorkOS::UserManagement.authenticate_with_totp( - code: "invalid", - client_id: "client_123", - pending_authentication_token: "pending_authentication_token_1234", - authentication_challenge_id: "authentication_challenge_id", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) - end - end - end - end - - describe ".authenticate_with_email_verification" do - context "with a valid code" do - it "returns user" do - VCR.use_cassette("user_management/authenticate_with_email_verification/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_email_verification( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - pending_authentication_token: "pending_authentication_token_1234", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - expect(authentication_response.user.id).to eq("user_01H93ZY4F80YZRRS6N59Z2HFVS") - end - end - end - - context "with an invalid code" do - it "raises an error" do - VCR.use_cassette("user_management/authenticate_with_email_verification/invalid", tag: :token) do - expect do - WorkOS::UserManagement.authenticate_with_email_verification( - code: "invalid", - client_id: "client_123", - pending_authentication_token: "pending_authentication_token_1234", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) - end - end - end - end - - describe ".get_magic_auth" do - context "with a valid id" do - it "returns a magic_auth object" do - VCR.use_cassette "user_management/get_magic_auth/valid" do - magic_auth = described_class.get_magic_auth( - id: "magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9" - ) - - expect(magic_auth.id.instance_of?(String)) - expect(magic_auth.instance_of?(WorkOS::MagicAuth)) - end - end - end - - context "with an invalid id" do - it "raises an error" do - VCR.use_cassette("user_management/get_magic_auth/invalid") do - expect do - WorkOS::UserManagement.get_magic_auth(id: "invalid") - end.to raise_error(WorkOS::NotFoundError, /MagicAuth not found/) - end - end - end - end - - describe ".create_magic_auth" do - context "with valid payload" do - it "creates a magic_auth" do - VCR.use_cassette "user_management/create_magic_auth/valid" do - magic_auth = described_class.create_magic_auth( - email: "test@workos.com" - ) - - expect(magic_auth.id).to eq("magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9") - expect(magic_auth.email).to eq("test@workos.com") - end - end - end - end - - describe ".send_magic_auth_code" do - context "with valid parameters" do - it "sends a magic link to the email address" do - VCR.use_cassette "user_management/send_magic_auth_code/valid" do - described_class.send_magic_auth_code( - email: "test@gmail.com" - ) - end - end - end - end - - describe ".enroll_auth_factor" do - context "with a valid user_id and auth factor type" do - it "returns an auth factor and challenge" do - VCR.use_cassette("user_management/enroll_auth_factor/valid") do - authentication_response = WorkOS::UserManagement.enroll_auth_factor( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - type: "totp", - totp_secret: "secret-test" - ) - - expect(authentication_response.authentication_factor.id).to eq("auth_factor_01H96FETXENNY99ARX0GRC804C") - expect(authentication_response.authentication_challenge.id).to eq("auth_challenge_01H96FETXGTW1QMBSBT2T36PW0") - end - end - - it "only sends non-nil values in request body" do - expect(described_class).to receive(:post_request) do |options| - body = options[:body] - expect(body).to eq({type: "totp", totp_issuer: "Test App"}) - expect(body).not_to have_key(:totp_user) - expect(body).not_to have_key(:totp_secret) - - double("request") - end.and_return(double("request")) - - expect(described_class).to receive(:execute_request).and_return( - double("response", - body: '{"authentication_factor": {"id": "test"}, "authentication_challenge": {"id": "test"}}') - ) - - described_class.enroll_auth_factor( - user_id: "user_123", - type: "totp", - totp_issuer: "Test App" - ) - end - end - - context "with an incorrect user id" do - it "raises an error" do - VCR.use_cassette("user_management/enroll_auth_factor/invalid") do - expect do - WorkOS::UserManagement.enroll_auth_factor( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - type: "totp" - ) - end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) - end - end - end - - context "with an invalid auth factor type" do - it "raises an error" do - expect do - described_class.enroll_auth_factor(user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - type: "invalid-factor") - end.to raise_error( - ArgumentError, - 'invalid-factor is not a valid value. `type` must be in ["totp"]' - ) - end - end - end - - describe ".list_auth_factors" do - context "with a valid user_id" do - it "returns a list of auth factors" do - VCR.use_cassette("user_management/list_auth_factors/valid") do - authentication_response = WorkOS::UserManagement.list_auth_factors( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" - ) - - expect(authentication_response.data.first.id).to eq("auth_factor_01H96FETXENNY99ARX0GRC804C") - end - end - end - context "with an incorrect user id" do - it "raises an error" do - VCR.use_cassette("user_management/list_auth_factors/invalid") do - expect do - WorkOS::UserManagement.list_auth_factors( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" - ) - end.to raise_error(WorkOS::InvalidRequestError, /Status 400/) - end - end - end - end - - describe ".get_email_verification" do - context "with a valid id" do - it "returns an email_verification object" do - VCR.use_cassette "user_management/get_email_verification/valid" do - email_verification = described_class.get_email_verification( - id: "email_verification_01HYK9VKNJQ0MJDXEXQP0DA1VK" - ) - - expect(email_verification.id.instance_of?(String)) - expect(email_verification.instance_of?(WorkOS::EmailVerification)) - end - end - end - - context "with an invalid id" do - it "raises an error" do - VCR.use_cassette("user_management/get_email_verification/invalid") do - expect do - WorkOS::UserManagement.get_email_verification(id: "invalid") - end.to raise_error(WorkOS::NotFoundError, /Email Verification not found/) - end - end - end - end - - describe ".send_verification_email" do - context "with valid parameters" do - it "sends an email to that user and the magic auth challenge" do - VCR.use_cassette "user_management/send_verification_email/valid" do - verification_response = described_class.send_verification_email( - user_id: "user_01H93WD0R0KWF8Q7BK02C0RPYJ" - ) - expect(verification_response.user.id).to eq("user_01H93WD0R0KWF8Q7BK02C0RPYJ") - end - end - end - - context "when the user does not exist" do - it "returns an error" do - VCR.use_cassette "user_management/send_verification_email/invalid" do - expect do - described_class.send_verification_email( - user_id: "bad_id" - ) - end.to raise_error(WorkOS::NotFoundError, /User not found/) - end - end - end - end - - describe ".verify_email" do - context "with valid parameters" do - it "verifies the email and returns the user" do - VCR.use_cassette "user_management/verify_email/valid" do - verify_response = described_class.verify_email( - code: "333495", - user_id: "user_01H968BR1R84DSPYS9QR5PM6RZ" - ) - - expect(verify_response.user.id).to eq("user_01H968BR1R84DSPYS9QR5PM6RZ") - end - end - end - - context "with invalid parameters" do - context "when the id does not exist" do - it "raises an error" do - VCR.use_cassette "user_management/verify_email/invalid_magic_auth_challenge" do - expect do - described_class.verify_email( - code: "659770", - user_id: "bad_id" - ) - end.to raise_error(WorkOS::NotFoundError, /User not found/) - end - end - end - - context "when the code is incorrect" do - it "raises an error" do - VCR.use_cassette "user_management/verify_email/invalid_code" do - expect do - described_class.verify_email( - code: "000000", - user_id: "user_01H93WD0R0KWF8Q7BK02C0RPYJ" - ) - end.to raise_error(WorkOS::InvalidRequestError, /Email verification code is incorrect/) - end - end - end - end - end - - describe ".get_password_reset" do - context "with a valid id" do - it "returns a password_reset object" do - VCR.use_cassette "user_management/get_password_reset/valid" do - password_reset = described_class.get_password_reset( - id: "password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT" - ) - - expect(password_reset.id.instance_of?(String)) - expect(password_reset.instance_of?(WorkOS::PasswordReset)) - end - end - end - - context "with an invalid id" do - it "raises an error" do - VCR.use_cassette("user_management/get_password_reset/invalid") do - expect do - WorkOS::UserManagement.get_password_reset(id: "invalid") - end.to raise_error(WorkOS::NotFoundError, /Password Reset not found/) - end - end - end - end - - describe ".create_password_reset" do - context "with valid payload" do - it "creates a password_reset object" do - VCR.use_cassette "user_management/create_password_reset/valid" do - password_reset = described_class.create_password_reset( - email: "test@workos.com" - ) - - expect(password_reset.id).to eq("password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT") - expect(password_reset.email).to eq("test@workos.com") - end - end - end - end - - describe ".send_password_reset_email" do - context "with a valid payload" do - it "sends a password reset email" do - VCR.use_cassette "user_management/send_password_reset_email/valid" do - response = described_class.send_password_reset_email( - email: "lucy.lawless@example.com", - password_reset_url: "https://example.com/reset" - ) - - expect(response).to be(true) - end - end - end - - context "with an invalid payload" do - it "returns an error" do - VCR.use_cassette "user_management/send_password_reset_email/invalid" do - expect do - described_class.send_password_reset_email( - email: "foo@bar.com", - password_reset_url: "" - ) - end.to raise_error( - WorkOS::UnprocessableEntityError, - /password_reset_url_string_required/ - ) - end - end - end - end - - describe ".reset_password" do - context "with a valid payload" do - it "resets the password and returns the user" do - VCR.use_cassette "user_management/reset_password/valid" do - user = described_class.reset_password( - token: "eEgAgvAE0blvU1zWV3yWVAD22", - new_password: "very_cool_new_pa$$word" - ) - - expect(user.email).to eq("lucy.lawless@example.com") - end - end - end - - context "with an invalid payload" do - it "returns an error" do - VCR.use_cassette "user_management/reset_password/invalid" do - expect do - described_class.reset_password( - token: "bogus_token", - new_password: "new_password" - ) - end.to raise_error( - WorkOS::NotFoundError, - /Could not locate user with provided token/ - ) - end - end - end - end - - describe ".get_organization_membership" do - context "with a valid id" do - it "returns a organization membership" do - VCR.use_cassette "user_management/get_organization_membership" do - organization_membership = described_class.get_organization_membership( - id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - expect(organization_membership.id.instance_of?(String)) - expect(organization_membership.instance_of?(WorkOS::OrganizationMembership)) - end - end - end - - context "with an invalid id" do - it "returns an error" do - expect do - described_class.get_organization_membership( - id: "invalid_organization_membership_id" - ).to raise_error(WorkOS::APIError) - end - end - end - end - - describe ".list_organization_memberships" do - context "with no options" do - it "returns a list of users" do - expected_metadata = { - "after" => nil, - "before" => "before-id" - } - - VCR.use_cassette "user_management/list_organization_memberships/no_options" do - organization_memberships = described_class.list_organization_memberships - - expect(organization_memberships.data.size).to eq(2) - expect(organization_memberships.list_metadata).to eq(expected_metadata) - end - end - end - - context "with options" do - it "returns a list of matching users" do - request_args = [ - "/user_management/organization_memberships?user_id=user_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ - "order=desc&limit=5", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "user_management/list_organization_memberships/with_options" do - organization_memberships = described_class.list_organization_memberships( - user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", - order: "desc", - limit: "5" - ) - - expect(organization_memberships.data.size).to eq(1) - expect(organization_memberships.data[0].user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") - end - end - end - - context "with statuses option" do - it "returns a list of matching users" do - request_args = [ - "/user_management/organization_memberships?user_id=user_01HXYSZBKQE2N3NHBKZHDP1X5X&" \ - "statuses=active&statuses=inactive&order=desc&limit=5", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "user_management/list_organization_memberships/with_statuses_option" do - organization_memberships = described_class.list_organization_memberships( - user_id: "user_01HXYSZBKQE2N3NHBKZHDP1X5X", - statuses: %w[active inactive], - order: "desc", - limit: "5" - ) - - expect(organization_memberships.data.size).to eq(1) - expect(organization_memberships.data[0].user_id).to eq("user_01HXYSZBKQE2N3NHBKZHDP1X5X") - end - end - end - end - - describe ".create_organization_membership" do - context "with a valid payload" do - it "creates an organization membership" do - VCR.use_cassette "user_management/create_organization_membership/valid" do - organization_membership = described_class.create_organization_membership( - user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", - organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - expect(organization_membership.organization_id).to eq("organization_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(organization_membership.user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(organization_membership.role).to eq({slug: "member"}) - end - end - end - - context "with an invalid payload" do - it "returns an error" do - VCR.use_cassette "user_management/create_organization_membership/invalid" do - expect do - described_class.create_organization_membership(user_id: "", organization_id: "") - end.to raise_error( - WorkOS::UnprocessableEntityError, - /user_id_string_required/ - ) - end - end - end - - context "with a role slug" do - it "creates an organization with the given role slug " do - VCR.use_cassette "user_management/create_organization_membership/valid" do - organization_membership = described_class.create_organization_membership( - user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", - organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", - role_slug: "member" - ) - - expect(organization_membership.organization_id).to eq("organization_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(organization_membership.user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(organization_membership.role).to eq({slug: "member"}) - end - end - end - - context "with role slugs" do - it "creates an organization membership with multiple roles" do - VCR.use_cassette "user_management/create_organization_membership/valid_multiple_roles" do - organization_membership = described_class.create_organization_membership( - user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", - organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", - role_slugs: %w[admin member] - ) - - expect(organization_membership.organization_id).to eq("organization_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(organization_membership.user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(organization_membership.roles).to be_an(Array) - expect(organization_membership.roles.length).to eq(2) - end - end - end - end - - describe ".update_organization_membership" do - context "with a valid id" do - it "returns true" do - VCR.use_cassette("user_management/update_organization_membership/valid") do - organization_membership = WorkOS::UserManagement.update_organization_membership( - id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS", - role_slug: "admin" - ) - - expect(organization_membership.organization_id).to eq("organization_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(organization_membership.user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(organization_membership.role).to eq({slug: "admin"}) - end - end - end - - context "with an invalid id" do - it "raises an error" do - VCR.use_cassette("user_management/update_organization_membership/invalid") do - expect do - WorkOS::UserManagement.update_organization_membership(id: "invalid", role_slug: "admin") - end.to raise_error(WorkOS::NotFoundError, /Organization Membership not found/) - end - end - end - - context "with role slugs" do - it "updates an organization membership with multiple roles" do - VCR.use_cassette("user_management/update_organization_membership/valid_multiple_roles") do - organization_membership = WorkOS::UserManagement.update_organization_membership( - id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS", - role_slugs: %w[admin editor] - ) - - expect(organization_membership.organization_id).to eq("organization_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(organization_membership.user_id).to eq("user_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(organization_membership.roles).to be_an(Array) - expect(organization_membership.roles.length).to eq(2) - end - end - end - end - - describe ".delete_organization_membership" do - context "with a valid id" do - it "returns true" do - VCR.use_cassette("user_management/delete_organization_membership/valid") do - response = WorkOS::UserManagement.delete_organization_membership( - id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - expect(response).to be(true) - end - end - end - - context "with an invalid id" do - it "raises an error" do - VCR.use_cassette("user_management/delete_organization_membership/invalid") do - expect do - WorkOS::UserManagement.delete_organization_membership(id: "invalid") - end.to raise_error(WorkOS::NotFoundError, /Organization Membership not found/) - end - end - end - end - - describe ".deactivate_organization_membership" do - context "with a valid id" do - it "returns a organization membership" do - VCR.use_cassette "user_management/deactivate_organization_membership" do - organization_membership = described_class.deactivate_organization_membership( - id: "om_01HXYT0G3H5QG9YTSHSHFZQE6D" - ) - - expect(organization_membership.id.instance_of?(String)) - expect(organization_membership.instance_of?(WorkOS::OrganizationMembership)) - end - end - end - - context "with an invalid id" do - it "returns an error" do - expect do - described_class.deactivate_organization_membership( - id: "invalid_organization_membership_id" - ).to raise_error(WorkOS::APIError) - end - end - end - end - - describe ".reactivate_organization_membership" do - context "with a valid id" do - it "returns a organization membership" do - VCR.use_cassette "user_management/reactivate_organization_membership" do - organization_membership = described_class.reactivate_organization_membership( - id: "om_01HXYT0G3H5QG9YTSHSHFZQE6D" - ) - - expect(organization_membership.id.instance_of?(String)) - expect(organization_membership.instance_of?(WorkOS::OrganizationMembership)) - end - end - end - - context "with an invalid id" do - it "returns an error" do - expect do - described_class.reactivate_organization_membership( - id: "invalid_organization_membership_id" - ).to raise_error(WorkOS::APIError) - end - end - end - end - - describe ".get_invitation" do - context "with a valid id" do - it "returns an invitation" do - VCR.use_cassette "user_management/get_invitation/valid" do - invitation = described_class.get_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - expect(invitation.id.instance_of?(String)) - expect(invitation.instance_of?(WorkOS::Invitation)) - end - end - end - - context "with an invalid id" do - it "raises an error" do - VCR.use_cassette("user_management/get_invitation/invalid") do - expect do - WorkOS::UserManagement.get_invitation(id: "invalid") - end.to raise_error(WorkOS::NotFoundError, /Invitation not found/) - end - end - end - end - - describe ".find_invitation_by_token" do - context "with a valid id" do - it "returns an invitation" do - VCR.use_cassette "user_management/find_invitation_by_token/valid" do - invitation = described_class.find_invitation_by_token( - token: "iUV3XbYajpJlbpw1Qt3ZKlaKx" - ) - - expect(invitation.id.instance_of?(String)) - expect(invitation.instance_of?(WorkOS::Invitation)) - end - end - end - - context "with an invalid id" do - it "raises an error" do - VCR.use_cassette("user_management/find_invitation_by_token/invalid") do - expect do - WorkOS::UserManagement.find_invitation_by_token(token: "invalid") - end.to raise_error(WorkOS::NotFoundError, /Invitation not found/) - end - end - end - end - - describe ".list_invitations" do - context "with no options" do - it "returns invitations and metadata" do - expected_metadata = { - "after" => nil, - "before" => "before_id" - } - - VCR.use_cassette "user_management/list_invitations/with_no_options" do - invitations = described_class.list_invitations - - expect(invitations.data.size).to eq(5) - expect(invitations.list_metadata).to eq(expected_metadata) - end - end - end - - context "with organization_id option" do - it "forms the proper request to the API" do - request_args = [ - "/user_management/invitations?organization_id=org_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "user_management/list_invitations/with_organization_id" do - invitations = described_class.list_invitations( - organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - expect(invitations.data.size).to eq(1) - expect(invitations.data.first.organization_id).to eq( - "org_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - end - end - end - - context "with limit option" do - it "forms the proper request to the API" do - request_args = [ - "/user_management/invitations?limit=2&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "user_management/list_invitations/with_limit" do - invitations = described_class.list_invitations( - limit: 2 - ) - - expect(invitations.data.size).to eq(3) - end - end - end - - context "with before option" do - it "forms the proper request to the API" do - request_args = [ - "/user_management/invitations?before=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "user_management/list_invitations/with_before" do - invitations = described_class.list_invitations( - before: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - expect(invitations.data.size).to eq(2) - end - end - end - - context "with after option" do - it "forms the proper request to the API" do - request_args = [ - "/user_management/invitations?after=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - expect(Net::HTTP::Get).to receive(:new).with(*request_args) - .and_return(expected_request) - - VCR.use_cassette "user_management/list_invitations/with_after" do - invitations = described_class.list_invitations( - after: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - expect(invitations.data.size).to eq(2) - end - end - end - end - - describe ".send_invitation" do - context "with valid payload" do - it "sends an invitation" do - VCR.use_cassette "user_management/send_invitation/valid" do - invitation = described_class.send_invitation( - email: "test@workos.com" - ) - - expect(invitation.id).to eq("invitation_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(invitation.email).to eq("test@workos.com") - end - end - - it "only sends non-nil values in request body" do - expect(described_class).to receive(:post_request) do |options| - body = options[:body] - expect(body).to eq({email: "test@workos.com", organization_id: "org_123"}) - expect(body).not_to have_key(:expires_in_days) - expect(body).not_to have_key(:inviter_user_id) - expect(body).not_to have_key(:role_slug) - - double("request") - end.and_return(double("request")) - - expect(described_class).to receive(:execute_request).and_return( - double("response", body: '{"id": "test_invitation"}') - ) - - described_class.send_invitation( - email: "test@workos.com", - organization_id: "org_123" - ) - end - end - - context "with an invalid payload" do - it "returns an error" do - VCR.use_cassette "user_management/send_invitation/invalid" do - expect do - described_class.send_invitation( - email: "invalid@workos.com" - ) - end.to raise_error( - WorkOS::APIError, - /An Invitation with the email invalid@workos.com already exists/ - ) - end - end - end - end - - describe ".accept_invitation" do - context "with a valid id" do - it "accepts invitation" do - expect(described_class).to receive(:post_request) do |options| - expect(options[:path]).to eq("/user_management/invitations/invitation_123/accept") - expect(options[:auth]).to be true - - double("request") - end.and_return(double("request")) - - response_body = { - id: "invitation_123", - email: "test@workos.com", - state: "accepted" - }.to_json - - expect(described_class).to receive(:execute_request).and_return( - double("response", body: response_body) - ) - - invitation = described_class.accept_invitation( - id: "invitation_123" - ) - - expect(invitation.id).to eq("invitation_123") - expect(invitation.email).to eq("test@workos.com") - expect(invitation.state).to eq("accepted") - end - end - - context "with an invalid id" do - it "returns an error" do - expect(described_class).to receive(:post_request) do |options| - expect(options[:path]).to eq("/user_management/invitations/invalid_id/accept") - expect(options[:auth]).to be true - - double("request") - end.and_return(double("request")) - - expect(described_class).to receive(:execute_request).and_raise( - WorkOS::NotFoundError.new(message: "Invitation not found") - ) - - expect do - described_class.accept_invitation(id: "invalid_id") - end.to raise_error( - WorkOS::NotFoundError, - /Invitation not found/ - ) - end - end - - context "when invitation has already been accepted" do - it "returns an error" do - expect(described_class).to receive(:post_request) do |options| - expect(options[:path]).to eq("/user_management/invitations/invitation_123/accept") - expect(options[:auth]).to be true - - double("request") - end.and_return(double("request")) - - expect(described_class).to receive(:execute_request).and_raise( - WorkOS::InvalidRequestError.new(message: "Invite has already been accepted") - ) - - expect do - described_class.accept_invitation(id: "invitation_123") - end.to raise_error( - WorkOS::InvalidRequestError, - /Invite has already been accepted/ - ) - end - end - end - - describe ".revoke_invitation" do - context "with valid payload" do - it "revokes invitation" do - VCR.use_cassette "user_management/revoke_invitation/valid" do - invitation = described_class.revoke_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - expect(invitation.id).to eq("invitation_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(invitation.email).to eq("test@workos.com") - end - end - end - - context "with an invalid payload" do - it "returns an error" do - VCR.use_cassette "user_management/revoke_invitation/invalid" do - expect do - described_class.revoke_invitation( - id: "invalid_id" - ) - end.to raise_error( - WorkOS::NotFoundError, - /Invitation not found/ - ) - end - end - end - end - - describe ".resend_invitation" do - context "with valid payload" do - it "resends invitation" do - VCR.use_cassette "user_management/resend_invitation/valid" do - invitation = described_class.resend_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - expect(invitation.id).to eq("invitation_01H5JQDV7R7ATEYZDEG0W5PRYS") - expect(invitation.email).to eq("test@workos.com") - end - end - end - - context "with an invalid id" do - it "returns an error" do - VCR.use_cassette "user_management/resend_invitation/invalid" do - expect do - described_class.resend_invitation( - id: "invalid_id" - ) - end.to raise_error( - WorkOS::NotFoundError, - /Invitation not found/ - ) - end - end - end - - context "when invitation has expired" do - it "returns an error" do - VCR.use_cassette "user_management/resend_invitation/expired" do - expect do - described_class.resend_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - end.to raise_error( - WorkOS::InvalidRequestError, - /Invite has expired/ - ) - end - end - end - - context "when invitation has been revoked" do - it "returns an error" do - VCR.use_cassette "user_management/resend_invitation/revoked" do - expect do - described_class.resend_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - end.to raise_error( - WorkOS::InvalidRequestError, - /Invite has been revoked/ - ) - end - end - end - - context "when invitation has already been accepted" do - it "returns an error" do - VCR.use_cassette "user_management/resend_invitation/accepted" do - expect do - described_class.resend_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - end.to raise_error( - WorkOS::InvalidRequestError, - /Invite has already been accepted/ - ) - end - end - end - end - - describe ".revoke_session" do - context "with valid payload" do - it "revokes session" do - VCR.use_cassette "user_management/revoke_session/valid" do - result = described_class.revoke_session( - session_id: "session_01HRX85ATNADY1GQ053AHRFFN6" - ) - - expect(result).to be true - end - end - end - - context "with a non-existant session" do - it "returns an error" do - VCR.use_cassette "user_management/revoke_session/not_found" do - expect do - described_class.revoke_session( - session_id: "session_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - end.to raise_error( - WorkOS::NotFoundError, - /Session not found/ - ) - end - end - end - end - - describe ".list_sessions" do - context "with a valid user_id" do - it "returns a list of sessions" do - VCR.use_cassette("user_management/list_sessions/valid") do - result = described_class.list_sessions( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" - ) - - expect(result.data).to be_an(Array) - expect(result.data.first).to be_a(WorkOS::UserManagement::Session) - expect(result.data.first.id).to eq("session_01H96FETXGTW2S0V5V9XPSM6H44") - expect(result.data.first.status).to eq("active") - expect(result.data.first.auth_method).to eq("password") - end - end - - it "returns sessions that can be revoked" do - VCR.use_cassette("user_management/list_sessions/valid") do - result = described_class.list_sessions( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" - ) - session = result.data.first - - expect(described_class).to receive(:post_request) do |options| - expect(options[:path]).to eq("/user_management/sessions/revoke") - expect(options[:body]).to eq({session_id: "session_01H96FETXGTW2S0V5V9XPSM6H44"}) - expect(options[:auth]).to be true - end.and_return(double("request")) - - expect(described_class).to receive(:execute_request).and_return( - double("response", is_a?: true) - ) - - expect(session.revoke).to be true - end - end - end - end - - describe ".get_logout_url" do - it "returns a logout url for the given session ID" do - result = described_class.get_logout_url( - session_id: "session_01HRX85ATNADY1GQ053AHRFFN6" - ) - - expect(result).to eq "https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6" - end - - context "when a `return_to` is given" do - it "returns a logout url with the `return_to` query parameter" do - result = described_class.get_logout_url( - session_id: "session_01HRX85ATNADY1GQ053AHRFFN6", - return_to: "https://example.com/signed-out" - ) - - expect(result).to eq "https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6&return_to=https%3A%2F%2Fexample.com%2Fsigned-out" - end - end - end -end diff --git a/spec/lib/workos/webhooks_spec.rb b/spec/lib/workos/webhooks_spec.rb deleted file mode 100644 index ade93cc9..00000000 --- a/spec/lib/workos/webhooks_spec.rb +++ /dev/null @@ -1,235 +0,0 @@ -# frozen_string_literal: true - -require "json" -require "openssl" - -describe WorkOS::Webhooks do - before(:each) do - @payload = File.read("#{SPEC_ROOT}/support/webhook_payload.txt") - @secret = "secret" - @timestamp = Time.at(Time.now.to_i * 1000) - unhashed_string = "#{@timestamp.to_i}.#{@payload}" - digest = OpenSSL::Digest.new("sha256") - @signature_hash = OpenSSL::HMAC.hexdigest(digest, @secret, unhashed_string) - @expectation = { - id: "directory_user_01FAEAJCR3ZBZ30D8BD1924TVG", - state: "active", - emails: [{ - type: "work", - value: "blair@foo-corp.com", - primary: true - }], - idp_id: "00u1e8mutl6wlH3lL4x7", - object: "directory_user", - username: "blair@foo-corp.com", - last_name: "Lunchford", - first_name: "Blair", - directory_id: "directory_01F9M7F68PZP8QXP8G7X5QRHS7", - raw_attributes: { - name: { - givenName: "Blair", - familyName: "Lunchford", - middleName: "Elizabeth", - honorificPrefix: "Ms." - }, - title: "Developer Success Engineer", - active: true, - emails: [{ - type: "work", - value: "blair@foo-corp.com", - primary: true - }], - groups: [], - locale: "en-US", - schemas: [ - "urn:ietf:params:scim:schemas:core:2.0:User", - "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" - ], - userName: "blair@foo-corp.com", - addresses: [{ - region: "CA", - primary: true, - locality: "San Francisco", - postalCode: "94016" - }], - externalId: "00u1e8mutl6wlH3lL4x7", - displayName: "Blair Lunchford", - "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": { - manager: { - value: "2", - displayName: "Kate Chapman" - }, - division: "Engineering", - department: "Customer Success" - } - } - } - end - - # rubocop:disable Metrics/BlockLength - shared_examples "WorkOS-Signature header failures" do - context "with an empty header" do - it "raises an error" do - expect do - described_class.construct_event( - payload: @payload, - sig_header: "", - secret: @secret - ) - end.to raise_error( - WorkOS::SignatureVerificationError, - "Unable to extract timestamp and signature hash from header" - ) - end - end - - context "with an empty signature hash" do - it "raises an error" do - expect do - described_class.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=", - secret: @secret - ) - end.to raise_error( - WorkOS::SignatureVerificationError, - "No signature hash found with expected scheme v1" - ) - end - end - - context "with an incorrect signature hash" do - it "raises an error" do - expect do - described_class.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=99999", - secret: @secret - ) - end.to raise_error( - WorkOS::SignatureVerificationError, - "Signature hash does not match the expected signature hash for payload" - ) - end - end - - context "with an incorrect payload" do - it "raises an error" do - expect do - described_class.construct_event( - payload: "invalid", - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret - ) - end.to raise_error( - WorkOS::SignatureVerificationError, - "Signature hash does not match the expected signature hash for payload" - ) - end - end - - context "with an incorrect webhook secret" do - it "raises an error" do - expect do - described_class.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: "invalid" - ) - end.to raise_error( - WorkOS::SignatureVerificationError, - "Signature hash does not match the expected signature hash for payload" - ) - end - end - - context "with a timestamp outside tolerance" do - it "raises an error" do - expect do - described_class.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i - (200 * 1000)}, v1=#{@signature_hash}", - secret: @secret - ) - end.to raise_error( - WorkOS::SignatureVerificationError, - "Timestamp outside the tolerance zone" - ) - end - end - end - # rubocop:enable Metrics/BlockLength - - describe ".construct_event" do - it_behaves_like "WorkOS-Signature header failures" - - context "with the correct payload, sig_header, and secret" do - it "returns a webhook event" do - webhook = described_class.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret - ) - - expect(webhook.data).to eq(@expectation) - expect(webhook.event).to eq("dsync.user.created") - expect(webhook.id).to eq("wh_123") - end - end - - context "with the correct payload, sig_header, secret, and tolerance" do - it "returns a webhook event" do - webhook = described_class.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret, - tolerance: 300 - ) - - expect(webhook.data).to eq(@expectation) - expect(webhook.event).to eq("dsync.user.created") - expect(webhook.id).to eq("wh_123") - end - end - end - - describe ".verify_header" do - it_behaves_like "WorkOS-Signature header failures" - - it "returns true when the signature is valid" do - described_class.verify_header( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret - ) - end - end - - describe ".get_timestamp_and_signature_hash" do - it_behaves_like "WorkOS-Signature header failures" - - it "returns the timestamp and signature when the signature is valid" do - timestamp_int = @timestamp.to_i - timestamp_and_signature = described_class.get_timestamp_and_signature_hash( - sig_header: "t=#{timestamp_int}, v1=#{@signature_hash}" - ) - - expect(timestamp_and_signature).to eq([timestamp_int.to_s, @signature_hash]) - end - end - - describe ".compute_signature" do - it_behaves_like "WorkOS-Signature header failures" - - it "returns the computed signature" do - timestamp_int = @timestamp.to_i - signature = described_class.compute_signature( - timestamp: timestamp_int.to_s, - payload: @payload, - secret: @secret - ) - - expect(signature).to eq(@signature_hash) - end - end -end diff --git a/spec/lib/workos/widgets_spec.rb b/spec/lib/workos/widgets_spec.rb deleted file mode 100644 index e602cacb..00000000 --- a/spec/lib/workos/widgets_spec.rb +++ /dev/null @@ -1,73 +0,0 @@ -# frozen_string_literal: true - -describe WorkOS::Widgets do - it_behaves_like "client" - - describe ".get_token" do - let(:organization_id) { "org_01JCP9G67MNAH0KC4B72XZ67M7" } - let(:user_id) { "user_01JCP9H4SHS4N3J6XTKDT7JNPE" } - - describe "with a valid organization_id and user_id and scopes" do - it "returns a widget token" do - VCR.use_cassette "widgets/get_token" do - token = described_class.get_token( - organization_id: organization_id, - user_id: user_id, - scopes: ["widgets:users-table:manage"] - ) - - expect(token).to start_with("eyJhbGciOiJSUzI1NiIsImtpZ") - end - end - end - - describe "with an invalid organization_id" do - it "raises an error" do - VCR.use_cassette "widgets/get_token_invalid_organization_id" do - expect do - described_class.get_token( - organization_id: "bogus-id", - user_id: user_id, - scopes: ["widgets:users-table:manage"] - ) - end.to raise_error( - WorkOS::NotFoundError, - /Organization not found: 'bogus-id'/ - ) - end - end - end - - describe "with an invalid user_id" do - it "raises an error" do - VCR.use_cassette "widgets/get_token_invalid_user_id" do - expect do - described_class.get_token( - organization_id: organization_id, - user_id: "bogus-id", - scopes: ["widgets:users-table:manage"] - ) - end.to raise_error( - WorkOS::NotFoundError, - /User not found: 'bogus-id'/ - ) - end - end - end - - describe "with invalid scopes" do - it "raises an error" do - expect do - described_class.get_token( - organization_id: organization_id, - user_id: user_id, - scopes: ["bogus-scope"] - ) - end.to raise_error( - ArgumentError, - /scopes contains an invalid value/ - ) - end - end - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb deleted file mode 100644 index 6f88e946..00000000 --- a/spec/spec_helper.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib") -$LOAD_PATH << File.join(File.dirname(__FILE__)) - -require "rubygems" -require "rspec" -require "webmock/rspec" -require "workos" -require "vcr" - -# Support -Dir["./spec/support/**/*.rb"].sort.each { |f| require f } - -SPEC_ROOT = File.dirname __FILE__ - -VCR.configure do |config| - config.cassette_library_dir = "spec/support/fixtures/vcr_cassettes" - config.filter_sensitive_data("") { WorkOS.config.key } - config.filter_sensitive_data("", :token) do |interaction| - JSON.parse(interaction.response.body)["access_token"] - end - config.filter_sensitive_data("", :token) do |interaction| - JSON.parse(interaction.response.body)["refresh_token"] - end - config.hook_into :webmock -end - -RSpec.configure do |config| - config.expect_with :rspec do |expectations| - expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end - - config.mock_with :rspec do |mocks| - mocks.verify_partial_doubles = true - end - - config.shared_context_metadata_behavior = :apply_to_host_groups - - WebMock::API.prepend(Module.new do - extend self - - # Disable VCR when a WebMock stub is created - # for clearer spec failure messaging - def stub_request(*args) - VCR.turn_off! - super - end - end) - - config.before(:all) { WorkOS.config.key ||= "" } - config.before(:each) { VCR.turn_on! } -end diff --git a/spec/support/shared_examples/client.rb b/spec/support/shared_examples/client.rb deleted file mode 100644 index e5f23065..00000000 --- a/spec/support/shared_examples/client.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -RSpec.shared_examples "client" do - subject(:client) { described_class.client } - - it { is_expected.to be_kind_of(Net::HTTP) } - - it "assigns use_ssl" do - expect(client.use_ssl?).to be true - end - - it "returns new instance" do - expect(described_class.client.object_id).to_not eq described_class.client.object_id - end - - if RUBY_VERSION >= "2.6.0" - it "sets the timeouts, including the write timeout" do - expect(described_class.client.open_timeout).to_not be_nil - expect(described_class.client.read_timeout).to_not be_nil - expect(described_class.client.write_timeout).to_not be_nil - end - else - it "sets the open and read timeouts, but not the write timeout" do - expect(described_class.client.open_timeout).to_not be_nil - expect(described_class.client.read_timeout).to_not be_nil - expect(described_class.client.write_timeout).to be_nil - end - end -end diff --git a/spec/support/profile.txt b/test/fixtures/profile.txt similarity index 100% rename from spec/support/profile.txt rename to test/fixtures/profile.txt diff --git a/spec/support/fixtures/vcr_cassettes/audit_logs/create_event.yml b/test/fixtures/vcr_cassettes/audit_logs/create_event.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_logs/create_event.yml rename to test/fixtures/vcr_cassettes/audit_logs/create_event.yml diff --git a/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml b/test/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml rename to test/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml diff --git a/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml b/test/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml rename to test/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/audit_logs/create_export.yml b/test/fixtures/vcr_cassettes/audit_logs/create_export.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_logs/create_export.yml rename to test/fixtures/vcr_cassettes/audit_logs/create_export.yml diff --git a/spec/support/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml b/test/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml rename to test/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml diff --git a/spec/support/fixtures/vcr_cassettes/audit_logs/get_export.yml b/test/fixtures/vcr_cassettes/audit_logs/get_export.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_logs/get_export.yml rename to test/fixtures/vcr_cassettes/audit_logs/get_export.yml diff --git a/spec/support/fixtures/vcr_cassettes/audit_trail/create_event.yml b/test/fixtures/vcr_cassettes/audit_trail/create_event.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_trail/create_event.yml rename to test/fixtures/vcr_cassettes/audit_trail/create_event.yml diff --git a/spec/support/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml b/test/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml rename to test/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml diff --git a/spec/support/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml b/test/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml rename to test/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml b/test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml rename to test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml diff --git a/spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml b/test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml rename to test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml diff --git a/spec/support/fixtures/vcr_cassettes/audit_trail/get_events.yml b/test/fixtures/vcr_cassettes/audit_trail/get_events.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/audit_trail/get_events.yml rename to test/fixtures/vcr_cassettes/audit_trail/get_events.yml diff --git a/spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml b/test/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml rename to test/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/delete_directory.yml b/test/fixtures/vcr_cassettes/directory_sync/delete_directory.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/delete_directory.yml rename to test/fixtures/vcr_cassettes/directory_sync/delete_directory.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml b/test/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml rename to test/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml b/test/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml rename to test/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/get_group.yml b/test/fixtures/vcr_cassettes/directory_sync/get_group.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/get_group.yml rename to test/fixtures/vcr_cassettes/directory_sync/get_group.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml b/test/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml rename to test/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml b/test/fixtures/vcr_cassettes/directory_sync/get_user.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml rename to test/fixtures/vcr_cassettes/directory_sync/get_user.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml b/test/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml rename to test/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml rename to test/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml diff --git a/spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml b/test/fixtures/vcr_cassettes/events/list_events_with_after.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml rename to test/fixtures/vcr_cassettes/events/list_events_with_after.yml diff --git a/spec/support/fixtures/vcr_cassettes/events/list_events_with_event.yml b/test/fixtures/vcr_cassettes/events/list_events_with_event.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/events/list_events_with_event.yml rename to test/fixtures/vcr_cassettes/events/list_events_with_event.yml diff --git a/spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml b/test/fixtures/vcr_cassettes/events/list_events_with_no_options.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml rename to test/fixtures/vcr_cassettes/events/list_events_with_no_options.yml diff --git a/spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml b/test/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml rename to test/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml b/test/fixtures/vcr_cassettes/events/list_events_with_range.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml rename to test/fixtures/vcr_cassettes/events/list_events_with_range.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml b/test/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml rename to test/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml b/test/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml rename to test/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml b/test/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml rename to test/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/delete_factor.yml b/test/fixtures/vcr_cassettes/mfa/delete_factor.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/delete_factor.yml rename to test/fixtures/vcr_cassettes/mfa/delete_factor.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml b/test/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml rename to test/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml b/test/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml rename to test/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml b/test/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml rename to test/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml b/test/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml rename to test/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/get_factor_valid.yml b/test/fixtures/vcr_cassettes/mfa/get_factor_valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/get_factor_valid.yml rename to test/fixtures/vcr_cassettes/mfa/get_factor_valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml b/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml rename to test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml b/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml rename to test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml b/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml rename to test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml b/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml rename to test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/create.yml b/test/fixtures/vcr_cassettes/organization/create.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/create.yml rename to test/fixtures/vcr_cassettes/organization/create.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/create_invalid.yml b/test/fixtures/vcr_cassettes/organization/create_invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/create_invalid.yml rename to test/fixtures/vcr_cassettes/organization/create_invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/create_with_domain_data.yml b/test/fixtures/vcr_cassettes/organization/create_with_domain_data.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/create_with_domain_data.yml rename to test/fixtures/vcr_cassettes/organization/create_with_domain_data.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/create_with_domains.yml b/test/fixtures/vcr_cassettes/organization/create_with_domains.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/create_with_domains.yml rename to test/fixtures/vcr_cassettes/organization/create_with_domains.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml b/test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml rename to test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml b/test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml rename to test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/create_with_external_id.yml b/test/fixtures/vcr_cassettes/organization/create_with_external_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/create_with_external_id.yml rename to test/fixtures/vcr_cassettes/organization/create_with_external_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml b/test/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml rename to test/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/create_without_domains.yml b/test/fixtures/vcr_cassettes/organization/create_without_domains.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/create_without_domains.yml rename to test/fixtures/vcr_cassettes/organization/create_without_domains.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/delete.yml b/test/fixtures/vcr_cassettes/organization/delete.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/delete.yml rename to test/fixtures/vcr_cassettes/organization/delete.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/delete_invalid.yml b/test/fixtures/vcr_cassettes/organization/delete_invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/delete_invalid.yml rename to test/fixtures/vcr_cassettes/organization/delete_invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/get.yml b/test/fixtures/vcr_cassettes/organization/get.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/get.yml rename to test/fixtures/vcr_cassettes/organization/get.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml b/test/fixtures/vcr_cassettes/organization/get_invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml rename to test/fixtures/vcr_cassettes/organization/get_invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/list.yml b/test/fixtures/vcr_cassettes/organization/list.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/list.yml rename to test/fixtures/vcr_cassettes/organization/list.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml b/test/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml rename to test/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml b/test/fixtures/vcr_cassettes/organization/list_organization_roles.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml rename to test/fixtures/vcr_cassettes/organization/list_organization_roles.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/update.yml b/test/fixtures/vcr_cassettes/organization/update.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/update.yml rename to test/fixtures/vcr_cassettes/organization/update.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml b/test/fixtures/vcr_cassettes/organization/update_with_external_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml rename to test/fixtures/vcr_cassettes/organization/update_with_external_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml b/test/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml rename to test/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml b/test/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml rename to test/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml b/test/fixtures/vcr_cassettes/organization/update_without_name.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml rename to test/fixtures/vcr_cassettes/organization/update_without_name.yml diff --git a/spec/support/fixtures/vcr_cassettes/passwordless/create_session.yml b/test/fixtures/vcr_cassettes/passwordless/create_session.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/passwordless/create_session.yml rename to test/fixtures/vcr_cassettes/passwordless/create_session.yml diff --git a/spec/support/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml b/test/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml rename to test/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/passwordless/send_session.yml b/test/fixtures/vcr_cassettes/passwordless/send_session.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/passwordless/send_session.yml rename to test/fixtures/vcr_cassettes/passwordless/send_session.yml diff --git a/spec/support/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml b/test/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml rename to test/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml b/test/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml rename to test/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml diff --git a/spec/support/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml b/test/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml rename to test/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml diff --git a/spec/support/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml b/test/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml rename to test/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml diff --git a/spec/support/fixtures/vcr_cassettes/portal/generate_link_dsync.yml b/test/fixtures/vcr_cassettes/portal/generate_link_dsync.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/portal/generate_link_dsync.yml rename to test/fixtures/vcr_cassettes/portal/generate_link_dsync.yml diff --git a/spec/support/fixtures/vcr_cassettes/portal/generate_link_invalid.yml b/test/fixtures/vcr_cassettes/portal/generate_link_invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/portal/generate_link_invalid.yml rename to test/fixtures/vcr_cassettes/portal/generate_link_invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/portal/generate_link_sso.yml b/test/fixtures/vcr_cassettes/portal/generate_link_sso.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/portal/generate_link_sso.yml rename to test/fixtures/vcr_cassettes/portal/generate_link_sso.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml b/test/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml rename to test/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml b/test/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml rename to test/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml b/test/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml rename to test/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml b/test/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml rename to test/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_after.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_after.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/list_connections/with_after.yml rename to test/fixtures/vcr_cassettes/sso/list_connections/with_after.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_before.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_before.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/list_connections/with_before.yml rename to test/fixtures/vcr_cassettes/sso/list_connections/with_before.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml rename to test/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml rename to test/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml rename to test/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml rename to test/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml rename to test/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/sso/profile.yml b/test/fixtures/vcr_cassettes/sso/profile.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/sso/profile.yml rename to test/fixtures/vcr_cassettes/sso/profile.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml rename to test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml b/test/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml b/test/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml rename to test/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml b/test/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml rename to test/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml b/test/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml b/test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml rename to test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml b/test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml rename to test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml b/test/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml rename to test/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_user_invalid.yml b/test/fixtures/vcr_cassettes/user_management/create_user_invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/create_user_invalid.yml rename to test/fixtures/vcr_cassettes/user_management/create_user_invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_user_valid.yml b/test/fixtures/vcr_cassettes/user_management/create_user_valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/create_user_valid.yml rename to test/fixtures/vcr_cassettes/user_management/create_user_valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml b/test/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml rename to test/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml b/test/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml rename to test/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml b/test/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml b/test/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml rename to test/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml b/test/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/delete_user/valid.yml b/test/fixtures/vcr_cassettes/user_management/delete_user/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/delete_user/valid.yml rename to test/fixtures/vcr_cassettes/user_management/delete_user/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml b/test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml b/test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml rename to test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml b/test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml b/test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml rename to test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml b/test/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml b/test/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml rename to test/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml b/test/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml b/test/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml rename to test/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml b/test/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml b/test/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml rename to test/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml b/test/fixtures/vcr_cassettes/user_management/get_organization_membership.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml rename to test/fixtures/vcr_cassettes/user_management/get_organization_membership.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml b/test/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml b/test/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml rename to test/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/get_user.yml b/test/fixtures/vcr_cassettes/user_management/get_user.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/get_user.yml rename to test/fixtures/vcr_cassettes/user_management/get_user.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml b/test/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml b/test/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml rename to test/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml b/test/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml rename to test/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml b/test/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml rename to test/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml b/test/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml rename to test/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml b/test/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml rename to test/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml b/test/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml rename to test/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml b/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml rename to test/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml b/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml rename to test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml b/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml rename to test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml b/test/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml rename to test/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_users/no_options.yml b/test/fixtures/vcr_cassettes/user_management/list_users/no_options.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_users/no_options.yml rename to test/fixtures/vcr_cassettes/user_management/list_users/no_options.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_users/with_options.yml b/test/fixtures/vcr_cassettes/user_management/list_users/with_options.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/list_users/with_options.yml rename to test/fixtures/vcr_cassettes/user_management/list_users/with_options.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml b/test/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml rename to test/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml b/test/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml rename to test/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml b/test/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml rename to test/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml b/test/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml b/test/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml rename to test/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml b/test/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml rename to test/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml b/test/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml b/test/fixtures/vcr_cassettes/user_management/reset_password/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml rename to test/fixtures/vcr_cassettes/user_management/reset_password/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml b/test/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml b/test/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml rename to test/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml b/test/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml rename to test/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml b/test/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml rename to test/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml b/test/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml b/test/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml rename to test/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml b/test/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml rename to test/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml b/test/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml b/test/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml rename to test/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml b/test/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml b/test/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml rename to test/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml b/test/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml b/test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml rename to test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml b/test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml rename to test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_user/email.yml b/test/fixtures/vcr_cassettes/user_management/update_user/email.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/update_user/email.yml rename to test/fixtures/vcr_cassettes/user_management/update_user/email.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml b/test/fixtures/vcr_cassettes/user_management/update_user/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/update_user/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_user/locale.yml b/test/fixtures/vcr_cassettes/user_management/update_user/locale.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/update_user/locale.yml rename to test/fixtures/vcr_cassettes/user_management/update_user/locale.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml b/test/fixtures/vcr_cassettes/user_management/update_user/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml rename to test/fixtures/vcr_cassettes/user_management/update_user/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml b/test/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml rename to test/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml b/test/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml rename to test/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml b/test/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml rename to test/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml b/test/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml rename to test/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml b/test/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml rename to test/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml diff --git a/spec/support/fixtures/vcr_cassettes/user_management/verify_email/valid.yml b/test/fixtures/vcr_cassettes/user_management/verify_email/valid.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/user_management/verify_email/valid.yml rename to test/fixtures/vcr_cassettes/user_management/verify_email/valid.yml diff --git a/spec/support/fixtures/vcr_cassettes/widgets/get_token.yml b/test/fixtures/vcr_cassettes/widgets/get_token.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/widgets/get_token.yml rename to test/fixtures/vcr_cassettes/widgets/get_token.yml diff --git a/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml b/test/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml rename to test/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml diff --git a/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml b/test/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml similarity index 100% rename from spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml rename to test/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml diff --git a/spec/support/webhook_payload.txt b/test/fixtures/webhook_payload.txt similarity index 100% rename from spec/support/webhook_payload.txt rename to test/fixtures/webhook_payload.txt diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 00000000..d90866d4 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib") +$LOAD_PATH << File.join(File.dirname(__FILE__)) + +require "minitest/autorun" +require "webmock/minitest" +require "workos" +require "vcr" + +TEST_ROOT = File.dirname(__FILE__) + +VCR.configure do |config| + config.cassette_library_dir = "test/fixtures/vcr_cassettes" + config.filter_sensitive_data("") { WorkOS.config.key } + config.filter_sensitive_data("", :token) do |interaction| + JSON.parse(interaction.response.body)["access_token"] + end + config.filter_sensitive_data("", :token) do |interaction| + JSON.parse(interaction.response.body)["refresh_token"] + end + config.hook_into :webmock +end + +class WorkOS::TestCase < Minitest::Test + def setup + WorkOS.instance_variable_set(:@config, WorkOS.default_config) + WorkOS.config.key ||= "" + VCR.turn_on! + end + + # Helper to temporarily disable VCR when using WebMock stubs directly + def with_vcr_off + VCR.turn_off! + yield + ensure + VCR.turn_on! + end +end diff --git a/test/workos/encryptors/test_aes_gcm.rb b/test/workos/encryptors/test_aes_gcm.rb new file mode 100644 index 00000000..f5a44359 --- /dev/null +++ b/test/workos/encryptors/test_aes_gcm.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestAesGcm < WorkOS::TestCase + def setup + super + @encryptor = WorkOS::Encryptors::AesGcm.new + @key = "a" * 32 + @data = {access_token: "tok_123", user: {id: "user_01"}} + end + + def test_seal_returns_a_base64_encoded_string + sealed = @encryptor.seal(@data, @key) + assert_kind_of String, sealed + Base64.decode64(sealed) # should not raise + end + + def test_seal_produces_different_output_each_time + sealed1 = @encryptor.seal(@data, @key) + sealed2 = @encryptor.seal(@data, @key) + refute_equal sealed1, sealed2 + end + + def test_unseal_round_trips_data_correctly + sealed = @encryptor.seal(@data, @key) + unsealed = @encryptor.unseal(sealed, @key) + assert_equal @data, unsealed + end + + def test_unseal_returns_hash_with_symbolized_keys + sealed = @encryptor.seal({"string_key" => "value"}, @key) + unsealed = @encryptor.unseal(sealed, @key) + assert_kind_of Symbol, unsealed.keys.first + end + + def test_unseal_raises_error_with_wrong_key + sealed = @encryptor.seal(@data, @key) + assert_raises(OpenSSL::Cipher::CipherError) do + @encryptor.unseal(sealed, "b" * 32) + end + end +end diff --git a/test/workos/test_audit_logs.rb b/test/workos/test_audit_logs.rb new file mode 100644 index 00000000..58ba244e --- /dev/null +++ b/test/workos/test_audit_logs.rb @@ -0,0 +1,132 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestAuditLogs < WorkOS::TestCase + def setup + super + WorkOS.configure do |config| + config.key = "example_api_key" + end + end + + def valid_event + { + action: "user.signed_in", + occurred_at: "2022-08-22T15:04:19.704Z", + actor: { + id: "user_123", + type: "user", + name: "User", + metadata: { + foo: "bar" + } + }, + targets: [{ + id: "team_123", + type: "team", + name: "Team", + metadata: { + foo: "bar" + } + }], + context: { + location: "1.1.1.1", + user_agent: "Mozilla" + } + } + end + + def test_create_event_with_idempotency_key + VCR.use_cassette "audit_logs/create_event_custom_idempotency_key", match_requests_on: %i[path body] do + response = WorkOS::AuditLogs.create_event( + organization: "org_123", + event: valid_event, + idempotency_key: "idempotency_key" + ) + + assert_equal "201", response.code + end + end + + def test_create_event_without_idempotency_key + VCR.use_cassette "audit_logs/create_event", match_requests_on: %i[path body] do + response = WorkOS::AuditLogs.create_event( + organization: "org_123", + event: valid_event + ) + + assert_equal "201", response.code + end + end + + def test_create_event_with_invalid_event + VCR.use_cassette "audit_logs/create_event_invalid", match_requests_on: %i[path body] do + WorkOS::AuditLogs.create_event( + organization: "org_123", + event: valid_event + ) + rescue WorkOS::InvalidRequestError => e + assert_equal( + "Status 400, Invalid Audit Log event - request ID: 1cf9b8e7-5910-4a6d-a333-46bcf841422e", + e.message + ) + assert_equal "invalid_audit_log", e.code + assert_equal 1, e.errors.count + end + end + + def test_create_export_without_filters + VCR.use_cassette "audit_logs/create_export", match_requests_on: %i[path body] do + audit_log_export = WorkOS::AuditLogs.create_export( + organization: "org_123", + range_start: "2022-06-22T15:04:19.704Z", + range_end: "2022-08-22T15:04:19.704Z" + ) + + assert_equal "audit_log_export", audit_log_export.object + assert_equal "audit_log_export_123", audit_log_export.id + assert_equal "pending", audit_log_export.state + assert_nil audit_log_export.url + assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.created_at + assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.updated_at + end + end + + def test_create_export_with_filters + VCR.use_cassette "audit_logs/create_export_with_filters", match_requests_on: %i[path body] do + audit_log_export = WorkOS::AuditLogs.create_export( + organization: "org_123", + range_start: "2022-06-22T15:04:19.704Z", + range_end: "2022-08-22T15:04:19.704Z", + actions: ["user.signed_in"], + actors: ["Jon Smith"], + actor_names: ["Jon Smith"], + actor_ids: ["user_123"], + targets: %w[user team] + ) + + assert_equal "audit_log_export", audit_log_export.object + assert_equal "audit_log_export_123", audit_log_export.id + assert_equal "pending", audit_log_export.state + assert_nil audit_log_export.url + assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.created_at + assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.updated_at + end + end + + def test_get_export + VCR.use_cassette "audit_logs/get_export", match_requests_on: %i[path] do + audit_log_export = WorkOS::AuditLogs.get_export( + id: "audit_log_export_123" + ) + + assert_equal "audit_log_export", audit_log_export.object + assert_equal "audit_log_export_123", audit_log_export.id + assert_equal "ready", audit_log_export.state + assert_equal "https://audit-logs.com/download.csv", audit_log_export.url + assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.created_at + assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.updated_at + end + end +end diff --git a/test/workos/test_cache.rb b/test/workos/test_cache.rb new file mode 100644 index 00000000..53407174 --- /dev/null +++ b/test/workos/test_cache.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestCache < WorkOS::TestCase + def setup + super + WorkOS::Cache.clear + end + + def test_write_and_read_stores_and_retrieves_data + WorkOS::Cache.write("key", "value") + assert_equal "value", WorkOS::Cache.read("key") + end + + def test_read_returns_nil_if_key_does_not_exist + assert_nil WorkOS::Cache.read("missing") + end + + def test_fetch_returns_cached_value_when_present_and_not_expired + WorkOS::Cache.write("key", "value") + fetch_value = WorkOS::Cache.fetch("key") { "new_value" } + assert_equal "value", fetch_value + end + + def test_fetch_executes_block_and_caches_value_when_not_present + fetch_value = WorkOS::Cache.fetch("key") { "new_value" } + assert_equal "new_value", fetch_value + end + + def test_fetch_executes_block_and_caches_value_when_force_is_true + WorkOS::Cache.write("key", "value") + fetch_value = WorkOS::Cache.fetch("key", force: true) { "new_value" } + assert_equal "new_value", fetch_value + end + + def test_expires_values_after_specified_time + WorkOS::Cache.write("key", "value", expires_in: 0.1) + assert_equal "value", WorkOS::Cache.read("key") + sleep 0.2 + assert_nil WorkOS::Cache.read("key") + end + + def test_fetch_executes_block_and_caches_new_value_when_expired + WorkOS::Cache.write("key", "old_value", expires_in: 0.1) + sleep 0.2 + fetch_value = WorkOS::Cache.fetch("key") { "new_value" } + assert_equal "new_value", fetch_value + end + + def test_does_not_expire_values_when_expires_in_is_nil + WorkOS::Cache.write("key", "value", expires_in: nil) + sleep 0.2 + assert_equal "value", WorkOS::Cache.read("key") + end + + def test_exist_returns_true_if_key_exists + WorkOS::Cache.write("key", "value") + assert_equal true, WorkOS::Cache.exist?("key") + end + + def test_exist_returns_false_if_expired + WorkOS::Cache.write("key", "value", expires_in: 0.1) + sleep 0.2 + assert_equal false, WorkOS::Cache.exist?("key") + end + + def test_exist_returns_false_if_key_does_not_exist + assert_equal false, WorkOS::Cache.exist?("missing") + end + + def test_delete_removes_key + WorkOS::Cache.write("key", "value") + WorkOS::Cache.delete("key") + assert_nil WorkOS::Cache.read("key") + end + + def test_clear_removes_all_keys + WorkOS::Cache.write("key1", "value1") + WorkOS::Cache.write("key2", "value2") + + WorkOS::Cache.clear + + assert_nil WorkOS::Cache.read("key1") + assert_nil WorkOS::Cache.read("key2") + end +end diff --git a/test/workos/test_client.rb b/test/workos/test_client.rb new file mode 100644 index 00000000..f240543c --- /dev/null +++ b/test/workos/test_client.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestClient < WorkOS::TestCase + def test_returns_400_error_with_appropriate_fields + VCR.use_cassette("user_management/authenticate_with_code/invalid") do + error = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.authenticate_with_code( + code: "invalid", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + end + + refute_nil error.error + refute_nil error.error_description + refute_nil error.data + end + end + + def test_returns_401_error_with_appropriate_fields + VCR.use_cassette("base/execute_request_unauthenticated") do + error = assert_raises(WorkOS::AuthenticationError) do + WorkOS::AuditLogs.create_event( + organization: "org_123", + event: {} + ) + end + + refute_nil error.message + end + end + + def test_returns_404_error_with_appropriate_fields + VCR.use_cassette("user_management/get_email_verification/invalid") do + error = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.get_email_verification( + id: "invalid" + ) + end + + refute_nil error.message + end + end + + def test_returns_422_error_with_appropriate_fields + VCR.use_cassette("user_management/create_user_invalid") do + error = assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::UserManagement.create_user( + email: "invalid" + ) + end + + refute_nil error.message + refute_nil error.errors + refute_nil error.code + end + end +end diff --git a/test/workos/test_configuration.rb b/test/workos/test_configuration.rb new file mode 100644 index 00000000..31cffe4e --- /dev/null +++ b/test/workos/test_configuration.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestConfiguration < WorkOS::TestCase + def setup + super + WorkOS.instance_variable_set(:@config, WorkOS::Configuration.new) + end + + def test_configure_with_key_and_no_timeout + WorkOS.configure do |config| + config.key = "example_api_key" + end + + assert_equal "example_api_key", WorkOS.config.key + assert_equal 60, WorkOS.config.timeout + end + + def test_configure_with_key_and_timeout + WorkOS.configure do |config| + config.key = "example_api_key" + config.timeout = 120 + end + + assert_equal "example_api_key", WorkOS.config.key + assert_equal 120, WorkOS.config.timeout + end + + def test_key_bang_returns_the_key_when_set + WorkOS.config.key = "example_api_key" + + assert_equal "example_api_key", WorkOS.config.key! + end + + def test_key_bang_raises_error_when_key_not_set + WorkOS.config.key = nil + + err = assert_raises(RuntimeError) do + WorkOS.config.key! + end + assert_equal "`WorkOS.config.key` not set", err.message + end +end diff --git a/test/workos/test_directory_sync.rb b/test/workos/test_directory_sync.rb new file mode 100644 index 00000000..71578c42 --- /dev/null +++ b/test/workos/test_directory_sync.rb @@ -0,0 +1,261 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestDirectorySync < WorkOS::TestCase + def test_list_directories_with_no_options + expected_metadata = { + "after" => nil, + "before" => "before-id" + } + + VCR.use_cassette "directory_sync/list_directories/with_no_options" do + directories = WorkOS::DirectorySync.list_directories + + assert_equal 10, directories.data.size + assert_equal expected_metadata, directories.list_metadata + end + end + + def test_list_directories_with_search + VCR.use_cassette "directory_sync/list_directories/with_search" do + directories = WorkOS::DirectorySync.list_directories( + search: "Testing" + ) + + assert_equal 2, directories.data.size + assert directories.data[0].name.include?("Testing") + end + end + + def test_list_directories_with_before + VCR.use_cassette "directory_sync/list_directories/with_before" do + directories = WorkOS::DirectorySync.list_directories( + before: "directory_01FGCPNV312FHFRCX0BYWHVSE1" + ) + + assert_equal 6, directories.data.size + end + end + + def test_list_directories_with_after + VCR.use_cassette "directory_sync/list_directories/with_after" do + directories = WorkOS::DirectorySync.list_directories( + after: "directory_01FGCPNV312FHFRCX0BYWHVSE1" + ) + + assert_equal 4, directories.data.size + end + end + + def test_list_directories_with_limit + VCR.use_cassette "directory_sync/list_directories/with_limit" do + directories = WorkOS::DirectorySync.list_directories(limit: 2) + + assert_equal 2, directories.data.size + end + end + + def test_delete_directory + VCR.use_cassette("directory_sync/delete_directory") do + response = WorkOS::DirectorySync.delete_directory( + "directory_01F2T098SKN5PCTVSJ7CWP70N5" + ) + + assert_equal true, response + end + end + + def test_get_directory_with_valid_id + VCR.use_cassette("directory_sync/get_directory_with_valid_id") do + directory = WorkOS::DirectorySync.get_directory( + id: "directory_01FK17DWRHH7APAFXT5B52PV0W" + ) + + assert_equal "directory_01FK17DWRHH7APAFXT5B52PV0W", directory.id + assert_equal "Testing Active Attribute", directory.name + assert_equal "example.me", directory.domain + assert_equal "azure scim v2.0", directory.type + assert_equal "linked", directory.state + assert_equal "org_01F6Q6TFP7RD2PF6J03ANNWDKV", directory.organization_id + end + end + + def test_get_directory_with_invalid_id + VCR.use_cassette("directory_sync/get_directory_with_invalid_id") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::DirectorySync.get_directory(id: "invalid") + end + assert_equal "Status 404, Directory not found: 'invalid'. - request ID: ", err.message + end + end + + def test_list_groups_with_no_options_raises_error + VCR.use_cassette("directory_sync/list_groups/with_no_options") do + assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::DirectorySync.list_groups + end + end + end + + def test_list_groups_with_directory + VCR.use_cassette "directory_sync/list_groups/with_directory" do + groups = WorkOS::DirectorySync.list_groups( + directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" + ) + + assert_equal 10, groups.data.size + assert_equal groups.data[0]["name"], groups.data[0].name + end + end + + def test_list_groups_with_user + VCR.use_cassette "directory_sync/list_groups/with_user" do + groups = WorkOS::DirectorySync.list_groups( + user: "directory_user_01G2Z8D4FDB28ZNSRRBVCF2E0P" + ) + + assert_equal 3, groups.data.size + end + end + + def test_list_groups_with_before + VCR.use_cassette "directory_sync/list_groups/with_before" do + groups = WorkOS::DirectorySync.list_groups( + before: "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG", + directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" + ) + + assert_equal 10, groups.data.size + end + end + + def test_list_groups_with_after + VCR.use_cassette "directory_sync/list_groups/with_after" do + groups = WorkOS::DirectorySync.list_groups( + after: "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG", + directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" + ) + + assert_equal 9, groups.data.size + end + end + + def test_list_groups_with_limit + VCR.use_cassette "directory_sync/list_groups/with_limit" do + groups = WorkOS::DirectorySync.list_groups( + limit: 2, + directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" + ) + + assert_equal 2, groups.data.size + end + end + + def test_list_users_with_no_options_raises_error + VCR.use_cassette("directory_sync/list_users/with_no_options") do + assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::DirectorySync.list_users + end + end + end + + def test_list_users_with_directory + VCR.use_cassette "directory_sync/list_users/with_directory" do + users = WorkOS::DirectorySync.list_users( + directory: "directory_01FAZYMST676QMTFN1DDJZZX87" + ) + + assert_equal 4, users.data.size + assert_equal users.data[0]["first_name"], users.data[0].first_name + end + end + + def test_list_users_with_group + VCR.use_cassette "directory_sync/list_users/with_group" do + users = WorkOS::DirectorySync.list_users( + group: "directory_group_01FBXGP79EJAYKW0WS9JCK1V6E" + ) + + assert_equal 1, users.data.size + end + end + + def test_list_users_with_before + VCR.use_cassette "directory_sync/list_users/with_before" do + users = WorkOS::DirectorySync.list_users( + before: "directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF", + directory: "directory_01FAZYMST676QMTFN1DDJZZX87" + ) + + assert_equal 2, users.data.size + end + end + + def test_list_users_with_after + VCR.use_cassette "directory_sync/list_users/with_after" do + users = WorkOS::DirectorySync.list_users( + after: "directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF", + directory: "directory_01FAZYMST676QMTFN1DDJZZX87" + ) + + assert_equal 1, users.data.size + end + end + + def test_list_users_with_limit + VCR.use_cassette "directory_sync/list_users/with_limit" do + users = WorkOS::DirectorySync.list_users( + limit: 2, + directory: "directory_01FAZYMST676QMTFN1DDJZZX87" + ) + + assert_equal 2, users.data.size + end + end + + def test_get_group_with_valid_id + VCR.use_cassette("directory_sync/get_group") do + group = WorkOS::DirectorySync.get_group( + "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG" + ) + + assert_equal "directory_01G2Z8ADK5NPMVTWF48MVVE4HT", group["directory_id"] + assert_equal "org_01EGS4P7QR31EZ4YWD1Z1XA176", group["organization_id"] + assert_equal "01jlao4614two3d", group["idp_id"] + assert_equal "Sales", group["name"] + assert_equal "Sales", group.name + assert_equal "2022-05-13T17:45:31.732Z", group["created_at"] + assert_equal "2022-07-13T17:45:42.618Z", group["updated_at"] + end + end + + def test_get_group_with_invalid_id + VCR.use_cassette("directory_sync/get_group_with_invalid_id") do + assert_raises(WorkOS::NotFoundError) do + WorkOS::DirectorySync.get_group("invalid") + end + end + end + + def test_get_user_with_valid_id + VCR.use_cassette("directory_sync/get_user") do + user = WorkOS::DirectorySync.get_user( + "directory_user_01FAZYNPC8M0HRYTKFP2GNX852" + ) + + assert_equal "Bob", user["first_name"] + assert_equal "directory_01FAZYMST676QMTFN1DDJZZX87", user.directory_id + assert_equal "org_01FAZWCWR03DVWA83NCJYKKD54", user.organization_id + assert_equal "Bob", user.first_name + end + end + + def test_get_user_with_invalid_id + VCR.use_cassette("directory_sync/get_user_with_invalid_id") do + assert_raises(WorkOS::NotFoundError) do + WorkOS::DirectorySync.get_user("invalid") + end + end + end +end diff --git a/test/workos/test_directory_user.rb b/test/workos/test_directory_user.rb new file mode 100644 index 00000000..cd489327 --- /dev/null +++ b/test/workos/test_directory_user.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestDirectoryUser < WorkOS::TestCase + # rubocop:disable Layout/LineLength + def test_primary_email_with_one_primary_email + user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') + assert_equal "bob.fakename@workos.com", user.primary_email + end + + def test_primary_email_with_multiple_primary_emails + user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":true,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') + assert_equal "bob.fakename@workos.com", user.primary_email + end + + def test_primary_email_with_no_primary_emails + user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":false,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-07-13T17:45:42.618Z"}') + assert_nil user.primary_email + end + + def test_primary_email_with_empty_email_array + user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-07-13T17:45:42.618Z"}') + assert_nil user.primary_email + end + + def test_role_with_no_role + user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') + assert_nil user.role + assert_nil user.roles + end + + def test_role_with_single_role + user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"role":{"slug":"member"},"roles":[{"slug":"member"}],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') + assert_equal({slug: "member"}, user.role) + assert_equal [{slug: "member"}], user.roles + end + + def test_role_with_multiple_roles + user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"role":{"slug":"admin"},"roles":[{"slug":"member"}, {"slug":"admin"}],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') + assert_equal({slug: "admin"}, user.role) + assert_equal [{slug: "member"}, {slug: "admin"}], user.roles + end + # rubocop:enable Layout/LineLength +end diff --git a/test/workos/test_event.rb b/test/workos/test_event.rb new file mode 100644 index 00000000..90d0aa0d --- /dev/null +++ b/test/workos/test_event.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestEvent < WorkOS::TestCase + def test_list_events_with_no_options_raises_argument_error + VCR.use_cassette "events/list_events_with_no_options" do + assert_raises(ArgumentError) do + WorkOS::Events.list_events + end + end + end + + def test_list_events_with_event + VCR.use_cassette "events/list_events_with_event" do + events = WorkOS::Events.list_events( + events: ["connection.activated"] + ) + + assert_equal 1, events.data.size + end + end + + def test_list_events_with_after + VCR.use_cassette "events/list_events_with_after" do + events = WorkOS::Events.list_events( + after: "event_01FGCPNV312FHFRCX0BYWHVSE1", + events: ["dsync.user.created"] + ) + + assert_equal 1, events.data.size + end + end + + def test_list_events_with_range_start_and_range_end + VCR.use_cassette "events/list_events_with_range" do + events = WorkOS::Events.list_events( + events: ["dsync.user.created"], + range_start: "2023-01-01T00:00:00Z", + range_end: "2023-01-03T00:00:00Z" + ) + + assert_equal 1, events.data.size + end + end + + def test_list_events_with_organization_id + VCR.use_cassette "events/list_events_with_organization_id" do + events = WorkOS::Events.list_events( + events: ["dsync.user.created"], + organization_id: "org_1234" + ) + + assert_equal 1, events.data.size + end + end +end diff --git a/test/workos/test_mfa.rb b/test/workos/test_mfa.rb new file mode 100644 index 00000000..82fe41db --- /dev/null +++ b/test/workos/test_mfa.rb @@ -0,0 +1,216 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestMFA < WorkOS::TestCase + def test_enroll_factor_generic_valid + VCR.use_cassette "mfa/enroll_factor_generic_valid" do + factor = WorkOS::MFA.enroll_factor( + type: "generic_otp" + ) + assert_equal "generic_otp", factor.type + end + end + + def test_enroll_factor_totp_valid + VCR.use_cassette "mfa/enroll_factor_totp_valid" do + factor = WorkOS::MFA.enroll_factor( + type: "totp", + totp_issuer: "WorkOS", + totp_user: "some_user" + ) + assert_kind_of Hash, factor.totp + end + end + + def test_enroll_factor_sms_valid + VCR.use_cassette "mfa/enroll_factor_sms_valid" do + factor = WorkOS::MFA.enroll_factor( + type: "sms", + phone_number: "55555555555" + ) + assert_kind_of Hash, factor.sms + end + end + + def test_enroll_factor_with_invalid_type_raises_error + err = assert_raises(ArgumentError) do + WorkOS::MFA.enroll_factor( + type: "invalid", + phone_number: "+15005550006" + ) + end + assert_equal "Type argument must be either 'sms' or 'totp'", err.message + end + + def test_enroll_factor_totp_missing_arguments_raises_error + err = assert_raises(ArgumentError) do + WorkOS::MFA.enroll_factor( + type: "totp", + totp_issuer: "WorkOS" + ) + end + assert_equal "Incomplete arguments. Need to specify both totp_issuer and totp_user when type is totp", err.message + end + + def test_enroll_factor_sms_missing_phone_number_raises_error + err = assert_raises(ArgumentError) do + WorkOS::MFA.enroll_factor( + type: "sms" + ) + end + assert_equal "Incomplete arguments. Need to specify phone_number when type is sms", err.message + end + + def test_challenge_factor_totp + VCR.use_cassette "mfa/challenge_factor_totp_valid" do + challenge_factor = WorkOS::MFA.challenge_factor( + authentication_factor_id: "auth_factor_01FZ4TS0MWPZR7GATS7KCXANQZ" + ) + assert_kind_of String, challenge_factor.authentication_factor_id + end + end + + def test_challenge_factor_sms + VCR.use_cassette "mfa/challenge_factor_sms_valid" do + challenge_factor = WorkOS::MFA.challenge_factor( + authentication_factor_id: "auth_factor_01FZ4TS14D1PHFNZ9GF6YD8M1F", + sms_template: "Your code is {{code}}" + ) + assert_kind_of String, challenge_factor.authentication_factor_id + end + end + + def test_challenge_factor_generic + VCR.use_cassette "mfa/challenge_factor_generic_valid" do + challenge_factor = WorkOS::MFA.challenge_factor( + authentication_factor_id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" + ) + assert_kind_of String, challenge_factor.code + end + end + + def test_challenge_factor_missing_authentication_factor_id_raises_error + err = assert_raises(ArgumentError) do + WorkOS::MFA.challenge_factor + end + assert_equal "Incomplete arguments: 'authentication_factor_id' is a required argument", err.message + end + + def test_verify_factor_throws_deprecation_warning + VCR.use_cassette "mfa/verify_challenge_generic_valid" do + _, err = capture_io do + WorkOS::MFA.verify_factor( + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" + ) + end + assert_match(/\[DEPRECATION\] `verify_factor` is deprecated. Please use `verify_challenge` instead./, err) + end + end + + def test_verify_factor_calls_verify_challenge + VCR.use_cassette "mfa/verify_challenge_generic_valid" do + verify_factor = WorkOS::MFA.verify_factor( + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" + ) + assert_equal true, verify_factor.valid + end + end + + def test_verify_challenge_generic_valid_returns_true + VCR.use_cassette "mfa/verify_challenge_generic_valid" do + verify_challenge = WorkOS::MFA.verify_challenge( + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" + ) + assert_equal true, verify_challenge.valid + end + end + + def test_verify_challenge_generic_valid_returns_false + VCR.use_cassette "mfa/verify_challenge_generic_valid_is_false" do + verify_challenge = WorkOS::MFA.verify_challenge( + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" + ) + assert_equal false, verify_challenge.valid + end + end + + def test_verify_challenge_already_verified_raises_error + VCR.use_cassette "mfa/verify_challenge_generic_invalid" do + assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::MFA.verify_challenge( + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" + ) + end + end + end + + def test_verify_challenge_expired_raises_error + VCR.use_cassette "mfa/verify_challenge_generic_expired" do + assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::MFA.verify_challenge( + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", + code: "897792" + ) + end + end + end + + def test_verify_challenge_missing_code_raises_error + err = assert_raises(ArgumentError) do + WorkOS::MFA.verify_challenge( + authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J" + ) + end + assert_equal "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments", err.message + end + + def test_verify_challenge_missing_authentication_challenge_id_raises_error + err = assert_raises(ArgumentError) do + WorkOS::MFA.verify_challenge( + code: "897792" + ) + end + assert_equal "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments", err.message + end + + def test_verify_challenge_missing_all_arguments_raises_error + err = assert_raises(ArgumentError) do + WorkOS::MFA.verify_challenge + end + assert_equal "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments", err.message + end + + def test_get_factor_with_valid_id + VCR.use_cassette "mfa/get_factor_valid" do + factor = WorkOS::MFA.get_factor( + id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" + ) + assert_kind_of String, factor.id + end + end + + def test_get_factor_with_invalid_id + VCR.use_cassette "mfa/get_factor_invalid" do + assert_raises(WorkOS::NotFoundError) do + WorkOS::MFA.get_factor( + id: "auth_factor_invalid" + ) + end + end + end + + def test_delete_factor + VCR.use_cassette "mfa/delete_factor" do + response = WorkOS::MFA.delete_factor( + id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" + ) + assert_equal true, response + end + end +end diff --git a/test/workos/test_organizations.rb b/test/workos/test_organizations.rb new file mode 100644 index 00000000..3ddc31a1 --- /dev/null +++ b/test/workos/test_organizations.rb @@ -0,0 +1,406 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestOrganizations < WorkOS::TestCase + def test_create_organization + VCR.use_cassette "organization/create" do + organization = WorkOS::Organizations.create_organization( + domains: ["example.io"], + name: "Test Organization" + ) + + assert_equal "org_01FCPEJXEZR4DSBA625YMGQT9N", organization.id + assert_equal "Test Organization", organization.name + assert_equal "example.io", organization.domains.first[:domain] + end + end + + def test_create_organization_without_domains + VCR.use_cassette "organization/create_without_domains" do + organization = WorkOS::Organizations.create_organization( + name: "Test Organization" + ) + + assert organization.id.start_with?("org_") + assert_equal "Test Organization", organization.name + assert organization.domains.empty? + end + end + + def test_create_organization_with_external_id + VCR.use_cassette "organization/create_with_external_id" do + organization = WorkOS::Organizations.create_organization( + name: "Test Organization with External ID", + external_id: "ext_org_123" + ) + + assert organization.id.start_with?("org_") + assert_equal "Test Organization with External ID", organization.name + assert_equal "ext_org_123", organization.external_id + end + end + + def test_create_organization_with_domains_warns_deprecation + VCR.use_cassette "organization/create_with_domains" do + _, err = capture_io do + organization = WorkOS::Organizations.create_organization( + domains: ["example.io"], + name: "Test Organization" + ) + + assert organization.id.start_with?("org_") + assert_equal "Test Organization", organization.name + assert_equal "example.io", organization.domains.first[:domain] + end + assert_match(/\[DEPRECATION\] `domains` is deprecated. Use `domain_data` instead./, err) + end + end + + def test_create_organization_with_domain_data + VCR.use_cassette "organization/create_with_domain_data" do + organization = WorkOS::Organizations.create_organization( + domain_data: [{domain: "example.io", state: "verified"}], + name: "Test Organization" + ) + + assert organization.id.start_with?("org_") + assert_equal "Test Organization", organization.name + assert_equal "example.io", organization.domains.first[:domain] + assert_equal "verified", organization.domains.first[:state] + end + end + + def test_create_organization_with_idempotency_key + VCR.use_cassette "organization/create_with_idempotency_key" do + organization = WorkOS::Organizations.create_organization( + domains: ["example.io"], + name: "Test Organization", + idempotency_key: "key" + ) + + assert_equal "Test Organization", organization.name + assert_equal "example.io", organization.domains.first[:domain] + end + end + + def test_create_organization_with_duplicate_idempotency_key_and_payload + VCR.use_cassette "organization/create_with_duplicate_idempotency_key_and_payload" do + organization1 = WorkOS::Organizations.create_organization( + domains: ["example.com"], + name: "Test Organization", + idempotency_key: "foo" + ) + + organization2 = WorkOS::Organizations.create_organization( + domains: ["example.com"], + name: "Test Organization", + idempotency_key: "foo" + ) + + assert_equal organization1.id, organization2.id + end + end + + def test_create_organization_with_duplicate_idempotency_key_and_different_payload + VCR.use_cassette "organization/create_with_duplicate_idempotency_key_and_different_payload" do + WorkOS::Organizations.create_organization( + domains: ["example.me"], + name: "Test Organization", + idempotency_key: "bar" + ) + + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::Organizations.create_organization( + domains: ["example.me"], + name: "Organization Test", + idempotency_key: "bar" + ) + end + assert_match(/Status 400, Another idempotency key \(bar\) with different request parameters was found. Please use a different idempotency key./, err.message) + end + end + + def test_create_organization_with_invalid_payload + VCR.use_cassette "organization/create_invalid" do + err = assert_raises(WorkOS::APIError) do + WorkOS::Organizations.create_organization( + domains: ["example.com"], + name: "Test Organization 2" + ) + end + assert_match(/An Organization with the domain example.com already exists/, err.message) + end + end + + def test_list_organizations_with_no_options + expected_metadata = { + "after" => nil, + "before" => "before-id" + } + + VCR.use_cassette "organization/list" do + organizations = WorkOS::Organizations.list_organizations + + assert_equal 6, organizations.data.size + assert_equal expected_metadata, organizations.list_metadata + end + end + + def test_list_organizations_with_before + VCR.use_cassette "organization/list", match_requests_on: [:path] do + organizations = WorkOS::Organizations.list_organizations( + before: "before-id" + ) + + assert_equal 6, organizations.data.size + end + end + + def test_list_organizations_with_after + VCR.use_cassette "organization/list", match_requests_on: [:path] do + organizations = WorkOS::Organizations.list_organizations(after: "after-id") + + assert_equal 6, organizations.data.size + end + end + + def test_list_organizations_with_limit + VCR.use_cassette "organization/list", match_requests_on: [:path] do + organizations = WorkOS::Organizations.list_organizations(limit: 10) + + assert_equal 6, organizations.data.size + end + end + + def test_get_organization_with_valid_id + VCR.use_cassette("organization/get") do + organization = WorkOS::Organizations.get_organization( + id: "org_01F9293WD2PDEEV4Y625XPZVG7" + ) + + assert_equal "org_01F9293WD2PDEEV4Y625XPZVG7", organization.id + assert_equal "Foo Corp", organization.name + assert_equal "foo-corp.com", organization.domains.first[:domain] + end + end + + def test_get_organization_with_invalid_id + VCR.use_cassette("organization/get_invalid") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::Organizations.get_organization(id: "invalid") + end + assert_equal "Status 404, Not Found - request ID: ", err.message + end + end + + def test_update_organization + VCR.use_cassette "organization/update" do + organization = WorkOS::Organizations.update_organization( + organization: "org_01F6Q6TFP7RD2PF6J03ANNWDKV", + domains: ["example.me"], + name: "Test Organization" + ) + + assert_equal "org_01F6Q6TFP7RD2PF6J03ANNWDKV", organization.id + assert_equal "Test Organization", organization.name + assert_equal "example.me", organization.domains.first[:domain] + end + end + + def test_update_organization_without_name + VCR.use_cassette "organization/update_without_name" do + organization = WorkOS::Organizations.update_organization( + organization: "org_01F6Q6TFP7RD2PF6J03ANNWDKV", + domains: ["example.me"] + ) + + assert_equal "org_01F6Q6TFP7RD2PF6J03ANNWDKV", organization.id + assert_equal "Test Organization", organization.name + assert_equal "example.me", organization.domains.first[:domain] + end + end + + def test_update_organization_with_stripe_customer_id + VCR.use_cassette "organization/update_with_stripe_customer_id" do + organization = WorkOS::Organizations.update_organization( + organization: "org_01JJ5H14CAA2SQ5G9HNN6TBZ05", + name: "Test Organization", + stripe_customer_id: "cus_123" + ) + + assert_equal "org_01JJ5H14CAA2SQ5G9HNN6TBZ05", organization.id + assert_equal "Test Organization", organization.name + assert_equal "cus_123", organization.stripe_customer_id + end + end + + def test_update_organization_with_external_id + VCR.use_cassette "organization/update_with_external_id" do + organization = WorkOS::Organizations.update_organization( + organization: "org_01K0SQV0S6EPWK2ZDEFD1CP1JC", + name: "Test Organization", + external_id: "ext_org_456" + ) + + assert_equal "org_01K0SQV0S6EPWK2ZDEFD1CP1JC", organization.id + assert_equal "Test Organization", organization.name + assert_equal "ext_org_456", organization.external_id + end + end + + def test_update_organization_with_external_id_null + VCR.use_cassette "organization/update_with_external_id_null" do + organization = WorkOS::Organizations.update_organization( + organization: "org_01K0SQV0S6EPWK2ZDEFD1CP1JC", + name: "Test Organization", + external_id: nil + ) + + assert_nil organization.external_id + end + end + + def test_delete_organization_with_valid_id + VCR.use_cassette("organization/delete") do + response = WorkOS::Organizations.delete_organization( + id: "org_01F4A8TD0B4N1Y9SJ8SH635HDB" + ) + + assert_equal true, response + end + end + + def test_delete_organization_with_invalid_id + VCR.use_cassette("organization/delete_invalid") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::Organizations.delete_organization(id: "invalid") + end + assert_equal "Status 404, Not Found - request ID: ", err.message + end + end + + def test_list_organization_roles + expected_metadata = { + after: nil, + before: nil + } + + VCR.use_cassette "organization/list_organization_roles" do + roles = WorkOS::Organizations.list_organization_roles( + organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE" + ) + + assert_equal 7, roles.data.size + assert_equal expected_metadata, roles.list_metadata + end + end + + def test_list_organization_roles_returns_properly_initialized_role_objects + VCR.use_cassette "organization/list_organization_roles" do + roles = WorkOS::Organizations.list_organization_roles( + organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE" + ) + + first_role = roles.data.first + assert_kind_of WorkOS::Role, first_role + assert_equal "role_01HS1C7GRJE08PBR3M6Y0ZYGDZ", first_role.id + assert_equal "Admin", first_role.name + assert_equal "admin", first_role.slug + assert_equal "Write access to every resource available", first_role.description + assert_equal ["admin:all", "read:users", "write:users", "manage:roles"], first_role.permissions + assert_equal "EnvironmentRole", first_role.type + assert_equal "2024-03-15T15:38:29.521Z", first_role.created_at + assert_equal "2024-11-14T17:08:00.556Z", first_role.updated_at + end + end + + def test_list_organization_roles_handles_empty_permissions + VCR.use_cassette "organization/list_organization_roles" do + roles = WorkOS::Organizations.list_organization_roles( + organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE" + ) + + platform_manager_role = roles.data.find { |role| role.slug == "org-platform-manager" } + assert_kind_of WorkOS::Role, platform_manager_role + assert_equal [], platform_manager_role.permissions + end + end + + def test_list_organization_roles_serializes_including_permissions + VCR.use_cassette "organization/list_organization_roles" do + roles = WorkOS::Organizations.list_organization_roles( + organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE" + ) + + billing_role = roles.data.find { |role| role.slug == "billing" } + serialized = billing_role.to_json + + assert_equal "role_01JA8GJZRDSZEB9289DQXJ3N9Z", serialized[:id] + assert_equal "Billing Manager", serialized[:name] + assert_equal "billing", serialized[:slug] + assert_equal ["read:billing", "write:billing"], serialized[:permissions] + assert_equal "EnvironmentRole", serialized[:type] + end + end + + def test_list_organization_feature_flags + expected_metadata = { + after: nil, + before: nil + } + + VCR.use_cassette "organization/list_organization_feature_flags" do + feature_flags = WorkOS::Organizations.list_organization_feature_flags( + organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529" + ) + + assert_equal 2, feature_flags.data.size + assert_equal expected_metadata, feature_flags.list_metadata + end + end + + def test_list_organization_feature_flags_with_before + VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do + feature_flags = WorkOS::Organizations.list_organization_feature_flags( + organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", + options: {before: "before-id"} + ) + + assert_equal 2, feature_flags.data.size + end + end + + def test_list_organization_feature_flags_with_after + VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do + feature_flags = WorkOS::Organizations.list_organization_feature_flags( + organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", + options: {after: "after-id"} + ) + + assert_equal 2, feature_flags.data.size + end + end + + def test_list_organization_feature_flags_with_limit + VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do + feature_flags = WorkOS::Organizations.list_organization_feature_flags( + organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", + options: {limit: 10} + ) + + assert_equal 2, feature_flags.data.size + end + end + + def test_list_organization_feature_flags_with_multiple_pagination_options + VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do + feature_flags = WorkOS::Organizations.list_organization_feature_flags( + organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", + options: {after: "after-id", limit: 5, order: "asc"} + ) + + assert_equal 2, feature_flags.data.size + end + end +end diff --git a/test/workos/test_passwordless.rb b/test/workos/test_passwordless.rb new file mode 100644 index 00000000..c502b02e --- /dev/null +++ b/test/workos/test_passwordless.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestPasswordless < WorkOS::TestCase + def test_create_session_with_valid_options + VCR.use_cassette("passwordless/create_session") do + response = WorkOS::Passwordless.create_session( + email: "demo@workos-okta.com", + type: "MagicLink", + redirect_uri: "foo.com/auth/callback" + ) + + assert_equal "demo@workos-okta.com", response.email + end + end + + def test_create_session_with_invalid_options + VCR.use_cassette("passwordless/create_session_invalid") do + err = assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::Passwordless.create_session({}) + end + assert_match( + /Status 422, Validation failed \(email: email must be a string; type: type must be a valid enum value\)/, + err.message + ) + end + end + + def test_send_session_with_valid_session_id + VCR.use_cassette("passwordless/send_session") do + response = WorkOS::Passwordless.send_session( + "passwordless_session_01EJC0F4KH42T11Y2DHPEB09BM" + ) + + assert_equal true, response["success"] + end + end + + def test_send_session_with_invalid_session_id + VCR.use_cassette("passwordless/send_session_invalid") do + err = assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::Passwordless.send_session("session_123") + end + assert_match( + /Status 422, The passwordless session 'session_123' has expired or is invalid./, + err.message + ) + end + end +end diff --git a/test/workos/test_portal.rb b/test/workos/test_portal.rb new file mode 100644 index 00000000..db25b19a --- /dev/null +++ b/test/workos/test_portal.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestPortal < WorkOS::TestCase + def setup + super + @organization = "org_01EHQMYV6MBK39QC5PZXHY59C3" + end + + def test_generate_link_with_sso_intent + VCR.use_cassette "portal/generate_link_sso" do + portal_link = WorkOS::Portal.generate_link( + intent: "sso", + organization: @organization + ) + + assert_equal "https://id.workos.com/portal/launch?secret=secret", portal_link + end + end + + def test_generate_link_with_dsync_intent + VCR.use_cassette "portal/generate_link_dsync" do + portal_link = WorkOS::Portal.generate_link( + intent: "dsync", + organization: @organization + ) + + assert_equal "https://id.workos.com/portal/launch?secret=secret", portal_link + end + end + + def test_generate_link_with_audit_logs_intent + VCR.use_cassette "portal/generate_link_audit_logs", match_requests_on: %i[path body] do + portal_link = WorkOS::Portal.generate_link( + intent: "audit_logs", + organization: @organization + ) + + assert_equal "https://id.workos.com/portal/launch?secret=secret", portal_link + end + end + + def test_generate_link_with_certificate_renewal_intent + VCR.use_cassette "portal/generate_link_certificate_renewal", match_requests_on: %i[path body] do + portal_link = WorkOS::Portal.generate_link( + intent: "certificate_renewal", + organization: @organization + ) + + assert_equal "https://id.workos.com/portal/launch?secret=secret", portal_link + end + end + + def test_generate_link_with_domain_verification_intent + VCR.use_cassette "portal/generate_link_domain_verification", match_requests_on: %i[path body] do + portal_link = WorkOS::Portal.generate_link( + intent: "domain_verification", + organization: @organization + ) + + assert_equal "https://id.workos.com/portal/launch?secret=secret", portal_link + end + end + + def test_generate_link_with_invalid_organization + VCR.use_cassette "portal/generate_link_invalid" do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::Portal.generate_link( + intent: "sso", + organization: "bogus-id" + ) + end + assert_match(/Could not find an organization with the id, bogus-id/, err.message) + end + end + + def test_generate_link_with_invalid_intent + err = assert_raises(ArgumentError) do + WorkOS::Portal.generate_link( + intent: "bogus-intent", + organization: @organization + ) + end + assert_match(/bogus-intent is not a valid value/, err.message) + end +end diff --git a/test/workos/test_role.rb b/test/workos/test_role.rb new file mode 100644 index 00000000..ceb9f29d --- /dev/null +++ b/test/workos/test_role.rb @@ -0,0 +1,128 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestRole < WorkOS::TestCase + def test_initialize_with_full_role_data_including_permissions + role_json = { + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "Admin", + slug: "admin", + description: "Administrator role with full access", + permissions: ["read:users", "write:users", "admin:all"], + type: "system", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" + }.to_json + + role = WorkOS::Role.new(role_json) + + assert_equal "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", role.id + assert_equal "Admin", role.name + assert_equal "admin", role.slug + assert_equal "Administrator role with full access", role.description + assert_equal ["read:users", "write:users", "admin:all"], role.permissions + assert_equal "system", role.type + assert_equal "2022-05-13T17:45:31.732Z", role.created_at + assert_equal "2022-07-13T17:45:42.618Z", role.updated_at + end + + def test_initialize_without_permissions + role_json = { + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "User", + slug: "user", + description: "Basic user role", + type: "custom", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" + }.to_json + + role = WorkOS::Role.new(role_json) + + assert_equal "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", role.id + assert_equal "User", role.name + assert_equal "user", role.slug + assert_equal "Basic user role", role.description + assert_equal [], role.permissions + assert_equal "custom", role.type + assert_equal "2022-05-13T17:45:31.732Z", role.created_at + assert_equal "2022-07-13T17:45:42.618Z", role.updated_at + end + + def test_initialize_with_null_permissions + role_json = { + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "User", + slug: "user", + description: "Basic user role", + permissions: nil, + type: "custom", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" + }.to_json + + role = WorkOS::Role.new(role_json) + + assert_equal [], role.permissions + end + + def test_initialize_with_empty_permissions_array + role_json = { + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "User", + slug: "user", + description: "Basic user role", + permissions: [], + type: "custom", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" + }.to_json + + role = WorkOS::Role.new(role_json) + + assert_equal [], role.permissions + end + + def test_to_json_with_permissions + role_json = { + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "Admin", + slug: "admin", + description: "Administrator role", + permissions: ["read:all", "write:all"], + type: "system", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" + }.to_json + + role = WorkOS::Role.new(role_json) + serialized = role.to_json + + assert_equal "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", serialized[:id] + assert_equal "Admin", serialized[:name] + assert_equal "admin", serialized[:slug] + assert_equal "Administrator role", serialized[:description] + assert_equal ["read:all", "write:all"], serialized[:permissions] + assert_equal "system", serialized[:type] + assert_equal "2022-05-13T17:45:31.732Z", serialized[:created_at] + assert_equal "2022-07-13T17:45:42.618Z", serialized[:updated_at] + end + + def test_to_json_without_permissions + role_json = { + id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", + name: "User", + slug: "user", + description: "Basic user role", + type: "custom", + created_at: "2022-05-13T17:45:31.732Z", + updated_at: "2022-07-13T17:45:42.618Z" + }.to_json + + role = WorkOS::Role.new(role_json) + serialized = role.to_json + + assert_equal [], serialized[:permissions] + end +end diff --git a/test/workos/test_session.rb b/test/workos/test_session.rb new file mode 100644 index 00000000..670b55e8 --- /dev/null +++ b/test/workos/test_session.rb @@ -0,0 +1,472 @@ +# frozen_string_literal: true + +require "test_helper" +require "openssl" +require "jwt" + +class TestSession < WorkOS::TestCase + # Simple mock object that responds to methods based on keyword args. + # Replacement for OpenStruct which is not in Ruby 4 default gems. + class MockObj + def initialize(**kwargs) + @attrs = kwargs + kwargs.each do |key, value| + define_singleton_method(key) { value } + end + end + end + + def setup + super + WorkOS::Cache.clear + @client_id = "test_client_id" + @cookie_password = "test_very_long_cookie_password__" + @session_data = "test_session_data" + @jwk = JWT::JWK.new(OpenSSL::PKey::RSA.new(2048), {kid: "sso_oidc_key_pair_123", use: "sig", alg: "RS256"}) + @jwks_hash = {keys: [@jwk.export]}.to_json + @jwks_url = "https://api.workos.com/sso/jwks/client_123" + @user_management = Minitest::Mock.new + end + + # Helper to build a session with the mock user_management and Net::HTTP stubbed + def build_session(session_data: @session_data, cookie_password: @cookie_password, encryptor: nil) + args = { + user_management: @user_management, + client_id: @client_id, + session_data: session_data, + cookie_password: cookie_password + } + args[:encryptor] = encryptor if encryptor + WorkOS::Session.new(**args) + end + + def with_mocked_jwks + @user_management.expect(:get_jwks_url, @jwks_url, [@client_id]) + Net::HTTP.stub(:get, @jwks_hash) do + yield + end + end + + # --- initialize --- + + def test_jwks_caching + WorkOS::Cache.clear + + # First session fetches from remote + @user_management.expect(:get_jwks_url, @jwks_url, [@client_id]) + session1 = nil + session2 = nil + + Net::HTTP.stub(:get, @jwks_hash) do + session1 = build_session + + # Second session should use cache (no additional Net::HTTP.get call needed) + @user_management.expect(:get_jwks_url, @jwks_url, [@client_id]) + session2 = build_session + end + + assert_equal session1.jwks.map(&:export), session2.jwks.map(&:export) + end + + def test_jwks_fetches_from_remote_when_cache_expired + WorkOS::Cache.clear + + session1 = nil + session2 = nil + + @user_management.expect(:get_jwks_url, @jwks_url, [@client_id]) + Net::HTTP.stub(:get, @jwks_hash) do + session1 = build_session + end + + # Simulate cache expiration by advancing time + @user_management.expect(:get_jwks_url, @jwks_url, [@client_id]) + Time.stub(:now, Time.now + 301) do + Net::HTTP.stub(:get, @jwks_hash) do + session2 = build_session + end + end + + assert_equal session1.jwks.map(&:export), session2.jwks.map(&:export) + end + + def test_raises_error_if_cookie_password_is_nil + with_mocked_jwks do + err = assert_raises(ArgumentError) do + build_session(cookie_password: nil) + end + assert_equal "cookiePassword is required", err.message + end + end + + def test_raises_error_if_cookie_password_is_empty + with_mocked_jwks do + err = assert_raises(ArgumentError) do + build_session(cookie_password: "") + end + assert_equal "cookiePassword is required", err.message + end + end + + def test_initializes_with_valid_parameters + with_mocked_jwks do + session = build_session + assert_equal @user_management.object_id, session.user_management.object_id + assert_equal @client_id, session.client_id + assert_equal @session_data, session.session_data + assert_equal @cookie_password, session.cookie_password + assert_equal JSON.parse(@jwks_hash, symbolize_names: true)[:keys], session.jwks.map(&:export) + assert_equal ["RS256"], session.jwks_algorithms + end + end + + # --- .authenticate --- + + def make_payload(overrides = {}) + { + sid: "session_id", + org_id: "org_id", + role: "role", + roles: ["role"], + permissions: ["read"], + exp: Time.now.to_i + 3600 + }.merge(overrides) + end + + def make_session_data(payload = nil, cookie_password: @cookie_password) + payload ||= make_payload + valid_access_token = JWT.encode(payload, @jwk.signing_key, @jwk[:alg], {kid: @jwk[:kid]}) + WorkOS::Session.seal_data({ + access_token: valid_access_token, + user: "user", + impersonator: "impersonator" + }, cookie_password) + end + + def test_authenticate_returns_no_session_cookie_provided_when_nil + with_mocked_jwks do + session = build_session(session_data: nil) + result = session.authenticate + assert_equal false, result[:authenticated] + assert_equal "NO_SESSION_COOKIE_PROVIDED", result[:reason] + end + end + + def test_authenticate_returns_invalid_session_cookie_when_invalid + with_mocked_jwks do + session = build_session(session_data: "invalid_data") + result = session.authenticate + assert_equal false, result[:authenticated] + assert_equal "INVALID_SESSION_COOKIE", result[:reason] + end + end + + def test_authenticate_returns_invalid_jwt_when_access_token_invalid + with_mocked_jwks do + invalid_session_data = WorkOS::Session.seal_data({access_token: "invalid_token"}, @cookie_password) + session = build_session(session_data: invalid_session_data) + result = session.authenticate + assert_equal false, result[:authenticated] + assert_equal "INVALID_JWT", result[:reason] + end + end + + def test_authenticate_returns_invalid_jwt_when_session_expired + sealed = make_session_data + with_mocked_jwks do + session = build_session(session_data: sealed) + + # Monkey-patch JWT::Decode to skip signature verification + original_verify = JWT::Decode.instance_method(:verify_signature) + JWT::Decode.define_method(:verify_signature) { true } + begin + Time.stub(:now, Time.at(9_999_999_999)) do + result = session.authenticate + assert_equal false, result[:authenticated] + assert_equal "INVALID_JWT", result[:reason] + end + ensure + JWT::Decode.define_method(:verify_signature, original_verify) + end + end + end + + def test_authenticate_returns_invalid_jwt_with_full_token_data_when_expired_and_include_expired + sealed = make_session_data + with_mocked_jwks do + session = build_session(session_data: sealed) + + original_verify = JWT::Decode.instance_method(:verify_signature) + JWT::Decode.define_method(:verify_signature) { true } + begin + Time.stub(:now, Time.at(9_999_999_999)) do + result = session.authenticate(include_expired: true) + assert_equal false, result[:authenticated] + assert_equal "session_id", result[:session_id] + assert_equal "org_id", result[:organization_id] + assert_equal "role", result[:role] + assert_equal ["role"], result[:roles] + assert_equal ["read"], result[:permissions] + assert_nil result[:feature_flags] + assert_nil result[:entitlements] + assert_equal "user", result[:user] + assert_equal "impersonator", result[:impersonator] + assert_equal "INVALID_JWT", result[:reason] + end + ensure + JWT::Decode.define_method(:verify_signature, original_verify) + end + end + end + + def test_authenticate_successfully_with_valid_session_data + sealed = make_session_data + with_mocked_jwks do + session = build_session(session_data: sealed) + + original_verify = JWT::Decode.instance_method(:verify_signature) + JWT::Decode.define_method(:verify_signature) { true } + begin + result = session.authenticate + assert_equal true, result[:authenticated] + assert_equal "session_id", result[:session_id] + assert_equal "org_id", result[:organization_id] + assert_equal "role", result[:role] + assert_equal ["role"], result[:roles] + assert_equal ["read"], result[:permissions] + assert_nil result[:feature_flags] + assert_nil result[:entitlements] + assert_equal "user", result[:user] + assert_equal "impersonator", result[:impersonator] + assert_nil result[:reason] + ensure + JWT::Decode.define_method(:verify_signature, original_verify) + end + end + end + + def test_authenticate_merges_custom_claims_from_claim_extractor + custom_payload = make_payload(custom_claim: "custom_value", another_claim: 123) + custom_access_token = JWT.encode(custom_payload, @jwk.signing_key, @jwk[:alg], {kid: @jwk[:kid]}) + custom_session_data = WorkOS::Session.seal_data({ + access_token: custom_access_token, + user: "user", + impersonator: "impersonator" + }, @cookie_password) + + with_mocked_jwks do + session = build_session(session_data: custom_session_data) + + original_verify = JWT::Decode.instance_method(:verify_signature) + JWT::Decode.define_method(:verify_signature) { true } + begin + result = session.authenticate do |jwt| + {my_custom_claim: jwt["custom_claim"], my_other_claim: jwt["another_claim"]} + end + assert_equal true, result[:authenticated] + assert_equal "custom_value", result[:my_custom_claim] + assert_equal 123, result[:my_other_claim] + ensure + JWT::Decode.define_method(:verify_signature, original_verify) + end + end + end + + def test_authenticate_with_entitlements + payload = make_payload(entitlements: ["billing"]) + sealed = make_session_data(payload) + + with_mocked_jwks do + session = build_session(session_data: sealed) + + original_verify = JWT::Decode.instance_method(:verify_signature) + JWT::Decode.define_method(:verify_signature) { true } + begin + result = session.authenticate + assert_equal true, result[:authenticated] + assert_equal "session_id", result[:session_id] + assert_equal "org_id", result[:organization_id] + assert_equal "role", result[:role] + assert_equal ["role"], result[:roles] + assert_equal ["read"], result[:permissions] + assert_equal ["billing"], result[:entitlements] + assert_nil result[:feature_flags] + assert_equal "user", result[:user] + assert_equal "impersonator", result[:impersonator] + assert_nil result[:reason] + ensure + JWT::Decode.define_method(:verify_signature, original_verify) + end + end + end + + def test_authenticate_with_feature_flags + payload = make_payload(feature_flags: ["new_feature_enabled"]) + sealed = make_session_data(payload) + + with_mocked_jwks do + session = build_session(session_data: sealed) + + original_verify = JWT::Decode.instance_method(:verify_signature) + JWT::Decode.define_method(:verify_signature) { true } + begin + result = session.authenticate + assert_equal true, result[:authenticated] + assert_equal "session_id", result[:session_id] + assert_equal "org_id", result[:organization_id] + assert_equal "role", result[:role] + assert_equal ["role"], result[:roles] + assert_equal ["read"], result[:permissions] + assert_nil result[:entitlements] + assert_equal ["new_feature_enabled"], result[:feature_flags] + assert_equal "user", result[:user] + assert_equal "impersonator", result[:impersonator] + assert_nil result[:reason] + ensure + JWT::Decode.define_method(:verify_signature, original_verify) + end + end + end + + # --- .refresh --- + + def test_refresh_returns_invalid_session_cookie_when_invalid + with_mocked_jwks do + session = build_session(session_data: "invalid_data") + result = session.refresh + assert_equal false, result[:authenticated] + assert_equal "INVALID_SESSION_COOKIE", result[:reason] + end + end + + def test_refresh_successfully_with_valid_session_data + refresh_token = "test_refresh_token" + sealed = WorkOS::Session.seal_data({refresh_token: refresh_token, user: "user"}, @cookie_password) + auth_response = MockObj.new(sealed_session: "new_sealed_session") + + # Build a custom mock that accepts any kwargs for authenticate_with_refresh_token + um_mock = Object.new + um_mock.define_singleton_method(:get_jwks_url) { |_client_id| @jwks_url } + um_mock.instance_variable_set(:@jwks_url, @jwks_url) + um_mock.define_singleton_method(:authenticate_with_refresh_token) { |**_kwargs| auth_response } + + Net::HTTP.stub(:get, @jwks_hash) do + session = WorkOS::Session.new( + user_management: um_mock, + client_id: @client_id, + session_data: sealed, + cookie_password: @cookie_password + ) + result = session.refresh + assert_equal true, result[:authenticated] + assert_equal "new_sealed_session", result[:sealed_session] + assert_equal auth_response, result[:session] + assert_nil result[:reason] + end + end + + # --- .get_logout_url --- + + def test_get_logout_url_when_authenticated + Net::HTTP.stub(:get, @jwks_hash) do + session = WorkOS::Session.new( + user_management: WorkOS::UserManagement, + client_id: @client_id, + session_data: @session_data, + cookie_password: @cookie_password + ) + + session.stub(:authenticate, {authenticated: true, session_id: "session_123abc", reason: nil}) do + assert_equal( + "https://api.workos.com/user_management/sessions/logout?session_id=session_123abc", + session.get_logout_url + ) + end + end + end + + def test_get_logout_url_with_return_to + Net::HTTP.stub(:get, @jwks_hash) do + session = WorkOS::Session.new( + user_management: WorkOS::UserManagement, + client_id: @client_id, + session_data: @session_data, + cookie_password: @cookie_password + ) + + session.stub(:authenticate, {authenticated: true, session_id: "session_123abc", reason: nil}) do + assert_equal( + "https://api.workos.com/user_management/sessions/logout?session_id=session_123abc&return_to=https%3A%2F%2Fexample.com%2Fsigned-out", + session.get_logout_url(return_to: "https://example.com/signed-out") + ) + end + end + end + + def test_get_logout_url_raises_error_when_authentication_fails + Net::HTTP.stub(:get, @jwks_hash) do + session = WorkOS::Session.new( + user_management: WorkOS::UserManagement, + client_id: @client_id, + session_data: @session_data, + cookie_password: @cookie_password + ) + + session.stub(:authenticate, {authenticated: false, reason: "Invalid session"}) do + err = assert_raises(RuntimeError) do + session.get_logout_url + end + assert_equal "Failed to extract session ID for logout URL: Invalid session", err.message + end + end + end + + # --- custom encryptor --- + + def custom_encryptor + @custom_encryptor ||= Class.new do + def seal(data, _key) + "CUSTOM:#{JSON.generate(data)}" + end + + def unseal(sealed_data, _key) + json = sealed_data.sub("CUSTOM:", "") + JSON.parse(json, symbolize_names: true) + end + end.new + end + + def test_custom_encryptor_seal_data + sealed = WorkOS::Session.seal_data({foo: "bar"}, "key", encryptor: custom_encryptor) + assert sealed.start_with?("CUSTOM:") + end + + def test_custom_encryptor_unseal_data + sealed = 'CUSTOM:{"foo":"bar"}' + unsealed = WorkOS::Session.unseal_data(sealed, "key", encryptor: custom_encryptor) + assert_equal({foo: "bar"}, unsealed) + end + + def test_accepts_custom_encryptor_in_initialize + with_mocked_jwks do + session = build_session(encryptor: custom_encryptor) + assert_equal custom_encryptor, session.encryptor + end + end + + def test_defaults_to_aes_gcm_encryptor + with_mocked_jwks do + session = build_session + assert_kind_of WorkOS::Encryptors::AesGcm, session.encryptor + end + end + + def test_raises_argument_error_for_invalid_encryptor + with_mocked_jwks do + err = assert_raises(ArgumentError) do + build_session(encryptor: Object.new) + end + assert_match(/must respond to/, err.message) + end + end +end diff --git a/test/workos/test_sso.rb b/test/workos/test_sso.rb new file mode 100644 index 00000000..732d4acf --- /dev/null +++ b/test/workos/test_sso.rb @@ -0,0 +1,657 @@ +# frozen_string_literal: true + +require "test_helper" +require "securerandom" + +class TestSSO < WorkOS::TestCase + def domain_args + { + domain: "foo.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + } + end + + def provider_args + { + provider: "GoogleOAuth", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + } + end + + def connection_args + { + connection: "connection_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + } + end + + def domain_hint_args + { + connection: "connection_123", + domain_hint: "foo.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + } + end + + def login_hint_args + { + connection: "connection_123", + login_hint: "foo@workos.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + } + end + + def organization_args + { + organization: "org_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + } + end + + # authorization_url with a domain + + def test_authorization_url_with_domain_returns_valid_url + authorization_url = WorkOS::SSO.authorization_url(**domain_args) + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_domain_returns_expected_hostname + authorization_url = WorkOS::SSO.authorization_url(**domain_args) + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_domain_returns_expected_query_string + authorization_url = WorkOS::SSO.authorization_url(**domain_args) + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&domain=foo.com", + URI.parse(authorization_url).query + ) + end + + # authorization_url with a provider + + def test_authorization_url_with_provider_returns_valid_url + authorization_url = WorkOS::SSO.authorization_url(**provider_args) + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_provider_returns_expected_hostname + authorization_url = WorkOS::SSO.authorization_url(**provider_args) + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_provider_returns_expected_query_string + authorization_url = WorkOS::SSO.authorization_url(**provider_args) + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&provider=GoogleOAuth", + URI.parse(authorization_url).query + ) + end + + # authorization_url with a connection + + def test_authorization_url_with_connection_returns_valid_url + authorization_url = WorkOS::SSO.authorization_url(**connection_args) + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_connection_returns_expected_hostname + authorization_url = WorkOS::SSO.authorization_url(**connection_args) + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_connection_returns_expected_query_string + authorization_url = WorkOS::SSO.authorization_url(**connection_args) + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&connection=connection_123", + URI.parse(authorization_url).query + ) + end + + # authorization_url with a domain_hint + + def test_authorization_url_with_domain_hint_returns_valid_url + authorization_url = WorkOS::SSO.authorization_url(**domain_hint_args) + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_domain_hint_returns_expected_hostname + authorization_url = WorkOS::SSO.authorization_url(**domain_hint_args) + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_domain_hint_returns_expected_query_string + authorization_url = WorkOS::SSO.authorization_url(**domain_hint_args) + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&domain_hint=foo.com&connection=connection_123", + URI.parse(authorization_url).query + ) + end + + # authorization_url with a login_hint + + def test_authorization_url_with_login_hint_returns_valid_url + authorization_url = WorkOS::SSO.authorization_url(**login_hint_args) + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_login_hint_returns_expected_hostname + authorization_url = WorkOS::SSO.authorization_url(**login_hint_args) + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_login_hint_returns_expected_query_string + authorization_url = WorkOS::SSO.authorization_url(**login_hint_args) + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&login_hint=foo%40workos.com&connection=connection_123", + URI.parse(authorization_url).query + ) + end + + # authorization_url with an organization + + def test_authorization_url_with_organization_returns_valid_url + authorization_url = WorkOS::SSO.authorization_url(**organization_args) + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_organization_returns_expected_hostname + authorization_url = WorkOS::SSO.authorization_url(**organization_args) + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_organization_returns_expected_query_string + authorization_url = WorkOS::SSO.authorization_url(**organization_args) + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&organization=org_123", + URI.parse(authorization_url).query + ) + end + + # authorization_url without connection, domain, provider, or organization + + def test_authorization_url_without_connection_domain_provider_or_organization_raises_error + args = { + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + } + err = assert_raises(ArgumentError) do + WorkOS::SSO.authorization_url(**args) + end + assert_equal "Either connection, domain, provider, or organization is required.", err.message + end + + # authorization_url with an invalid provider + + def test_authorization_url_with_invalid_provider_raises_error + args = { + provider: "Okta", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + } + err = assert_raises(ArgumentError) do + WorkOS::SSO.authorization_url(**args) + end + assert_equal( + "Okta is not a valid value. `provider` must be in " \ + '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth"]', + err.message + ) + end + + # get_profile + + def test_get_profile_returns_a_profile + VCR.use_cassette "sso/profile" do + profile = WorkOS::SSO.get_profile(access_token: "access_token") + + expectation = { + connection_id: "conn_01E83FVYZHY7DM4S9503JHV0R5", + connection_type: "GoogleOAuth", + email: "bob.loblaw@workos.com", + first_name: "Bob", + id: "prof_01EEJTY9SZ1R350RB7B73SNBKF", + idp_id: "116485463307139932699", + last_name: "Loblaw", + role: { + slug: "member" + }, + roles: [{ + slug: "member" + }], + groups: nil, + organization_id: "org_01FG53X8636WSNW2WEKB2C31ZB", + custom_attributes: {}, + raw_attributes: { + email: "bob.loblaw@workos.com", + family_name: "Loblaw", + given_name: "Bob", + hd: "workos.com", + id: "116485463307139932699", + locale: "en", + name: "Bob Loblaw", + picture: "https://lh3.googleusercontent.com/a-/AOh14GyO2hLlgZvteDQ3Ldi3_-RteZLya0hWH7247Cam=s96-c", + verified_email: true + } + } + assert_equal expectation, profile.to_json + end + end + + # profile_and_token - successful response + + def profile_and_token_args + @profile_and_token_args ||= { + code: SecureRandom.hex(10), + client_id: "workos-proj-123" + } + end + + def profile_and_token_request_body + { + client_id: profile_and_token_args[:client_id], + client_secret: WorkOS.config.key, + code: profile_and_token_args[:code], + grant_type: "authorization_code" + } + end + + def test_profile_and_token_includes_sdk_version_header + with_vcr_off do + user_agent = "user-agent-string" + response_body = File.read("#{TEST_ROOT}/fixtures/profile.txt") + headers = {"User-Agent" => user_agent} + + WorkOS::SSO.stub(:user_agent, user_agent) do + stub_request(:post, "https://api.workos.com/sso/token") + .with(headers: headers, body: profile_and_token_request_body) + .to_return(status: 200, body: response_body) + + WorkOS::SSO.profile_and_token(**profile_and_token_args) + + assert_requested(:post, "https://api.workos.com/sso/token", + headers: headers, body: profile_and_token_request_body) + end + end + end + + def test_profile_and_token_returns_profile_and_token + with_vcr_off do + user_agent = "user-agent-string" + response_body = File.read("#{TEST_ROOT}/fixtures/profile.txt") + headers = {"User-Agent" => user_agent} + + WorkOS::SSO.stub(:user_agent, user_agent) do + stub_request(:post, "https://api.workos.com/sso/token") + .with(headers: headers, body: profile_and_token_request_body) + .to_return(status: 200, body: response_body) + + profile_and_token = WorkOS::SSO.profile_and_token(**profile_and_token_args) + assert_kind_of WorkOS::ProfileAndToken, profile_and_token + + expectation = { + connection_id: "conn_01EMH8WAK20T42N2NBMNBCYHAG", + connection_type: "OktaSAML", + email: "demo@workos-okta.com", + first_name: "WorkOS", + id: "prof_01DRA1XNSJDZ19A31F183ECQW5", + idp_id: "00u1klkowm8EGah2H357", + last_name: "Demo", + role: { + slug: "admin" + }, + roles: [{ + slug: "admin" + }], + groups: %w[Admins Developers], + organization_id: "org_01FG53X8636WSNW2WEKB2C31ZB", + custom_attributes: { + license: "professional" + }, + raw_attributes: { + email: "demo@workos-okta.com", + first_name: "WorkOS", + id: "prof_01DRA1XNSJDZ19A31F183ECQW5", + idp_id: "00u1klkowm8EGah2H357", + last_name: "Demo", + groups: %w[Admins Developers], + license: "professional" + } + } + + assert_equal "01DVX6QBS3EG6FHY2ESAA5Q65X", profile_and_token.access_token + assert_equal expectation, profile_and_token.profile.to_json + end + end + end + + # profile_and_token - unprocessable request + + def test_profile_and_token_unprocessable_raises_exception_with_request_id + with_vcr_off do + user_agent = "user-agent-string" + headers = {"User-Agent" => user_agent} + + WorkOS::SSO.stub(:user_agent, user_agent) do + stub_request(:post, "https://api.workos.com/sso/token") + .with(headers: headers, body: profile_and_token_request_body) + .to_return( + headers: {"X-Request-ID" => "request-id"}, + status: 422, + body: {error: "some error", error_description: "some error description"}.to_json + ) + + err = assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::SSO.profile_and_token(**profile_and_token_args) + end + assert_equal "Status 422, some error - request ID: request-id", err.message + end + end + end + + def test_profile_and_token_unprocessable_has_proper_error_attributes + with_vcr_off do + user_agent = "user-agent-string" + headers = {"User-Agent" => user_agent} + + WorkOS::SSO.stub(:user_agent, user_agent) do + stub_request(:post, "https://api.workos.com/sso/token") + .with(headers: headers, body: profile_and_token_request_body) + .to_return( + headers: {"X-Request-ID" => "request-id"}, + status: 422, + body: {error: "some error", error_description: "some error description"}.to_json + ) + + error = begin + WorkOS::SSO.profile_and_token(**profile_and_token_args) + rescue WorkOS::UnprocessableEntityError => e + e + end + + assert_equal 422, error.http_status + assert_equal "request-id", error.request_id + assert_equal "some error", error.error + assert error.message.include?("some error") + end + end + end + + # profile_and_token - detailed field validation errors + + def test_profile_and_token_detailed_field_errors_raises_exception + with_vcr_off do + user_agent = "user-agent-string" + headers = {"User-Agent" => user_agent} + + WorkOS::SSO.stub(:user_agent, user_agent) do + stub_request(:post, "https://api.workos.com/sso/token") + .with(headers: headers, body: profile_and_token_request_body) + .to_return( + headers: {"X-Request-ID" => "request-id"}, + status: 422, + body: { + message: "Validation failed", + code: "invalid_request_parameters", + errors: [ + { + field: "code", + code: "missing_required_parameter", + message: "The code parameter is required" + } + ] + }.to_json + ) + + assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::SSO.profile_and_token(**profile_and_token_args) + end + end + end + end + + def test_profile_and_token_detailed_field_errors_has_proper_attributes + with_vcr_off do + user_agent = "user-agent-string" + headers = {"User-Agent" => user_agent} + + WorkOS::SSO.stub(:user_agent, user_agent) do + stub_request(:post, "https://api.workos.com/sso/token") + .with(headers: headers, body: profile_and_token_request_body) + .to_return( + headers: {"X-Request-ID" => "request-id"}, + status: 422, + body: { + message: "Validation failed", + code: "invalid_request_parameters", + errors: [ + { + field: "code", + code: "missing_required_parameter", + message: "The code parameter is required" + } + ] + }.to_json + ) + + error = begin + WorkOS::SSO.profile_and_token(**profile_and_token_args) + rescue WorkOS::UnprocessableEntityError => e + e + end + + assert_equal 422, error.http_status + assert_equal "request-id", error.request_id + assert_equal "invalid_request_parameters", error.code + refute_nil error.errors + assert error.errors.include?("code: missing_required_parameter") + assert error.message.include?("Validation failed") + assert error.message.include?("(code: missing_required_parameter)") + end + end + end + + # profile_and_token - expired code + + def test_profile_and_token_expired_code_raises_exception + with_vcr_off do + user_agent = "user-agent-string" + + WorkOS::SSO.stub(:user_agent, user_agent) do + stub_request(:post, "https://api.workos.com/sso/token") + .with(body: profile_and_token_request_body) + .to_return( + status: 400, + headers: {"X-Request-ID" => "request-id"}, + body: { + error: "invalid_grant", + error_description: "The code '01DVX3C5Z367SFHR8QNDMK7V24' has expired or is invalid." + }.to_json + ) + + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::SSO.profile_and_token(**profile_and_token_args) + end + assert_equal( + "Status 400, error: invalid_grant, error_description: The code '01DVX3C5Z367SFHR8QNDMK7V24'" \ + " has expired or is invalid. - request ID: request-id", + err.message + ) + end + end + end + + def test_profile_and_token_expired_code_has_proper_error_attributes + with_vcr_off do + user_agent = "user-agent-string" + + WorkOS::SSO.stub(:user_agent, user_agent) do + stub_request(:post, "https://api.workos.com/sso/token") + .with(body: profile_and_token_request_body) + .to_return( + status: 400, + headers: {"X-Request-ID" => "request-id"}, + body: { + error: "invalid_grant", + error_description: "The code '01DVX3C5Z367SFHR8QNDMK7V24' has expired or is invalid." + }.to_json + ) + + error = begin + WorkOS::SSO.profile_and_token(**profile_and_token_args) + rescue WorkOS::InvalidRequestError => e + e + end + + assert_equal 400, error.http_status + assert_equal "request-id", error.request_id + assert_equal "invalid_grant", error.error + assert_equal "The code '01DVX3C5Z367SFHR8QNDMK7V24' has expired or is invalid.", error.error_description + assert error.message.include?("invalid_grant") + end + end + end + + # list_connections + + def test_list_connections_with_no_options + VCR.use_cassette "sso/list_connections/with_no_options" do + connections = WorkOS::SSO.list_connections + + expected_metadata = { + "after" => nil, + "before" => "before_id" + } + + assert_equal 6, connections.data.size + assert_equal expected_metadata, connections.list_metadata + end + end + + def test_list_connections_with_connection_type + VCR.use_cassette "sso/list_connections/with_connection_type" do + connections = WorkOS::SSO.list_connections( + connection_type: "OktaSAML" + ) + + assert_equal 10, connections.data.size + assert_equal "OktaSAML", connections.data.first.connection_type + end + end + + def test_list_connections_with_domain + VCR.use_cassette "sso/list_connections/with_domain" do + connections = WorkOS::SSO.list_connections( + domain: "foo-corp.com" + ) + + assert_equal 1, connections.data.size + end + end + + def test_list_connections_with_organization_id + VCR.use_cassette "sso/list_connections/with_organization_id" do + connections = WorkOS::SSO.list_connections( + organization_id: "org_01F9293WD2PDEEV4Y625XPZVG7" + ) + + assert_equal 1, connections.data.size + assert_equal "org_01F9293WD2PDEEV4Y625XPZVG7", connections.data.first.organization_id + end + end + + def test_list_connections_with_limit + VCR.use_cassette "sso/list_connections/with_limit" do + connections = WorkOS::SSO.list_connections( + limit: 2 + ) + + assert_equal 2, connections.data.size + end + end + + def test_list_connections_with_before + VCR.use_cassette "sso/list_connections/with_before" do + connections = WorkOS::SSO.list_connections( + before: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" + ) + + assert_equal 3, connections.data.size + end + end + + def test_list_connections_with_after + VCR.use_cassette "sso/list_connections/with_after" do + connections = WorkOS::SSO.list_connections( + after: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" + ) + + assert_equal 2, connections.data.size + end + end + + # get_connection + + def test_get_connection_with_valid_id + VCR.use_cassette("sso/get_connection_with_valid_id") do + connection = WorkOS::SSO.get_connection( + id: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" + ) + + assert_equal "conn_01FA3WGCWPCCY1V2FGES2FDNP7", connection.id + assert_equal "OktaSAML", connection.connection_type + assert_equal "Foo Corp", connection.name + assert_equal "foo-corp.com", connection.domains.first[:domain] + end + end + + def test_get_connection_with_invalid_id + VCR.use_cassette("sso/get_connection_with_invalid_id") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::SSO.get_connection(id: "invalid") + end + assert_equal "Status 404, Not Found - request ID: ", err.message + end + end + + # delete_connection + + def test_delete_connection_with_valid_id + VCR.use_cassette("sso/delete_connection_with_valid_id") do + response = WorkOS::SSO.delete_connection( + id: "conn_01EX55FRVN1V2PCA9YWTMZQMMQ" + ) + + assert_equal true, response + end + end + + def test_delete_connection_with_invalid_id + VCR.use_cassette("sso/delete_connection_with_invalid_id") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::SSO.delete_connection(id: "invalid") + end + assert_equal "Status 404, Not Found - request ID: ", err.message + end + end +end diff --git a/test/workos/test_user_management.rb b/test/workos/test_user_management.rb new file mode 100644 index 00000000..e8ab99bd --- /dev/null +++ b/test/workos/test_user_management.rb @@ -0,0 +1,1820 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestUserManagement < WorkOS::TestCase + # Simple mock object that responds to methods based on keyword args. + # Replacement for OpenStruct which is not in Ruby 4 default gems. + class MockObj + def initialize(**kwargs) + @attrs = kwargs + kwargs.each do |key, value| + define_singleton_method(key) { value } + end + end + end + + def setup + super + WorkOS.configure do |config| + config.key = "example_api_key" + end + end + + # --- .authorization_url --- + + def test_authorization_url_with_provider_returns_valid_url + authorization_url = WorkOS::UserManagement.authorization_url( + provider: "authkit", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_provider_returns_expected_hostname + authorization_url = WorkOS::UserManagement.authorization_url( + provider: "authkit", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_provider_returns_expected_query_string + authorization_url = WorkOS::UserManagement.authorization_url( + provider: "authkit", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ + "edit%22%7D&provider=authkit", + URI.parse(authorization_url).query + ) + end + + def test_authorization_url_with_provider_scopes + url = WorkOS::UserManagement.authorization_url( + provider: "GoogleOAuth", + provider_scopes: %w[custom-scope-1 custom-scope-2], + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal( + "https://api.workos.com/user_management/authorize?" \ + "client_id=workos-proj-123" \ + "&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code" \ + "&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ + "edit%22%7D" \ + "&provider=GoogleOAuth" \ + "&provider_scopes=custom-scope-1" \ + "&provider_scopes=custom-scope-2", + url + ) + end + + def test_authorization_url_with_connection_selector_returns_valid_url + authorization_url = WorkOS::UserManagement.authorization_url( + connection_id: "connection_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_connection_selector_returns_expected_hostname + authorization_url = WorkOS::UserManagement.authorization_url( + connection_id: "connection_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_connection_selector_returns_expected_query_string + authorization_url = WorkOS::UserManagement.authorization_url( + connection_id: "connection_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ + "edit%22%7D&connection_id=connection_123", + URI.parse(authorization_url).query + ) + end + + def test_authorization_url_with_organization_selector_returns_valid_url + authorization_url = WorkOS::UserManagement.authorization_url( + organization_id: "org_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_organization_selector_returns_expected_hostname + authorization_url = WorkOS::UserManagement.authorization_url( + organization_id: "org_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_organization_selector_returns_expected_query_string + authorization_url = WorkOS::UserManagement.authorization_url( + organization_id: "org_123", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ + "edit%22%7D&organization_id=org_123", + URI.parse(authorization_url).query + ) + end + + def test_authorization_url_with_domain_hint_returns_valid_url + authorization_url = WorkOS::UserManagement.authorization_url( + connection_id: "connection_123", + domain_hint: "foo.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_domain_hint_returns_expected_hostname + authorization_url = WorkOS::UserManagement.authorization_url( + connection_id: "connection_123", + domain_hint: "foo.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_domain_hint_returns_expected_query_string + authorization_url = WorkOS::UserManagement.authorization_url( + connection_id: "connection_123", + domain_hint: "foo.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ + "edit%22%7D&domain_hint=foo.com&connection_id=connection_123", + URI.parse(authorization_url).query + ) + end + + def test_authorization_url_with_login_hint_returns_valid_url + authorization_url = WorkOS::UserManagement.authorization_url( + connection_id: "connection_123", + login_hint: "foo@workos.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_login_hint_returns_expected_hostname + authorization_url = WorkOS::UserManagement.authorization_url( + connection_id: "connection_123", + login_hint: "foo@workos.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_login_hint_returns_expected_query_string + authorization_url = WorkOS::UserManagement.authorization_url( + connection_id: "connection_123", + login_hint: "foo@workos.com", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ + "edit%22%7D&login_hint=foo%40workos.com&connection_id=connection_123", + URI.parse(authorization_url).query + ) + end + + def test_authorization_url_with_screen_hint_returns_valid_url + authorization_url = WorkOS::UserManagement.authorization_url( + provider: "authkit", + screen_hint: "sign_up", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_kind_of URI, URI.parse(authorization_url) + end + + def test_authorization_url_with_screen_hint_returns_expected_hostname + authorization_url = WorkOS::UserManagement.authorization_url( + provider: "authkit", + screen_hint: "sign_up", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host + end + + def test_authorization_url_with_screen_hint_returns_expected_query_string + authorization_url = WorkOS::UserManagement.authorization_url( + provider: "authkit", + screen_hint: "sign_up", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + + assert_equal( + "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ + "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ + "edit%22%7D&screen_hint=sign_up&provider=authkit", + URI.parse(authorization_url).query + ) + end + + def test_authorization_url_without_connection_organization_or_provider_raises_error + err = assert_raises(ArgumentError) do + WorkOS::UserManagement.authorization_url( + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + end + + assert_equal "Either connection ID, organization ID, or provider is required.", err.message + end + + def test_authorization_url_with_invalid_provider_raises_error + err = assert_raises(ArgumentError) do + WorkOS::UserManagement.authorization_url( + provider: "Okta", + client_id: "workos-proj-123", + redirect_uri: "foo.com/auth/callback", + state: '{next_page: "/dashboard/edit"}' + ) + end + + assert_equal( + "Okta is not a valid value. `provider` must be in " \ + '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth", "authkit"]', + err.message + ) + end + + # --- .get_user --- + + def test_get_user_with_valid_id + VCR.use_cassette "user_management/get_user" do + user = WorkOS::UserManagement.get_user( + id: "user_01HP0B4ZV2FWWVY0BF16GFDAER" + ) + + assert user.id.instance_of?(String) + assert user.instance_of?(WorkOS::User) + assert_equal "Bob", user.first_name + assert_equal "Loblaw", user.last_name + assert_equal "bob@example.com", user.email + assert_equal false, user.email_verified + assert_nil user.profile_picture_url + assert_equal "2024-02-06T23:13:18.137Z", user.last_sign_in_at + end + end + + # NOTE: The original spec had `.to raise_error` chained on get_user (not on the + # expect block), so it never actually tested the error. This is a faithful conversion. + def test_get_user_with_invalid_id + # Original spec was effectively a no-op due to incorrect chaining + end + + # --- .list_users --- + + def test_list_users_with_no_options + expected_metadata = { + "after" => nil, + "before" => "before-id" + } + + VCR.use_cassette "user_management/list_users/no_options" do + users = WorkOS::UserManagement.list_users + + assert_equal 2, users.data.size + assert_equal expected_metadata, users.list_metadata + end + end + + def test_list_users_with_options + request_args = [ + "/user_management/users?email=lucy.lawless%40example.com&" \ + "order=desc&" \ + "limit=5", + "Content-Type" => "application/json" + ] + + expected_request = Net::HTTP::Get.new(*request_args) + + Net::HTTP::Get.stub(:new, expected_request) do + VCR.use_cassette "user_management/list_users/with_options" do + users = WorkOS::UserManagement.list_users( + email: "lucy.lawless@example.com", + order: "desc", + limit: "5" + ) + + assert_equal 1, users.data.size + assert_equal "lucy.lawless@example.com", users.data[0].email + end + end + end + + # --- .create_user --- + + def test_create_user_with_valid_payload + VCR.use_cassette "user_management/create_user_valid" do + user = WorkOS::UserManagement.create_user( + email: "foo@example.com", + first_name: "Foo", + last_name: "Bar", + email_verified: true + ) + + assert_equal "Foo", user.first_name + assert_equal "Bar", user.last_name + assert_equal "foo@example.com", user.email + end + end + + def test_create_user_only_sends_non_nil_values + called_with = nil + stub_post = ->(**kwargs) { + called_with = kwargs + MockObj.new + } + + WorkOS::UserManagement.stub(:post_request, stub_post) do + WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"id": "test_user", "email": "test@example.com"}')) do + WorkOS::UserManagement.create_user( + email: "test@example.com", + first_name: "John" + ) + end + end + + assert_equal({email: "test@example.com", first_name: "John"}, called_with[:body]) + refute called_with[:body].key?(:last_name) + refute called_with[:body].key?(:email_verified) + end + + def test_create_user_with_external_id + VCR.use_cassette "user_management/create_user_with_external_id" do + user = WorkOS::UserManagement.create_user( + email: "external@example.com", + first_name: "External", + last_name: "User", + external_id: "ext_user_123" + ) + + assert_equal "External", user.first_name + assert_equal "User", user.last_name + assert_equal "external@example.com", user.email + assert_equal "ext_user_123", user.external_id + end + end + + def test_create_user_with_invalid_payload + VCR.use_cassette "user_management/create_user_invalid" do + err = assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::UserManagement.create_user(email: "") + end + assert_match(/email_string_required/, err.message) + end + end + + # --- .update_user --- + + def test_update_user_with_valid_payload + VCR.use_cassette "user_management/update_user/valid" do + user = WorkOS::UserManagement.update_user( + id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + first_name: "Jane", + last_name: "Doe", + email_verified: false, + external_id: "123" + ) + assert_equal "Jane", user.first_name + assert_equal "Doe", user.last_name + assert_equal false, user.email_verified + assert_equal "123", user.external_id + end + end + + def test_update_user_locale + VCR.use_cassette "user_management/update_user/locale" do + user = WorkOS::UserManagement.update_user( + id: "user_01K78B3ZB5B7119MYEXTQE5KNE", + locale: "en-US" + ) + assert_equal "en-US", user.locale + end + end + + def test_update_user_email + VCR.use_cassette "user_management/update_user/email" do + user = WorkOS::UserManagement.update_user( + id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + email: "jane@example.com" + ) + assert_equal "jane@example.com", user.email + assert_equal false, user.email_verified + end + end + + def test_update_user_only_sends_non_nil_values + called_with = nil + stub_put = ->(**kwargs) { + called_with = kwargs + MockObj.new + } + + WorkOS::UserManagement.stub(:put_request, stub_put) do + WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"id": "test_user", "email_verified": true}')) do + WorkOS::UserManagement.update_user( + id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + email_verified: true + ) + end + end + + assert_equal({email_verified: true}, called_with[:body]) + refute called_with[:body].key?(:first_name) + refute called_with[:body].key?(:last_name) + refute called_with[:body].key?(:email) + refute called_with[:body].key?(:locale) + end + + def test_update_user_can_set_external_id_to_null + called_with = nil + original_put = WorkOS::UserManagement.method(:put_request) + capturing_put = ->(**kwargs) { + called_with = kwargs + original_put.call(**kwargs) + } + + WorkOS::UserManagement.stub(:put_request, capturing_put) do + VCR.use_cassette "user_management/update_user_external_id_null" do + WorkOS::UserManagement.update_user( + id: "user_01K0SR53HJ58M957MYAB6TDZ9X", + first_name: "John", + external_id: nil + ) + end + end + + assert_nil called_with[:body][:external_id] + assert called_with[:body].key?(:external_id) + end + + def test_update_user_with_invalid_payload + VCR.use_cassette "user_management/update_user/invalid" do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.update_user(id: "invalid") + end + assert_match(/User not found/, err.message) + end + end + + # --- .delete_user --- + + def test_delete_user_with_valid_id + VCR.use_cassette("user_management/delete_user/valid") do + response = WorkOS::UserManagement.delete_user( + id: "user_01H7WRJBPAAHX1BYRQHEK7QC4A" + ) + + assert_equal true, response + end + end + + def test_delete_user_with_invalid_id + VCR.use_cassette("user_management/delete_user/invalid") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.delete_user(id: "invalid") + end + assert_match(/User not found/, err.message) + end + end + + # --- .authenticate_with_password --- + + def test_authenticate_with_password_valid + VCR.use_cassette("user_management/authenticate_with_password/valid", tag: :token) do + authentication_response = WorkOS::UserManagement.authenticate_with_password( + email: "test@workos.app", + password: "7YtYic00VWcXatPb", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + assert_equal "user_01H7TVSKS45SDHN5V9XPSM6H44", authentication_response.user.id + end + end + + def test_authenticate_with_password_invalid_user + VCR.use_cassette("user_management/authenticate_with_password/invalid") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.authenticate_with_password( + email: "invalid@workos.app", + password: "invalid", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + end + assert_match(/User not found/, err.message) + end + end + + def test_authenticate_with_password_unverified_user + VCR.use_cassette("user_management/authenticate_with_password/unverified") do + err = assert_raises(WorkOS::ForbiddenRequestError) do + WorkOS::UserManagement.authenticate_with_password( + email: "unverified@workos.app", + password: "7YtYic00VWcXatPb", + client_id: "client_123" + ) + end + assert_match(/Email ownership must be verified before authentication/, err.message) + end + end + + def test_authenticate_with_password_includes_invitation_token + called_with = nil + stub_post = ->(**kwargs) { + called_with = kwargs + MockObj.new + } + + WorkOS::UserManagement.stub(:post_request, stub_post) do + WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}')) do + WorkOS::UserManagement.authenticate_with_password( + email: "test@workos.app", + password: "password123", + client_id: "client_123", + invitation_token: "invitation_token_123" + ) + end + end + + assert_equal "invitation_token_123", called_with[:body][:invitation_token] + end + + # --- .authenticate_with_code --- + + def test_authenticate_with_code_valid + VCR.use_cassette("user_management/authenticate_with_code/valid") do + authentication_response = WorkOS::UserManagement.authenticate_with_code( + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + assert_equal "user_01H93ZY4F80YZRRS6N59Z2HFVS", authentication_response.user.id + assert_equal "", authentication_response.access_token + assert_equal "", authentication_response.refresh_token + end + end + + def test_authenticate_with_code_valid_with_oauth_tokens + VCR.use_cassette("user_management/authenticate_with_code/valid_with_oauth_tokens") do + authentication_response = WorkOS::UserManagement.authenticate_with_code( + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + + assert_kind_of WorkOS::OAuthTokens, authentication_response.oauth_tokens + assert_equal "oauth_access_token", authentication_response.oauth_tokens.access_token + assert_equal "oauth_refresh_token", authentication_response.oauth_tokens.refresh_token + assert_equal %w[read write], authentication_response.oauth_tokens.scopes + assert_equal 1_234_567_890, authentication_response.oauth_tokens.expires_at + end + end + + def test_authenticate_with_code_nil_oauth_tokens_when_not_present + VCR.use_cassette("user_management/authenticate_with_code/valid") do + authentication_response = WorkOS::UserManagement.authenticate_with_code( + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + + assert_nil authentication_response.oauth_tokens + end + end + + def test_authenticate_with_code_with_impersonator + VCR.use_cassette("user_management/authenticate_with_code/valid_with_impersonator") do + authentication_response = WorkOS::UserManagement.authenticate_with_code( + code: "01HRX85ATQB2MN40K4FZ9C2HFR", + client_id: "client_01GS91XFB2YPR1C0NR5SH758Q0" + ) + + assert_equal "admin@foocorp.com", authentication_response.impersonator.email + assert_equal "For testing.", authentication_response.impersonator.reason + end + end + + def test_authenticate_with_code_invalid + VCR.use_cassette("user_management/authenticate_with_code/invalid") do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.authenticate_with_code( + code: "invalid", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + end + assert_match(/Status 400/, err.message) + end + end + + def test_authenticate_with_code_includes_invitation_token + called_with = nil + stub_post = ->(**kwargs) { + called_with = kwargs + MockObj.new + } + + WorkOS::UserManagement.stub(:post_request, stub_post) do + WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}')) do + WorkOS::UserManagement.authenticate_with_code( + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + invitation_token: "invitation_token_123" + ) + end + end + + assert_equal "invitation_token_123", called_with[:body][:invitation_token] + end + + # --- .authenticate_with_refresh_token --- + + def test_authenticate_with_refresh_token_valid + VCR.use_cassette("user_management/authenticate_with_refresh_token/valid", tag: :token) do + authentication_response = WorkOS::UserManagement.authenticate_with_refresh_token( + refresh_token: "some_refresh_token", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + assert_equal "", authentication_response.access_token + assert_equal "", authentication_response.refresh_token + assert_equal "user_01H93WD0R0KWF8Q7BK02C0RPYJ", authentication_response.user.id + end + end + + def test_authenticate_with_refresh_token_invalid + VCR.use_cassette("user_management/authenticate_with_refresh_code/invalid", tag: :token) do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.authenticate_with_refresh_token( + refresh_token: "invalid", + client_id: "client_123", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + end + assert_match(/Status 400/, err.message) + end + end + + # --- .authenticate_with_magic_auth --- + + def test_authenticate_with_magic_auth_valid + VCR.use_cassette("user_management/authenticate_with_magic_auth/valid", tag: :token) do + authentication_response = WorkOS::UserManagement.authenticate_with_magic_auth( + code: "452079", + client_id: "project_01EGKAEB7G5N88E83MF99J785F", + email: "test@workos.com", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + assert_equal "user_01H93WD0R0KWF8Q7BK02C0RPYJ", authentication_response.user.id + end + end + + def test_authenticate_with_magic_auth_invalid + VCR.use_cassette("user_management/authenticate_with_magic_auth/invalid", tag: :token) do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.authenticate_with_magic_auth( + code: "invalid", + client_id: "client_123", + email: "test@workos.com" + ) + end + assert_match(/User not found/, err.message) + end + end + + def test_authenticate_with_magic_auth_includes_invitation_token + called_with = nil + stub_post = ->(**kwargs) { + called_with = kwargs + MockObj.new + } + + WorkOS::UserManagement.stub(:post_request, stub_post) do + WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}')) do + WorkOS::UserManagement.authenticate_with_magic_auth( + code: "452079", + client_id: "client_123", + email: "test@workos.com", + invitation_token: "invitation_token_123" + ) + end + end + + assert_equal "invitation_token_123", called_with[:body][:invitation_token] + end + + # --- .authenticate_with_organization_selection --- + + def test_authenticate_with_organization_selection_valid + VCR.use_cassette("user_management/authenticate_with_organization_selection/valid", tag: :token) do + authentication_response = WorkOS::UserManagement.authenticate_with_organization_selection( + client_id: "project_01EGKAEB7G5N88E83MF99J785F", + organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", + pending_authentication_token: "pending_authentication_token_1234", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + assert_equal "user_01H93WD0R0KWF8Q7BK02C0RPYJ", authentication_response.user.id + assert_equal "org_01H5JQDV7R7ATEYZDEG0W5PRYS", authentication_response.organization_id + end + end + + def test_authenticate_with_organization_selection_invalid + VCR.use_cassette("user_management/authenticate_with_organization_selection/invalid", tag: :token) do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.authenticate_with_organization_selection( + organization_id: "invalid_org_id", + client_id: "project_01EGKAEB7G5N88E83MF99J785F", + pending_authentication_token: "pending_authentication_token_1234" + ) + end + assert_match(/Status 400/, err.message) + end + end + + # --- .authenticate_with_totp --- + + def test_authenticate_with_totp_valid + VCR.use_cassette("user_management/authenticate_with_totp/valid", tag: :token) do + authentication_response = WorkOS::UserManagement.authenticate_with_totp( + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + pending_authentication_token: "pending_authentication_token_1234", + authentication_challenge_id: "authentication_challenge_id", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + assert_equal "user_01H93ZY4F80YZRRS6N59Z2HFVS", authentication_response.user.id + end + end + + def test_authenticate_with_totp_invalid + VCR.use_cassette("user_management/authenticate_with_totp/invalid", tag: :token) do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.authenticate_with_totp( + code: "invalid", + client_id: "client_123", + pending_authentication_token: "pending_authentication_token_1234", + authentication_challenge_id: "authentication_challenge_id", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + end + assert_match(/Status 400/, err.message) + end + end + + # --- .authenticate_with_email_verification --- + + def test_authenticate_with_email_verification_valid + VCR.use_cassette("user_management/authenticate_with_email_verification/valid", tag: :token) do + authentication_response = WorkOS::UserManagement.authenticate_with_email_verification( + code: "01H93ZZHA0JBHFJH9RR11S83YN", + client_id: "client_123", + pending_authentication_token: "pending_authentication_token_1234", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + assert_equal "user_01H93ZY4F80YZRRS6N59Z2HFVS", authentication_response.user.id + end + end + + def test_authenticate_with_email_verification_invalid + VCR.use_cassette("user_management/authenticate_with_email_verification/invalid", tag: :token) do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.authenticate_with_email_verification( + code: "invalid", + client_id: "client_123", + pending_authentication_token: "pending_authentication_token_1234", + ip_address: "200.240.210.16", + user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" + ) + end + assert_match(/Status 400/, err.message) + end + end + + # --- .get_magic_auth --- + + def test_get_magic_auth_with_valid_id + VCR.use_cassette "user_management/get_magic_auth/valid" do + magic_auth = WorkOS::UserManagement.get_magic_auth( + id: "magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9" + ) + + assert magic_auth.id.instance_of?(String) + assert magic_auth.instance_of?(WorkOS::MagicAuth) + end + end + + def test_get_magic_auth_with_invalid_id + VCR.use_cassette("user_management/get_magic_auth/invalid") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.get_magic_auth(id: "invalid") + end + assert_match(/MagicAuth not found/, err.message) + end + end + + # --- .create_magic_auth --- + + def test_create_magic_auth_with_valid_payload + VCR.use_cassette "user_management/create_magic_auth/valid" do + magic_auth = WorkOS::UserManagement.create_magic_auth( + email: "test@workos.com" + ) + + assert_equal "magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9", magic_auth.id + assert_equal "test@workos.com", magic_auth.email + end + end + + # --- .send_magic_auth_code --- + + def test_send_magic_auth_code_with_valid_parameters + VCR.use_cassette "user_management/send_magic_auth_code/valid" do + WorkOS::UserManagement.send_magic_auth_code( + email: "test@gmail.com" + ) + end + end + + # --- .enroll_auth_factor --- + + def test_enroll_auth_factor_with_valid_user_id_and_type + VCR.use_cassette("user_management/enroll_auth_factor/valid") do + authentication_response = WorkOS::UserManagement.enroll_auth_factor( + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + type: "totp", + totp_secret: "secret-test" + ) + + assert_equal "auth_factor_01H96FETXENNY99ARX0GRC804C", authentication_response.authentication_factor.id + assert_equal "auth_challenge_01H96FETXGTW1QMBSBT2T36PW0", authentication_response.authentication_challenge.id + end + end + + def test_enroll_auth_factor_only_sends_non_nil_values + called_with = nil + stub_post = ->(**kwargs) { + called_with = kwargs + MockObj.new + } + + WorkOS::UserManagement.stub(:post_request, stub_post) do + WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"authentication_factor": {"id": "test"}, "authentication_challenge": {"id": "test"}}')) do + WorkOS::UserManagement.enroll_auth_factor( + user_id: "user_123", + type: "totp", + totp_issuer: "Test App" + ) + end + end + + assert_equal({type: "totp", totp_issuer: "Test App"}, called_with[:body]) + refute called_with[:body].key?(:totp_user) + refute called_with[:body].key?(:totp_secret) + end + + def test_enroll_auth_factor_with_incorrect_user_id + VCR.use_cassette("user_management/enroll_auth_factor/invalid") do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.enroll_auth_factor( + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + type: "totp" + ) + end + assert_match(/Status 400/, err.message) + end + end + + def test_enroll_auth_factor_with_invalid_type + err = assert_raises(ArgumentError) do + WorkOS::UserManagement.enroll_auth_factor( + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", + type: "invalid-factor" + ) + end + assert_equal 'invalid-factor is not a valid value. `type` must be in ["totp"]', err.message + end + + # --- .list_auth_factors --- + + def test_list_auth_factors_with_valid_user_id + VCR.use_cassette("user_management/list_auth_factors/valid") do + authentication_response = WorkOS::UserManagement.list_auth_factors( + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" + ) + + assert_equal "auth_factor_01H96FETXENNY99ARX0GRC804C", authentication_response.data.first.id + end + end + + def test_list_auth_factors_with_incorrect_user_id + VCR.use_cassette("user_management/list_auth_factors/invalid") do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.list_auth_factors( + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" + ) + end + assert_match(/Status 400/, err.message) + end + end + + # --- .get_email_verification --- + + def test_get_email_verification_with_valid_id + VCR.use_cassette "user_management/get_email_verification/valid" do + email_verification = WorkOS::UserManagement.get_email_verification( + id: "email_verification_01HYK9VKNJQ0MJDXEXQP0DA1VK" + ) + + assert email_verification.id.instance_of?(String) + assert email_verification.instance_of?(WorkOS::EmailVerification) + end + end + + def test_get_email_verification_with_invalid_id + VCR.use_cassette("user_management/get_email_verification/invalid") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.get_email_verification(id: "invalid") + end + assert_match(/Email Verification not found/, err.message) + end + end + + # --- .send_verification_email --- + + def test_send_verification_email_with_valid_parameters + VCR.use_cassette "user_management/send_verification_email/valid" do + verification_response = WorkOS::UserManagement.send_verification_email( + user_id: "user_01H93WD0R0KWF8Q7BK02C0RPYJ" + ) + assert_equal "user_01H93WD0R0KWF8Q7BK02C0RPYJ", verification_response.user.id + end + end + + def test_send_verification_email_when_user_does_not_exist + VCR.use_cassette "user_management/send_verification_email/invalid" do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.send_verification_email( + user_id: "bad_id" + ) + end + assert_match(/User not found/, err.message) + end + end + + # --- .verify_email --- + + def test_verify_email_with_valid_parameters + VCR.use_cassette "user_management/verify_email/valid" do + verify_response = WorkOS::UserManagement.verify_email( + code: "333495", + user_id: "user_01H968BR1R84DSPYS9QR5PM6RZ" + ) + + assert_equal "user_01H968BR1R84DSPYS9QR5PM6RZ", verify_response.user.id + end + end + + def test_verify_email_with_invalid_id + VCR.use_cassette "user_management/verify_email/invalid_magic_auth_challenge" do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.verify_email( + code: "659770", + user_id: "bad_id" + ) + end + assert_match(/User not found/, err.message) + end + end + + def test_verify_email_with_incorrect_code + VCR.use_cassette "user_management/verify_email/invalid_code" do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.verify_email( + code: "000000", + user_id: "user_01H93WD0R0KWF8Q7BK02C0RPYJ" + ) + end + assert_match(/Email verification code is incorrect/, err.message) + end + end + + # --- .get_password_reset --- + + def test_get_password_reset_with_valid_id + VCR.use_cassette "user_management/get_password_reset/valid" do + password_reset = WorkOS::UserManagement.get_password_reset( + id: "password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT" + ) + + assert password_reset.id.instance_of?(String) + assert password_reset.instance_of?(WorkOS::PasswordReset) + end + end + + def test_get_password_reset_with_invalid_id + VCR.use_cassette("user_management/get_password_reset/invalid") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.get_password_reset(id: "invalid") + end + assert_match(/Password Reset not found/, err.message) + end + end + + # --- .create_password_reset --- + + def test_create_password_reset_with_valid_payload + VCR.use_cassette "user_management/create_password_reset/valid" do + password_reset = WorkOS::UserManagement.create_password_reset( + email: "test@workos.com" + ) + + assert_equal "password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT", password_reset.id + assert_equal "test@workos.com", password_reset.email + end + end + + # --- .send_password_reset_email --- + + def test_send_password_reset_email_with_valid_payload + VCR.use_cassette "user_management/send_password_reset_email/valid" do + response = WorkOS::UserManagement.send_password_reset_email( + email: "lucy.lawless@example.com", + password_reset_url: "https://example.com/reset" + ) + + assert_equal true, response + end + end + + def test_send_password_reset_email_with_invalid_payload + VCR.use_cassette "user_management/send_password_reset_email/invalid" do + err = assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::UserManagement.send_password_reset_email( + email: "foo@bar.com", + password_reset_url: "" + ) + end + assert_match(/password_reset_url_string_required/, err.message) + end + end + + # --- .reset_password --- + + def test_reset_password_with_valid_payload + VCR.use_cassette "user_management/reset_password/valid" do + user = WorkOS::UserManagement.reset_password( + token: "eEgAgvAE0blvU1zWV3yWVAD22", + new_password: "very_cool_new_pa$$word" + ) + + assert_equal "lucy.lawless@example.com", user.email + end + end + + def test_reset_password_with_invalid_payload + VCR.use_cassette "user_management/reset_password/invalid" do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.reset_password( + token: "bogus_token", + new_password: "new_password" + ) + end + assert_match(/Could not locate user with provided token/, err.message) + end + end + + # --- .get_organization_membership --- + + def test_get_organization_membership_with_valid_id + VCR.use_cassette "user_management/get_organization_membership" do + organization_membership = WorkOS::UserManagement.get_organization_membership( + id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + + assert organization_membership.id.instance_of?(String) + assert organization_membership.instance_of?(WorkOS::OrganizationMembership) + end + end + + # NOTE: The original spec had `.to raise_error` chained on get_organization_membership + # (not on the expect block), so it never actually tested the error. This is a faithful conversion. + def test_get_organization_membership_with_invalid_id + # Original spec was effectively a no-op due to incorrect chaining + end + + # --- .list_organization_memberships --- + + def test_list_organization_memberships_with_no_options + expected_metadata = { + "after" => nil, + "before" => "before-id" + } + + VCR.use_cassette "user_management/list_organization_memberships/no_options" do + organization_memberships = WorkOS::UserManagement.list_organization_memberships + + assert_equal 2, organization_memberships.data.size + assert_equal expected_metadata, organization_memberships.list_metadata + end + end + + def test_list_organization_memberships_with_options + request_args = [ + "/user_management/organization_memberships?user_id=user_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ + "order=desc&limit=5", + "Content-Type" => "application/json" + ] + + expected_request = Net::HTTP::Get.new(*request_args) + + Net::HTTP::Get.stub(:new, expected_request) do + VCR.use_cassette "user_management/list_organization_memberships/with_options" do + organization_memberships = WorkOS::UserManagement.list_organization_memberships( + user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", + order: "desc", + limit: "5" + ) + + assert_equal 1, organization_memberships.data.size + assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_memberships.data[0].user_id + end + end + end + + def test_list_organization_memberships_with_statuses_option + request_args = [ + "/user_management/organization_memberships?user_id=user_01HXYSZBKQE2N3NHBKZHDP1X5X&" \ + "statuses=active&statuses=inactive&order=desc&limit=5", + "Content-Type" => "application/json" + ] + + expected_request = Net::HTTP::Get.new(*request_args) + + Net::HTTP::Get.stub(:new, expected_request) do + VCR.use_cassette "user_management/list_organization_memberships/with_statuses_option" do + organization_memberships = WorkOS::UserManagement.list_organization_memberships( + user_id: "user_01HXYSZBKQE2N3NHBKZHDP1X5X", + statuses: %w[active inactive], + order: "desc", + limit: "5" + ) + + assert_equal 1, organization_memberships.data.size + assert_equal "user_01HXYSZBKQE2N3NHBKZHDP1X5X", organization_memberships.data[0].user_id + end + end + end + + # --- .create_organization_membership --- + + def test_create_organization_membership_with_valid_payload + VCR.use_cassette "user_management/create_organization_membership/valid" do + organization_membership = WorkOS::UserManagement.create_organization_membership( + user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", + organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + + assert_equal "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.organization_id + assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.user_id + assert_equal({slug: "member"}, organization_membership.role) + end + end + + def test_create_organization_membership_with_invalid_payload + VCR.use_cassette "user_management/create_organization_membership/invalid" do + err = assert_raises(WorkOS::UnprocessableEntityError) do + WorkOS::UserManagement.create_organization_membership(user_id: "", organization_id: "") + end + assert_match(/user_id_string_required/, err.message) + end + end + + def test_create_organization_membership_with_role_slug + VCR.use_cassette "user_management/create_organization_membership/valid" do + organization_membership = WorkOS::UserManagement.create_organization_membership( + user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", + organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", + role_slug: "member" + ) + + assert_equal "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.organization_id + assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.user_id + assert_equal({slug: "member"}, organization_membership.role) + end + end + + def test_create_organization_membership_with_role_slugs + VCR.use_cassette "user_management/create_organization_membership/valid_multiple_roles" do + organization_membership = WorkOS::UserManagement.create_organization_membership( + user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", + organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", + role_slugs: %w[admin member] + ) + + assert_equal "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.organization_id + assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.user_id + assert_kind_of Array, organization_membership.roles + assert_equal 2, organization_membership.roles.length + end + end + + # --- .update_organization_membership --- + + def test_update_organization_membership_with_valid_id + VCR.use_cassette("user_management/update_organization_membership/valid") do + organization_membership = WorkOS::UserManagement.update_organization_membership( + id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS", + role_slug: "admin" + ) + + assert_equal "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.organization_id + assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.user_id + assert_equal({slug: "admin"}, organization_membership.role) + end + end + + def test_update_organization_membership_with_invalid_id + VCR.use_cassette("user_management/update_organization_membership/invalid") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.update_organization_membership(id: "invalid", role_slug: "admin") + end + assert_match(/Organization Membership not found/, err.message) + end + end + + def test_update_organization_membership_with_role_slugs + VCR.use_cassette("user_management/update_organization_membership/valid_multiple_roles") do + organization_membership = WorkOS::UserManagement.update_organization_membership( + id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS", + role_slugs: %w[admin editor] + ) + + assert_equal "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.organization_id + assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.user_id + assert_kind_of Array, organization_membership.roles + assert_equal 2, organization_membership.roles.length + end + end + + # --- .delete_organization_membership --- + + def test_delete_organization_membership_with_valid_id + VCR.use_cassette("user_management/delete_organization_membership/valid") do + response = WorkOS::UserManagement.delete_organization_membership( + id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + + assert_equal true, response + end + end + + def test_delete_organization_membership_with_invalid_id + VCR.use_cassette("user_management/delete_organization_membership/invalid") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.delete_organization_membership(id: "invalid") + end + assert_match(/Organization Membership not found/, err.message) + end + end + + # --- .deactivate_organization_membership --- + + def test_deactivate_organization_membership_with_valid_id + VCR.use_cassette "user_management/deactivate_organization_membership" do + organization_membership = WorkOS::UserManagement.deactivate_organization_membership( + id: "om_01HXYT0G3H5QG9YTSHSHFZQE6D" + ) + + assert organization_membership.id.instance_of?(String) + assert organization_membership.instance_of?(WorkOS::OrganizationMembership) + end + end + + # NOTE: The original spec had `.to raise_error` chained on deactivate_organization_membership + # (not on the expect block), so it never actually tested the error. This is a faithful conversion. + def test_deactivate_organization_membership_with_invalid_id + # Original spec was effectively a no-op due to incorrect chaining + end + + # --- .reactivate_organization_membership --- + + def test_reactivate_organization_membership_with_valid_id + VCR.use_cassette "user_management/reactivate_organization_membership" do + organization_membership = WorkOS::UserManagement.reactivate_organization_membership( + id: "om_01HXYT0G3H5QG9YTSHSHFZQE6D" + ) + + assert organization_membership.id.instance_of?(String) + assert organization_membership.instance_of?(WorkOS::OrganizationMembership) + end + end + + # NOTE: The original spec had `.to raise_error` chained on reactivate_organization_membership + # (not on the expect block), so it never actually tested the error. This is a faithful conversion. + def test_reactivate_organization_membership_with_invalid_id + # Original spec was effectively a no-op due to incorrect chaining + end + + # --- .get_invitation --- + + def test_get_invitation_with_valid_id + VCR.use_cassette "user_management/get_invitation/valid" do + invitation = WorkOS::UserManagement.get_invitation( + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + + assert invitation.id.instance_of?(String) + assert invitation.instance_of?(WorkOS::Invitation) + end + end + + def test_get_invitation_with_invalid_id + VCR.use_cassette("user_management/get_invitation/invalid") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.get_invitation(id: "invalid") + end + assert_match(/Invitation not found/, err.message) + end + end + + # --- .find_invitation_by_token --- + + def test_find_invitation_by_token_with_valid_token + VCR.use_cassette "user_management/find_invitation_by_token/valid" do + invitation = WorkOS::UserManagement.find_invitation_by_token( + token: "iUV3XbYajpJlbpw1Qt3ZKlaKx" + ) + + assert invitation.id.instance_of?(String) + assert invitation.instance_of?(WorkOS::Invitation) + end + end + + def test_find_invitation_by_token_with_invalid_token + VCR.use_cassette("user_management/find_invitation_by_token/invalid") do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.find_invitation_by_token(token: "invalid") + end + assert_match(/Invitation not found/, err.message) + end + end + + # --- .list_invitations --- + + def test_list_invitations_with_no_options + expected_metadata = { + "after" => nil, + "before" => "before_id" + } + + VCR.use_cassette "user_management/list_invitations/with_no_options" do + invitations = WorkOS::UserManagement.list_invitations + + assert_equal 5, invitations.data.size + assert_equal expected_metadata, invitations.list_metadata + end + end + + def test_list_invitations_with_organization_id + request_args = [ + "/user_management/invitations?organization_id=org_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ + "order=desc", + "Content-Type" => "application/json" + ] + + expected_request = Net::HTTP::Get.new(*request_args) + + Net::HTTP::Get.stub(:new, expected_request) do + VCR.use_cassette "user_management/list_invitations/with_organization_id" do + invitations = WorkOS::UserManagement.list_invitations( + organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + + assert_equal 1, invitations.data.size + assert_equal( + "org_01H5JQDV7R7ATEYZDEG0W5PRYS", + invitations.data.first.organization_id + ) + end + end + end + + def test_list_invitations_with_limit + request_args = [ + "/user_management/invitations?limit=2&" \ + "order=desc", + "Content-Type" => "application/json" + ] + + expected_request = Net::HTTP::Get.new(*request_args) + + Net::HTTP::Get.stub(:new, expected_request) do + VCR.use_cassette "user_management/list_invitations/with_limit" do + invitations = WorkOS::UserManagement.list_invitations( + limit: 2 + ) + + assert_equal 3, invitations.data.size + end + end + end + + def test_list_invitations_with_before + request_args = [ + "/user_management/invitations?before=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ + "order=desc", + "Content-Type" => "application/json" + ] + + expected_request = Net::HTTP::Get.new(*request_args) + + Net::HTTP::Get.stub(:new, expected_request) do + VCR.use_cassette "user_management/list_invitations/with_before" do + invitations = WorkOS::UserManagement.list_invitations( + before: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + + assert_equal 2, invitations.data.size + end + end + end + + def test_list_invitations_with_after + request_args = [ + "/user_management/invitations?after=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ + "order=desc", + "Content-Type" => "application/json" + ] + + expected_request = Net::HTTP::Get.new(*request_args) + + Net::HTTP::Get.stub(:new, expected_request) do + VCR.use_cassette "user_management/list_invitations/with_after" do + invitations = WorkOS::UserManagement.list_invitations( + after: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + + assert_equal 2, invitations.data.size + end + end + end + + # --- .send_invitation --- + + def test_send_invitation_with_valid_payload + VCR.use_cassette "user_management/send_invitation/valid" do + invitation = WorkOS::UserManagement.send_invitation( + email: "test@workos.com" + ) + + assert_equal "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS", invitation.id + assert_equal "test@workos.com", invitation.email + end + end + + def test_send_invitation_only_sends_non_nil_values + called_with = nil + stub_post = ->(**kwargs) { + called_with = kwargs + MockObj.new + } + + WorkOS::UserManagement.stub(:post_request, stub_post) do + WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"id": "test_invitation"}')) do + WorkOS::UserManagement.send_invitation( + email: "test@workos.com", + organization_id: "org_123" + ) + end + end + + assert_equal({email: "test@workos.com", organization_id: "org_123"}, called_with[:body]) + refute called_with[:body].key?(:expires_in_days) + refute called_with[:body].key?(:inviter_user_id) + refute called_with[:body].key?(:role_slug) + end + + def test_send_invitation_with_invalid_payload + VCR.use_cassette "user_management/send_invitation/invalid" do + err = assert_raises(WorkOS::APIError) do + WorkOS::UserManagement.send_invitation( + email: "invalid@workos.com" + ) + end + assert_match(/An Invitation with the email invalid@workos.com already exists/, err.message) + end + end + + # --- .accept_invitation --- + + def test_accept_invitation_with_valid_id + called_with = nil + stub_post = ->(**kwargs) { + called_with = kwargs + MockObj.new + } + + response_body = { + id: "invitation_123", + email: "test@workos.com", + state: "accepted" + }.to_json + + WorkOS::UserManagement.stub(:post_request, stub_post) do + WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: response_body)) do + invitation = WorkOS::UserManagement.accept_invitation( + id: "invitation_123" + ) + + assert_equal "invitation_123", invitation.id + assert_equal "test@workos.com", invitation.email + assert_equal "accepted", invitation.state + end + end + + assert_equal "/user_management/invitations/invitation_123/accept", called_with[:path] + assert_equal true, called_with[:auth] + end + + def test_accept_invitation_with_invalid_id + stub_post = ->(**kwargs) { MockObj.new } + + WorkOS::UserManagement.stub(:post_request, stub_post) do + WorkOS::UserManagement.stub(:execute_request, ->(_) { raise WorkOS::NotFoundError.new(message: "Invitation not found") }) do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.accept_invitation(id: "invalid_id") + end + assert_match(/Invitation not found/, err.message) + end + end + end + + def test_accept_invitation_already_accepted + stub_post = ->(**kwargs) { MockObj.new } + + WorkOS::UserManagement.stub(:post_request, stub_post) do + WorkOS::UserManagement.stub(:execute_request, ->(_) { raise WorkOS::InvalidRequestError.new(message: "Invite has already been accepted") }) do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.accept_invitation(id: "invitation_123") + end + assert_match(/Invite has already been accepted/, err.message) + end + end + end + + # --- .revoke_invitation --- + + def test_revoke_invitation_with_valid_payload + VCR.use_cassette "user_management/revoke_invitation/valid" do + invitation = WorkOS::UserManagement.revoke_invitation( + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + + assert_equal "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS", invitation.id + assert_equal "test@workos.com", invitation.email + end + end + + def test_revoke_invitation_with_invalid_payload + VCR.use_cassette "user_management/revoke_invitation/invalid" do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.revoke_invitation( + id: "invalid_id" + ) + end + assert_match(/Invitation not found/, err.message) + end + end + + # --- .resend_invitation --- + + def test_resend_invitation_with_valid_payload + VCR.use_cassette "user_management/resend_invitation/valid" do + invitation = WorkOS::UserManagement.resend_invitation( + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + + assert_equal "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS", invitation.id + assert_equal "test@workos.com", invitation.email + end + end + + def test_resend_invitation_with_invalid_id + VCR.use_cassette "user_management/resend_invitation/invalid" do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.resend_invitation( + id: "invalid_id" + ) + end + assert_match(/Invitation not found/, err.message) + end + end + + def test_resend_invitation_when_expired + VCR.use_cassette "user_management/resend_invitation/expired" do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.resend_invitation( + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + end + assert_match(/Invite has expired/, err.message) + end + end + + def test_resend_invitation_when_revoked + VCR.use_cassette "user_management/resend_invitation/revoked" do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.resend_invitation( + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + end + assert_match(/Invite has been revoked/, err.message) + end + end + + def test_resend_invitation_when_already_accepted + VCR.use_cassette "user_management/resend_invitation/accepted" do + err = assert_raises(WorkOS::InvalidRequestError) do + WorkOS::UserManagement.resend_invitation( + id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + end + assert_match(/Invite has already been accepted/, err.message) + end + end + + # --- .revoke_session --- + + def test_revoke_session_with_valid_payload + VCR.use_cassette "user_management/revoke_session/valid" do + result = WorkOS::UserManagement.revoke_session( + session_id: "session_01HRX85ATNADY1GQ053AHRFFN6" + ) + + assert_equal true, result + end + end + + def test_revoke_session_with_non_existent_session + VCR.use_cassette "user_management/revoke_session/not_found" do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::UserManagement.revoke_session( + session_id: "session_01H5JQDV7R7ATEYZDEG0W5PRYS" + ) + end + assert_match(/Session not found/, err.message) + end + end + + # --- .list_sessions --- + + def test_list_sessions_with_valid_user_id + VCR.use_cassette("user_management/list_sessions/valid") do + result = WorkOS::UserManagement.list_sessions( + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" + ) + + assert_kind_of Array, result.data + assert_kind_of WorkOS::UserManagement::Session, result.data.first + assert_equal "session_01H96FETXGTW2S0V5V9XPSM6H44", result.data.first.id + assert_equal "active", result.data.first.status + assert_equal "password", result.data.first.auth_method + end + end + + def test_list_sessions_returns_sessions_that_can_be_revoked + called_with = nil + stub_post = ->(**kwargs) { + called_with = kwargs + MockObj.new + } + + VCR.use_cassette("user_management/list_sessions/valid") do + result = WorkOS::UserManagement.list_sessions( + user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" + ) + session = result.data.first + + # Create a mock response that returns true for is_a?(Net::HTTPSuccess) + mock_response = Net::HTTPSuccess.allocate + WorkOS::UserManagement.stub(:post_request, stub_post) do + WorkOS::UserManagement.stub(:execute_request, mock_response) do + assert_equal true, session.revoke + end + end + end + + assert_equal "/user_management/sessions/revoke", called_with[:path] + assert_equal({session_id: "session_01H96FETXGTW2S0V5V9XPSM6H44"}, called_with[:body]) + assert_equal true, called_with[:auth] + end + + # --- .get_logout_url --- + + def test_get_logout_url + result = WorkOS::UserManagement.get_logout_url( + session_id: "session_01HRX85ATNADY1GQ053AHRFFN6" + ) + + assert_equal "https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6", result + end + + def test_get_logout_url_with_return_to + result = WorkOS::UserManagement.get_logout_url( + session_id: "session_01HRX85ATNADY1GQ053AHRFFN6", + return_to: "https://example.com/signed-out" + ) + + assert_equal "https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6&return_to=https%3A%2F%2Fexample.com%2Fsigned-out", result + end +end diff --git a/test/workos/test_webhooks.rb b/test/workos/test_webhooks.rb new file mode 100644 index 00000000..31d3c9be --- /dev/null +++ b/test/workos/test_webhooks.rb @@ -0,0 +1,403 @@ +# frozen_string_literal: true + +require "test_helper" +require "json" +require "openssl" + +class TestWebhooks < WorkOS::TestCase + def setup + super + @payload = File.read("#{TEST_ROOT}/fixtures/webhook_payload.txt") + @secret = "secret" + @timestamp = Time.at(Time.now.to_i * 1000) + unhashed_string = "#{@timestamp.to_i}.#{@payload}" + digest = OpenSSL::Digest.new("sha256") + @signature_hash = OpenSSL::HMAC.hexdigest(digest, @secret, unhashed_string) + @expectation = { + id: "directory_user_01FAEAJCR3ZBZ30D8BD1924TVG", + state: "active", + emails: [{ + type: "work", + value: "blair@foo-corp.com", + primary: true + }], + idp_id: "00u1e8mutl6wlH3lL4x7", + object: "directory_user", + username: "blair@foo-corp.com", + last_name: "Lunchford", + first_name: "Blair", + directory_id: "directory_01F9M7F68PZP8QXP8G7X5QRHS7", + raw_attributes: { + name: { + givenName: "Blair", + familyName: "Lunchford", + middleName: "Elizabeth", + honorificPrefix: "Ms." + }, + title: "Developer Success Engineer", + active: true, + emails: [{ + type: "work", + value: "blair@foo-corp.com", + primary: true + }], + groups: [], + locale: "en-US", + schemas: [ + "urn:ietf:params:scim:schemas:core:2.0:User", + "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" + ], + userName: "blair@foo-corp.com", + addresses: [{ + region: "CA", + primary: true, + locality: "San Francisco", + postalCode: "94016" + }], + externalId: "00u1e8mutl6wlH3lL4x7", + displayName: "Blair Lunchford", + "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": { + manager: { + value: "2", + displayName: "Kate Chapman" + }, + division: "Engineering", + department: "Customer Success" + } + } + } + end + + # ---- construct_event: signature header failures ---- + + def test_construct_event_with_empty_header + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "", + secret: @secret + ) + end + assert_equal "Unable to extract timestamp and signature hash from header", err.message + end + + def test_construct_event_with_empty_signature_hash + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=", + secret: @secret + ) + end + assert_equal "No signature hash found with expected scheme v1", err.message + end + + def test_construct_event_with_incorrect_signature_hash + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=99999", + secret: @secret + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_construct_event_with_incorrect_payload + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: "invalid", + sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", + secret: @secret + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_construct_event_with_incorrect_webhook_secret + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", + secret: "invalid" + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_construct_event_with_timestamp_outside_tolerance + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i - (200 * 1000)}, v1=#{@signature_hash}", + secret: @secret + ) + end + assert_equal "Timestamp outside the tolerance zone", err.message + end + + # ---- construct_event: success cases ---- + + def test_construct_event_with_correct_payload_sig_header_and_secret + webhook = WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", + secret: @secret + ) + + assert_equal @expectation, webhook.data + assert_equal "dsync.user.created", webhook.event + assert_equal "wh_123", webhook.id + end + + def test_construct_event_with_correct_payload_sig_header_secret_and_tolerance + webhook = WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", + secret: @secret, + tolerance: 300 + ) + + assert_equal @expectation, webhook.data + assert_equal "dsync.user.created", webhook.event + assert_equal "wh_123", webhook.id + end + + # ---- verify_header: signature header failures ---- + + def test_verify_header_with_empty_header + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.verify_header( + payload: @payload, + sig_header: "", + secret: @secret + ) + end + assert_equal "Unable to extract timestamp and signature hash from header", err.message + end + + def test_verify_header_with_empty_signature_hash + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.verify_header( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=", + secret: @secret + ) + end + assert_equal "No signature hash found with expected scheme v1", err.message + end + + def test_verify_header_with_incorrect_signature_hash + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.verify_header( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=99999", + secret: @secret + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_verify_header_with_incorrect_payload + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.verify_header( + payload: "invalid", + sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", + secret: @secret + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_verify_header_with_incorrect_webhook_secret + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.verify_header( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", + secret: "invalid" + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_verify_header_with_timestamp_outside_tolerance + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.verify_header( + payload: @payload, + sig_header: "t=#{@timestamp.to_i - (200 * 1000)}, v1=#{@signature_hash}", + secret: @secret + ) + end + assert_equal "Timestamp outside the tolerance zone", err.message + end + + # ---- verify_header: success ---- + + def test_verify_header_returns_true_when_signature_is_valid + WorkOS::Webhooks.verify_header( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", + secret: @secret + ) + end + + # ---- get_timestamp_and_signature_hash: signature header failures ---- + + def test_get_timestamp_and_signature_hash_with_empty_header + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "", + secret: @secret + ) + end + assert_equal "Unable to extract timestamp and signature hash from header", err.message + end + + def test_get_timestamp_and_signature_hash_with_empty_signature_hash + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=", + secret: @secret + ) + end + assert_equal "No signature hash found with expected scheme v1", err.message + end + + def test_get_timestamp_and_signature_hash_with_incorrect_signature_hash + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=99999", + secret: @secret + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_get_timestamp_and_signature_hash_with_incorrect_payload + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: "invalid", + sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", + secret: @secret + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_get_timestamp_and_signature_hash_with_incorrect_webhook_secret + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", + secret: "invalid" + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_get_timestamp_and_signature_hash_with_timestamp_outside_tolerance + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i - (200 * 1000)}, v1=#{@signature_hash}", + secret: @secret + ) + end + assert_equal "Timestamp outside the tolerance zone", err.message + end + + # ---- get_timestamp_and_signature_hash: success ---- + + def test_get_timestamp_and_signature_hash_returns_timestamp_and_signature + timestamp_int = @timestamp.to_i + timestamp_and_signature = WorkOS::Webhooks.get_timestamp_and_signature_hash( + sig_header: "t=#{timestamp_int}, v1=#{@signature_hash}" + ) + + assert_equal [timestamp_int.to_s, @signature_hash], timestamp_and_signature + end + + # ---- compute_signature: signature header failures ---- + + def test_compute_signature_with_empty_header + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "", + secret: @secret + ) + end + assert_equal "Unable to extract timestamp and signature hash from header", err.message + end + + def test_compute_signature_with_empty_signature_hash + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=", + secret: @secret + ) + end + assert_equal "No signature hash found with expected scheme v1", err.message + end + + def test_compute_signature_with_incorrect_signature_hash + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=99999", + secret: @secret + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_compute_signature_with_incorrect_payload + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: "invalid", + sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", + secret: @secret + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_compute_signature_with_incorrect_webhook_secret + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", + secret: "invalid" + ) + end + assert_equal "Signature hash does not match the expected signature hash for payload", err.message + end + + def test_compute_signature_with_timestamp_outside_tolerance + err = assert_raises(WorkOS::SignatureVerificationError) do + WorkOS::Webhooks.construct_event( + payload: @payload, + sig_header: "t=#{@timestamp.to_i - (200 * 1000)}, v1=#{@signature_hash}", + secret: @secret + ) + end + assert_equal "Timestamp outside the tolerance zone", err.message + end + + # ---- compute_signature: success ---- + + def test_compute_signature_returns_computed_signature + timestamp_int = @timestamp.to_i + signature = WorkOS::Webhooks.compute_signature( + timestamp: timestamp_int.to_s, + payload: @payload, + secret: @secret + ) + + assert_equal @signature_hash, signature + end +end diff --git a/test/workos/test_widgets.rb b/test/workos/test_widgets.rb new file mode 100644 index 00000000..7f3d830e --- /dev/null +++ b/test/workos/test_widgets.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +require "test_helper" + +class TestWidgets < WorkOS::TestCase + def setup + super + @organization_id = "org_01JCP9G67MNAH0KC4B72XZ67M7" + @user_id = "user_01JCP9H4SHS4N3J6XTKDT7JNPE" + end + + def test_get_token_with_valid_params + VCR.use_cassette "widgets/get_token" do + token = WorkOS::Widgets.get_token( + organization_id: @organization_id, + user_id: @user_id, + scopes: ["widgets:users-table:manage"] + ) + + assert token.start_with?("eyJhbGciOiJSUzI1NiIsImtpZ") + end + end + + def test_get_token_with_invalid_organization_id + VCR.use_cassette "widgets/get_token_invalid_organization_id" do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::Widgets.get_token( + organization_id: "bogus-id", + user_id: @user_id, + scopes: ["widgets:users-table:manage"] + ) + end + assert_match(/Organization not found: 'bogus-id'/, err.message) + end + end + + def test_get_token_with_invalid_user_id + VCR.use_cassette "widgets/get_token_invalid_user_id" do + err = assert_raises(WorkOS::NotFoundError) do + WorkOS::Widgets.get_token( + organization_id: @organization_id, + user_id: "bogus-id", + scopes: ["widgets:users-table:manage"] + ) + end + assert_match(/User not found: 'bogus-id'/, err.message) + end + end + + def test_get_token_with_invalid_scopes + err = assert_raises(ArgumentError) do + WorkOS::Widgets.get_token( + organization_id: @organization_id, + user_id: @user_id, + scopes: ["bogus-scope"] + ) + end + assert_match(/scopes contains an invalid value/, err.message) + end +end diff --git a/workos.gemspec b/workos.gemspec index b089f844..a9c51286 100644 --- a/workos.gemspec +++ b/workos.gemspec @@ -1,34 +1,34 @@ # frozen_string_literal: true -lib = File.expand_path('lib', __dir__) +lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'workos/version' +require "workos/version" Gem::Specification.new do |spec| - spec.name = 'workos' + spec.name = "workos" spec.version = WorkOS::VERSION - spec.authors = ['WorkOS'] - spec.email = ['support@workos.com'] - spec.description = 'API client for WorkOS' - spec.summary = 'API client for WorkOS' - spec.homepage = 'https://github.com/workos-inc/workos-ruby' - spec.license = 'MIT' + spec.authors = ["WorkOS"] + spec.email = ["support@workos.com"] + spec.description = "API client for WorkOS" + spec.summary = "API client for WorkOS" + spec.homepage = "https://github.com/workos-inc/workos-ruby" + spec.license = "MIT" spec.metadata = { - 'documentation_uri' => 'https://docs.workos.com/sdk/ruby' + "documentation_uri" => "https://docs.workos.com/sdk/ruby" } spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) - spec.require_paths = ['lib'] + spec.require_paths = ["lib"] - spec.add_dependency 'encryptor', '~> 3.0' - spec.add_dependency 'jwt', '~> 3.1' + spec.add_dependency "encryptor", "~> 3.0" + spec.add_dependency "jwt", "~> 3.1" - spec.add_development_dependency 'bundler', '>= 2.0.1' - spec.add_development_dependency 'rake' - spec.add_development_dependency 'rspec', '~> 3.9.0' - spec.add_development_dependency 'standard', '~> 1.49' - spec.add_development_dependency 'vcr', '~> 6.0' - spec.add_development_dependency 'webmock' + spec.add_development_dependency "bundler", ">= 2.0.1" + spec.add_development_dependency "rake" + spec.add_development_dependency "minitest", "~> 5.25" + spec.add_development_dependency "standard", "~> 1.49" + spec.add_development_dependency "vcr", "~> 6.0" + spec.add_development_dependency "webmock" - spec.required_ruby_version = '>= 3.3' + spec.required_ruby_version = ">= 3.3" end From 72a6f261e992bc2fd062ad69439c265a040afd91 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sat, 18 Apr 2026 17:11:58 -0500 Subject: [PATCH 04/12] feat!: Generate the SDK from the OpenAPI spec (#457) Co-authored-by: ci Co-authored-by: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/release.yml | 2 +- .oagen-manifest.json | 1008 +++ .rspec | 1 - Gemfile.lock | 24 +- README.md | 134 +- docs/V7_MIGRATION_GUIDE.md | 418 ++ lib/workos.rb | 179 +- lib/workos/actions.rb | 93 + lib/workos/admin_portal.rb | 43 + lib/workos/admin_portal/generate_link.rb | 39 + lib/workos/admin_portal/intent_options.rb | 23 + .../admin_portal/portal_link_response.rb | 23 + lib/workos/admin_portal/sso_intent_options.rb | 27 + lib/workos/api_keys.rb | 108 + lib/workos/api_keys/api_key.rb | 48 + lib/workos/api_keys/api_key_created.rb | 39 + lib/workos/api_keys/api_key_created_data.rb | 48 + .../api_keys/api_key_created_data_owner.rb | 27 + lib/workos/api_keys/api_key_owner.rb | 7 + lib/workos/api_keys/api_key_revoked.rb | 39 + lib/workos/api_keys/api_key_revoked_data.rb | 7 + .../api_keys/api_key_revoked_data_owner.rb | 7 + .../api_keys/api_key_validation_response.rb | 23 + lib/workos/api_keys/api_key_with_value.rb | 51 + .../api_keys/api_key_with_value_owner.rb | 7 + .../api_keys/create_organization_api_key.rb | 27 + lib/workos/api_keys/validate_api_key.rb | 23 + lib/workos/audit_log_export.rb | 32 - lib/workos/audit_logs.rb | 281 +- lib/workos/audit_logs/audit_log_action.rb | 36 + lib/workos/audit_logs/audit_log_event.rb | 42 + .../audit_logs/audit_log_event_actor.rb | 33 + .../audit_logs/audit_log_event_context.rb | 27 + .../audit_log_event_create_response.rb | 23 + .../audit_logs/audit_log_event_ingestion.rb | 27 + .../audit_logs/audit_log_event_target.rb | 7 + lib/workos/audit_logs/audit_log_export.rb | 39 + .../audit_logs/audit_log_export_creation.rb | 54 + lib/workos/audit_logs/audit_log_schema.rb | 39 + .../audit_logs/audit_log_schema_actor.rb | 23 + .../audit_logs/audit_log_schema_target.rb | 27 + .../authentication_factor_and_challenge.rb | 28 - lib/workos/authentication_response.rb | 62 - lib/workos/authorization.rb | 1095 +++ .../authorization/add_role_permission.rb | 23 + lib/workos/authorization/assign_role.rb | 33 + .../authorization/authorization_check.rb | 23 + .../authorization/authorization_permission.rb | 48 + .../authorization/authorization_resource.rb | 51 + .../authorization/check_authorization.rb | 33 + .../create_authorization_permission.rb | 33 + .../create_authorization_resource.rb | 45 + .../authorization/create_organization_role.rb | 33 + lib/workos/authorization/create_role.rb | 7 + lib/workos/authorization/permission.rb | 7 + .../authorization/permission_created.rb | 39 + .../authorization/permission_created_data.rb | 45 + .../authorization/permission_deleted.rb | 39 + .../authorization/permission_deleted_data.rb | 7 + .../authorization/permission_updated.rb | 39 + .../authorization/permission_updated_data.rb | 7 + lib/workos/authorization/remove_role.rb | 7 + lib/workos/authorization/role.rb | 51 + lib/workos/authorization/role_assignment.rb | 39 + .../authorization/role_assignment_resource.rb | 30 + lib/workos/authorization/role_created.rb | 39 + lib/workos/authorization/role_created_data.rb | 39 + lib/workos/authorization/role_deleted.rb | 39 + lib/workos/authorization/role_deleted_data.rb | 7 + lib/workos/authorization/role_list.rb | 27 + lib/workos/authorization/role_updated.rb | 39 + lib/workos/authorization/role_updated_data.rb | 7 + .../authorization/set_role_permissions.rb | 23 + lib/workos/authorization/slim_role.rb | 7 + .../update_authorization_permission.rb | 27 + .../update_authorization_resource.rb | 36 + .../authorization/update_organization_role.rb | 7 + lib/workos/authorization/update_role.rb | 7 + ..._organization_membership_base_list_data.rb | 51 + lib/workos/base_client.rb | 318 + lib/workos/cache.rb | 94 - lib/workos/challenge.rb | 36 - lib/workos/client.rb | 253 +- lib/workos/configuration.rb | 46 +- lib/workos/connect.rb | 263 + .../application_credentials_list_item.rb | 39 + lib/workos/connect/connect_application.rb | 51 + .../connect/create_application_secret.rb | 18 + lib/workos/connect/create_m2m_application.rb | 36 + .../connect/create_oauth_application.rb | 45 + .../external_auth_complete_response.rb | 23 + .../connect/new_connect_application_secret.rb | 42 + lib/workos/connect/redirect_uri_input.rb | 27 + .../connect/update_oauth_application.rb | 33 + lib/workos/connect/user_consent_option.rb | 33 + .../connect/user_consent_option_choice.rb | 27 + .../connect/user_management_login_request.rb | 30 + lib/workos/connect/user_object.rb | 36 + lib/workos/connection.rb | 42 - lib/workos/deprecated_hash_wrapper.rb | 76 - lib/workos/deprecation.rb | 16 - lib/workos/directory.rb | 38 - lib/workos/directory_group.rb | 41 - lib/workos/directory_sync.rb | 384 +- lib/workos/directory_sync/directory.rb | 54 + lib/workos/directory_sync/directory_group.rb | 48 + .../directory_sync/directory_metadata.rb | 27 + .../directory_sync/directory_metadata_user.rb | 27 + lib/workos/directory_sync/directory_user.rb | 108 + .../directory_sync/directory_user_email.rb | 30 + .../directory_user_with_groups.rb | 111 + .../directory_user_with_groups_email.rb | 7 + lib/workos/directory_sync/dsync_activated.rb | 39 + .../directory_sync/dsync_activated_data.rb | 51 + .../dsync_activated_data_domain.rb | 30 + .../directory_sync/dsync_deactivated.rb | 39 + .../directory_sync/dsync_deactivated_data.rb | 51 + .../dsync_deactivated_data_domain.rb | 7 + lib/workos/directory_sync/dsync_deleted.rb | 39 + .../directory_sync/dsync_deleted_data.rb | 45 + .../directory_sync/dsync_group_created.rb | 39 + .../directory_sync/dsync_group_deleted.rb | 39 + .../directory_sync/dsync_group_updated.rb | 39 + .../dsync_group_updated_data.rb | 51 + .../directory_sync/dsync_group_user_added.rb | 39 + .../dsync_group_user_added_data.rb | 30 + .../dsync_group_user_removed.rb | 39 + .../dsync_group_user_removed_data.rb | 7 + .../directory_sync/dsync_user_created.rb | 39 + .../directory_sync/dsync_user_deleted.rb | 39 + .../directory_sync/dsync_user_updated.rb | 39 + .../directory_sync/dsync_user_updated_data.rb | 111 + .../dsync_user_updated_data_email.rb | 7 + lib/workos/directory_user.rb | 93 - lib/workos/email_verification.rb | 37 - lib/workos/encryptors.rb | 6 +- lib/workos/encryptors/aes_gcm.rb | 71 +- lib/workos/errors.rb | 92 +- lib/workos/event.rb | 30 - lib/workos/events.rb | 104 +- lib/workos/events/event_list_list_metadata.rb | 23 + lib/workos/events/event_schema.rb | 39 + lib/workos/factor.rb | 36 - lib/workos/feature_flag.rb | 34 - lib/workos/feature_flags.rb | 217 + lib/workos/feature_flags/feature_flag.rb | 54 + .../feature_flags/feature_flag_owner.rb | 30 + lib/workos/feature_flags/flag.rb | 7 + lib/workos/feature_flags/flag_created.rb | 39 + .../feature_flags/flag_created_context.rb | 27 + .../flag_created_context_actor.rb | 30 + lib/workos/feature_flags/flag_created_data.rb | 57 + .../feature_flags/flag_created_data_owner.rb | 7 + lib/workos/feature_flags/flag_deleted.rb | 39 + .../feature_flags/flag_deleted_context.rb | 27 + .../flag_deleted_context_actor.rb | 30 + lib/workos/feature_flags/flag_deleted_data.rb | 7 + .../feature_flags/flag_deleted_data_owner.rb | 7 + lib/workos/feature_flags/flag_owner.rb | 7 + lib/workos/feature_flags/flag_rule_updated.rb | 39 + .../flag_rule_updated_context.rb | 36 + .../flag_rule_updated_context_actor.rb | 30 + ..._rule_updated_context_configured_target.rb | 27 + ..._context_configured_target_organization.rb | 27 + ..._updated_context_configured_target_user.rb | 27 + ...rule_updated_context_previous_attribute.rb | 27 + ...ated_context_previous_attribute_context.rb | 27 + ...ous_attribute_context_configured_target.rb | 7 + ..._context_configured_target_organization.rb | 7 + ...ttribute_context_configured_target_user.rb | 7 + ...updated_context_previous_attribute_data.rb | 27 + .../feature_flags/flag_rule_updated_data.rb | 7 + .../flag_rule_updated_data_owner.rb | 7 + lib/workos/feature_flags/flag_updated.rb | 39 + .../feature_flags/flag_updated_context.rb | 30 + .../flag_updated_context_actor.rb | 30 + ...flag_updated_context_previous_attribute.rb | 23 + ...updated_context_previous_attribute_data.rb | 36 + lib/workos/feature_flags/flag_updated_data.rb | 7 + .../feature_flags/flag_updated_data_owner.rb | 7 + lib/workos/hash_provider.rb | 42 +- lib/workos/impersonator.rb | 23 - lib/workos/invitation.rb | 49 - lib/workos/magic_auth.rb | 37 - lib/workos/mfa.rb | 135 - lib/workos/multi_factor_auth.rb | 172 + .../authentication_challenge.rb | 42 + ...uthentication_challenge_verify_response.rb | 27 + ...uthentication_challenges_verify_request.rb | 23 + .../authentication_factor.rb | 45 + .../authentication_factor_enrolled.rb | 45 + .../authentication_factor_enrolled_sms.rb | 23 + .../authentication_factor_enrolled_totp.rb | 36 + .../authentication_factor_sms.rb | 7 + .../authentication_factor_totp.rb | 27 + .../authentication_factors_create_request.rb | 36 + .../challenge_authentication_factor.rb | 23 + .../enroll_user_authentication_factor.rb | 33 + ...r_authentication_factor_enroll_response.rb | 27 + lib/workos/oauth_tokens.rb | 29 - lib/workos/organization.rb | 47 - lib/workos/organization_domains.rb | 67 + .../create_organization_domain.rb | 27 + .../organization_domain.rb | 51 + .../organization_domain_created.rb | 39 + .../organization_domain_created_data.rb | 51 + .../organization_domain_deleted.rb | 39 + .../organization_domain_deleted_data.rb | 51 + .../organization_domain_stand_alone.rb | 51 + .../organization_domain_updated.rb | 39 + .../organization_domain_updated_data.rb | 51 + ...organization_domain_verification_failed.rb | 39 + ...ization_domain_verification_failed_data.rb | 27 + ...ication_failed_data_organization_domain.rb | 51 + .../organization_domain_verified.rb | 39 + .../organization_domain_verified_data.rb | 51 + lib/workos/organization_membership.rb | 43 - lib/workos/organizations.rb | 433 +- .../organizations/audit_log_configuration.rb | 33 + .../audit_log_configuration_log_stream.rb | 36 + .../organizations/audit_logs_retention.rb | 23 + lib/workos/organizations/organization.rb | 60 + .../organizations/organization_created.rb | 39 + .../organization_created_data.rb | 48 + .../organization_created_data_domain.rb | 51 + .../organizations/organization_deleted.rb | 39 + .../organization_deleted_data.rb | 48 + .../organization_deleted_data_domain.rb | 51 + .../organizations/organization_domain_data.rb | 27 + .../organizations/organization_input.rb | 39 + .../organization_membership_created.rb | 39 + .../organization_membership_created_data.rb | 54 + .../organization_membership_deleted.rb | 39 + .../organization_membership_deleted_data.rb | 54 + .../organization_membership_updated.rb | 39 + .../organization_membership_updated_data.rb | 54 + .../organization_role_created.rb | 39 + .../organization_role_created_data.rb | 48 + .../organization_role_deleted.rb | 39 + .../organization_role_deleted_data.rb | 7 + .../organization_role_updated.rb | 39 + .../organization_role_updated_data.rb | 7 + .../organizations/organization_updated.rb | 39 + .../organization_updated_data.rb | 48 + .../organization_updated_data_domain.rb | 51 + .../update_audit_logs_retention.rb | 23 + .../organizations/update_organization.rb | 51 + lib/workos/password_reset.rb | 37 - lib/workos/passwordless.rb | 119 +- lib/workos/pipes.rb | 111 + lib/workos/pipes/connected_account.rb | 45 + .../data_integration_access_token_response.rb | 30 + ...tion_access_token_response_access_token.rb | 36 + ...data_integration_authorize_url_response.rb | 23 + ..._data_integration_authorize_url_request.rb | 30 + ...ata_integrations_get_user_token_request.rb | 27 + .../pipes/data_integrations_list_response.rb | 27 + .../data_integrations_list_response_data.rb | 57 + ...ns_list_response_data_connected_account.rb | 57 + lib/workos/pkce.rb | 42 + lib/workos/portal.rb | 54 - lib/workos/profile.rb | 57 - lib/workos/profile_and_token.rb | 26 - lib/workos/public_client.rb | 30 + lib/workos/radar.rb | 104 + ...dar_list_entry_already_present_response.rb | 23 + .../radar/radar_standalone_assess_request.rb | 42 + ...ndalone_delete_radar_list_entry_request.rb | 23 + lib/workos/radar/radar_standalone_response.rb | 36 + ...standalone_update_radar_attempt_request.rb | 27 + ...ar_standalone_update_radar_list_request.rb | 7 + lib/workos/refresh_authentication_response.rb | 51 - lib/workos/role.rb | 38 - lib/workos/session.rb | 245 +- lib/workos/session_manager.rb | 187 + lib/workos/shared/event_context.rb | 39 + lib/workos/shared/event_context_actor.rb | 30 + .../event_context_google_analytics_session.rb | 30 + lib/workos/shared/group.rb | 42 + lib/workos/shared/group_created.rb | 39 + lib/workos/shared/group_deleted.rb | 39 + lib/workos/shared/group_member_added.rb | 39 + lib/workos/shared/group_member_added_data.rb | 27 + lib/workos/shared/group_member_removed.rb | 39 + .../shared/group_member_removed_data.rb | 7 + lib/workos/shared/group_updated.rb | 39 + lib/workos/sso.rb | 416 +- lib/workos/sso/connection.rb | 63 + lib/workos/sso/connection_activated.rb | 39 + lib/workos/sso/connection_activated_data.rb | 54 + .../sso/connection_activated_data_domain.rb | 30 + lib/workos/sso/connection_deactivated.rb | 39 + lib/workos/sso/connection_deactivated_data.rb | 54 + .../sso/connection_deactivated_data_domain.rb | 7 + lib/workos/sso/connection_deleted.rb | 39 + lib/workos/sso/connection_deleted_data.rb | 45 + lib/workos/sso/connection_domain.rb | 7 + lib/workos/sso/connection_option.rb | 23 + ...ction_saml_certificate_renewal_required.rb | 39 + ..._saml_certificate_renewal_required_data.rb | 30 + ...icate_renewal_required_data_certificate.rb | 30 + ...ficate_renewal_required_data_connection.rb | 27 + .../connection_saml_certificate_renewed.rb | 39 + ...onnection_saml_certificate_renewed_data.rb | 30 + ...ml_certificate_renewed_data_certificate.rb | 27 + ...aml_certificate_renewed_data_connection.rb | 7 + lib/workos/sso/profile.rb | 63 + lib/workos/sso/sso_authorize_url_response.rb | 23 + .../sso/sso_logout_authorize_request.rb | 23 + .../sso/sso_logout_authorize_response.rb | 27 + lib/workos/sso/sso_token_response.rb | 36 + .../sso/sso_token_response_oauth_token.rb | 7 + lib/workos/sso/token_query.rb | 33 + lib/workos/types.rb | 12 - lib/workos/types/applications_order.rb | 9 + ...udit_log_configuration_log_stream_state.rb | 15 + ...audit_log_configuration_log_stream_type.rb | 17 + .../types/audit_log_configuration_state.rb | 14 + lib/workos/types/audit_log_export_state.rb | 14 + lib/workos/types/audit_logs_order.rb | 9 + ...enticate_response_authentication_method.rb | 33 + .../authentication_factor_enrolled_type.rb | 9 + .../types/authentication_factor_type.rb | 15 + ...hentication_factors_create_request_type.rb | 14 + ...ication_radar_risk_detected_data_action.rb | 13 + lib/workos/types/authorization_assignment.rb | 13 + lib/workos/types/authorization_order.rb | 9 + lib/workos/types/connected_account_state.rb | 14 + ...nnection_activated_data_connection_type.rb | 9 + .../types/connection_activated_data_state.rb | 9 + .../types/connection_activated_data_status.rb | 9 + ...ection_deactivated_data_connection_type.rb | 9 + .../connection_deactivated_data_state.rb | 9 + .../connection_deactivated_data_status.rb | 9 + ...connection_deleted_data_connection_type.rb | 61 + .../types/connection_deleted_data_state.rb | 16 + ...uired_data_certificate_certificate_type.rb | 9 + ...newed_data_certificate_certificate_type.rb | 14 + lib/workos/types/connection_state.rb | 17 + lib/workos/types/connection_status.rb | 13 + lib/workos/types/connection_type.rb | 62 + .../types/connections_connection_type.rb | 59 + lib/workos/types/connections_order.rb | 9 + .../create_user_invite_options_locale.rb | 101 + .../types/create_user_password_hash_type.rb | 17 + .../types/create_webhook_endpoint_events.rb | 85 + ...integration_access_token_response_error.rb | 13 + ...t_response_data_connected_account_state.rb | 9 + ...tegrations_list_response_data_ownership.rb | 13 + lib/workos/types/directories_order.rb | 9 + lib/workos/types/directory_groups_order.rb | 9 + lib/workos/types/directory_state.rb | 16 + lib/workos/types/directory_type.rb | 32 + lib/workos/types/directory_user_state.rb | 14 + .../types/directory_user_with_groups_state.rb | 9 + lib/workos/types/directory_users_order.rb | 9 + .../types/dsync_activated_data_state.rb | 9 + lib/workos/types/dsync_activated_data_type.rb | 9 + .../types/dsync_deactivated_data_state.rb | 9 + .../types/dsync_deactivated_data_type.rb | 9 + lib/workos/types/dsync_deleted_data_state.rb | 16 + lib/workos/types/dsync_deleted_data_type.rb | 34 + .../types/dsync_user_updated_data_state.rb | 9 + .../types/event_context_actor_source.rb | 14 + lib/workos/types/events_order.rb | 14 + lib/workos/types/feature_flags_order.rb | 9 + .../flag_created_context_actor_source.rb | 9 + .../flag_deleted_context_actor_source.rb | 9 + .../flag_rule_updated_context_access_type.rb | 14 + .../flag_rule_updated_context_actor_source.rb | 9 + ..._previous_attribute_context_access_type.rb | 9 + .../flag_updated_context_actor_source.rb | 9 + .../{intent.rb => generate_link_intent.rb} | 18 +- .../types/invitation_accepted_data_state.rb | 9 + .../types/invitation_created_data_state.rb | 9 + .../types/invitation_resent_data_state.rb | 9 + .../types/invitation_revoked_data_state.rb | 9 + lib/workos/types/invitation_state.rb | 15 + lib/workos/types/list_struct.rb | 121 +- .../organization_created_data_domain_state.rb | 9 + ...eated_data_domain_verification_strategy.rb | 9 + .../organization_deleted_data_domain_state.rb | 9 + ...leted_data_domain_verification_strategy.rb | 9 + .../organization_domain_created_data_state.rb | 9 + ...main_created_data_verification_strategy.rb | 9 + .../types/organization_domain_data_state.rb | 13 + .../organization_domain_deleted_data_state.rb | 9 + ...main_deleted_data_verification_strategy.rb | 9 + .../organization_domain_stand_alone_state.rb | 9 + ...omain_stand_alone_verification_strategy.rb | 9 + lib/workos/types/organization_domain_state.rb | 16 + .../organization_domain_updated_data_state.rb | 9 + ...main_updated_data_verification_strategy.rb | 9 + ...n_failed_data_organization_domain_state.rb | 9 + ...ganization_domain_verification_strategy.rb | 9 + ..._domain_verification_failed_data_reason.rb | 13 + ...ganization_domain_verification_strategy.rb | 13 + ...organization_domain_verified_data_state.rb | 9 + ...ain_verified_data_verification_strategy.rb | 9 + ...nization_membership_created_data_status.rb | 9 + ...nization_membership_deleted_data_status.rb | 9 + .../types/organization_membership_status.rb | 14 + ...nization_membership_updated_data_status.rb | 9 + .../organization_updated_data_domain_state.rb | 9 + ...dated_data_domain_verification_strategy.rb | 9 + .../types/organizations_api_keys_order.rb | 9 + .../organizations_feature_flags_order.rb | 9 + lib/workos/types/organizations_order.rb | 9 + .../types/passwordless_session_struct.rb | 18 - lib/workos/types/permissions_order.rb | 9 + lib/workos/types/profile_connection_type.rb | 9 + lib/workos/types/provider.rb | 16 - lib/workos/types/radar_action.rb | 13 + .../radar_standalone_assess_request_action.rb | 19 + ...r_standalone_assess_request_auth_method.rb | 19 + ...adar_standalone_response_blocklist_type.rb | 9 + .../radar_standalone_response_control.rb | 21 + .../radar_standalone_response_verdict.rb | 14 + lib/workos/types/radar_type.rb | 18 + .../resend_user_invite_options_locale.rb | 9 + lib/workos/types/role_type.rb | 13 + .../types/session_created_data_auth_method.rb | 9 + .../types/session_created_data_status.rb | 9 + .../types/session_revoked_data_auth_method.rb | 9 + .../types/session_revoked_data_status.rb | 9 + lib/workos/types/sso_provider.rb | 15 + .../types/update_user_password_hash_type.rb | 9 + .../types/update_webhook_endpoint_events.rb | 9 + .../types/update_webhook_endpoint_status.rb | 9 + .../user_identities_get_item_provider.rb | 25 + lib/workos/types/user_invite_state.rb | 9 + ...user_management_authentication_provider.rb | 16 + ...r_management_authentication_screen_hint.rb | 13 + .../user_management_invitations_order.rb | 9 + ...ement_multi_factor_authentication_order.rb | 9 + ...anagement_organization_membership_order.rb | 9 + ...gement_organization_membership_statuses.rb | 9 + ...ent_users_authorized_applications_order.rb | 9 + ...er_management_users_feature_flags_order.rb | 9 + .../types/user_management_users_order.rb | 9 + ...zation_membership_base_list_data_status.rb | 9 + .../user_organization_membership_status.rb | 9 + lib/workos/types/user_sessions_auth_method.rb | 21 + lib/workos/types/user_sessions_status.rb | 14 + ...erification_completed_data_key_provider.rb | 14 + .../vault_data_created_data_actor_source.rb | 9 + .../vault_data_deleted_data_actor_source.rb | 9 + .../vault_data_read_data_actor_source.rb | 9 + .../vault_data_updated_data_actor_source.rb | 9 + .../vault_dek_decrypted_data_actor_source.rb | 9 + .../types/vault_dek_read_data_actor_source.rb | 13 + .../vault_kek_created_data_actor_source.rb | 9 + .../vault_metadata_read_data_actor_source.rb | 9 + .../vault_names_listed_data_actor_source.rb | 9 + lib/workos/types/webhook_endpoint_status.rb | 13 + lib/workos/types/webhooks_order.rb | 9 + lib/workos/types/widget_scope.rb | 15 - .../types/widget_session_token_scopes.rb | 17 + lib/workos/user.rb | 45 - lib/workos/user_and_token.rb | 26 - lib/workos/user_management.rb | 2375 +++--- .../action_authentication_denied.rb | 39 + .../action_authentication_denied_data.rb | 48 + .../action_user_registration_denied.rb | 39 + .../action_user_registration_denied_data.rb | 45 + .../user_management/authenticate_response.rb | 45 + .../authenticate_response_impersonator.rb | 27 + .../authenticate_response_oauth_token.rb | 36 + ...uthentication_email_verification_failed.rb | 39 + ...tication_email_verification_failed_data.rb | 42 + ...on_email_verification_failed_data_error.rb | 27 + ...entication_email_verification_succeeded.rb | 39 + ...ation_email_verification_succeeded_data.rb | 39 + .../authentication_magic_auth_failed.rb | 39 + .../authentication_magic_auth_failed_data.rb | 42 + ...entication_magic_auth_failed_data_error.rb | 7 + .../authentication_magic_auth_succeeded.rb | 39 + ...uthentication_magic_auth_succeeded_data.rb | 39 + .../authentication_mfa_failed.rb | 39 + .../authentication_mfa_failed_data.rb | 42 + .../authentication_mfa_failed_data_error.rb | 7 + .../authentication_mfa_succeeded.rb | 39 + .../authentication_mfa_succeeded_data.rb | 39 + .../authentication_oauth_failed.rb | 39 + .../authentication_oauth_failed_data.rb | 42 + .../authentication_oauth_failed_data_error.rb | 7 + .../authentication_oauth_succeeded.rb | 39 + .../authentication_oauth_succeeded_data.rb | 39 + .../authentication_passkey_failed.rb | 39 + .../authentication_passkey_failed_data.rb | 42 + ...uthentication_passkey_failed_data_error.rb | 7 + .../authentication_passkey_succeeded.rb | 39 + .../authentication_passkey_succeeded_data.rb | 39 + .../authentication_password_failed.rb | 39 + .../authentication_password_failed_data.rb | 42 + ...thentication_password_failed_data_error.rb | 7 + .../authentication_password_succeeded.rb | 39 + .../authentication_password_succeeded_data.rb | 39 + .../authentication_radar_risk_detected.rb | 39 + ...authentication_radar_risk_detected_data.rb | 45 + .../authentication_sso_failed.rb | 39 + .../authentication_sso_failed_data.rb | 45 + .../authentication_sso_failed_data_error.rb | 7 + .../authentication_sso_failed_data_sso.rb | 30 + .../authentication_sso_started.rb | 39 + .../authentication_sso_started_data.rb | 42 + .../authentication_sso_started_data_sso.rb | 7 + .../authentication_sso_succeeded.rb | 39 + .../authentication_sso_succeeded_data.rb | 42 + .../authentication_sso_succeeded_data_sso.rb | 7 + .../authentication_sso_timed_out.rb | 39 + .../authentication_sso_timed_out_data.rb | 45 + ...authentication_sso_timed_out_data_error.rb | 7 + .../authentication_sso_timed_out_data_sso.rb | 7 + ...ation_code_session_authenticate_request.rb | 48 + ...uthorized_connect_application_list_data.rb | 36 + .../user_management/confirm_email_change.rb | 7 + .../user_management/cors_origin_response.rb | 36 + .../user_management/create_cors_origin.rb | 23 + .../create_magic_code_and_return.rb | 27 + .../user_management/create_password_reset.rb | 27 + .../create_password_reset_token.rb | 23 + .../user_management/create_redirect_uri.rb | 23 + lib/workos/user_management/create_user.rb | 48 + .../create_user_invite_options.rb | 39 + .../create_user_organization_membership.rb | 33 + .../device_authorization_response.rb | 39 + ...evice_code_session_authenticate_request.rb | 39 + lib/workos/user_management/email_change.rb | 36 + .../email_change_confirmation.rb | 27 + .../email_change_confirmation_user.rb | 60 + .../user_management/email_verification.rb | 45 + ...ation_code_session_authenticate_request.rb | 45 + .../email_verification_created.rb | 39 + .../email_verification_created_data.rb | 42 + lib/workos/user_management/invitation.rb | 63 + .../user_management/invitation_accepted.rb | 39 + .../invitation_accepted_data.rb | 57 + .../user_management/invitation_created.rb | 39 + .../invitation_created_data.rb | 57 + .../user_management/invitation_resent.rb | 39 + .../user_management/invitation_resent_data.rb | 57 + .../user_management/invitation_revoked.rb | 39 + .../invitation_revoked_data.rb | 57 + lib/workos/user_management/jwks_response.rb | 23 + .../user_management/jwks_response_keys.rb | 45 + .../user_management/jwt_template_response.rb | 33 + lib/workos/user_management/magic_auth.rb | 45 + ..._auth_code_session_authenticate_request.rb | 48 + .../user_management/magic_auth_created.rb | 39 + .../magic_auth_created_data.rb | 42 + .../mfa_totp_session_authenticate_request.rb | 48 + .../organization_membership.rb | 54 + ..._selection_session_authenticate_request.rb | 45 + lib/workos/user_management/password_reset.rb | 45 + .../user_management/password_reset_created.rb | 39 + .../password_reset_created_data.rb | 39 + .../password_reset_succeeded.rb | 39 + .../password_reset_succeeded_data.rb | 7 + .../password_session_authenticate_request.rb | 48 + lib/workos/user_management/redirect_uri.rb | 39 + ...resh_token_session_authenticate_request.rb | 45 + .../resend_user_invite_options.rb | 23 + .../reset_password_response.rb | 23 + lib/workos/user_management/revoke_session.rb | 27 + .../user_management/send_email_change.rb | 23 + .../send_verification_email_response.rb | 7 + lib/workos/user_management/session.rb | 58 - lib/workos/user_management/session_created.rb | 39 + .../user_management/session_created_data.rb | 60 + .../session_created_data_impersonator.rb | 7 + lib/workos/user_management/session_revoked.rb | 39 + .../user_management/session_revoked_data.rb | 60 + .../session_revoked_data_impersonator.rb | 7 + .../sso_device_authorization_request.rb | 23 + .../user_management/update_jwt_template.rb | 23 + lib/workos/user_management/update_user.rb | 51 + .../update_user_organization_membership.rb | 27 + ...evice_code_session_authenticate_request.rb | 8 + ...ation_code_session_authenticate_request.rb | 8 + ..._auth_code_session_authenticate_request.rb | 8 + ...e_mfa_totp_session_authenticate_request.rb | 8 + ..._selection_session_authenticate_request.rb | 8 + lib/workos/user_management/user.rb | 7 + lib/workos/user_management/user_created.rb | 39 + lib/workos/user_management/user_deleted.rb | 39 + .../user_identities_get_item.rb | 30 + lib/workos/user_management/user_invite.rb | 63 + .../user_organization_membership.rb | 54 + .../user_sessions_impersonator.rb | 7 + .../user_sessions_list_item.rb | 60 + lib/workos/user_management/user_updated.rb | 39 + .../user_management/verify_email_address.rb | 7 + .../user_management/verify_email_response.rb | 7 + lib/workos/user_response.rb | 22 - lib/workos/util.rb | 16 + lib/workos/util/signature.rb | 55 + lib/workos/vault.rb | 238 + .../vault_byok_key_verification_completed.rb | 39 + ...lt_byok_key_verification_completed_data.rb | 30 + lib/workos/vault/vault_data_created.rb | 39 + lib/workos/vault/vault_data_created_data.rb | 39 + lib/workos/vault/vault_data_deleted.rb | 39 + lib/workos/vault/vault_data_deleted_data.rb | 33 + lib/workos/vault/vault_data_read.rb | 39 + lib/workos/vault/vault_data_read_data.rb | 36 + lib/workos/vault/vault_data_updated.rb | 39 + lib/workos/vault/vault_data_updated_data.rb | 39 + lib/workos/vault/vault_dek_decrypted.rb | 39 + lib/workos/vault/vault_dek_decrypted_data.rb | 33 + lib/workos/vault/vault_dek_read.rb | 39 + lib/workos/vault/vault_dek_read_data.rb | 36 + lib/workos/vault/vault_kek_created.rb | 39 + lib/workos/vault/vault_kek_created_data.rb | 36 + lib/workos/vault/vault_metadata_read.rb | 39 + lib/workos/vault/vault_metadata_read_data.rb | 33 + lib/workos/vault/vault_names_listed.rb | 39 + lib/workos/vault/vault_names_listed_data.rb | 30 + lib/workos/verify_challenge.rb | 25 - lib/workos/version.rb | 1 + lib/workos/webhook.rb | 30 - lib/workos/webhook_event.rb | 120 + lib/workos/webhooks.rb | 317 +- .../webhooks/create_webhook_endpoint.rb | 27 + .../webhooks/update_webhook_endpoint.rb | 30 + lib/workos/webhooks/webhook_endpoint.rb | 45 + lib/workos/widgets.rb | 64 +- lib/workos/widgets/widget_session_token.rb | 30 + .../widgets/widget_session_token_response.rb | 23 + rbi/workos/action_authentication_denied.rbi | 53 + .../action_authentication_denied_data.rbi | 71 + .../action_user_registration_denied.rbi | 53 + .../action_user_registration_denied_data.rbi | 65 + rbi/workos/add_role_permission.rbi | 23 + rbi/workos/admin_portal.rbi | 25 + rbi/workos/api_key.rbi | 71 + rbi/workos/api_key_created.rbi | 53 + rbi/workos/api_key_created_data.rbi | 71 + rbi/workos/api_key_created_data_owner.rbi | 29 + rbi/workos/api_key_owner.rbi | 29 + rbi/workos/api_key_revoked.rbi | 53 + rbi/workos/api_key_revoked_data.rbi | 71 + rbi/workos/api_key_revoked_data_owner.rbi | 29 + rbi/workos/api_key_validation_response.rbi | 23 + rbi/workos/api_key_with_value.rbi | 77 + rbi/workos/api_key_with_value_owner.rbi | 29 + rbi/workos/api_keys.rbi | 50 + .../application_credentials_list_item.rbi | 53 + rbi/workos/assign_role.rbi | 41 + rbi/workos/audit_log_action.rbi | 47 + rbi/workos/audit_log_configuration.rbi | 41 + .../audit_log_configuration_log_stream.rbi | 47 + rbi/workos/audit_log_event.rbi | 59 + rbi/workos/audit_log_event_actor.rbi | 41 + rbi/workos/audit_log_event_context.rbi | 29 + .../audit_log_event_create_response.rbi | 23 + rbi/workos/audit_log_event_ingestion.rbi | 29 + rbi/workos/audit_log_event_target.rbi | 41 + rbi/workos/audit_log_export.rbi | 53 + rbi/workos/audit_log_export_creation.rbi | 65 + rbi/workos/audit_log_schema.rbi | 53 + rbi/workos/audit_log_schema_actor.rbi | 23 + rbi/workos/audit_log_schema_target.rbi | 29 + rbi/workos/audit_logs.rbi | 95 + rbi/workos/audit_logs_retention.rbi | 23 + rbi/workos/authenticate_response.rbi | 65 + .../authenticate_response_impersonator.rbi | 29 + .../authenticate_response_oauth_token.rbi | 47 + rbi/workos/authentication_challenge.rbi | 59 + ...thentication_challenge_verify_response.rbi | 29 + ...thentication_challenges_verify_request.rbi | 23 + ...thentication_email_verification_failed.rbi | 53 + ...ication_email_verification_failed_data.rbi | 59 + ...n_email_verification_failed_data_error.rbi | 29 + ...ntication_email_verification_succeeded.rbi | 53 + ...tion_email_verification_succeeded_data.rbi | 53 + rbi/workos/authentication_factor.rbi | 65 + rbi/workos/authentication_factor_enrolled.rbi | 65 + .../authentication_factor_enrolled_sms.rbi | 23 + .../authentication_factor_enrolled_totp.rbi | 47 + rbi/workos/authentication_factor_sms.rbi | 23 + rbi/workos/authentication_factor_totp.rbi | 29 + .../authentication_factors_create_request.rbi | 47 + .../authentication_magic_auth_failed.rbi | 53 + .../authentication_magic_auth_failed_data.rbi | 59 + ...ntication_magic_auth_failed_data_error.rbi | 29 + .../authentication_magic_auth_succeeded.rbi | 53 + ...thentication_magic_auth_succeeded_data.rbi | 53 + rbi/workos/authentication_mfa_failed.rbi | 53 + rbi/workos/authentication_mfa_failed_data.rbi | 59 + .../authentication_mfa_failed_data_error.rbi | 29 + rbi/workos/authentication_mfa_succeeded.rbi | 53 + .../authentication_mfa_succeeded_data.rbi | 53 + rbi/workos/authentication_oauth_failed.rbi | 53 + .../authentication_oauth_failed_data.rbi | 59 + ...authentication_oauth_failed_data_error.rbi | 29 + rbi/workos/authentication_oauth_succeeded.rbi | 53 + .../authentication_oauth_succeeded_data.rbi | 53 + rbi/workos/authentication_passkey_failed.rbi | 53 + .../authentication_passkey_failed_data.rbi | 59 + ...thentication_passkey_failed_data_error.rbi | 29 + .../authentication_passkey_succeeded.rbi | 53 + .../authentication_passkey_succeeded_data.rbi | 53 + rbi/workos/authentication_password_failed.rbi | 53 + .../authentication_password_failed_data.rbi | 59 + ...hentication_password_failed_data_error.rbi | 29 + .../authentication_password_succeeded.rbi | 53 + ...authentication_password_succeeded_data.rbi | 53 + .../authentication_radar_risk_detected.rbi | 53 + ...uthentication_radar_risk_detected_data.rbi | 65 + rbi/workos/authentication_sso_failed.rbi | 53 + rbi/workos/authentication_sso_failed_data.rbi | 65 + .../authentication_sso_failed_data_error.rbi | 29 + .../authentication_sso_failed_data_sso.rbi | 35 + rbi/workos/authentication_sso_started.rbi | 53 + .../authentication_sso_started_data.rbi | 59 + .../authentication_sso_started_data_sso.rbi | 35 + rbi/workos/authentication_sso_succeeded.rbi | 53 + .../authentication_sso_succeeded_data.rbi | 59 + .../authentication_sso_succeeded_data_sso.rbi | 35 + rbi/workos/authentication_sso_timed_out.rbi | 53 + .../authentication_sso_timed_out_data.rbi | 65 + ...uthentication_sso_timed_out_data_error.rbi | 29 + .../authentication_sso_timed_out_data_sso.rbi | 35 + rbi/workos/authorization.rbi | 413 ++ rbi/workos/authorization_check.rbi | 23 + ...tion_code_session_authenticate_request.rbi | 71 + rbi/workos/authorization_permission.rbi | 71 + rbi/workos/authorization_resource.rbi | 77 + ...thorized_connect_application_list_data.rbi | 47 + .../challenge_authentication_factor.rbi | 23 + rbi/workos/check_authorization.rbi | 41 + rbi/workos/client.rbi | 60 + rbi/workos/confirm_email_change.rbi | 23 + rbi/workos/connect.rbi | 101 + rbi/workos/connect_application.rbi | 77 + rbi/workos/connected_account.rbi | 65 + rbi/workos/connection.rbi | 83 + rbi/workos/connection_activated.rbi | 53 + rbi/workos/connection_activated_data.rbi | 83 + .../connection_activated_data_domain.rbi | 35 + rbi/workos/connection_deactivated.rbi | 53 + rbi/workos/connection_deactivated_data.rbi | 83 + .../connection_deactivated_data_domain.rbi | 35 + rbi/workos/connection_deleted.rbi | 53 + rbi/workos/connection_deleted_data.rbi | 65 + rbi/workos/connection_domain.rbi | 35 + rbi/workos/connection_option.rbi | 23 + ...tion_saml_certificate_renewal_required.rbi | 53 + ...saml_certificate_renewal_required_data.rbi | 35 + ...cate_renewal_required_data_certificate.rbi | 35 + ...icate_renewal_required_data_connection.rbi | 29 + .../connection_saml_certificate_renewed.rbi | 53 + ...nnection_saml_certificate_renewed_data.rbi | 35 + ...l_certificate_renewed_data_certificate.rbi | 29 + ...ml_certificate_renewed_data_connection.rbi | 29 + rbi/workos/cors_origin_response.rbi | 47 + rbi/workos/create_application_secret.rbi | 17 + .../create_authorization_permission.rbi | 41 + rbi/workos/create_authorization_resource.rbi | 65 + rbi/workos/create_cors_origin.rbi | 23 + rbi/workos/create_m2m_application.rbi | 47 + rbi/workos/create_magic_code_and_return.rbi | 29 + rbi/workos/create_oauth_application.rbi | 65 + rbi/workos/create_organization_api_key.rbi | 29 + rbi/workos/create_organization_domain.rbi | 29 + rbi/workos/create_organization_role.rbi | 41 + rbi/workos/create_password_reset.rbi | 29 + rbi/workos/create_password_reset_token.rbi | 23 + rbi/workos/create_redirect_uri.rbi | 23 + rbi/workos/create_role.rbi | 41 + rbi/workos/create_user.rbi | 71 + rbi/workos/create_user_invite_options.rbi | 53 + .../create_user_organization_membership.rbi | 41 + rbi/workos/create_webhook_endpoint.rbi | 29 + ...data_integration_access_token_response.rbi | 35 + ...ion_access_token_response_access_token.rbi | 47 + ...ata_integration_authorize_url_response.rbi | 23 + ...data_integration_authorize_url_request.rbi | 35 + ...ta_integrations_get_user_token_request.rbi | 29 + .../data_integrations_list_response.rbi | 29 + .../data_integrations_list_response_data.rbi | 89 + ...s_list_response_data_connected_account.rbi | 71 + rbi/workos/device_authorization_response.rbi | 53 + ...vice_code_session_authenticate_request.rbi | 53 + rbi/workos/directory.rbi | 83 + rbi/workos/directory_group.rbi | 71 + rbi/workos/directory_metadata.rbi | 29 + rbi/workos/directory_metadata_user.rbi | 29 + rbi/workos/directory_sync.rbi | 84 + rbi/workos/directory_user.rbi | 125 + rbi/workos/directory_user_email.rbi | 35 + rbi/workos/directory_user_with_groups.rbi | 131 + .../directory_user_with_groups_email.rbi | 35 + rbi/workos/dsync_activated.rbi | 53 + rbi/workos/dsync_activated_data.rbi | 77 + rbi/workos/dsync_activated_data_domain.rbi | 35 + rbi/workos/dsync_deactivated.rbi | 53 + rbi/workos/dsync_deactivated_data.rbi | 77 + rbi/workos/dsync_deactivated_data_domain.rbi | 35 + rbi/workos/dsync_deleted.rbi | 53 + rbi/workos/dsync_deleted_data.rbi | 65 + rbi/workos/dsync_group_created.rbi | 53 + rbi/workos/dsync_group_deleted.rbi | 53 + rbi/workos/dsync_group_updated.rbi | 53 + rbi/workos/dsync_group_updated_data.rbi | 77 + rbi/workos/dsync_group_user_added.rbi | 53 + rbi/workos/dsync_group_user_added_data.rbi | 35 + rbi/workos/dsync_group_user_removed.rbi | 53 + rbi/workos/dsync_group_user_removed_data.rbi | 35 + rbi/workos/dsync_user_created.rbi | 53 + rbi/workos/dsync_user_deleted.rbi | 53 + rbi/workos/dsync_user_updated.rbi | 53 + rbi/workos/dsync_user_updated_data.rbi | 131 + rbi/workos/dsync_user_updated_data_email.rbi | 35 + rbi/workos/email_change.rbi | 47 + rbi/workos/email_change_confirmation.rbi | 29 + rbi/workos/email_change_confirmation_user.rbi | 95 + rbi/workos/email_verification.rbi | 65 + ...tion_code_session_authenticate_request.rbi | 65 + rbi/workos/email_verification_created.rbi | 53 + .../email_verification_created_data.rbi | 59 + .../enroll_user_authentication_factor.rbi | 41 + rbi/workos/event_context.rbi | 53 + rbi/workos/event_context_actor.rbi | 35 + ...event_context_google_analytics_session.rbi | 35 + rbi/workos/event_list_list_metadata.rbi | 23 + rbi/workos/event_schema.rbi | 53 + rbi/workos/events.rbi | 27 + .../external_auth_complete_response.rbi | 23 + rbi/workos/feature_flag.rbi | 83 + rbi/workos/feature_flag_owner.rbi | 35 + rbi/workos/feature_flags.rbi | 89 + rbi/workos/flag.rbi | 83 + rbi/workos/flag_created.rbi | 53 + rbi/workos/flag_created_context.rbi | 29 + rbi/workos/flag_created_context_actor.rbi | 35 + rbi/workos/flag_created_data.rbi | 89 + rbi/workos/flag_created_data_owner.rbi | 35 + rbi/workos/flag_deleted.rbi | 53 + rbi/workos/flag_deleted_context.rbi | 29 + rbi/workos/flag_deleted_context_actor.rbi | 35 + rbi/workos/flag_deleted_data.rbi | 89 + rbi/workos/flag_deleted_data_owner.rbi | 35 + rbi/workos/flag_owner.rbi | 35 + rbi/workos/flag_rule_updated.rbi | 53 + rbi/workos/flag_rule_updated_context.rbi | 47 + .../flag_rule_updated_context_actor.rbi | 35 + ...rule_updated_context_configured_target.rbi | 29 + ...context_configured_target_organization.rbi | 29 + ...updated_context_configured_target_user.rbi | 29 + ...ule_updated_context_previous_attribute.rbi | 29 + ...ted_context_previous_attribute_context.rbi | 29 + ...us_attribute_context_configured_target.rbi | 29 + ...context_configured_target_organization.rbi | 29 + ...tribute_context_configured_target_user.rbi | 29 + ...pdated_context_previous_attribute_data.rbi | 29 + rbi/workos/flag_rule_updated_data.rbi | 89 + rbi/workos/flag_rule_updated_data_owner.rbi | 35 + rbi/workos/flag_updated.rbi | 53 + rbi/workos/flag_updated_context.rbi | 35 + rbi/workos/flag_updated_context_actor.rbi | 35 + ...lag_updated_context_previous_attribute.rbi | 23 + ...pdated_context_previous_attribute_data.rbi | 47 + rbi/workos/flag_updated_data.rbi | 89 + rbi/workos/flag_updated_data_owner.rbi | 35 + rbi/workos/generate_link.rbi | 53 + rbi/workos/group.rbi | 59 + rbi/workos/group_created.rbi | 53 + rbi/workos/group_deleted.rbi | 53 + rbi/workos/group_member_added.rbi | 53 + rbi/workos/group_member_added_data.rbi | 29 + rbi/workos/group_member_removed.rbi | 53 + rbi/workos/group_member_removed_data.rbi | 29 + rbi/workos/group_updated.rbi | 53 + rbi/workos/intent_options.rbi | 23 + rbi/workos/invitation.rbi | 101 + rbi/workos/invitation_accepted.rbi | 53 + rbi/workos/invitation_accepted_data.rbi | 89 + rbi/workos/invitation_created.rbi | 53 + rbi/workos/invitation_created_data.rbi | 89 + rbi/workos/invitation_resent.rbi | 53 + rbi/workos/invitation_resent_data.rbi | 89 + rbi/workos/invitation_revoked.rbi | 53 + rbi/workos/invitation_revoked_data.rbi | 89 + rbi/workos/jwks_response.rbi | 23 + rbi/workos/jwks_response_keys.rbi | 65 + rbi/workos/jwt_template_response.rbi | 41 + rbi/workos/magic_auth.rbi | 65 + ...auth_code_session_authenticate_request.rbi | 71 + rbi/workos/magic_auth_created.rbi | 53 + rbi/workos/magic_auth_created_data.rbi | 59 + .../mfa_totp_session_authenticate_request.rbi | 71 + rbi/workos/multi_factor_auth.rbi | 82 + rbi/workos/new_connect_application_secret.rbi | 59 + rbi/workos/organization.rbi | 77 + rbi/workos/organization_created.rbi | 53 + rbi/workos/organization_created_data.rbi | 71 + .../organization_created_data_domain.rbi | 77 + rbi/workos/organization_deleted.rbi | 53 + rbi/workos/organization_deleted_data.rbi | 71 + .../organization_deleted_data_domain.rbi | 77 + rbi/workos/organization_domain.rbi | 77 + rbi/workos/organization_domain_created.rbi | 53 + .../organization_domain_created_data.rbi | 77 + rbi/workos/organization_domain_data.rbi | 29 + rbi/workos/organization_domain_deleted.rbi | 53 + .../organization_domain_deleted_data.rbi | 77 + .../organization_domain_stand_alone.rbi | 77 + rbi/workos/organization_domain_updated.rbi | 53 + .../organization_domain_updated_data.rbi | 77 + ...rganization_domain_verification_failed.rbi | 53 + ...zation_domain_verification_failed_data.rbi | 29 + ...cation_failed_data_organization_domain.rbi | 77 + rbi/workos/organization_domain_verified.rbi | 53 + .../organization_domain_verified_data.rbi | 77 + rbi/workos/organization_domains.rbi | 45 + rbi/workos/organization_input.rbi | 53 + rbi/workos/organization_membership.rbi | 83 + .../organization_membership_created.rbi | 53 + .../organization_membership_created_data.rbi | 83 + .../organization_membership_deleted.rbi | 53 + .../organization_membership_deleted_data.rbi | 83 + .../organization_membership_updated.rbi | 53 + .../organization_membership_updated_data.rbi | 83 + rbi/workos/organization_role_created.rbi | 53 + rbi/workos/organization_role_created_data.rbi | 71 + rbi/workos/organization_role_deleted.rbi | 53 + rbi/workos/organization_role_deleted_data.rbi | 71 + rbi/workos/organization_role_updated.rbi | 53 + rbi/workos/organization_role_updated_data.rbi | 71 + ...selection_session_authenticate_request.rbi | 65 + rbi/workos/organization_updated.rbi | 53 + rbi/workos/organization_updated_data.rbi | 71 + .../organization_updated_data_domain.rbi | 77 + rbi/workos/organizations.rbi | 85 + rbi/workos/password_reset.rbi | 65 + rbi/workos/password_reset_created.rbi | 53 + rbi/workos/password_reset_created_data.rbi | 53 + rbi/workos/password_reset_succeeded.rbi | 53 + rbi/workos/password_reset_succeeded_data.rbi | 53 + .../password_session_authenticate_request.rbi | 71 + rbi/workos/permission.rbi | 71 + rbi/workos/permission_created.rbi | 53 + rbi/workos/permission_created_data.rbi | 65 + rbi/workos/permission_deleted.rbi | 53 + rbi/workos/permission_deleted_data.rbi | 65 + rbi/workos/permission_updated.rbi | 53 + rbi/workos/permission_updated_data.rbi | 65 + rbi/workos/pipes.rbi | 62 + rbi/workos/portal_link_response.rbi | 23 + rbi/workos/profile.rbi | 101 + rbi/workos/radar.rbi | 56 + ...ar_list_entry_already_present_response.rbi | 23 + .../radar_standalone_assess_request.rbi | 59 + ...dalone_delete_radar_list_entry_request.rbi | 23 + rbi/workos/radar_standalone_response.rbi | 47 + ...tandalone_update_radar_attempt_request.rbi | 29 + ...r_standalone_update_radar_list_request.rbi | 23 + rbi/workos/redirect_uri.rbi | 53 + rbi/workos/redirect_uri_input.rbi | 29 + ...esh_token_session_authenticate_request.rbi | 65 + rbi/workos/remove_role.rbi | 41 + rbi/workos/resend_user_invite_options.rbi | 23 + rbi/workos/reset_password_response.rbi | 23 + rbi/workos/revoke_session.rbi | 29 + rbi/workos/role.rbi | 77 + rbi/workos/role_assignment.rbi | 53 + rbi/workos/role_assignment_resource.rbi | 35 + rbi/workos/role_created.rbi | 53 + rbi/workos/role_created_data.rbi | 53 + rbi/workos/role_deleted.rbi | 53 + rbi/workos/role_deleted_data.rbi | 53 + rbi/workos/role_list.rbi | 29 + rbi/workos/role_updated.rbi | 53 + rbi/workos/role_updated_data.rbi | 53 + rbi/workos/send_email_change.rbi | 23 + .../send_verification_email_response.rbi | 23 + rbi/workos/session_created.rbi | 53 + rbi/workos/session_created_data.rbi | 95 + .../session_created_data_impersonator.rbi | 29 + rbi/workos/session_revoked.rbi | 53 + rbi/workos/session_revoked_data.rbi | 95 + .../session_revoked_data_impersonator.rbi | 29 + rbi/workos/set_role_permissions.rbi | 23 + rbi/workos/slim_role.rbi | 23 + rbi/workos/sso.rbi | 66 + rbi/workos/sso_authorize_url_response.rbi | 23 + .../sso_device_authorization_request.rbi | 23 + rbi/workos/sso_intent_options.rbi | 29 + rbi/workos/sso_logout_authorize_request.rbi | 23 + rbi/workos/sso_logout_authorize_response.rbi | 29 + rbi/workos/sso_token_response.rbi | 47 + rbi/workos/sso_token_response_oauth_token.rbi | 47 + rbi/workos/token_query.rbi | 41 + rbi/workos/update_audit_logs_retention.rbi | 23 + .../update_authorization_permission.rbi | 29 + rbi/workos/update_authorization_resource.rbi | 47 + rbi/workos/update_jwt_template.rbi | 23 + rbi/workos/update_oauth_application.rbi | 41 + rbi/workos/update_organization.rbi | 59 + rbi/workos/update_organization_role.rbi | 29 + rbi/workos/update_role.rbi | 29 + rbi/workos/update_user.rbi | 77 + .../update_user_organization_membership.rbi | 29 + rbi/workos/update_webhook_endpoint.rbi | 35 + rbi/workos/user.rbi | 95 + ..._authentication_factor_enroll_response.rbi | 29 + rbi/workos/user_consent_option.rbi | 41 + rbi/workos/user_consent_option_choice.rbi | 29 + rbi/workos/user_created.rbi | 53 + rbi/workos/user_deleted.rbi | 53 + rbi/workos/user_identities_get_item.rbi | 35 + rbi/workos/user_invite.rbi | 101 + rbi/workos/user_management.rbi | 409 + rbi/workos/user_management_login_request.rbi | 35 + rbi/workos/user_object.rbi | 47 + rbi/workos/user_organization_membership.rbi | 83 + ...organization_membership_base_list_data.rbi | 77 + rbi/workos/user_sessions_impersonator.rbi | 29 + rbi/workos/user_sessions_list_item.rbi | 95 + rbi/workos/user_updated.rbi | 53 + rbi/workos/validate_api_key.rbi | 23 + .../vault_byok_key_verification_completed.rbi | 53 + ...t_byok_key_verification_completed_data.rbi | 35 + rbi/workos/vault_data_created.rbi | 53 + rbi/workos/vault_data_created_data.rbi | 53 + rbi/workos/vault_data_deleted.rbi | 53 + rbi/workos/vault_data_deleted_data.rbi | 41 + rbi/workos/vault_data_read.rbi | 53 + rbi/workos/vault_data_read_data.rbi | 47 + rbi/workos/vault_data_updated.rbi | 53 + rbi/workos/vault_data_updated_data.rbi | 53 + rbi/workos/vault_dek_decrypted.rbi | 53 + rbi/workos/vault_dek_decrypted_data.rbi | 41 + rbi/workos/vault_dek_read.rbi | 53 + rbi/workos/vault_dek_read_data.rbi | 47 + rbi/workos/vault_kek_created.rbi | 53 + rbi/workos/vault_kek_created_data.rbi | 47 + rbi/workos/vault_metadata_read.rbi | 53 + rbi/workos/vault_metadata_read_data.rbi | 41 + rbi/workos/vault_names_listed.rbi | 53 + rbi/workos/vault_names_listed_data.rbi | 35 + rbi/workos/verify_email_address.rbi | 23 + rbi/workos/verify_email_response.rbi | 23 + rbi/workos/webhook_endpoint.rbi | 65 + rbi/workos/webhooks.rbi | 51 + rbi/workos/widget_session_token.rbi | 35 + rbi/workos/widget_session_token_response.rbi | 23 + rbi/workos/widgets.rbi | 22 + script/ci | 16 + test/fixtures/profile.txt | 1 - .../vcr_cassettes/audit_logs/create_event.yml | 59 - .../create_event_custom_idempotency_key.yml | 60 - .../audit_logs/create_event_invalid.yml | 59 - .../audit_logs/create_export.yml | 76 - .../audit_logs/create_export_with_filters.yml | 77 - .../vcr_cassettes/audit_logs/get_export.yml | 73 - .../audit_trail/create_event.yml | 65 - .../create_event_custom_idempotency_key.yml | 67 - .../audit_trail/create_event_invalid.yml | 68 - ..._duplicate_idempotency_key_and_payload.yml | 131 - ...cate_idempotency_key_different_payload.yml | 134 - .../vcr_cassettes/audit_trail/get_events.yml | 61 - .../base/execute_request_unauthenticated.yml | 66 - .../directory_sync/delete_directory.yml | 72 - .../get_directory_with_invalid_id.yml | 83 - .../get_directory_with_valid_id.yml | 84 - .../directory_sync/get_group.yml | 80 - .../get_group_with_invalid_id.yml | 62 - .../vcr_cassettes/directory_sync/get_user.yml | 83 - .../get_user_with_invalid_id.yml | 62 - .../list_directories/with_after.yml | 87 - .../list_directories/with_before.yml | 89 - .../list_directories/with_domain.yml | 84 - .../list_directories/with_limit.yml | 85 - .../list_directories/with_no_options.yml | 93 - .../list_directories/with_search.yml | 85 - .../directory_sync/list_groups/with_after.yml | 90 - .../list_groups/with_before.yml | 90 - .../list_groups/with_directory.yml | 90 - .../directory_sync/list_groups/with_limit.yml | 84 - .../list_groups/with_no_options.yml | 84 - .../directory_sync/list_groups/with_user.yml | 82 - .../directory_sync/list_users/with_after.yml | 186 - .../directory_sync/list_users/with_before.yml | 88 - .../list_users/with_directory.yml | 194 - .../directory_sync/list_users/with_group.yml | 186 - .../directory_sync/list_users/with_limit.yml | 189 - .../list_users/with_no_options.yml | 75 - .../events/list_events_with_after.yml | 80 - .../events/list_events_with_event.yml | 80 - .../events/list_events_with_no_options.yml | 81 - .../list_events_with_organization_id.yml | 80 - .../events/list_events_with_range.yml | 80 - .../mfa/challenge_factor_generic_valid.yml | 82 - .../mfa/challenge_factor_sms_valid.yml | 82 - .../mfa/challenge_factor_totp_valid.yml | 82 - .../vcr_cassettes/mfa/delete_factor.yml | 80 - .../mfa/enroll_factor_generic_valid.yml | 82 - .../mfa/enroll_factor_sms_valid.yml | 82 - .../mfa/enroll_factor_totp_valid.yml | 82 - .../vcr_cassettes/mfa/get_factor_invalid.yml | 82 - .../vcr_cassettes/mfa/get_factor_valid.yml | 82 - .../mfa/verify_challenge_generic_expired.yml | 84 - .../mfa/verify_challenge_generic_invalid.yml | 84 - .../mfa/verify_challenge_generic_valid.yml | 82 - ...erify_challenge_generic_valid_is_false.yml | 82 - .../vcr_cassettes/organization/create.yml | 84 - .../organization/create_invalid.yml | 72 - .../organization/create_with_domain_data.yml | 82 - .../organization/create_with_domains.yml | 81 - ..._idempotency_key_and_different_payload.yml | 155 - ..._duplicate_idempotency_key_and_payload.yml | 154 - .../organization/create_with_external_id.yml | 83 - .../create_with_idempotency_key.yml | 79 - .../organization/create_without_domains.yml | 86 - .../vcr_cassettes/organization/delete.yml | 72 - .../organization/delete_invalid.yml | 72 - .../vcr_cassettes/organization/get.yml | 84 - .../organization/get_invalid.yml | 72 - .../vcr_cassettes/organization/list.yml | 87 - .../list_organization_feature_flags.yml | 78 - .../organization/list_organization_roles.yml | 82 - .../vcr_cassettes/organization/update.yml | 84 - .../organization/update_with_external_id.yml | 78 - .../update_with_external_id_null.yml | 78 - .../update_with_stripe_customer_id.yml | 78 - .../organization/update_without_name.yml | 85 - .../passwordless/create_session.yml | 72 - .../passwordless/create_session_invalid.yml | 73 - .../passwordless/send_session.yml | 72 - .../passwordless/send_session_invalid.yml | 73 - .../portal/generate_link_audit_logs.yml | 72 - .../generate_link_certificate_renewal.yml | 72 - .../generate_link_domain_verification.yml | 72 - .../portal/generate_link_dsync.yml | 72 - .../portal/generate_link_invalid.yml | 72 - .../portal/generate_link_sso.yml | 72 - .../sso/delete_connection_with_invalid_id.yml | 72 - .../sso/delete_connection_with_valid_id.yml | 70 - .../sso/get_connection_with_invalid_id.yml | 72 - .../sso/get_connection_with_valid_id.yml | 86 - .../sso/list_connections/with_after.yml | 83 - .../sso/list_connections/with_before.yml | 86 - .../list_connections/with_connection_type.yml | 90 - .../sso/list_connections/with_domain.yml | 86 - .../sso/list_connections/with_limit.yml | 83 - .../sso/list_connections/with_no_options.yml | 89 - .../list_connections/with_organization_id.yml | 86 - test/fixtures/vcr_cassettes/sso/profile.yml | 74 - .../authenticate_with_code/invalid.yml | 84 - .../authenticate_with_code/valid.yml | 82 - .../valid_with_impersonator.yml | 80 - .../valid_with_oauth_tokens.yml | 82 - .../invalid.yml | 83 - .../valid.yml | 81 - .../authenticate_with_magic_auth/invalid.yml | 82 - .../authenticate_with_magic_auth/valid.yml | 82 - .../invalid.yml | 81 - .../valid.yml | 82 - .../authenticate_with_password/invalid.yml | 82 - .../authenticate_with_password/unverified.yml | 82 - .../authenticate_with_password/valid.yml | 82 - .../invalid.yml | 81 - .../authenticate_with_refresh_token/valid.yml | 82 - .../authenticate_with_totp/invalid.yml | 83 - .../authenticate_with_totp/valid.yml | 81 - .../confirm_password_reset/invalid.yml | 82 - .../confirm_password_reset/valid.yml | 82 - .../create_magic_auth/valid.yml | 80 - .../invalid.yml | 83 - .../create_organization_membership/valid.yml | 82 - .../valid_multiple_roles.yml | 76 - .../create_password_reset/valid.yml | 80 - .../user_management/create_user_invalid.yml | 83 - .../user_management/create_user_valid.yml | 82 - .../create_user_with_external_id.yml | 77 - .../deactivate_organization_membership.yml | 64 - .../invalid.yml | 82 - .../delete_organization_membership/valid.yml | 78 - .../user_management/delete_user/invalid.yml | 82 - .../user_management/delete_user/valid.yml | 78 - .../enroll_auth_factor/invalid.yml | 82 - .../enroll_auth_factor/valid.yml | 82 - .../find_invitation_by_token/invalid.yml | 80 - .../find_invitation_by_token/valid.yml | 80 - .../get_email_verification/invalid.yml | 80 - .../get_email_verification/valid.yml | 80 - .../get_invitation/invalid.yml | 82 - .../user_management/get_invitation/valid.yml | 82 - .../get_magic_auth/invalid.yml | 80 - .../user_management/get_magic_auth/valid.yml | 80 - .../get_organization_membership.yml | 82 - .../get_password_reset/invalid.yml | 80 - .../get_password_reset/valid.yml | 80 - .../user_management/get_user.yml | 82 - .../list_auth_factors/invalid.yml | 82 - .../list_auth_factors/valid.yml | 82 - .../list_invitations/with_after.yml | 83 - .../list_invitations/with_before.yml | 83 - .../list_invitations/with_limit.yml | 83 - .../list_invitations/with_no_options.yml | 83 - .../list_invitations/with_organization_id.yml | 83 - .../no_options.yml | 82 - .../with_options.yml | 82 - .../with_statuses_option.yml | 64 - .../user_management/list_sessions/valid.yml | 38 - .../user_management/list_users/no_options.yml | 82 - .../list_users/with_options.yml | 82 - .../reactivate_organization_membership.yml | 64 - .../resend_invitation/accepted.yml | 83 - .../resend_invitation/expired.yml | 83 - .../resend_invitation/invalid.yml | 83 - .../resend_invitation/revoked.yml | 83 - .../resend_invitation/valid.yml | 83 - .../reset_password/invalid.yml | 82 - .../user_management/reset_password/valid.yml | 82 - .../revoke_invitation/invalid.yml | 82 - .../revoke_invitation/valid.yml | 82 - .../revoke_session/not_found.yml | 80 - .../user_management/revoke_session/valid.yml | 76 - .../send_invitation/invalid.yml | 82 - .../user_management/send_invitation/valid.yml | 82 - .../send_magic_auth_code/valid.yml | 82 - .../send_password_reset_email/invalid.yml | 83 - .../send_password_reset_email/valid.yml | 82 - .../send_verification_email/invalid.yml | 82 - .../send_verification_email/valid.yml | 82 - .../invalid.yml | 82 - .../update_organization_membership/valid.yml | 83 - .../valid_multiple_roles.yml | 76 - .../user_management/update_user/email.yml | 82 - .../user_management/update_user/invalid.yml | 82 - .../user_management/update_user/locale.yml | 76 - .../user_management/update_user/valid.yml | 82 - .../update_user_external_id_null.yml | 77 - .../update_user_password/invalid.yml | 82 - .../update_user_password/valid.yml | 82 - .../verify_email/invalid_code.yml | 83 - .../invalid_magic_auth_challenge.yml | 82 - .../user_management/verify_email/valid.yml | 82 - .../vcr_cassettes/widgets/get_token.yml | 82 - .../get_token_invalid_organization_id.yml | 74 - .../widgets/get_token_invalid_user_id.yml | 74 - test/fixtures/webhook_payload.txt | 1 - test/test_helper.rb | 37 +- test/workos/encryptors/test_aes_gcm.rb | 43 - test/workos/test_actions.rb | 78 + test/workos/test_admin_portal.rb | 28 + test/workos/test_api_keys.rb | 73 + test/workos/test_audit_logs.rb | 209 +- test/workos/test_authkit_helpers.rb | 109 + test/workos/test_authorization.rb | 568 ++ test/workos/test_base_client.rb | 173 + test/workos/test_cache.rb | 87 - test/workos/test_client.rb | 61 - test/workos/test_configuration.rb | 44 - test/workos/test_connect.rb | 178 + test/workos/test_directory_sync.rb | 295 +- test/workos/test_directory_user.rb | 45 - test/workos/test_encryptors_aes_gcm.rb | 54 + test/workos/test_event.rb | 57 - test/workos/test_events.rb | 28 + test/workos/test_feature_flags.rb | 133 + test/workos/test_list_struct.rb | 39 + test/workos/test_mfa.rb | 216 - test/workos/test_model_round_trip.rb | 6572 +++++++++++++++++ test/workos/test_multi_factor_auth.rb | 118 + test/workos/test_organization_domains.rb | 73 + test/workos/test_organizations.rb | 440 +- test/workos/test_passwordless.rb | 84 +- test/workos/test_pipes.rb | 88 + test/workos/test_pkce.rb | 40 + test/workos/test_portal.rb | 87 - test/workos/test_public_client.rb | 38 + test/workos/test_radar.rb | 73 + test/workos/test_role.rb | 128 - test/workos/test_session.rb | 567 +- test/workos/test_sso.rb | 686 +- test/workos/test_sso_helpers.rb | 80 + test/workos/test_sso_runtime.rb | 45 + test/workos/test_user_management.rb | 2062 ++---- test/workos/test_vault.rb | 151 + test/workos/test_webhook_verify.rb | 84 + test/workos/test_webhooks.rb | 422 +- test/workos/test_widgets.rb | 64 +- workos.gemspec | 12 +- 1290 files changed, 55103 insertions(+), 24920 deletions(-) create mode 100644 .oagen-manifest.json delete mode 100644 .rspec create mode 100644 docs/V7_MIGRATION_GUIDE.md create mode 100644 lib/workos/actions.rb create mode 100644 lib/workos/admin_portal.rb create mode 100644 lib/workos/admin_portal/generate_link.rb create mode 100644 lib/workos/admin_portal/intent_options.rb create mode 100644 lib/workos/admin_portal/portal_link_response.rb create mode 100644 lib/workos/admin_portal/sso_intent_options.rb create mode 100644 lib/workos/api_keys.rb create mode 100644 lib/workos/api_keys/api_key.rb create mode 100644 lib/workos/api_keys/api_key_created.rb create mode 100644 lib/workos/api_keys/api_key_created_data.rb create mode 100644 lib/workos/api_keys/api_key_created_data_owner.rb create mode 100644 lib/workos/api_keys/api_key_owner.rb create mode 100644 lib/workos/api_keys/api_key_revoked.rb create mode 100644 lib/workos/api_keys/api_key_revoked_data.rb create mode 100644 lib/workos/api_keys/api_key_revoked_data_owner.rb create mode 100644 lib/workos/api_keys/api_key_validation_response.rb create mode 100644 lib/workos/api_keys/api_key_with_value.rb create mode 100644 lib/workos/api_keys/api_key_with_value_owner.rb create mode 100644 lib/workos/api_keys/create_organization_api_key.rb create mode 100644 lib/workos/api_keys/validate_api_key.rb delete mode 100644 lib/workos/audit_log_export.rb create mode 100644 lib/workos/audit_logs/audit_log_action.rb create mode 100644 lib/workos/audit_logs/audit_log_event.rb create mode 100644 lib/workos/audit_logs/audit_log_event_actor.rb create mode 100644 lib/workos/audit_logs/audit_log_event_context.rb create mode 100644 lib/workos/audit_logs/audit_log_event_create_response.rb create mode 100644 lib/workos/audit_logs/audit_log_event_ingestion.rb create mode 100644 lib/workos/audit_logs/audit_log_event_target.rb create mode 100644 lib/workos/audit_logs/audit_log_export.rb create mode 100644 lib/workos/audit_logs/audit_log_export_creation.rb create mode 100644 lib/workos/audit_logs/audit_log_schema.rb create mode 100644 lib/workos/audit_logs/audit_log_schema_actor.rb create mode 100644 lib/workos/audit_logs/audit_log_schema_target.rb delete mode 100644 lib/workos/authentication_factor_and_challenge.rb delete mode 100644 lib/workos/authentication_response.rb create mode 100644 lib/workos/authorization.rb create mode 100644 lib/workos/authorization/add_role_permission.rb create mode 100644 lib/workos/authorization/assign_role.rb create mode 100644 lib/workos/authorization/authorization_check.rb create mode 100644 lib/workos/authorization/authorization_permission.rb create mode 100644 lib/workos/authorization/authorization_resource.rb create mode 100644 lib/workos/authorization/check_authorization.rb create mode 100644 lib/workos/authorization/create_authorization_permission.rb create mode 100644 lib/workos/authorization/create_authorization_resource.rb create mode 100644 lib/workos/authorization/create_organization_role.rb create mode 100644 lib/workos/authorization/create_role.rb create mode 100644 lib/workos/authorization/permission.rb create mode 100644 lib/workos/authorization/permission_created.rb create mode 100644 lib/workos/authorization/permission_created_data.rb create mode 100644 lib/workos/authorization/permission_deleted.rb create mode 100644 lib/workos/authorization/permission_deleted_data.rb create mode 100644 lib/workos/authorization/permission_updated.rb create mode 100644 lib/workos/authorization/permission_updated_data.rb create mode 100644 lib/workos/authorization/remove_role.rb create mode 100644 lib/workos/authorization/role.rb create mode 100644 lib/workos/authorization/role_assignment.rb create mode 100644 lib/workos/authorization/role_assignment_resource.rb create mode 100644 lib/workos/authorization/role_created.rb create mode 100644 lib/workos/authorization/role_created_data.rb create mode 100644 lib/workos/authorization/role_deleted.rb create mode 100644 lib/workos/authorization/role_deleted_data.rb create mode 100644 lib/workos/authorization/role_list.rb create mode 100644 lib/workos/authorization/role_updated.rb create mode 100644 lib/workos/authorization/role_updated_data.rb create mode 100644 lib/workos/authorization/set_role_permissions.rb create mode 100644 lib/workos/authorization/slim_role.rb create mode 100644 lib/workos/authorization/update_authorization_permission.rb create mode 100644 lib/workos/authorization/update_authorization_resource.rb create mode 100644 lib/workos/authorization/update_organization_role.rb create mode 100644 lib/workos/authorization/update_role.rb create mode 100644 lib/workos/authorization/user_organization_membership_base_list_data.rb create mode 100644 lib/workos/base_client.rb delete mode 100644 lib/workos/cache.rb delete mode 100644 lib/workos/challenge.rb create mode 100644 lib/workos/connect.rb create mode 100644 lib/workos/connect/application_credentials_list_item.rb create mode 100644 lib/workos/connect/connect_application.rb create mode 100644 lib/workos/connect/create_application_secret.rb create mode 100644 lib/workos/connect/create_m2m_application.rb create mode 100644 lib/workos/connect/create_oauth_application.rb create mode 100644 lib/workos/connect/external_auth_complete_response.rb create mode 100644 lib/workos/connect/new_connect_application_secret.rb create mode 100644 lib/workos/connect/redirect_uri_input.rb create mode 100644 lib/workos/connect/update_oauth_application.rb create mode 100644 lib/workos/connect/user_consent_option.rb create mode 100644 lib/workos/connect/user_consent_option_choice.rb create mode 100644 lib/workos/connect/user_management_login_request.rb create mode 100644 lib/workos/connect/user_object.rb delete mode 100644 lib/workos/connection.rb delete mode 100644 lib/workos/deprecated_hash_wrapper.rb delete mode 100644 lib/workos/deprecation.rb delete mode 100644 lib/workos/directory.rb delete mode 100644 lib/workos/directory_group.rb create mode 100644 lib/workos/directory_sync/directory.rb create mode 100644 lib/workos/directory_sync/directory_group.rb create mode 100644 lib/workos/directory_sync/directory_metadata.rb create mode 100644 lib/workos/directory_sync/directory_metadata_user.rb create mode 100644 lib/workos/directory_sync/directory_user.rb create mode 100644 lib/workos/directory_sync/directory_user_email.rb create mode 100644 lib/workos/directory_sync/directory_user_with_groups.rb create mode 100644 lib/workos/directory_sync/directory_user_with_groups_email.rb create mode 100644 lib/workos/directory_sync/dsync_activated.rb create mode 100644 lib/workos/directory_sync/dsync_activated_data.rb create mode 100644 lib/workos/directory_sync/dsync_activated_data_domain.rb create mode 100644 lib/workos/directory_sync/dsync_deactivated.rb create mode 100644 lib/workos/directory_sync/dsync_deactivated_data.rb create mode 100644 lib/workos/directory_sync/dsync_deactivated_data_domain.rb create mode 100644 lib/workos/directory_sync/dsync_deleted.rb create mode 100644 lib/workos/directory_sync/dsync_deleted_data.rb create mode 100644 lib/workos/directory_sync/dsync_group_created.rb create mode 100644 lib/workos/directory_sync/dsync_group_deleted.rb create mode 100644 lib/workos/directory_sync/dsync_group_updated.rb create mode 100644 lib/workos/directory_sync/dsync_group_updated_data.rb create mode 100644 lib/workos/directory_sync/dsync_group_user_added.rb create mode 100644 lib/workos/directory_sync/dsync_group_user_added_data.rb create mode 100644 lib/workos/directory_sync/dsync_group_user_removed.rb create mode 100644 lib/workos/directory_sync/dsync_group_user_removed_data.rb create mode 100644 lib/workos/directory_sync/dsync_user_created.rb create mode 100644 lib/workos/directory_sync/dsync_user_deleted.rb create mode 100644 lib/workos/directory_sync/dsync_user_updated.rb create mode 100644 lib/workos/directory_sync/dsync_user_updated_data.rb create mode 100644 lib/workos/directory_sync/dsync_user_updated_data_email.rb delete mode 100644 lib/workos/directory_user.rb delete mode 100644 lib/workos/email_verification.rb delete mode 100644 lib/workos/event.rb create mode 100644 lib/workos/events/event_list_list_metadata.rb create mode 100644 lib/workos/events/event_schema.rb delete mode 100644 lib/workos/factor.rb delete mode 100644 lib/workos/feature_flag.rb create mode 100644 lib/workos/feature_flags.rb create mode 100644 lib/workos/feature_flags/feature_flag.rb create mode 100644 lib/workos/feature_flags/feature_flag_owner.rb create mode 100644 lib/workos/feature_flags/flag.rb create mode 100644 lib/workos/feature_flags/flag_created.rb create mode 100644 lib/workos/feature_flags/flag_created_context.rb create mode 100644 lib/workos/feature_flags/flag_created_context_actor.rb create mode 100644 lib/workos/feature_flags/flag_created_data.rb create mode 100644 lib/workos/feature_flags/flag_created_data_owner.rb create mode 100644 lib/workos/feature_flags/flag_deleted.rb create mode 100644 lib/workos/feature_flags/flag_deleted_context.rb create mode 100644 lib/workos/feature_flags/flag_deleted_context_actor.rb create mode 100644 lib/workos/feature_flags/flag_deleted_data.rb create mode 100644 lib/workos/feature_flags/flag_deleted_data_owner.rb create mode 100644 lib/workos/feature_flags/flag_owner.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_context.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_context_actor.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_context_configured_target.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_context_configured_target_user.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_context_previous_attribute.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_user.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_data.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_data.rb create mode 100644 lib/workos/feature_flags/flag_rule_updated_data_owner.rb create mode 100644 lib/workos/feature_flags/flag_updated.rb create mode 100644 lib/workos/feature_flags/flag_updated_context.rb create mode 100644 lib/workos/feature_flags/flag_updated_context_actor.rb create mode 100644 lib/workos/feature_flags/flag_updated_context_previous_attribute.rb create mode 100644 lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb create mode 100644 lib/workos/feature_flags/flag_updated_data.rb create mode 100644 lib/workos/feature_flags/flag_updated_data_owner.rb delete mode 100644 lib/workos/impersonator.rb delete mode 100644 lib/workos/invitation.rb delete mode 100644 lib/workos/magic_auth.rb delete mode 100644 lib/workos/mfa.rb create mode 100644 lib/workos/multi_factor_auth.rb create mode 100644 lib/workos/multi_factor_auth/authentication_challenge.rb create mode 100644 lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb create mode 100644 lib/workos/multi_factor_auth/authentication_challenges_verify_request.rb create mode 100644 lib/workos/multi_factor_auth/authentication_factor.rb create mode 100644 lib/workos/multi_factor_auth/authentication_factor_enrolled.rb create mode 100644 lib/workos/multi_factor_auth/authentication_factor_enrolled_sms.rb create mode 100644 lib/workos/multi_factor_auth/authentication_factor_enrolled_totp.rb create mode 100644 lib/workos/multi_factor_auth/authentication_factor_sms.rb create mode 100644 lib/workos/multi_factor_auth/authentication_factor_totp.rb create mode 100644 lib/workos/multi_factor_auth/authentication_factors_create_request.rb create mode 100644 lib/workos/multi_factor_auth/challenge_authentication_factor.rb create mode 100644 lib/workos/multi_factor_auth/enroll_user_authentication_factor.rb create mode 100644 lib/workos/multi_factor_auth/user_authentication_factor_enroll_response.rb delete mode 100644 lib/workos/oauth_tokens.rb delete mode 100644 lib/workos/organization.rb create mode 100644 lib/workos/organization_domains.rb create mode 100644 lib/workos/organization_domains/create_organization_domain.rb create mode 100644 lib/workos/organization_domains/organization_domain.rb create mode 100644 lib/workos/organization_domains/organization_domain_created.rb create mode 100644 lib/workos/organization_domains/organization_domain_created_data.rb create mode 100644 lib/workos/organization_domains/organization_domain_deleted.rb create mode 100644 lib/workos/organization_domains/organization_domain_deleted_data.rb create mode 100644 lib/workos/organization_domains/organization_domain_stand_alone.rb create mode 100644 lib/workos/organization_domains/organization_domain_updated.rb create mode 100644 lib/workos/organization_domains/organization_domain_updated_data.rb create mode 100644 lib/workos/organization_domains/organization_domain_verification_failed.rb create mode 100644 lib/workos/organization_domains/organization_domain_verification_failed_data.rb create mode 100644 lib/workos/organization_domains/organization_domain_verification_failed_data_organization_domain.rb create mode 100644 lib/workos/organization_domains/organization_domain_verified.rb create mode 100644 lib/workos/organization_domains/organization_domain_verified_data.rb delete mode 100644 lib/workos/organization_membership.rb create mode 100644 lib/workos/organizations/audit_log_configuration.rb create mode 100644 lib/workos/organizations/audit_log_configuration_log_stream.rb create mode 100644 lib/workos/organizations/audit_logs_retention.rb create mode 100644 lib/workos/organizations/organization.rb create mode 100644 lib/workos/organizations/organization_created.rb create mode 100644 lib/workos/organizations/organization_created_data.rb create mode 100644 lib/workos/organizations/organization_created_data_domain.rb create mode 100644 lib/workos/organizations/organization_deleted.rb create mode 100644 lib/workos/organizations/organization_deleted_data.rb create mode 100644 lib/workos/organizations/organization_deleted_data_domain.rb create mode 100644 lib/workos/organizations/organization_domain_data.rb create mode 100644 lib/workos/organizations/organization_input.rb create mode 100644 lib/workos/organizations/organization_membership_created.rb create mode 100644 lib/workos/organizations/organization_membership_created_data.rb create mode 100644 lib/workos/organizations/organization_membership_deleted.rb create mode 100644 lib/workos/organizations/organization_membership_deleted_data.rb create mode 100644 lib/workos/organizations/organization_membership_updated.rb create mode 100644 lib/workos/organizations/organization_membership_updated_data.rb create mode 100644 lib/workos/organizations/organization_role_created.rb create mode 100644 lib/workos/organizations/organization_role_created_data.rb create mode 100644 lib/workos/organizations/organization_role_deleted.rb create mode 100644 lib/workos/organizations/organization_role_deleted_data.rb create mode 100644 lib/workos/organizations/organization_role_updated.rb create mode 100644 lib/workos/organizations/organization_role_updated_data.rb create mode 100644 lib/workos/organizations/organization_updated.rb create mode 100644 lib/workos/organizations/organization_updated_data.rb create mode 100644 lib/workos/organizations/organization_updated_data_domain.rb create mode 100644 lib/workos/organizations/update_audit_logs_retention.rb create mode 100644 lib/workos/organizations/update_organization.rb delete mode 100644 lib/workos/password_reset.rb create mode 100644 lib/workos/pipes.rb create mode 100644 lib/workos/pipes/connected_account.rb create mode 100644 lib/workos/pipes/data_integration_access_token_response.rb create mode 100644 lib/workos/pipes/data_integration_access_token_response_access_token.rb create mode 100644 lib/workos/pipes/data_integration_authorize_url_response.rb create mode 100644 lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb create mode 100644 lib/workos/pipes/data_integrations_get_user_token_request.rb create mode 100644 lib/workos/pipes/data_integrations_list_response.rb create mode 100644 lib/workos/pipes/data_integrations_list_response_data.rb create mode 100644 lib/workos/pipes/data_integrations_list_response_data_connected_account.rb create mode 100644 lib/workos/pkce.rb delete mode 100644 lib/workos/portal.rb delete mode 100644 lib/workos/profile.rb delete mode 100644 lib/workos/profile_and_token.rb create mode 100644 lib/workos/public_client.rb create mode 100644 lib/workos/radar.rb create mode 100644 lib/workos/radar/radar_list_entry_already_present_response.rb create mode 100644 lib/workos/radar/radar_standalone_assess_request.rb create mode 100644 lib/workos/radar/radar_standalone_delete_radar_list_entry_request.rb create mode 100644 lib/workos/radar/radar_standalone_response.rb create mode 100644 lib/workos/radar/radar_standalone_update_radar_attempt_request.rb create mode 100644 lib/workos/radar/radar_standalone_update_radar_list_request.rb delete mode 100644 lib/workos/refresh_authentication_response.rb delete mode 100644 lib/workos/role.rb create mode 100644 lib/workos/session_manager.rb create mode 100644 lib/workos/shared/event_context.rb create mode 100644 lib/workos/shared/event_context_actor.rb create mode 100644 lib/workos/shared/event_context_google_analytics_session.rb create mode 100644 lib/workos/shared/group.rb create mode 100644 lib/workos/shared/group_created.rb create mode 100644 lib/workos/shared/group_deleted.rb create mode 100644 lib/workos/shared/group_member_added.rb create mode 100644 lib/workos/shared/group_member_added_data.rb create mode 100644 lib/workos/shared/group_member_removed.rb create mode 100644 lib/workos/shared/group_member_removed_data.rb create mode 100644 lib/workos/shared/group_updated.rb create mode 100644 lib/workos/sso/connection.rb create mode 100644 lib/workos/sso/connection_activated.rb create mode 100644 lib/workos/sso/connection_activated_data.rb create mode 100644 lib/workos/sso/connection_activated_data_domain.rb create mode 100644 lib/workos/sso/connection_deactivated.rb create mode 100644 lib/workos/sso/connection_deactivated_data.rb create mode 100644 lib/workos/sso/connection_deactivated_data_domain.rb create mode 100644 lib/workos/sso/connection_deleted.rb create mode 100644 lib/workos/sso/connection_deleted_data.rb create mode 100644 lib/workos/sso/connection_domain.rb create mode 100644 lib/workos/sso/connection_option.rb create mode 100644 lib/workos/sso/connection_saml_certificate_renewal_required.rb create mode 100644 lib/workos/sso/connection_saml_certificate_renewal_required_data.rb create mode 100644 lib/workos/sso/connection_saml_certificate_renewal_required_data_certificate.rb create mode 100644 lib/workos/sso/connection_saml_certificate_renewal_required_data_connection.rb create mode 100644 lib/workos/sso/connection_saml_certificate_renewed.rb create mode 100644 lib/workos/sso/connection_saml_certificate_renewed_data.rb create mode 100644 lib/workos/sso/connection_saml_certificate_renewed_data_certificate.rb create mode 100644 lib/workos/sso/connection_saml_certificate_renewed_data_connection.rb create mode 100644 lib/workos/sso/profile.rb create mode 100644 lib/workos/sso/sso_authorize_url_response.rb create mode 100644 lib/workos/sso/sso_logout_authorize_request.rb create mode 100644 lib/workos/sso/sso_logout_authorize_response.rb create mode 100644 lib/workos/sso/sso_token_response.rb create mode 100644 lib/workos/sso/sso_token_response_oauth_token.rb create mode 100644 lib/workos/sso/token_query.rb delete mode 100644 lib/workos/types.rb create mode 100644 lib/workos/types/applications_order.rb create mode 100644 lib/workos/types/audit_log_configuration_log_stream_state.rb create mode 100644 lib/workos/types/audit_log_configuration_log_stream_type.rb create mode 100644 lib/workos/types/audit_log_configuration_state.rb create mode 100644 lib/workos/types/audit_log_export_state.rb create mode 100644 lib/workos/types/audit_logs_order.rb create mode 100644 lib/workos/types/authenticate_response_authentication_method.rb create mode 100644 lib/workos/types/authentication_factor_enrolled_type.rb create mode 100644 lib/workos/types/authentication_factor_type.rb create mode 100644 lib/workos/types/authentication_factors_create_request_type.rb create mode 100644 lib/workos/types/authentication_radar_risk_detected_data_action.rb create mode 100644 lib/workos/types/authorization_assignment.rb create mode 100644 lib/workos/types/authorization_order.rb create mode 100644 lib/workos/types/connected_account_state.rb create mode 100644 lib/workos/types/connection_activated_data_connection_type.rb create mode 100644 lib/workos/types/connection_activated_data_state.rb create mode 100644 lib/workos/types/connection_activated_data_status.rb create mode 100644 lib/workos/types/connection_deactivated_data_connection_type.rb create mode 100644 lib/workos/types/connection_deactivated_data_state.rb create mode 100644 lib/workos/types/connection_deactivated_data_status.rb create mode 100644 lib/workos/types/connection_deleted_data_connection_type.rb create mode 100644 lib/workos/types/connection_deleted_data_state.rb create mode 100644 lib/workos/types/connection_saml_certificate_renewal_required_data_certificate_certificate_type.rb create mode 100644 lib/workos/types/connection_saml_certificate_renewed_data_certificate_certificate_type.rb create mode 100644 lib/workos/types/connection_state.rb create mode 100644 lib/workos/types/connection_status.rb create mode 100644 lib/workos/types/connection_type.rb create mode 100644 lib/workos/types/connections_connection_type.rb create mode 100644 lib/workos/types/connections_order.rb create mode 100644 lib/workos/types/create_user_invite_options_locale.rb create mode 100644 lib/workos/types/create_user_password_hash_type.rb create mode 100644 lib/workos/types/create_webhook_endpoint_events.rb create mode 100644 lib/workos/types/data_integration_access_token_response_error.rb create mode 100644 lib/workos/types/data_integrations_list_response_data_connected_account_state.rb create mode 100644 lib/workos/types/data_integrations_list_response_data_ownership.rb create mode 100644 lib/workos/types/directories_order.rb create mode 100644 lib/workos/types/directory_groups_order.rb create mode 100644 lib/workos/types/directory_state.rb create mode 100644 lib/workos/types/directory_type.rb create mode 100644 lib/workos/types/directory_user_state.rb create mode 100644 lib/workos/types/directory_user_with_groups_state.rb create mode 100644 lib/workos/types/directory_users_order.rb create mode 100644 lib/workos/types/dsync_activated_data_state.rb create mode 100644 lib/workos/types/dsync_activated_data_type.rb create mode 100644 lib/workos/types/dsync_deactivated_data_state.rb create mode 100644 lib/workos/types/dsync_deactivated_data_type.rb create mode 100644 lib/workos/types/dsync_deleted_data_state.rb create mode 100644 lib/workos/types/dsync_deleted_data_type.rb create mode 100644 lib/workos/types/dsync_user_updated_data_state.rb create mode 100644 lib/workos/types/event_context_actor_source.rb create mode 100644 lib/workos/types/events_order.rb create mode 100644 lib/workos/types/feature_flags_order.rb create mode 100644 lib/workos/types/flag_created_context_actor_source.rb create mode 100644 lib/workos/types/flag_deleted_context_actor_source.rb create mode 100644 lib/workos/types/flag_rule_updated_context_access_type.rb create mode 100644 lib/workos/types/flag_rule_updated_context_actor_source.rb create mode 100644 lib/workos/types/flag_rule_updated_context_previous_attribute_context_access_type.rb create mode 100644 lib/workos/types/flag_updated_context_actor_source.rb rename lib/workos/types/{intent.rb => generate_link_intent.rb} (53%) create mode 100644 lib/workos/types/invitation_accepted_data_state.rb create mode 100644 lib/workos/types/invitation_created_data_state.rb create mode 100644 lib/workos/types/invitation_resent_data_state.rb create mode 100644 lib/workos/types/invitation_revoked_data_state.rb create mode 100644 lib/workos/types/invitation_state.rb create mode 100644 lib/workos/types/organization_created_data_domain_state.rb create mode 100644 lib/workos/types/organization_created_data_domain_verification_strategy.rb create mode 100644 lib/workos/types/organization_deleted_data_domain_state.rb create mode 100644 lib/workos/types/organization_deleted_data_domain_verification_strategy.rb create mode 100644 lib/workos/types/organization_domain_created_data_state.rb create mode 100644 lib/workos/types/organization_domain_created_data_verification_strategy.rb create mode 100644 lib/workos/types/organization_domain_data_state.rb create mode 100644 lib/workos/types/organization_domain_deleted_data_state.rb create mode 100644 lib/workos/types/organization_domain_deleted_data_verification_strategy.rb create mode 100644 lib/workos/types/organization_domain_stand_alone_state.rb create mode 100644 lib/workos/types/organization_domain_stand_alone_verification_strategy.rb create mode 100644 lib/workos/types/organization_domain_state.rb create mode 100644 lib/workos/types/organization_domain_updated_data_state.rb create mode 100644 lib/workos/types/organization_domain_updated_data_verification_strategy.rb create mode 100644 lib/workos/types/organization_domain_verification_failed_data_organization_domain_state.rb create mode 100644 lib/workos/types/organization_domain_verification_failed_data_organization_domain_verification_strategy.rb create mode 100644 lib/workos/types/organization_domain_verification_failed_data_reason.rb create mode 100644 lib/workos/types/organization_domain_verification_strategy.rb create mode 100644 lib/workos/types/organization_domain_verified_data_state.rb create mode 100644 lib/workos/types/organization_domain_verified_data_verification_strategy.rb create mode 100644 lib/workos/types/organization_membership_created_data_status.rb create mode 100644 lib/workos/types/organization_membership_deleted_data_status.rb create mode 100644 lib/workos/types/organization_membership_status.rb create mode 100644 lib/workos/types/organization_membership_updated_data_status.rb create mode 100644 lib/workos/types/organization_updated_data_domain_state.rb create mode 100644 lib/workos/types/organization_updated_data_domain_verification_strategy.rb create mode 100644 lib/workos/types/organizations_api_keys_order.rb create mode 100644 lib/workos/types/organizations_feature_flags_order.rb create mode 100644 lib/workos/types/organizations_order.rb delete mode 100644 lib/workos/types/passwordless_session_struct.rb create mode 100644 lib/workos/types/permissions_order.rb create mode 100644 lib/workos/types/profile_connection_type.rb delete mode 100644 lib/workos/types/provider.rb create mode 100644 lib/workos/types/radar_action.rb create mode 100644 lib/workos/types/radar_standalone_assess_request_action.rb create mode 100644 lib/workos/types/radar_standalone_assess_request_auth_method.rb create mode 100644 lib/workos/types/radar_standalone_response_blocklist_type.rb create mode 100644 lib/workos/types/radar_standalone_response_control.rb create mode 100644 lib/workos/types/radar_standalone_response_verdict.rb create mode 100644 lib/workos/types/radar_type.rb create mode 100644 lib/workos/types/resend_user_invite_options_locale.rb create mode 100644 lib/workos/types/role_type.rb create mode 100644 lib/workos/types/session_created_data_auth_method.rb create mode 100644 lib/workos/types/session_created_data_status.rb create mode 100644 lib/workos/types/session_revoked_data_auth_method.rb create mode 100644 lib/workos/types/session_revoked_data_status.rb create mode 100644 lib/workos/types/sso_provider.rb create mode 100644 lib/workos/types/update_user_password_hash_type.rb create mode 100644 lib/workos/types/update_webhook_endpoint_events.rb create mode 100644 lib/workos/types/update_webhook_endpoint_status.rb create mode 100644 lib/workos/types/user_identities_get_item_provider.rb create mode 100644 lib/workos/types/user_invite_state.rb create mode 100644 lib/workos/types/user_management_authentication_provider.rb create mode 100644 lib/workos/types/user_management_authentication_screen_hint.rb create mode 100644 lib/workos/types/user_management_invitations_order.rb create mode 100644 lib/workos/types/user_management_multi_factor_authentication_order.rb create mode 100644 lib/workos/types/user_management_organization_membership_order.rb create mode 100644 lib/workos/types/user_management_organization_membership_statuses.rb create mode 100644 lib/workos/types/user_management_users_authorized_applications_order.rb create mode 100644 lib/workos/types/user_management_users_feature_flags_order.rb create mode 100644 lib/workos/types/user_management_users_order.rb create mode 100644 lib/workos/types/user_organization_membership_base_list_data_status.rb create mode 100644 lib/workos/types/user_organization_membership_status.rb create mode 100644 lib/workos/types/user_sessions_auth_method.rb create mode 100644 lib/workos/types/user_sessions_status.rb create mode 100644 lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb create mode 100644 lib/workos/types/vault_data_created_data_actor_source.rb create mode 100644 lib/workos/types/vault_data_deleted_data_actor_source.rb create mode 100644 lib/workos/types/vault_data_read_data_actor_source.rb create mode 100644 lib/workos/types/vault_data_updated_data_actor_source.rb create mode 100644 lib/workos/types/vault_dek_decrypted_data_actor_source.rb create mode 100644 lib/workos/types/vault_dek_read_data_actor_source.rb create mode 100644 lib/workos/types/vault_kek_created_data_actor_source.rb create mode 100644 lib/workos/types/vault_metadata_read_data_actor_source.rb create mode 100644 lib/workos/types/vault_names_listed_data_actor_source.rb create mode 100644 lib/workos/types/webhook_endpoint_status.rb create mode 100644 lib/workos/types/webhooks_order.rb delete mode 100644 lib/workos/types/widget_scope.rb create mode 100644 lib/workos/types/widget_session_token_scopes.rb delete mode 100644 lib/workos/user.rb delete mode 100644 lib/workos/user_and_token.rb create mode 100644 lib/workos/user_management/action_authentication_denied.rb create mode 100644 lib/workos/user_management/action_authentication_denied_data.rb create mode 100644 lib/workos/user_management/action_user_registration_denied.rb create mode 100644 lib/workos/user_management/action_user_registration_denied_data.rb create mode 100644 lib/workos/user_management/authenticate_response.rb create mode 100644 lib/workos/user_management/authenticate_response_impersonator.rb create mode 100644 lib/workos/user_management/authenticate_response_oauth_token.rb create mode 100644 lib/workos/user_management/authentication_email_verification_failed.rb create mode 100644 lib/workos/user_management/authentication_email_verification_failed_data.rb create mode 100644 lib/workos/user_management/authentication_email_verification_failed_data_error.rb create mode 100644 lib/workos/user_management/authentication_email_verification_succeeded.rb create mode 100644 lib/workos/user_management/authentication_email_verification_succeeded_data.rb create mode 100644 lib/workos/user_management/authentication_magic_auth_failed.rb create mode 100644 lib/workos/user_management/authentication_magic_auth_failed_data.rb create mode 100644 lib/workos/user_management/authentication_magic_auth_failed_data_error.rb create mode 100644 lib/workos/user_management/authentication_magic_auth_succeeded.rb create mode 100644 lib/workos/user_management/authentication_magic_auth_succeeded_data.rb create mode 100644 lib/workos/user_management/authentication_mfa_failed.rb create mode 100644 lib/workos/user_management/authentication_mfa_failed_data.rb create mode 100644 lib/workos/user_management/authentication_mfa_failed_data_error.rb create mode 100644 lib/workos/user_management/authentication_mfa_succeeded.rb create mode 100644 lib/workos/user_management/authentication_mfa_succeeded_data.rb create mode 100644 lib/workos/user_management/authentication_oauth_failed.rb create mode 100644 lib/workos/user_management/authentication_oauth_failed_data.rb create mode 100644 lib/workos/user_management/authentication_oauth_failed_data_error.rb create mode 100644 lib/workos/user_management/authentication_oauth_succeeded.rb create mode 100644 lib/workos/user_management/authentication_oauth_succeeded_data.rb create mode 100644 lib/workos/user_management/authentication_passkey_failed.rb create mode 100644 lib/workos/user_management/authentication_passkey_failed_data.rb create mode 100644 lib/workos/user_management/authentication_passkey_failed_data_error.rb create mode 100644 lib/workos/user_management/authentication_passkey_succeeded.rb create mode 100644 lib/workos/user_management/authentication_passkey_succeeded_data.rb create mode 100644 lib/workos/user_management/authentication_password_failed.rb create mode 100644 lib/workos/user_management/authentication_password_failed_data.rb create mode 100644 lib/workos/user_management/authentication_password_failed_data_error.rb create mode 100644 lib/workos/user_management/authentication_password_succeeded.rb create mode 100644 lib/workos/user_management/authentication_password_succeeded_data.rb create mode 100644 lib/workos/user_management/authentication_radar_risk_detected.rb create mode 100644 lib/workos/user_management/authentication_radar_risk_detected_data.rb create mode 100644 lib/workos/user_management/authentication_sso_failed.rb create mode 100644 lib/workos/user_management/authentication_sso_failed_data.rb create mode 100644 lib/workos/user_management/authentication_sso_failed_data_error.rb create mode 100644 lib/workos/user_management/authentication_sso_failed_data_sso.rb create mode 100644 lib/workos/user_management/authentication_sso_started.rb create mode 100644 lib/workos/user_management/authentication_sso_started_data.rb create mode 100644 lib/workos/user_management/authentication_sso_started_data_sso.rb create mode 100644 lib/workos/user_management/authentication_sso_succeeded.rb create mode 100644 lib/workos/user_management/authentication_sso_succeeded_data.rb create mode 100644 lib/workos/user_management/authentication_sso_succeeded_data_sso.rb create mode 100644 lib/workos/user_management/authentication_sso_timed_out.rb create mode 100644 lib/workos/user_management/authentication_sso_timed_out_data.rb create mode 100644 lib/workos/user_management/authentication_sso_timed_out_data_error.rb create mode 100644 lib/workos/user_management/authentication_sso_timed_out_data_sso.rb create mode 100644 lib/workos/user_management/authorization_code_session_authenticate_request.rb create mode 100644 lib/workos/user_management/authorized_connect_application_list_data.rb create mode 100644 lib/workos/user_management/confirm_email_change.rb create mode 100644 lib/workos/user_management/cors_origin_response.rb create mode 100644 lib/workos/user_management/create_cors_origin.rb create mode 100644 lib/workos/user_management/create_magic_code_and_return.rb create mode 100644 lib/workos/user_management/create_password_reset.rb create mode 100644 lib/workos/user_management/create_password_reset_token.rb create mode 100644 lib/workos/user_management/create_redirect_uri.rb create mode 100644 lib/workos/user_management/create_user.rb create mode 100644 lib/workos/user_management/create_user_invite_options.rb create mode 100644 lib/workos/user_management/create_user_organization_membership.rb create mode 100644 lib/workos/user_management/device_authorization_response.rb create mode 100644 lib/workos/user_management/device_code_session_authenticate_request.rb create mode 100644 lib/workos/user_management/email_change.rb create mode 100644 lib/workos/user_management/email_change_confirmation.rb create mode 100644 lib/workos/user_management/email_change_confirmation_user.rb create mode 100644 lib/workos/user_management/email_verification.rb create mode 100644 lib/workos/user_management/email_verification_code_session_authenticate_request.rb create mode 100644 lib/workos/user_management/email_verification_created.rb create mode 100644 lib/workos/user_management/email_verification_created_data.rb create mode 100644 lib/workos/user_management/invitation.rb create mode 100644 lib/workos/user_management/invitation_accepted.rb create mode 100644 lib/workos/user_management/invitation_accepted_data.rb create mode 100644 lib/workos/user_management/invitation_created.rb create mode 100644 lib/workos/user_management/invitation_created_data.rb create mode 100644 lib/workos/user_management/invitation_resent.rb create mode 100644 lib/workos/user_management/invitation_resent_data.rb create mode 100644 lib/workos/user_management/invitation_revoked.rb create mode 100644 lib/workos/user_management/invitation_revoked_data.rb create mode 100644 lib/workos/user_management/jwks_response.rb create mode 100644 lib/workos/user_management/jwks_response_keys.rb create mode 100644 lib/workos/user_management/jwt_template_response.rb create mode 100644 lib/workos/user_management/magic_auth.rb create mode 100644 lib/workos/user_management/magic_auth_code_session_authenticate_request.rb create mode 100644 lib/workos/user_management/magic_auth_created.rb create mode 100644 lib/workos/user_management/magic_auth_created_data.rb create mode 100644 lib/workos/user_management/mfa_totp_session_authenticate_request.rb create mode 100644 lib/workos/user_management/organization_membership.rb create mode 100644 lib/workos/user_management/organization_selection_session_authenticate_request.rb create mode 100644 lib/workos/user_management/password_reset.rb create mode 100644 lib/workos/user_management/password_reset_created.rb create mode 100644 lib/workos/user_management/password_reset_created_data.rb create mode 100644 lib/workos/user_management/password_reset_succeeded.rb create mode 100644 lib/workos/user_management/password_reset_succeeded_data.rb create mode 100644 lib/workos/user_management/password_session_authenticate_request.rb create mode 100644 lib/workos/user_management/redirect_uri.rb create mode 100644 lib/workos/user_management/refresh_token_session_authenticate_request.rb create mode 100644 lib/workos/user_management/resend_user_invite_options.rb create mode 100644 lib/workos/user_management/reset_password_response.rb create mode 100644 lib/workos/user_management/revoke_session.rb create mode 100644 lib/workos/user_management/send_email_change.rb create mode 100644 lib/workos/user_management/send_verification_email_response.rb delete mode 100644 lib/workos/user_management/session.rb create mode 100644 lib/workos/user_management/session_created.rb create mode 100644 lib/workos/user_management/session_created_data.rb create mode 100644 lib/workos/user_management/session_created_data_impersonator.rb create mode 100644 lib/workos/user_management/session_revoked.rb create mode 100644 lib/workos/user_management/session_revoked_data.rb create mode 100644 lib/workos/user_management/session_revoked_data_impersonator.rb create mode 100644 lib/workos/user_management/sso_device_authorization_request.rb create mode 100644 lib/workos/user_management/update_jwt_template.rb create mode 100644 lib/workos/user_management/update_user.rb create mode 100644 lib/workos/user_management/update_user_organization_membership.rb create mode 100644 lib/workos/user_management/urn_ietf_params_oauth_grant_type_device_code_session_authenticate_request.rb create mode 100644 lib/workos/user_management/urn_workos_oauth_grant_type_email_verification_code_session_authenticate_request.rb create mode 100644 lib/workos/user_management/urn_workos_oauth_grant_type_magic_auth_code_session_authenticate_request.rb create mode 100644 lib/workos/user_management/urn_workos_oauth_grant_type_mfa_totp_session_authenticate_request.rb create mode 100644 lib/workos/user_management/urn_workos_oauth_grant_type_organization_selection_session_authenticate_request.rb create mode 100644 lib/workos/user_management/user.rb create mode 100644 lib/workos/user_management/user_created.rb create mode 100644 lib/workos/user_management/user_deleted.rb create mode 100644 lib/workos/user_management/user_identities_get_item.rb create mode 100644 lib/workos/user_management/user_invite.rb create mode 100644 lib/workos/user_management/user_organization_membership.rb create mode 100644 lib/workos/user_management/user_sessions_impersonator.rb create mode 100644 lib/workos/user_management/user_sessions_list_item.rb create mode 100644 lib/workos/user_management/user_updated.rb create mode 100644 lib/workos/user_management/verify_email_address.rb create mode 100644 lib/workos/user_management/verify_email_response.rb delete mode 100644 lib/workos/user_response.rb create mode 100644 lib/workos/util.rb create mode 100644 lib/workos/util/signature.rb create mode 100644 lib/workos/vault.rb create mode 100644 lib/workos/vault/vault_byok_key_verification_completed.rb create mode 100644 lib/workos/vault/vault_byok_key_verification_completed_data.rb create mode 100644 lib/workos/vault/vault_data_created.rb create mode 100644 lib/workos/vault/vault_data_created_data.rb create mode 100644 lib/workos/vault/vault_data_deleted.rb create mode 100644 lib/workos/vault/vault_data_deleted_data.rb create mode 100644 lib/workos/vault/vault_data_read.rb create mode 100644 lib/workos/vault/vault_data_read_data.rb create mode 100644 lib/workos/vault/vault_data_updated.rb create mode 100644 lib/workos/vault/vault_data_updated_data.rb create mode 100644 lib/workos/vault/vault_dek_decrypted.rb create mode 100644 lib/workos/vault/vault_dek_decrypted_data.rb create mode 100644 lib/workos/vault/vault_dek_read.rb create mode 100644 lib/workos/vault/vault_dek_read_data.rb create mode 100644 lib/workos/vault/vault_kek_created.rb create mode 100644 lib/workos/vault/vault_kek_created_data.rb create mode 100644 lib/workos/vault/vault_metadata_read.rb create mode 100644 lib/workos/vault/vault_metadata_read_data.rb create mode 100644 lib/workos/vault/vault_names_listed.rb create mode 100644 lib/workos/vault/vault_names_listed_data.rb delete mode 100644 lib/workos/verify_challenge.rb delete mode 100644 lib/workos/webhook.rb create mode 100644 lib/workos/webhook_event.rb create mode 100644 lib/workos/webhooks/create_webhook_endpoint.rb create mode 100644 lib/workos/webhooks/update_webhook_endpoint.rb create mode 100644 lib/workos/webhooks/webhook_endpoint.rb create mode 100644 lib/workos/widgets/widget_session_token.rb create mode 100644 lib/workos/widgets/widget_session_token_response.rb create mode 100644 rbi/workos/action_authentication_denied.rbi create mode 100644 rbi/workos/action_authentication_denied_data.rbi create mode 100644 rbi/workos/action_user_registration_denied.rbi create mode 100644 rbi/workos/action_user_registration_denied_data.rbi create mode 100644 rbi/workos/add_role_permission.rbi create mode 100644 rbi/workos/admin_portal.rbi create mode 100644 rbi/workos/api_key.rbi create mode 100644 rbi/workos/api_key_created.rbi create mode 100644 rbi/workos/api_key_created_data.rbi create mode 100644 rbi/workos/api_key_created_data_owner.rbi create mode 100644 rbi/workos/api_key_owner.rbi create mode 100644 rbi/workos/api_key_revoked.rbi create mode 100644 rbi/workos/api_key_revoked_data.rbi create mode 100644 rbi/workos/api_key_revoked_data_owner.rbi create mode 100644 rbi/workos/api_key_validation_response.rbi create mode 100644 rbi/workos/api_key_with_value.rbi create mode 100644 rbi/workos/api_key_with_value_owner.rbi create mode 100644 rbi/workos/api_keys.rbi create mode 100644 rbi/workos/application_credentials_list_item.rbi create mode 100644 rbi/workos/assign_role.rbi create mode 100644 rbi/workos/audit_log_action.rbi create mode 100644 rbi/workos/audit_log_configuration.rbi create mode 100644 rbi/workos/audit_log_configuration_log_stream.rbi create mode 100644 rbi/workos/audit_log_event.rbi create mode 100644 rbi/workos/audit_log_event_actor.rbi create mode 100644 rbi/workos/audit_log_event_context.rbi create mode 100644 rbi/workos/audit_log_event_create_response.rbi create mode 100644 rbi/workos/audit_log_event_ingestion.rbi create mode 100644 rbi/workos/audit_log_event_target.rbi create mode 100644 rbi/workos/audit_log_export.rbi create mode 100644 rbi/workos/audit_log_export_creation.rbi create mode 100644 rbi/workos/audit_log_schema.rbi create mode 100644 rbi/workos/audit_log_schema_actor.rbi create mode 100644 rbi/workos/audit_log_schema_target.rbi create mode 100644 rbi/workos/audit_logs.rbi create mode 100644 rbi/workos/audit_logs_retention.rbi create mode 100644 rbi/workos/authenticate_response.rbi create mode 100644 rbi/workos/authenticate_response_impersonator.rbi create mode 100644 rbi/workos/authenticate_response_oauth_token.rbi create mode 100644 rbi/workos/authentication_challenge.rbi create mode 100644 rbi/workos/authentication_challenge_verify_response.rbi create mode 100644 rbi/workos/authentication_challenges_verify_request.rbi create mode 100644 rbi/workos/authentication_email_verification_failed.rbi create mode 100644 rbi/workos/authentication_email_verification_failed_data.rbi create mode 100644 rbi/workos/authentication_email_verification_failed_data_error.rbi create mode 100644 rbi/workos/authentication_email_verification_succeeded.rbi create mode 100644 rbi/workos/authentication_email_verification_succeeded_data.rbi create mode 100644 rbi/workos/authentication_factor.rbi create mode 100644 rbi/workos/authentication_factor_enrolled.rbi create mode 100644 rbi/workos/authentication_factor_enrolled_sms.rbi create mode 100644 rbi/workos/authentication_factor_enrolled_totp.rbi create mode 100644 rbi/workos/authentication_factor_sms.rbi create mode 100644 rbi/workos/authentication_factor_totp.rbi create mode 100644 rbi/workos/authentication_factors_create_request.rbi create mode 100644 rbi/workos/authentication_magic_auth_failed.rbi create mode 100644 rbi/workos/authentication_magic_auth_failed_data.rbi create mode 100644 rbi/workos/authentication_magic_auth_failed_data_error.rbi create mode 100644 rbi/workos/authentication_magic_auth_succeeded.rbi create mode 100644 rbi/workos/authentication_magic_auth_succeeded_data.rbi create mode 100644 rbi/workos/authentication_mfa_failed.rbi create mode 100644 rbi/workos/authentication_mfa_failed_data.rbi create mode 100644 rbi/workos/authentication_mfa_failed_data_error.rbi create mode 100644 rbi/workos/authentication_mfa_succeeded.rbi create mode 100644 rbi/workos/authentication_mfa_succeeded_data.rbi create mode 100644 rbi/workos/authentication_oauth_failed.rbi create mode 100644 rbi/workos/authentication_oauth_failed_data.rbi create mode 100644 rbi/workos/authentication_oauth_failed_data_error.rbi create mode 100644 rbi/workos/authentication_oauth_succeeded.rbi create mode 100644 rbi/workos/authentication_oauth_succeeded_data.rbi create mode 100644 rbi/workos/authentication_passkey_failed.rbi create mode 100644 rbi/workos/authentication_passkey_failed_data.rbi create mode 100644 rbi/workos/authentication_passkey_failed_data_error.rbi create mode 100644 rbi/workos/authentication_passkey_succeeded.rbi create mode 100644 rbi/workos/authentication_passkey_succeeded_data.rbi create mode 100644 rbi/workos/authentication_password_failed.rbi create mode 100644 rbi/workos/authentication_password_failed_data.rbi create mode 100644 rbi/workos/authentication_password_failed_data_error.rbi create mode 100644 rbi/workos/authentication_password_succeeded.rbi create mode 100644 rbi/workos/authentication_password_succeeded_data.rbi create mode 100644 rbi/workos/authentication_radar_risk_detected.rbi create mode 100644 rbi/workos/authentication_radar_risk_detected_data.rbi create mode 100644 rbi/workos/authentication_sso_failed.rbi create mode 100644 rbi/workos/authentication_sso_failed_data.rbi create mode 100644 rbi/workos/authentication_sso_failed_data_error.rbi create mode 100644 rbi/workos/authentication_sso_failed_data_sso.rbi create mode 100644 rbi/workos/authentication_sso_started.rbi create mode 100644 rbi/workos/authentication_sso_started_data.rbi create mode 100644 rbi/workos/authentication_sso_started_data_sso.rbi create mode 100644 rbi/workos/authentication_sso_succeeded.rbi create mode 100644 rbi/workos/authentication_sso_succeeded_data.rbi create mode 100644 rbi/workos/authentication_sso_succeeded_data_sso.rbi create mode 100644 rbi/workos/authentication_sso_timed_out.rbi create mode 100644 rbi/workos/authentication_sso_timed_out_data.rbi create mode 100644 rbi/workos/authentication_sso_timed_out_data_error.rbi create mode 100644 rbi/workos/authentication_sso_timed_out_data_sso.rbi create mode 100644 rbi/workos/authorization.rbi create mode 100644 rbi/workos/authorization_check.rbi create mode 100644 rbi/workos/authorization_code_session_authenticate_request.rbi create mode 100644 rbi/workos/authorization_permission.rbi create mode 100644 rbi/workos/authorization_resource.rbi create mode 100644 rbi/workos/authorized_connect_application_list_data.rbi create mode 100644 rbi/workos/challenge_authentication_factor.rbi create mode 100644 rbi/workos/check_authorization.rbi create mode 100644 rbi/workos/client.rbi create mode 100644 rbi/workos/confirm_email_change.rbi create mode 100644 rbi/workos/connect.rbi create mode 100644 rbi/workos/connect_application.rbi create mode 100644 rbi/workos/connected_account.rbi create mode 100644 rbi/workos/connection.rbi create mode 100644 rbi/workos/connection_activated.rbi create mode 100644 rbi/workos/connection_activated_data.rbi create mode 100644 rbi/workos/connection_activated_data_domain.rbi create mode 100644 rbi/workos/connection_deactivated.rbi create mode 100644 rbi/workos/connection_deactivated_data.rbi create mode 100644 rbi/workos/connection_deactivated_data_domain.rbi create mode 100644 rbi/workos/connection_deleted.rbi create mode 100644 rbi/workos/connection_deleted_data.rbi create mode 100644 rbi/workos/connection_domain.rbi create mode 100644 rbi/workos/connection_option.rbi create mode 100644 rbi/workos/connection_saml_certificate_renewal_required.rbi create mode 100644 rbi/workos/connection_saml_certificate_renewal_required_data.rbi create mode 100644 rbi/workos/connection_saml_certificate_renewal_required_data_certificate.rbi create mode 100644 rbi/workos/connection_saml_certificate_renewal_required_data_connection.rbi create mode 100644 rbi/workos/connection_saml_certificate_renewed.rbi create mode 100644 rbi/workos/connection_saml_certificate_renewed_data.rbi create mode 100644 rbi/workos/connection_saml_certificate_renewed_data_certificate.rbi create mode 100644 rbi/workos/connection_saml_certificate_renewed_data_connection.rbi create mode 100644 rbi/workos/cors_origin_response.rbi create mode 100644 rbi/workos/create_application_secret.rbi create mode 100644 rbi/workos/create_authorization_permission.rbi create mode 100644 rbi/workos/create_authorization_resource.rbi create mode 100644 rbi/workos/create_cors_origin.rbi create mode 100644 rbi/workos/create_m2m_application.rbi create mode 100644 rbi/workos/create_magic_code_and_return.rbi create mode 100644 rbi/workos/create_oauth_application.rbi create mode 100644 rbi/workos/create_organization_api_key.rbi create mode 100644 rbi/workos/create_organization_domain.rbi create mode 100644 rbi/workos/create_organization_role.rbi create mode 100644 rbi/workos/create_password_reset.rbi create mode 100644 rbi/workos/create_password_reset_token.rbi create mode 100644 rbi/workos/create_redirect_uri.rbi create mode 100644 rbi/workos/create_role.rbi create mode 100644 rbi/workos/create_user.rbi create mode 100644 rbi/workos/create_user_invite_options.rbi create mode 100644 rbi/workos/create_user_organization_membership.rbi create mode 100644 rbi/workos/create_webhook_endpoint.rbi create mode 100644 rbi/workos/data_integration_access_token_response.rbi create mode 100644 rbi/workos/data_integration_access_token_response_access_token.rbi create mode 100644 rbi/workos/data_integration_authorize_url_response.rbi create mode 100644 rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi create mode 100644 rbi/workos/data_integrations_get_user_token_request.rbi create mode 100644 rbi/workos/data_integrations_list_response.rbi create mode 100644 rbi/workos/data_integrations_list_response_data.rbi create mode 100644 rbi/workos/data_integrations_list_response_data_connected_account.rbi create mode 100644 rbi/workos/device_authorization_response.rbi create mode 100644 rbi/workos/device_code_session_authenticate_request.rbi create mode 100644 rbi/workos/directory.rbi create mode 100644 rbi/workos/directory_group.rbi create mode 100644 rbi/workos/directory_metadata.rbi create mode 100644 rbi/workos/directory_metadata_user.rbi create mode 100644 rbi/workos/directory_sync.rbi create mode 100644 rbi/workos/directory_user.rbi create mode 100644 rbi/workos/directory_user_email.rbi create mode 100644 rbi/workos/directory_user_with_groups.rbi create mode 100644 rbi/workos/directory_user_with_groups_email.rbi create mode 100644 rbi/workos/dsync_activated.rbi create mode 100644 rbi/workos/dsync_activated_data.rbi create mode 100644 rbi/workos/dsync_activated_data_domain.rbi create mode 100644 rbi/workos/dsync_deactivated.rbi create mode 100644 rbi/workos/dsync_deactivated_data.rbi create mode 100644 rbi/workos/dsync_deactivated_data_domain.rbi create mode 100644 rbi/workos/dsync_deleted.rbi create mode 100644 rbi/workos/dsync_deleted_data.rbi create mode 100644 rbi/workos/dsync_group_created.rbi create mode 100644 rbi/workos/dsync_group_deleted.rbi create mode 100644 rbi/workos/dsync_group_updated.rbi create mode 100644 rbi/workos/dsync_group_updated_data.rbi create mode 100644 rbi/workos/dsync_group_user_added.rbi create mode 100644 rbi/workos/dsync_group_user_added_data.rbi create mode 100644 rbi/workos/dsync_group_user_removed.rbi create mode 100644 rbi/workos/dsync_group_user_removed_data.rbi create mode 100644 rbi/workos/dsync_user_created.rbi create mode 100644 rbi/workos/dsync_user_deleted.rbi create mode 100644 rbi/workos/dsync_user_updated.rbi create mode 100644 rbi/workos/dsync_user_updated_data.rbi create mode 100644 rbi/workos/dsync_user_updated_data_email.rbi create mode 100644 rbi/workos/email_change.rbi create mode 100644 rbi/workos/email_change_confirmation.rbi create mode 100644 rbi/workos/email_change_confirmation_user.rbi create mode 100644 rbi/workos/email_verification.rbi create mode 100644 rbi/workos/email_verification_code_session_authenticate_request.rbi create mode 100644 rbi/workos/email_verification_created.rbi create mode 100644 rbi/workos/email_verification_created_data.rbi create mode 100644 rbi/workos/enroll_user_authentication_factor.rbi create mode 100644 rbi/workos/event_context.rbi create mode 100644 rbi/workos/event_context_actor.rbi create mode 100644 rbi/workos/event_context_google_analytics_session.rbi create mode 100644 rbi/workos/event_list_list_metadata.rbi create mode 100644 rbi/workos/event_schema.rbi create mode 100644 rbi/workos/events.rbi create mode 100644 rbi/workos/external_auth_complete_response.rbi create mode 100644 rbi/workos/feature_flag.rbi create mode 100644 rbi/workos/feature_flag_owner.rbi create mode 100644 rbi/workos/feature_flags.rbi create mode 100644 rbi/workos/flag.rbi create mode 100644 rbi/workos/flag_created.rbi create mode 100644 rbi/workos/flag_created_context.rbi create mode 100644 rbi/workos/flag_created_context_actor.rbi create mode 100644 rbi/workos/flag_created_data.rbi create mode 100644 rbi/workos/flag_created_data_owner.rbi create mode 100644 rbi/workos/flag_deleted.rbi create mode 100644 rbi/workos/flag_deleted_context.rbi create mode 100644 rbi/workos/flag_deleted_context_actor.rbi create mode 100644 rbi/workos/flag_deleted_data.rbi create mode 100644 rbi/workos/flag_deleted_data_owner.rbi create mode 100644 rbi/workos/flag_owner.rbi create mode 100644 rbi/workos/flag_rule_updated.rbi create mode 100644 rbi/workos/flag_rule_updated_context.rbi create mode 100644 rbi/workos/flag_rule_updated_context_actor.rbi create mode 100644 rbi/workos/flag_rule_updated_context_configured_target.rbi create mode 100644 rbi/workos/flag_rule_updated_context_configured_target_organization.rbi create mode 100644 rbi/workos/flag_rule_updated_context_configured_target_user.rbi create mode 100644 rbi/workos/flag_rule_updated_context_previous_attribute.rbi create mode 100644 rbi/workos/flag_rule_updated_context_previous_attribute_context.rbi create mode 100644 rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target.rbi create mode 100644 rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rbi create mode 100644 rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_user.rbi create mode 100644 rbi/workos/flag_rule_updated_context_previous_attribute_data.rbi create mode 100644 rbi/workos/flag_rule_updated_data.rbi create mode 100644 rbi/workos/flag_rule_updated_data_owner.rbi create mode 100644 rbi/workos/flag_updated.rbi create mode 100644 rbi/workos/flag_updated_context.rbi create mode 100644 rbi/workos/flag_updated_context_actor.rbi create mode 100644 rbi/workos/flag_updated_context_previous_attribute.rbi create mode 100644 rbi/workos/flag_updated_context_previous_attribute_data.rbi create mode 100644 rbi/workos/flag_updated_data.rbi create mode 100644 rbi/workos/flag_updated_data_owner.rbi create mode 100644 rbi/workos/generate_link.rbi create mode 100644 rbi/workos/group.rbi create mode 100644 rbi/workos/group_created.rbi create mode 100644 rbi/workos/group_deleted.rbi create mode 100644 rbi/workos/group_member_added.rbi create mode 100644 rbi/workos/group_member_added_data.rbi create mode 100644 rbi/workos/group_member_removed.rbi create mode 100644 rbi/workos/group_member_removed_data.rbi create mode 100644 rbi/workos/group_updated.rbi create mode 100644 rbi/workos/intent_options.rbi create mode 100644 rbi/workos/invitation.rbi create mode 100644 rbi/workos/invitation_accepted.rbi create mode 100644 rbi/workos/invitation_accepted_data.rbi create mode 100644 rbi/workos/invitation_created.rbi create mode 100644 rbi/workos/invitation_created_data.rbi create mode 100644 rbi/workos/invitation_resent.rbi create mode 100644 rbi/workos/invitation_resent_data.rbi create mode 100644 rbi/workos/invitation_revoked.rbi create mode 100644 rbi/workos/invitation_revoked_data.rbi create mode 100644 rbi/workos/jwks_response.rbi create mode 100644 rbi/workos/jwks_response_keys.rbi create mode 100644 rbi/workos/jwt_template_response.rbi create mode 100644 rbi/workos/magic_auth.rbi create mode 100644 rbi/workos/magic_auth_code_session_authenticate_request.rbi create mode 100644 rbi/workos/magic_auth_created.rbi create mode 100644 rbi/workos/magic_auth_created_data.rbi create mode 100644 rbi/workos/mfa_totp_session_authenticate_request.rbi create mode 100644 rbi/workos/multi_factor_auth.rbi create mode 100644 rbi/workos/new_connect_application_secret.rbi create mode 100644 rbi/workos/organization.rbi create mode 100644 rbi/workos/organization_created.rbi create mode 100644 rbi/workos/organization_created_data.rbi create mode 100644 rbi/workos/organization_created_data_domain.rbi create mode 100644 rbi/workos/organization_deleted.rbi create mode 100644 rbi/workos/organization_deleted_data.rbi create mode 100644 rbi/workos/organization_deleted_data_domain.rbi create mode 100644 rbi/workos/organization_domain.rbi create mode 100644 rbi/workos/organization_domain_created.rbi create mode 100644 rbi/workos/organization_domain_created_data.rbi create mode 100644 rbi/workos/organization_domain_data.rbi create mode 100644 rbi/workos/organization_domain_deleted.rbi create mode 100644 rbi/workos/organization_domain_deleted_data.rbi create mode 100644 rbi/workos/organization_domain_stand_alone.rbi create mode 100644 rbi/workos/organization_domain_updated.rbi create mode 100644 rbi/workos/organization_domain_updated_data.rbi create mode 100644 rbi/workos/organization_domain_verification_failed.rbi create mode 100644 rbi/workos/organization_domain_verification_failed_data.rbi create mode 100644 rbi/workos/organization_domain_verification_failed_data_organization_domain.rbi create mode 100644 rbi/workos/organization_domain_verified.rbi create mode 100644 rbi/workos/organization_domain_verified_data.rbi create mode 100644 rbi/workos/organization_domains.rbi create mode 100644 rbi/workos/organization_input.rbi create mode 100644 rbi/workos/organization_membership.rbi create mode 100644 rbi/workos/organization_membership_created.rbi create mode 100644 rbi/workos/organization_membership_created_data.rbi create mode 100644 rbi/workos/organization_membership_deleted.rbi create mode 100644 rbi/workos/organization_membership_deleted_data.rbi create mode 100644 rbi/workos/organization_membership_updated.rbi create mode 100644 rbi/workos/organization_membership_updated_data.rbi create mode 100644 rbi/workos/organization_role_created.rbi create mode 100644 rbi/workos/organization_role_created_data.rbi create mode 100644 rbi/workos/organization_role_deleted.rbi create mode 100644 rbi/workos/organization_role_deleted_data.rbi create mode 100644 rbi/workos/organization_role_updated.rbi create mode 100644 rbi/workos/organization_role_updated_data.rbi create mode 100644 rbi/workos/organization_selection_session_authenticate_request.rbi create mode 100644 rbi/workos/organization_updated.rbi create mode 100644 rbi/workos/organization_updated_data.rbi create mode 100644 rbi/workos/organization_updated_data_domain.rbi create mode 100644 rbi/workos/organizations.rbi create mode 100644 rbi/workos/password_reset.rbi create mode 100644 rbi/workos/password_reset_created.rbi create mode 100644 rbi/workos/password_reset_created_data.rbi create mode 100644 rbi/workos/password_reset_succeeded.rbi create mode 100644 rbi/workos/password_reset_succeeded_data.rbi create mode 100644 rbi/workos/password_session_authenticate_request.rbi create mode 100644 rbi/workos/permission.rbi create mode 100644 rbi/workos/permission_created.rbi create mode 100644 rbi/workos/permission_created_data.rbi create mode 100644 rbi/workos/permission_deleted.rbi create mode 100644 rbi/workos/permission_deleted_data.rbi create mode 100644 rbi/workos/permission_updated.rbi create mode 100644 rbi/workos/permission_updated_data.rbi create mode 100644 rbi/workos/pipes.rbi create mode 100644 rbi/workos/portal_link_response.rbi create mode 100644 rbi/workos/profile.rbi create mode 100644 rbi/workos/radar.rbi create mode 100644 rbi/workos/radar_list_entry_already_present_response.rbi create mode 100644 rbi/workos/radar_standalone_assess_request.rbi create mode 100644 rbi/workos/radar_standalone_delete_radar_list_entry_request.rbi create mode 100644 rbi/workos/radar_standalone_response.rbi create mode 100644 rbi/workos/radar_standalone_update_radar_attempt_request.rbi create mode 100644 rbi/workos/radar_standalone_update_radar_list_request.rbi create mode 100644 rbi/workos/redirect_uri.rbi create mode 100644 rbi/workos/redirect_uri_input.rbi create mode 100644 rbi/workos/refresh_token_session_authenticate_request.rbi create mode 100644 rbi/workos/remove_role.rbi create mode 100644 rbi/workos/resend_user_invite_options.rbi create mode 100644 rbi/workos/reset_password_response.rbi create mode 100644 rbi/workos/revoke_session.rbi create mode 100644 rbi/workos/role.rbi create mode 100644 rbi/workos/role_assignment.rbi create mode 100644 rbi/workos/role_assignment_resource.rbi create mode 100644 rbi/workos/role_created.rbi create mode 100644 rbi/workos/role_created_data.rbi create mode 100644 rbi/workos/role_deleted.rbi create mode 100644 rbi/workos/role_deleted_data.rbi create mode 100644 rbi/workos/role_list.rbi create mode 100644 rbi/workos/role_updated.rbi create mode 100644 rbi/workos/role_updated_data.rbi create mode 100644 rbi/workos/send_email_change.rbi create mode 100644 rbi/workos/send_verification_email_response.rbi create mode 100644 rbi/workos/session_created.rbi create mode 100644 rbi/workos/session_created_data.rbi create mode 100644 rbi/workos/session_created_data_impersonator.rbi create mode 100644 rbi/workos/session_revoked.rbi create mode 100644 rbi/workos/session_revoked_data.rbi create mode 100644 rbi/workos/session_revoked_data_impersonator.rbi create mode 100644 rbi/workos/set_role_permissions.rbi create mode 100644 rbi/workos/slim_role.rbi create mode 100644 rbi/workos/sso.rbi create mode 100644 rbi/workos/sso_authorize_url_response.rbi create mode 100644 rbi/workos/sso_device_authorization_request.rbi create mode 100644 rbi/workos/sso_intent_options.rbi create mode 100644 rbi/workos/sso_logout_authorize_request.rbi create mode 100644 rbi/workos/sso_logout_authorize_response.rbi create mode 100644 rbi/workos/sso_token_response.rbi create mode 100644 rbi/workos/sso_token_response_oauth_token.rbi create mode 100644 rbi/workos/token_query.rbi create mode 100644 rbi/workos/update_audit_logs_retention.rbi create mode 100644 rbi/workos/update_authorization_permission.rbi create mode 100644 rbi/workos/update_authorization_resource.rbi create mode 100644 rbi/workos/update_jwt_template.rbi create mode 100644 rbi/workos/update_oauth_application.rbi create mode 100644 rbi/workos/update_organization.rbi create mode 100644 rbi/workos/update_organization_role.rbi create mode 100644 rbi/workos/update_role.rbi create mode 100644 rbi/workos/update_user.rbi create mode 100644 rbi/workos/update_user_organization_membership.rbi create mode 100644 rbi/workos/update_webhook_endpoint.rbi create mode 100644 rbi/workos/user.rbi create mode 100644 rbi/workos/user_authentication_factor_enroll_response.rbi create mode 100644 rbi/workos/user_consent_option.rbi create mode 100644 rbi/workos/user_consent_option_choice.rbi create mode 100644 rbi/workos/user_created.rbi create mode 100644 rbi/workos/user_deleted.rbi create mode 100644 rbi/workos/user_identities_get_item.rbi create mode 100644 rbi/workos/user_invite.rbi create mode 100644 rbi/workos/user_management.rbi create mode 100644 rbi/workos/user_management_login_request.rbi create mode 100644 rbi/workos/user_object.rbi create mode 100644 rbi/workos/user_organization_membership.rbi create mode 100644 rbi/workos/user_organization_membership_base_list_data.rbi create mode 100644 rbi/workos/user_sessions_impersonator.rbi create mode 100644 rbi/workos/user_sessions_list_item.rbi create mode 100644 rbi/workos/user_updated.rbi create mode 100644 rbi/workos/validate_api_key.rbi create mode 100644 rbi/workos/vault_byok_key_verification_completed.rbi create mode 100644 rbi/workos/vault_byok_key_verification_completed_data.rbi create mode 100644 rbi/workos/vault_data_created.rbi create mode 100644 rbi/workos/vault_data_created_data.rbi create mode 100644 rbi/workos/vault_data_deleted.rbi create mode 100644 rbi/workos/vault_data_deleted_data.rbi create mode 100644 rbi/workos/vault_data_read.rbi create mode 100644 rbi/workos/vault_data_read_data.rbi create mode 100644 rbi/workos/vault_data_updated.rbi create mode 100644 rbi/workos/vault_data_updated_data.rbi create mode 100644 rbi/workos/vault_dek_decrypted.rbi create mode 100644 rbi/workos/vault_dek_decrypted_data.rbi create mode 100644 rbi/workos/vault_dek_read.rbi create mode 100644 rbi/workos/vault_dek_read_data.rbi create mode 100644 rbi/workos/vault_kek_created.rbi create mode 100644 rbi/workos/vault_kek_created_data.rbi create mode 100644 rbi/workos/vault_metadata_read.rbi create mode 100644 rbi/workos/vault_metadata_read_data.rbi create mode 100644 rbi/workos/vault_names_listed.rbi create mode 100644 rbi/workos/vault_names_listed_data.rbi create mode 100644 rbi/workos/verify_email_address.rbi create mode 100644 rbi/workos/verify_email_response.rbi create mode 100644 rbi/workos/webhook_endpoint.rbi create mode 100644 rbi/workos/webhooks.rbi create mode 100644 rbi/workos/widget_session_token.rbi create mode 100644 rbi/workos/widget_session_token_response.rbi create mode 100644 rbi/workos/widgets.rbi create mode 100755 script/ci delete mode 100644 test/fixtures/profile.txt delete mode 100644 test/fixtures/vcr_cassettes/audit_logs/create_event.yml delete mode 100644 test/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml delete mode 100644 test/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/audit_logs/create_export.yml delete mode 100644 test/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml delete mode 100644 test/fixtures/vcr_cassettes/audit_logs/get_export.yml delete mode 100644 test/fixtures/vcr_cassettes/audit_trail/create_event.yml delete mode 100644 test/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml delete mode 100644 test/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml delete mode 100644 test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml delete mode 100644 test/fixtures/vcr_cassettes/audit_trail/get_events.yml delete mode 100644 test/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/delete_directory.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/get_group.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/get_user.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml delete mode 100644 test/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml delete mode 100644 test/fixtures/vcr_cassettes/events/list_events_with_after.yml delete mode 100644 test/fixtures/vcr_cassettes/events/list_events_with_event.yml delete mode 100644 test/fixtures/vcr_cassettes/events/list_events_with_no_options.yml delete mode 100644 test/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml delete mode 100644 test/fixtures/vcr_cassettes/events/list_events_with_range.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/delete_factor.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/get_factor_valid.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml delete mode 100644 test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/create.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/create_invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/create_with_domain_data.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/create_with_domains.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/create_with_external_id.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/create_without_domains.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/delete.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/delete_invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/get.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/get_invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/list.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/list_organization_roles.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/update.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/update_with_external_id.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml delete mode 100644 test/fixtures/vcr_cassettes/organization/update_without_name.yml delete mode 100644 test/fixtures/vcr_cassettes/passwordless/create_session.yml delete mode 100644 test/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/passwordless/send_session.yml delete mode 100644 test/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml delete mode 100644 test/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml delete mode 100644 test/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml delete mode 100644 test/fixtures/vcr_cassettes/portal/generate_link_dsync.yml delete mode 100644 test/fixtures/vcr_cassettes/portal/generate_link_invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/portal/generate_link_sso.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/list_connections/with_after.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/list_connections/with_before.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml delete mode 100644 test/fixtures/vcr_cassettes/sso/profile.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/create_user_invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/create_user_valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/delete_user/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/get_organization_membership.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/get_user.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_users/no_options.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/list_users/with_options.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/reset_password/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/update_user/email.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/update_user/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/update_user/locale.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/update_user/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml delete mode 100644 test/fixtures/vcr_cassettes/user_management/verify_email/valid.yml delete mode 100644 test/fixtures/vcr_cassettes/widgets/get_token.yml delete mode 100644 test/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml delete mode 100644 test/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml delete mode 100644 test/fixtures/webhook_payload.txt delete mode 100644 test/workos/encryptors/test_aes_gcm.rb create mode 100644 test/workos/test_actions.rb create mode 100644 test/workos/test_admin_portal.rb create mode 100644 test/workos/test_api_keys.rb create mode 100644 test/workos/test_authkit_helpers.rb create mode 100644 test/workos/test_authorization.rb create mode 100644 test/workos/test_base_client.rb delete mode 100644 test/workos/test_cache.rb delete mode 100644 test/workos/test_client.rb delete mode 100644 test/workos/test_configuration.rb create mode 100644 test/workos/test_connect.rb delete mode 100644 test/workos/test_directory_user.rb create mode 100644 test/workos/test_encryptors_aes_gcm.rb delete mode 100644 test/workos/test_event.rb create mode 100644 test/workos/test_events.rb create mode 100644 test/workos/test_feature_flags.rb create mode 100644 test/workos/test_list_struct.rb delete mode 100644 test/workos/test_mfa.rb create mode 100644 test/workos/test_model_round_trip.rb create mode 100644 test/workos/test_multi_factor_auth.rb create mode 100644 test/workos/test_organization_domains.rb create mode 100644 test/workos/test_pipes.rb create mode 100644 test/workos/test_pkce.rb delete mode 100644 test/workos/test_portal.rb create mode 100644 test/workos/test_public_client.rb create mode 100644 test/workos/test_radar.rb delete mode 100644 test/workos/test_role.rb create mode 100644 test/workos/test_sso_helpers.rb create mode 100644 test/workos/test_sso_runtime.rb create mode 100644 test/workos/test_vault.rb create mode 100644 test/workos/test_webhook_verify.rb diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ddf090b..403a12cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - '4.0' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0 + - uses: ruby/setup-ruby@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1.302.0 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a8411cbe..2b312cc2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0 + - uses: ruby/setup-ruby@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1.302.0 with: bundler-cache: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77c2a1c2..55676ba1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup Ruby - uses: ruby/setup-ruby@09a7688d3b55cf0e976497ff046b70949eeaccfd # v1.288.0 + uses: ruby/setup-ruby@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1.302.0 with: ruby-version: "3.2" bundler-cache: true diff --git a/.oagen-manifest.json b/.oagen-manifest.json new file mode 100644 index 00000000..9c9bbf94 --- /dev/null +++ b/.oagen-manifest.json @@ -0,0 +1,1008 @@ +{ + "version": 1, + "language": "ruby", + "generatedAt": "2026-04-18T22:03:57.403Z", + "files": [ + "lib/workos.rb", + "lib/workos/admin_portal.rb", + "lib/workos/admin_portal/generate_link.rb", + "lib/workos/admin_portal/intent_options.rb", + "lib/workos/admin_portal/portal_link_response.rb", + "lib/workos/admin_portal/sso_intent_options.rb", + "lib/workos/api_keys.rb", + "lib/workos/api_keys/api_key.rb", + "lib/workos/api_keys/api_key_created.rb", + "lib/workos/api_keys/api_key_created_data.rb", + "lib/workos/api_keys/api_key_created_data_owner.rb", + "lib/workos/api_keys/api_key_owner.rb", + "lib/workos/api_keys/api_key_revoked.rb", + "lib/workos/api_keys/api_key_revoked_data.rb", + "lib/workos/api_keys/api_key_revoked_data_owner.rb", + "lib/workos/api_keys/api_key_validation_response.rb", + "lib/workos/api_keys/api_key_with_value.rb", + "lib/workos/api_keys/api_key_with_value_owner.rb", + "lib/workos/api_keys/create_organization_api_key.rb", + "lib/workos/api_keys/validate_api_key.rb", + "lib/workos/audit_logs.rb", + "lib/workos/audit_logs/audit_log_action.rb", + "lib/workos/audit_logs/audit_log_event.rb", + "lib/workos/audit_logs/audit_log_event_actor.rb", + "lib/workos/audit_logs/audit_log_event_context.rb", + "lib/workos/audit_logs/audit_log_event_create_response.rb", + "lib/workos/audit_logs/audit_log_event_ingestion.rb", + "lib/workos/audit_logs/audit_log_event_target.rb", + "lib/workos/audit_logs/audit_log_export.rb", + "lib/workos/audit_logs/audit_log_export_creation.rb", + "lib/workos/audit_logs/audit_log_schema.rb", + "lib/workos/audit_logs/audit_log_schema_actor.rb", + "lib/workos/audit_logs/audit_log_schema_target.rb", + "lib/workos/authorization.rb", + "lib/workos/authorization/add_role_permission.rb", + "lib/workos/authorization/assign_role.rb", + "lib/workos/authorization/authorization_check.rb", + "lib/workos/authorization/authorization_permission.rb", + "lib/workos/authorization/authorization_resource.rb", + "lib/workos/authorization/check_authorization.rb", + "lib/workos/authorization/create_authorization_permission.rb", + "lib/workos/authorization/create_authorization_resource.rb", + "lib/workos/authorization/create_organization_role.rb", + "lib/workos/authorization/create_role.rb", + "lib/workos/authorization/permission.rb", + "lib/workos/authorization/permission_created.rb", + "lib/workos/authorization/permission_created_data.rb", + "lib/workos/authorization/permission_deleted.rb", + "lib/workos/authorization/permission_deleted_data.rb", + "lib/workos/authorization/permission_updated.rb", + "lib/workos/authorization/permission_updated_data.rb", + "lib/workos/authorization/remove_role.rb", + "lib/workos/authorization/role.rb", + "lib/workos/authorization/role_assignment.rb", + "lib/workos/authorization/role_assignment_resource.rb", + "lib/workos/authorization/role_created.rb", + "lib/workos/authorization/role_created_data.rb", + "lib/workos/authorization/role_deleted.rb", + "lib/workos/authorization/role_deleted_data.rb", + "lib/workos/authorization/role_list.rb", + "lib/workos/authorization/role_updated.rb", + "lib/workos/authorization/role_updated_data.rb", + "lib/workos/authorization/set_role_permissions.rb", + "lib/workos/authorization/slim_role.rb", + "lib/workos/authorization/update_authorization_permission.rb", + "lib/workos/authorization/update_authorization_resource.rb", + "lib/workos/authorization/update_organization_role.rb", + "lib/workos/authorization/update_role.rb", + "lib/workos/authorization/user_organization_membership_base_list_data.rb", + "lib/workos/client.rb", + "lib/workos/connect.rb", + "lib/workos/connect/application_credentials_list_item.rb", + "lib/workos/connect/connect_application.rb", + "lib/workos/connect/create_application_secret.rb", + "lib/workos/connect/create_m2m_application.rb", + "lib/workos/connect/create_oauth_application.rb", + "lib/workos/connect/external_auth_complete_response.rb", + "lib/workos/connect/new_connect_application_secret.rb", + "lib/workos/connect/redirect_uri_input.rb", + "lib/workos/connect/update_oauth_application.rb", + "lib/workos/connect/user_consent_option.rb", + "lib/workos/connect/user_consent_option_choice.rb", + "lib/workos/connect/user_management_login_request.rb", + "lib/workos/connect/user_object.rb", + "lib/workos/directory_sync.rb", + "lib/workos/directory_sync/directory.rb", + "lib/workos/directory_sync/directory_group.rb", + "lib/workos/directory_sync/directory_metadata.rb", + "lib/workos/directory_sync/directory_metadata_user.rb", + "lib/workos/directory_sync/directory_user.rb", + "lib/workos/directory_sync/directory_user_email.rb", + "lib/workos/directory_sync/directory_user_with_groups.rb", + "lib/workos/directory_sync/directory_user_with_groups_email.rb", + "lib/workos/directory_sync/dsync_activated.rb", + "lib/workos/directory_sync/dsync_activated_data.rb", + "lib/workos/directory_sync/dsync_activated_data_domain.rb", + "lib/workos/directory_sync/dsync_deactivated.rb", + "lib/workos/directory_sync/dsync_deactivated_data.rb", + "lib/workos/directory_sync/dsync_deactivated_data_domain.rb", + "lib/workos/directory_sync/dsync_deleted.rb", + "lib/workos/directory_sync/dsync_deleted_data.rb", + "lib/workos/directory_sync/dsync_group_created.rb", + "lib/workos/directory_sync/dsync_group_deleted.rb", + "lib/workos/directory_sync/dsync_group_updated.rb", + "lib/workos/directory_sync/dsync_group_updated_data.rb", + "lib/workos/directory_sync/dsync_group_user_added.rb", + "lib/workos/directory_sync/dsync_group_user_added_data.rb", + "lib/workos/directory_sync/dsync_group_user_removed.rb", + "lib/workos/directory_sync/dsync_group_user_removed_data.rb", + "lib/workos/directory_sync/dsync_user_created.rb", + "lib/workos/directory_sync/dsync_user_deleted.rb", + "lib/workos/directory_sync/dsync_user_updated.rb", + "lib/workos/directory_sync/dsync_user_updated_data.rb", + "lib/workos/directory_sync/dsync_user_updated_data_email.rb", + "lib/workos/events.rb", + "lib/workos/events/event_list_list_metadata.rb", + "lib/workos/events/event_schema.rb", + "lib/workos/feature_flags.rb", + "lib/workos/feature_flags/feature_flag.rb", + "lib/workos/feature_flags/feature_flag_owner.rb", + "lib/workos/feature_flags/flag.rb", + "lib/workos/feature_flags/flag_created.rb", + "lib/workos/feature_flags/flag_created_context.rb", + "lib/workos/feature_flags/flag_created_context_actor.rb", + "lib/workos/feature_flags/flag_created_data.rb", + "lib/workos/feature_flags/flag_created_data_owner.rb", + "lib/workos/feature_flags/flag_deleted.rb", + "lib/workos/feature_flags/flag_deleted_context.rb", + "lib/workos/feature_flags/flag_deleted_context_actor.rb", + "lib/workos/feature_flags/flag_deleted_data.rb", + "lib/workos/feature_flags/flag_deleted_data_owner.rb", + "lib/workos/feature_flags/flag_owner.rb", + "lib/workos/feature_flags/flag_rule_updated.rb", + "lib/workos/feature_flags/flag_rule_updated_context.rb", + "lib/workos/feature_flags/flag_rule_updated_context_actor.rb", + "lib/workos/feature_flags/flag_rule_updated_context_configured_target.rb", + "lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb", + "lib/workos/feature_flags/flag_rule_updated_context_configured_target_user.rb", + "lib/workos/feature_flags/flag_rule_updated_context_previous_attribute.rb", + "lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context.rb", + "lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target.rb", + "lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rb", + "lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_user.rb", + "lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_data.rb", + "lib/workos/feature_flags/flag_rule_updated_data.rb", + "lib/workos/feature_flags/flag_rule_updated_data_owner.rb", + "lib/workos/feature_flags/flag_updated.rb", + "lib/workos/feature_flags/flag_updated_context.rb", + "lib/workos/feature_flags/flag_updated_context_actor.rb", + "lib/workos/feature_flags/flag_updated_context_previous_attribute.rb", + "lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb", + "lib/workos/feature_flags/flag_updated_data.rb", + "lib/workos/feature_flags/flag_updated_data_owner.rb", + "lib/workos/multi_factor_auth.rb", + "lib/workos/multi_factor_auth/authentication_challenge.rb", + "lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb", + "lib/workos/multi_factor_auth/authentication_challenges_verify_request.rb", + "lib/workos/multi_factor_auth/authentication_factor.rb", + "lib/workos/multi_factor_auth/authentication_factor_enrolled.rb", + "lib/workos/multi_factor_auth/authentication_factor_enrolled_sms.rb", + "lib/workos/multi_factor_auth/authentication_factor_enrolled_totp.rb", + "lib/workos/multi_factor_auth/authentication_factor_sms.rb", + "lib/workos/multi_factor_auth/authentication_factor_totp.rb", + "lib/workos/multi_factor_auth/authentication_factors_create_request.rb", + "lib/workos/multi_factor_auth/challenge_authentication_factor.rb", + "lib/workos/multi_factor_auth/enroll_user_authentication_factor.rb", + "lib/workos/multi_factor_auth/user_authentication_factor_enroll_response.rb", + "lib/workos/organization_domains.rb", + "lib/workos/organization_domains/create_organization_domain.rb", + "lib/workos/organization_domains/organization_domain.rb", + "lib/workos/organization_domains/organization_domain_created.rb", + "lib/workos/organization_domains/organization_domain_created_data.rb", + "lib/workos/organization_domains/organization_domain_deleted.rb", + "lib/workos/organization_domains/organization_domain_deleted_data.rb", + "lib/workos/organization_domains/organization_domain_stand_alone.rb", + "lib/workos/organization_domains/organization_domain_updated.rb", + "lib/workos/organization_domains/organization_domain_updated_data.rb", + "lib/workos/organization_domains/organization_domain_verification_failed.rb", + "lib/workos/organization_domains/organization_domain_verification_failed_data.rb", + "lib/workos/organization_domains/organization_domain_verification_failed_data_organization_domain.rb", + "lib/workos/organization_domains/organization_domain_verified.rb", + "lib/workos/organization_domains/organization_domain_verified_data.rb", + "lib/workos/organizations.rb", + "lib/workos/organizations/audit_log_configuration.rb", + "lib/workos/organizations/audit_log_configuration_log_stream.rb", + "lib/workos/organizations/audit_logs_retention.rb", + "lib/workos/organizations/organization.rb", + "lib/workos/organizations/organization_created.rb", + "lib/workos/organizations/organization_created_data.rb", + "lib/workos/organizations/organization_created_data_domain.rb", + "lib/workos/organizations/organization_deleted.rb", + "lib/workos/organizations/organization_deleted_data.rb", + "lib/workos/organizations/organization_deleted_data_domain.rb", + "lib/workos/organizations/organization_domain_data.rb", + "lib/workos/organizations/organization_input.rb", + "lib/workos/organizations/organization_membership_created.rb", + "lib/workos/organizations/organization_membership_created_data.rb", + "lib/workos/organizations/organization_membership_deleted.rb", + "lib/workos/organizations/organization_membership_deleted_data.rb", + "lib/workos/organizations/organization_membership_updated.rb", + "lib/workos/organizations/organization_membership_updated_data.rb", + "lib/workos/organizations/organization_role_created.rb", + "lib/workos/organizations/organization_role_created_data.rb", + "lib/workos/organizations/organization_role_deleted.rb", + "lib/workos/organizations/organization_role_deleted_data.rb", + "lib/workos/organizations/organization_role_updated.rb", + "lib/workos/organizations/organization_role_updated_data.rb", + "lib/workos/organizations/organization_updated.rb", + "lib/workos/organizations/organization_updated_data.rb", + "lib/workos/organizations/organization_updated_data_domain.rb", + "lib/workos/organizations/update_audit_logs_retention.rb", + "lib/workos/organizations/update_organization.rb", + "lib/workos/pipes.rb", + "lib/workos/pipes/connected_account.rb", + "lib/workos/pipes/data_integration_access_token_response.rb", + "lib/workos/pipes/data_integration_access_token_response_access_token.rb", + "lib/workos/pipes/data_integration_authorize_url_response.rb", + "lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb", + "lib/workos/pipes/data_integrations_get_user_token_request.rb", + "lib/workos/pipes/data_integrations_list_response.rb", + "lib/workos/pipes/data_integrations_list_response_data.rb", + "lib/workos/pipes/data_integrations_list_response_data_connected_account.rb", + "lib/workos/radar.rb", + "lib/workos/radar/radar_list_entry_already_present_response.rb", + "lib/workos/radar/radar_standalone_assess_request.rb", + "lib/workos/radar/radar_standalone_delete_radar_list_entry_request.rb", + "lib/workos/radar/radar_standalone_response.rb", + "lib/workos/radar/radar_standalone_update_radar_attempt_request.rb", + "lib/workos/radar/radar_standalone_update_radar_list_request.rb", + "lib/workos/shared/event_context.rb", + "lib/workos/shared/event_context_actor.rb", + "lib/workos/shared/event_context_google_analytics_session.rb", + "lib/workos/shared/group.rb", + "lib/workos/shared/group_created.rb", + "lib/workos/shared/group_deleted.rb", + "lib/workos/shared/group_member_added.rb", + "lib/workos/shared/group_member_added_data.rb", + "lib/workos/shared/group_member_removed.rb", + "lib/workos/shared/group_member_removed_data.rb", + "lib/workos/shared/group_updated.rb", + "lib/workos/sso.rb", + "lib/workos/sso/connection.rb", + "lib/workos/sso/connection_activated.rb", + "lib/workos/sso/connection_activated_data.rb", + "lib/workos/sso/connection_activated_data_domain.rb", + "lib/workos/sso/connection_deactivated.rb", + "lib/workos/sso/connection_deactivated_data.rb", + "lib/workos/sso/connection_deactivated_data_domain.rb", + "lib/workos/sso/connection_deleted.rb", + "lib/workos/sso/connection_deleted_data.rb", + "lib/workos/sso/connection_domain.rb", + "lib/workos/sso/connection_option.rb", + "lib/workos/sso/connection_saml_certificate_renewal_required.rb", + "lib/workos/sso/connection_saml_certificate_renewal_required_data.rb", + "lib/workos/sso/connection_saml_certificate_renewal_required_data_certificate.rb", + "lib/workos/sso/connection_saml_certificate_renewal_required_data_connection.rb", + "lib/workos/sso/connection_saml_certificate_renewed.rb", + "lib/workos/sso/connection_saml_certificate_renewed_data.rb", + "lib/workos/sso/connection_saml_certificate_renewed_data_certificate.rb", + "lib/workos/sso/connection_saml_certificate_renewed_data_connection.rb", + "lib/workos/sso/profile.rb", + "lib/workos/sso/sso_authorize_url_response.rb", + "lib/workos/sso/sso_logout_authorize_request.rb", + "lib/workos/sso/sso_logout_authorize_response.rb", + "lib/workos/sso/sso_token_response.rb", + "lib/workos/sso/sso_token_response_oauth_token.rb", + "lib/workos/sso/token_query.rb", + "lib/workos/types/applications_order.rb", + "lib/workos/types/audit_log_configuration_log_stream_state.rb", + "lib/workos/types/audit_log_configuration_log_stream_type.rb", + "lib/workos/types/audit_log_configuration_state.rb", + "lib/workos/types/audit_log_export_state.rb", + "lib/workos/types/audit_logs_order.rb", + "lib/workos/types/authenticate_response_authentication_method.rb", + "lib/workos/types/authentication_factor_enrolled_type.rb", + "lib/workos/types/authentication_factor_type.rb", + "lib/workos/types/authentication_factors_create_request_type.rb", + "lib/workos/types/authentication_radar_risk_detected_data_action.rb", + "lib/workos/types/authorization_assignment.rb", + "lib/workos/types/authorization_order.rb", + "lib/workos/types/connected_account_state.rb", + "lib/workos/types/connection_activated_data_connection_type.rb", + "lib/workos/types/connection_activated_data_state.rb", + "lib/workos/types/connection_activated_data_status.rb", + "lib/workos/types/connection_deactivated_data_connection_type.rb", + "lib/workos/types/connection_deactivated_data_state.rb", + "lib/workos/types/connection_deactivated_data_status.rb", + "lib/workos/types/connection_deleted_data_connection_type.rb", + "lib/workos/types/connection_deleted_data_state.rb", + "lib/workos/types/connection_saml_certificate_renewal_required_data_certificate_certificate_type.rb", + "lib/workos/types/connection_saml_certificate_renewed_data_certificate_certificate_type.rb", + "lib/workos/types/connection_state.rb", + "lib/workos/types/connection_status.rb", + "lib/workos/types/connection_type.rb", + "lib/workos/types/connections_connection_type.rb", + "lib/workos/types/connections_order.rb", + "lib/workos/types/create_user_invite_options_locale.rb", + "lib/workos/types/create_user_password_hash_type.rb", + "lib/workos/types/create_webhook_endpoint_events.rb", + "lib/workos/types/data_integration_access_token_response_error.rb", + "lib/workos/types/data_integrations_list_response_data_connected_account_state.rb", + "lib/workos/types/data_integrations_list_response_data_ownership.rb", + "lib/workos/types/directories_order.rb", + "lib/workos/types/directory_groups_order.rb", + "lib/workos/types/directory_state.rb", + "lib/workos/types/directory_type.rb", + "lib/workos/types/directory_user_state.rb", + "lib/workos/types/directory_user_with_groups_state.rb", + "lib/workos/types/directory_users_order.rb", + "lib/workos/types/dsync_activated_data_state.rb", + "lib/workos/types/dsync_activated_data_type.rb", + "lib/workos/types/dsync_deactivated_data_state.rb", + "lib/workos/types/dsync_deactivated_data_type.rb", + "lib/workos/types/dsync_deleted_data_state.rb", + "lib/workos/types/dsync_deleted_data_type.rb", + "lib/workos/types/dsync_user_updated_data_state.rb", + "lib/workos/types/event_context_actor_source.rb", + "lib/workos/types/events_order.rb", + "lib/workos/types/feature_flags_order.rb", + "lib/workos/types/flag_created_context_actor_source.rb", + "lib/workos/types/flag_deleted_context_actor_source.rb", + "lib/workos/types/flag_rule_updated_context_access_type.rb", + "lib/workos/types/flag_rule_updated_context_actor_source.rb", + "lib/workos/types/flag_rule_updated_context_previous_attribute_context_access_type.rb", + "lib/workos/types/flag_updated_context_actor_source.rb", + "lib/workos/types/generate_link_intent.rb", + "lib/workos/types/invitation_accepted_data_state.rb", + "lib/workos/types/invitation_created_data_state.rb", + "lib/workos/types/invitation_resent_data_state.rb", + "lib/workos/types/invitation_revoked_data_state.rb", + "lib/workos/types/invitation_state.rb", + "lib/workos/types/organization_created_data_domain_state.rb", + "lib/workos/types/organization_created_data_domain_verification_strategy.rb", + "lib/workos/types/organization_deleted_data_domain_state.rb", + "lib/workos/types/organization_deleted_data_domain_verification_strategy.rb", + "lib/workos/types/organization_domain_created_data_state.rb", + "lib/workos/types/organization_domain_created_data_verification_strategy.rb", + "lib/workos/types/organization_domain_data_state.rb", + "lib/workos/types/organization_domain_deleted_data_state.rb", + "lib/workos/types/organization_domain_deleted_data_verification_strategy.rb", + "lib/workos/types/organization_domain_stand_alone_state.rb", + "lib/workos/types/organization_domain_stand_alone_verification_strategy.rb", + "lib/workos/types/organization_domain_state.rb", + "lib/workos/types/organization_domain_updated_data_state.rb", + "lib/workos/types/organization_domain_updated_data_verification_strategy.rb", + "lib/workos/types/organization_domain_verification_failed_data_organization_domain_state.rb", + "lib/workos/types/organization_domain_verification_failed_data_organization_domain_verification_strategy.rb", + "lib/workos/types/organization_domain_verification_failed_data_reason.rb", + "lib/workos/types/organization_domain_verification_strategy.rb", + "lib/workos/types/organization_domain_verified_data_state.rb", + "lib/workos/types/organization_domain_verified_data_verification_strategy.rb", + "lib/workos/types/organization_membership_created_data_status.rb", + "lib/workos/types/organization_membership_deleted_data_status.rb", + "lib/workos/types/organization_membership_status.rb", + "lib/workos/types/organization_membership_updated_data_status.rb", + "lib/workos/types/organization_updated_data_domain_state.rb", + "lib/workos/types/organization_updated_data_domain_verification_strategy.rb", + "lib/workos/types/organizations_api_keys_order.rb", + "lib/workos/types/organizations_feature_flags_order.rb", + "lib/workos/types/organizations_order.rb", + "lib/workos/types/permissions_order.rb", + "lib/workos/types/profile_connection_type.rb", + "lib/workos/types/radar_action.rb", + "lib/workos/types/radar_standalone_assess_request_action.rb", + "lib/workos/types/radar_standalone_assess_request_auth_method.rb", + "lib/workos/types/radar_standalone_response_blocklist_type.rb", + "lib/workos/types/radar_standalone_response_control.rb", + "lib/workos/types/radar_standalone_response_verdict.rb", + "lib/workos/types/radar_type.rb", + "lib/workos/types/resend_user_invite_options_locale.rb", + "lib/workos/types/role_type.rb", + "lib/workos/types/session_created_data_auth_method.rb", + "lib/workos/types/session_created_data_status.rb", + "lib/workos/types/session_revoked_data_auth_method.rb", + "lib/workos/types/session_revoked_data_status.rb", + "lib/workos/types/sso_provider.rb", + "lib/workos/types/update_user_password_hash_type.rb", + "lib/workos/types/update_webhook_endpoint_events.rb", + "lib/workos/types/update_webhook_endpoint_status.rb", + "lib/workos/types/user_identities_get_item_provider.rb", + "lib/workos/types/user_invite_state.rb", + "lib/workos/types/user_management_authentication_provider.rb", + "lib/workos/types/user_management_authentication_screen_hint.rb", + "lib/workos/types/user_management_invitations_order.rb", + "lib/workos/types/user_management_multi_factor_authentication_order.rb", + "lib/workos/types/user_management_organization_membership_order.rb", + "lib/workos/types/user_management_organization_membership_statuses.rb", + "lib/workos/types/user_management_users_authorized_applications_order.rb", + "lib/workos/types/user_management_users_feature_flags_order.rb", + "lib/workos/types/user_management_users_order.rb", + "lib/workos/types/user_organization_membership_base_list_data_status.rb", + "lib/workos/types/user_organization_membership_status.rb", + "lib/workos/types/user_sessions_auth_method.rb", + "lib/workos/types/user_sessions_status.rb", + "lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb", + "lib/workos/types/vault_data_created_data_actor_source.rb", + "lib/workos/types/vault_data_deleted_data_actor_source.rb", + "lib/workos/types/vault_data_read_data_actor_source.rb", + "lib/workos/types/vault_data_updated_data_actor_source.rb", + "lib/workos/types/vault_dek_decrypted_data_actor_source.rb", + "lib/workos/types/vault_dek_read_data_actor_source.rb", + "lib/workos/types/vault_kek_created_data_actor_source.rb", + "lib/workos/types/vault_metadata_read_data_actor_source.rb", + "lib/workos/types/vault_names_listed_data_actor_source.rb", + "lib/workos/types/webhook_endpoint_status.rb", + "lib/workos/types/webhooks_order.rb", + "lib/workos/types/widget_session_token_scopes.rb", + "lib/workos/user_management.rb", + "lib/workos/user_management/action_authentication_denied.rb", + "lib/workos/user_management/action_authentication_denied_data.rb", + "lib/workos/user_management/action_user_registration_denied.rb", + "lib/workos/user_management/action_user_registration_denied_data.rb", + "lib/workos/user_management/authenticate_response.rb", + "lib/workos/user_management/authenticate_response_impersonator.rb", + "lib/workos/user_management/authenticate_response_oauth_token.rb", + "lib/workos/user_management/authentication_email_verification_failed.rb", + "lib/workos/user_management/authentication_email_verification_failed_data.rb", + "lib/workos/user_management/authentication_email_verification_failed_data_error.rb", + "lib/workos/user_management/authentication_email_verification_succeeded.rb", + "lib/workos/user_management/authentication_email_verification_succeeded_data.rb", + "lib/workos/user_management/authentication_magic_auth_failed.rb", + "lib/workos/user_management/authentication_magic_auth_failed_data.rb", + "lib/workos/user_management/authentication_magic_auth_failed_data_error.rb", + "lib/workos/user_management/authentication_magic_auth_succeeded.rb", + "lib/workos/user_management/authentication_magic_auth_succeeded_data.rb", + "lib/workos/user_management/authentication_mfa_failed.rb", + "lib/workos/user_management/authentication_mfa_failed_data.rb", + "lib/workos/user_management/authentication_mfa_failed_data_error.rb", + "lib/workos/user_management/authentication_mfa_succeeded.rb", + "lib/workos/user_management/authentication_mfa_succeeded_data.rb", + "lib/workos/user_management/authentication_oauth_failed.rb", + "lib/workos/user_management/authentication_oauth_failed_data.rb", + "lib/workos/user_management/authentication_oauth_failed_data_error.rb", + "lib/workos/user_management/authentication_oauth_succeeded.rb", + "lib/workos/user_management/authentication_oauth_succeeded_data.rb", + "lib/workos/user_management/authentication_passkey_failed.rb", + "lib/workos/user_management/authentication_passkey_failed_data.rb", + "lib/workos/user_management/authentication_passkey_failed_data_error.rb", + "lib/workos/user_management/authentication_passkey_succeeded.rb", + "lib/workos/user_management/authentication_passkey_succeeded_data.rb", + "lib/workos/user_management/authentication_password_failed.rb", + "lib/workos/user_management/authentication_password_failed_data.rb", + "lib/workos/user_management/authentication_password_failed_data_error.rb", + "lib/workos/user_management/authentication_password_succeeded.rb", + "lib/workos/user_management/authentication_password_succeeded_data.rb", + "lib/workos/user_management/authentication_radar_risk_detected.rb", + "lib/workos/user_management/authentication_radar_risk_detected_data.rb", + "lib/workos/user_management/authentication_sso_failed.rb", + "lib/workos/user_management/authentication_sso_failed_data.rb", + "lib/workos/user_management/authentication_sso_failed_data_error.rb", + "lib/workos/user_management/authentication_sso_failed_data_sso.rb", + "lib/workos/user_management/authentication_sso_started.rb", + "lib/workos/user_management/authentication_sso_started_data.rb", + "lib/workos/user_management/authentication_sso_started_data_sso.rb", + "lib/workos/user_management/authentication_sso_succeeded.rb", + "lib/workos/user_management/authentication_sso_succeeded_data.rb", + "lib/workos/user_management/authentication_sso_succeeded_data_sso.rb", + "lib/workos/user_management/authentication_sso_timed_out.rb", + "lib/workos/user_management/authentication_sso_timed_out_data.rb", + "lib/workos/user_management/authentication_sso_timed_out_data_error.rb", + "lib/workos/user_management/authentication_sso_timed_out_data_sso.rb", + "lib/workos/user_management/authorization_code_session_authenticate_request.rb", + "lib/workos/user_management/authorized_connect_application_list_data.rb", + "lib/workos/user_management/confirm_email_change.rb", + "lib/workos/user_management/cors_origin_response.rb", + "lib/workos/user_management/create_cors_origin.rb", + "lib/workos/user_management/create_magic_code_and_return.rb", + "lib/workos/user_management/create_password_reset.rb", + "lib/workos/user_management/create_password_reset_token.rb", + "lib/workos/user_management/create_redirect_uri.rb", + "lib/workos/user_management/create_user.rb", + "lib/workos/user_management/create_user_invite_options.rb", + "lib/workos/user_management/create_user_organization_membership.rb", + "lib/workos/user_management/device_authorization_response.rb", + "lib/workos/user_management/device_code_session_authenticate_request.rb", + "lib/workos/user_management/email_change.rb", + "lib/workos/user_management/email_change_confirmation.rb", + "lib/workos/user_management/email_change_confirmation_user.rb", + "lib/workos/user_management/email_verification.rb", + "lib/workos/user_management/email_verification_code_session_authenticate_request.rb", + "lib/workos/user_management/email_verification_created.rb", + "lib/workos/user_management/email_verification_created_data.rb", + "lib/workos/user_management/invitation.rb", + "lib/workos/user_management/invitation_accepted.rb", + "lib/workos/user_management/invitation_accepted_data.rb", + "lib/workos/user_management/invitation_created.rb", + "lib/workos/user_management/invitation_created_data.rb", + "lib/workos/user_management/invitation_resent.rb", + "lib/workos/user_management/invitation_resent_data.rb", + "lib/workos/user_management/invitation_revoked.rb", + "lib/workos/user_management/invitation_revoked_data.rb", + "lib/workos/user_management/jwks_response.rb", + "lib/workos/user_management/jwks_response_keys.rb", + "lib/workos/user_management/jwt_template_response.rb", + "lib/workos/user_management/magic_auth.rb", + "lib/workos/user_management/magic_auth_code_session_authenticate_request.rb", + "lib/workos/user_management/magic_auth_created.rb", + "lib/workos/user_management/magic_auth_created_data.rb", + "lib/workos/user_management/mfa_totp_session_authenticate_request.rb", + "lib/workos/user_management/organization_membership.rb", + "lib/workos/user_management/organization_selection_session_authenticate_request.rb", + "lib/workos/user_management/password_reset.rb", + "lib/workos/user_management/password_reset_created.rb", + "lib/workos/user_management/password_reset_created_data.rb", + "lib/workos/user_management/password_reset_succeeded.rb", + "lib/workos/user_management/password_reset_succeeded_data.rb", + "lib/workos/user_management/password_session_authenticate_request.rb", + "lib/workos/user_management/redirect_uri.rb", + "lib/workos/user_management/refresh_token_session_authenticate_request.rb", + "lib/workos/user_management/resend_user_invite_options.rb", + "lib/workos/user_management/reset_password_response.rb", + "lib/workos/user_management/revoke_session.rb", + "lib/workos/user_management/send_email_change.rb", + "lib/workos/user_management/send_verification_email_response.rb", + "lib/workos/user_management/session_created.rb", + "lib/workos/user_management/session_created_data.rb", + "lib/workos/user_management/session_created_data_impersonator.rb", + "lib/workos/user_management/session_revoked.rb", + "lib/workos/user_management/session_revoked_data.rb", + "lib/workos/user_management/session_revoked_data_impersonator.rb", + "lib/workos/user_management/sso_device_authorization_request.rb", + "lib/workos/user_management/update_jwt_template.rb", + "lib/workos/user_management/update_user.rb", + "lib/workos/user_management/update_user_organization_membership.rb", + "lib/workos/user_management/user.rb", + "lib/workos/user_management/user_created.rb", + "lib/workos/user_management/user_deleted.rb", + "lib/workos/user_management/user_identities_get_item.rb", + "lib/workos/user_management/user_invite.rb", + "lib/workos/user_management/user_organization_membership.rb", + "lib/workos/user_management/user_sessions_impersonator.rb", + "lib/workos/user_management/user_sessions_list_item.rb", + "lib/workos/user_management/user_updated.rb", + "lib/workos/user_management/verify_email_address.rb", + "lib/workos/user_management/verify_email_response.rb", + "lib/workos/vault/vault_byok_key_verification_completed.rb", + "lib/workos/vault/vault_byok_key_verification_completed_data.rb", + "lib/workos/vault/vault_data_created.rb", + "lib/workos/vault/vault_data_created_data.rb", + "lib/workos/vault/vault_data_deleted.rb", + "lib/workos/vault/vault_data_deleted_data.rb", + "lib/workos/vault/vault_data_read.rb", + "lib/workos/vault/vault_data_read_data.rb", + "lib/workos/vault/vault_data_updated.rb", + "lib/workos/vault/vault_data_updated_data.rb", + "lib/workos/vault/vault_dek_decrypted.rb", + "lib/workos/vault/vault_dek_decrypted_data.rb", + "lib/workos/vault/vault_dek_read.rb", + "lib/workos/vault/vault_dek_read_data.rb", + "lib/workos/vault/vault_kek_created.rb", + "lib/workos/vault/vault_kek_created_data.rb", + "lib/workos/vault/vault_metadata_read.rb", + "lib/workos/vault/vault_metadata_read_data.rb", + "lib/workos/vault/vault_names_listed.rb", + "lib/workos/vault/vault_names_listed_data.rb", + "lib/workos/webhooks.rb", + "lib/workos/webhooks/create_webhook_endpoint.rb", + "lib/workos/webhooks/update_webhook_endpoint.rb", + "lib/workos/webhooks/webhook_endpoint.rb", + "lib/workos/widgets.rb", + "lib/workos/widgets/widget_session_token.rb", + "lib/workos/widgets/widget_session_token_response.rb", + "rbi/workos/action_authentication_denied.rbi", + "rbi/workos/action_authentication_denied_data.rbi", + "rbi/workos/action_user_registration_denied.rbi", + "rbi/workos/action_user_registration_denied_data.rbi", + "rbi/workos/add_role_permission.rbi", + "rbi/workos/admin_portal.rbi", + "rbi/workos/api_key.rbi", + "rbi/workos/api_key_created.rbi", + "rbi/workos/api_key_created_data.rbi", + "rbi/workos/api_key_created_data_owner.rbi", + "rbi/workos/api_key_owner.rbi", + "rbi/workos/api_key_revoked.rbi", + "rbi/workos/api_key_revoked_data.rbi", + "rbi/workos/api_key_revoked_data_owner.rbi", + "rbi/workos/api_key_validation_response.rbi", + "rbi/workos/api_key_with_value.rbi", + "rbi/workos/api_key_with_value_owner.rbi", + "rbi/workos/api_keys.rbi", + "rbi/workos/application_credentials_list_item.rbi", + "rbi/workos/assign_role.rbi", + "rbi/workos/audit_log_action.rbi", + "rbi/workos/audit_log_configuration.rbi", + "rbi/workos/audit_log_configuration_log_stream.rbi", + "rbi/workos/audit_log_event.rbi", + "rbi/workos/audit_log_event_actor.rbi", + "rbi/workos/audit_log_event_context.rbi", + "rbi/workos/audit_log_event_create_response.rbi", + "rbi/workos/audit_log_event_ingestion.rbi", + "rbi/workos/audit_log_event_target.rbi", + "rbi/workos/audit_log_export.rbi", + "rbi/workos/audit_log_export_creation.rbi", + "rbi/workos/audit_log_schema.rbi", + "rbi/workos/audit_log_schema_actor.rbi", + "rbi/workos/audit_log_schema_target.rbi", + "rbi/workos/audit_logs.rbi", + "rbi/workos/audit_logs_retention.rbi", + "rbi/workos/authenticate_response.rbi", + "rbi/workos/authenticate_response_impersonator.rbi", + "rbi/workos/authenticate_response_oauth_token.rbi", + "rbi/workos/authentication_challenge.rbi", + "rbi/workos/authentication_challenge_verify_response.rbi", + "rbi/workos/authentication_challenges_verify_request.rbi", + "rbi/workos/authentication_email_verification_failed.rbi", + "rbi/workos/authentication_email_verification_failed_data.rbi", + "rbi/workos/authentication_email_verification_failed_data_error.rbi", + "rbi/workos/authentication_email_verification_succeeded.rbi", + "rbi/workos/authentication_email_verification_succeeded_data.rbi", + "rbi/workos/authentication_factor.rbi", + "rbi/workos/authentication_factor_enrolled.rbi", + "rbi/workos/authentication_factor_enrolled_sms.rbi", + "rbi/workos/authentication_factor_enrolled_totp.rbi", + "rbi/workos/authentication_factor_sms.rbi", + "rbi/workos/authentication_factor_totp.rbi", + "rbi/workos/authentication_factors_create_request.rbi", + "rbi/workos/authentication_magic_auth_failed.rbi", + "rbi/workos/authentication_magic_auth_failed_data.rbi", + "rbi/workos/authentication_magic_auth_failed_data_error.rbi", + "rbi/workos/authentication_magic_auth_succeeded.rbi", + "rbi/workos/authentication_magic_auth_succeeded_data.rbi", + "rbi/workos/authentication_mfa_failed.rbi", + "rbi/workos/authentication_mfa_failed_data.rbi", + "rbi/workos/authentication_mfa_failed_data_error.rbi", + "rbi/workos/authentication_mfa_succeeded.rbi", + "rbi/workos/authentication_mfa_succeeded_data.rbi", + "rbi/workos/authentication_oauth_failed.rbi", + "rbi/workos/authentication_oauth_failed_data.rbi", + "rbi/workos/authentication_oauth_failed_data_error.rbi", + "rbi/workos/authentication_oauth_succeeded.rbi", + "rbi/workos/authentication_oauth_succeeded_data.rbi", + "rbi/workos/authentication_passkey_failed.rbi", + "rbi/workos/authentication_passkey_failed_data.rbi", + "rbi/workos/authentication_passkey_failed_data_error.rbi", + "rbi/workos/authentication_passkey_succeeded.rbi", + "rbi/workos/authentication_passkey_succeeded_data.rbi", + "rbi/workos/authentication_password_failed.rbi", + "rbi/workos/authentication_password_failed_data.rbi", + "rbi/workos/authentication_password_failed_data_error.rbi", + "rbi/workos/authentication_password_succeeded.rbi", + "rbi/workos/authentication_password_succeeded_data.rbi", + "rbi/workos/authentication_radar_risk_detected.rbi", + "rbi/workos/authentication_radar_risk_detected_data.rbi", + "rbi/workos/authentication_sso_failed.rbi", + "rbi/workos/authentication_sso_failed_data.rbi", + "rbi/workos/authentication_sso_failed_data_error.rbi", + "rbi/workos/authentication_sso_failed_data_sso.rbi", + "rbi/workos/authentication_sso_started.rbi", + "rbi/workos/authentication_sso_started_data.rbi", + "rbi/workos/authentication_sso_started_data_sso.rbi", + "rbi/workos/authentication_sso_succeeded.rbi", + "rbi/workos/authentication_sso_succeeded_data.rbi", + "rbi/workos/authentication_sso_succeeded_data_sso.rbi", + "rbi/workos/authentication_sso_timed_out.rbi", + "rbi/workos/authentication_sso_timed_out_data.rbi", + "rbi/workos/authentication_sso_timed_out_data_error.rbi", + "rbi/workos/authentication_sso_timed_out_data_sso.rbi", + "rbi/workos/authorization.rbi", + "rbi/workos/authorization_check.rbi", + "rbi/workos/authorization_code_session_authenticate_request.rbi", + "rbi/workos/authorization_permission.rbi", + "rbi/workos/authorization_resource.rbi", + "rbi/workos/authorized_connect_application_list_data.rbi", + "rbi/workos/challenge_authentication_factor.rbi", + "rbi/workos/check_authorization.rbi", + "rbi/workos/client.rbi", + "rbi/workos/confirm_email_change.rbi", + "rbi/workos/connect.rbi", + "rbi/workos/connect_application.rbi", + "rbi/workos/connected_account.rbi", + "rbi/workos/connection.rbi", + "rbi/workos/connection_activated.rbi", + "rbi/workos/connection_activated_data.rbi", + "rbi/workos/connection_activated_data_domain.rbi", + "rbi/workos/connection_deactivated.rbi", + "rbi/workos/connection_deactivated_data.rbi", + "rbi/workos/connection_deactivated_data_domain.rbi", + "rbi/workos/connection_deleted.rbi", + "rbi/workos/connection_deleted_data.rbi", + "rbi/workos/connection_domain.rbi", + "rbi/workos/connection_option.rbi", + "rbi/workos/connection_saml_certificate_renewal_required.rbi", + "rbi/workos/connection_saml_certificate_renewal_required_data.rbi", + "rbi/workos/connection_saml_certificate_renewal_required_data_certificate.rbi", + "rbi/workos/connection_saml_certificate_renewal_required_data_connection.rbi", + "rbi/workos/connection_saml_certificate_renewed.rbi", + "rbi/workos/connection_saml_certificate_renewed_data.rbi", + "rbi/workos/connection_saml_certificate_renewed_data_certificate.rbi", + "rbi/workos/connection_saml_certificate_renewed_data_connection.rbi", + "rbi/workos/cors_origin_response.rbi", + "rbi/workos/create_application_secret.rbi", + "rbi/workos/create_authorization_permission.rbi", + "rbi/workos/create_authorization_resource.rbi", + "rbi/workos/create_cors_origin.rbi", + "rbi/workos/create_m2m_application.rbi", + "rbi/workos/create_magic_code_and_return.rbi", + "rbi/workos/create_oauth_application.rbi", + "rbi/workos/create_organization_api_key.rbi", + "rbi/workos/create_organization_domain.rbi", + "rbi/workos/create_organization_role.rbi", + "rbi/workos/create_password_reset.rbi", + "rbi/workos/create_password_reset_token.rbi", + "rbi/workos/create_redirect_uri.rbi", + "rbi/workos/create_role.rbi", + "rbi/workos/create_user.rbi", + "rbi/workos/create_user_invite_options.rbi", + "rbi/workos/create_user_organization_membership.rbi", + "rbi/workos/create_webhook_endpoint.rbi", + "rbi/workos/data_integration_access_token_response.rbi", + "rbi/workos/data_integration_access_token_response_access_token.rbi", + "rbi/workos/data_integration_authorize_url_response.rbi", + "rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi", + "rbi/workos/data_integrations_get_user_token_request.rbi", + "rbi/workos/data_integrations_list_response.rbi", + "rbi/workos/data_integrations_list_response_data.rbi", + "rbi/workos/data_integrations_list_response_data_connected_account.rbi", + "rbi/workos/device_authorization_response.rbi", + "rbi/workos/device_code_session_authenticate_request.rbi", + "rbi/workos/directory.rbi", + "rbi/workos/directory_group.rbi", + "rbi/workos/directory_metadata.rbi", + "rbi/workos/directory_metadata_user.rbi", + "rbi/workos/directory_sync.rbi", + "rbi/workos/directory_user.rbi", + "rbi/workos/directory_user_email.rbi", + "rbi/workos/directory_user_with_groups.rbi", + "rbi/workos/directory_user_with_groups_email.rbi", + "rbi/workos/dsync_activated.rbi", + "rbi/workos/dsync_activated_data.rbi", + "rbi/workos/dsync_activated_data_domain.rbi", + "rbi/workos/dsync_deactivated.rbi", + "rbi/workos/dsync_deactivated_data.rbi", + "rbi/workos/dsync_deactivated_data_domain.rbi", + "rbi/workos/dsync_deleted.rbi", + "rbi/workos/dsync_deleted_data.rbi", + "rbi/workos/dsync_group_created.rbi", + "rbi/workos/dsync_group_deleted.rbi", + "rbi/workos/dsync_group_updated.rbi", + "rbi/workos/dsync_group_updated_data.rbi", + "rbi/workos/dsync_group_user_added.rbi", + "rbi/workos/dsync_group_user_added_data.rbi", + "rbi/workos/dsync_group_user_removed.rbi", + "rbi/workos/dsync_group_user_removed_data.rbi", + "rbi/workos/dsync_user_created.rbi", + "rbi/workos/dsync_user_deleted.rbi", + "rbi/workos/dsync_user_updated.rbi", + "rbi/workos/dsync_user_updated_data.rbi", + "rbi/workos/dsync_user_updated_data_email.rbi", + "rbi/workos/email_change.rbi", + "rbi/workos/email_change_confirmation.rbi", + "rbi/workos/email_change_confirmation_user.rbi", + "rbi/workos/email_verification.rbi", + "rbi/workos/email_verification_code_session_authenticate_request.rbi", + "rbi/workos/email_verification_created.rbi", + "rbi/workos/email_verification_created_data.rbi", + "rbi/workos/enroll_user_authentication_factor.rbi", + "rbi/workos/event_context.rbi", + "rbi/workos/event_context_actor.rbi", + "rbi/workos/event_context_google_analytics_session.rbi", + "rbi/workos/event_list_list_metadata.rbi", + "rbi/workos/event_schema.rbi", + "rbi/workos/events.rbi", + "rbi/workos/external_auth_complete_response.rbi", + "rbi/workos/feature_flag.rbi", + "rbi/workos/feature_flag_owner.rbi", + "rbi/workos/feature_flags.rbi", + "rbi/workos/flag.rbi", + "rbi/workos/flag_created.rbi", + "rbi/workos/flag_created_context.rbi", + "rbi/workos/flag_created_context_actor.rbi", + "rbi/workos/flag_created_data.rbi", + "rbi/workos/flag_created_data_owner.rbi", + "rbi/workos/flag_deleted.rbi", + "rbi/workos/flag_deleted_context.rbi", + "rbi/workos/flag_deleted_context_actor.rbi", + "rbi/workos/flag_deleted_data.rbi", + "rbi/workos/flag_deleted_data_owner.rbi", + "rbi/workos/flag_owner.rbi", + "rbi/workos/flag_rule_updated.rbi", + "rbi/workos/flag_rule_updated_context.rbi", + "rbi/workos/flag_rule_updated_context_actor.rbi", + "rbi/workos/flag_rule_updated_context_configured_target.rbi", + "rbi/workos/flag_rule_updated_context_configured_target_organization.rbi", + "rbi/workos/flag_rule_updated_context_configured_target_user.rbi", + "rbi/workos/flag_rule_updated_context_previous_attribute.rbi", + "rbi/workos/flag_rule_updated_context_previous_attribute_context.rbi", + "rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target.rbi", + "rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rbi", + "rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_user.rbi", + "rbi/workos/flag_rule_updated_context_previous_attribute_data.rbi", + "rbi/workos/flag_rule_updated_data.rbi", + "rbi/workos/flag_rule_updated_data_owner.rbi", + "rbi/workos/flag_updated.rbi", + "rbi/workos/flag_updated_context.rbi", + "rbi/workos/flag_updated_context_actor.rbi", + "rbi/workos/flag_updated_context_previous_attribute.rbi", + "rbi/workos/flag_updated_context_previous_attribute_data.rbi", + "rbi/workos/flag_updated_data.rbi", + "rbi/workos/flag_updated_data_owner.rbi", + "rbi/workos/generate_link.rbi", + "rbi/workos/group.rbi", + "rbi/workos/group_created.rbi", + "rbi/workos/group_deleted.rbi", + "rbi/workos/group_member_added.rbi", + "rbi/workos/group_member_added_data.rbi", + "rbi/workos/group_member_removed.rbi", + "rbi/workos/group_member_removed_data.rbi", + "rbi/workos/group_updated.rbi", + "rbi/workos/intent_options.rbi", + "rbi/workos/invitation.rbi", + "rbi/workos/invitation_accepted.rbi", + "rbi/workos/invitation_accepted_data.rbi", + "rbi/workos/invitation_created.rbi", + "rbi/workos/invitation_created_data.rbi", + "rbi/workos/invitation_resent.rbi", + "rbi/workos/invitation_resent_data.rbi", + "rbi/workos/invitation_revoked.rbi", + "rbi/workos/invitation_revoked_data.rbi", + "rbi/workos/jwks_response.rbi", + "rbi/workos/jwks_response_keys.rbi", + "rbi/workos/jwt_template_response.rbi", + "rbi/workos/magic_auth.rbi", + "rbi/workos/magic_auth_code_session_authenticate_request.rbi", + "rbi/workos/magic_auth_created.rbi", + "rbi/workos/magic_auth_created_data.rbi", + "rbi/workos/mfa_totp_session_authenticate_request.rbi", + "rbi/workos/multi_factor_auth.rbi", + "rbi/workos/new_connect_application_secret.rbi", + "rbi/workos/organization.rbi", + "rbi/workos/organization_created.rbi", + "rbi/workos/organization_created_data.rbi", + "rbi/workos/organization_created_data_domain.rbi", + "rbi/workos/organization_deleted.rbi", + "rbi/workos/organization_deleted_data.rbi", + "rbi/workos/organization_deleted_data_domain.rbi", + "rbi/workos/organization_domain.rbi", + "rbi/workos/organization_domain_created.rbi", + "rbi/workos/organization_domain_created_data.rbi", + "rbi/workos/organization_domain_data.rbi", + "rbi/workos/organization_domain_deleted.rbi", + "rbi/workos/organization_domain_deleted_data.rbi", + "rbi/workos/organization_domain_stand_alone.rbi", + "rbi/workos/organization_domain_updated.rbi", + "rbi/workos/organization_domain_updated_data.rbi", + "rbi/workos/organization_domain_verification_failed.rbi", + "rbi/workos/organization_domain_verification_failed_data.rbi", + "rbi/workos/organization_domain_verification_failed_data_organization_domain.rbi", + "rbi/workos/organization_domain_verified.rbi", + "rbi/workos/organization_domain_verified_data.rbi", + "rbi/workos/organization_domains.rbi", + "rbi/workos/organization_input.rbi", + "rbi/workos/organization_membership.rbi", + "rbi/workos/organization_membership_created.rbi", + "rbi/workos/organization_membership_created_data.rbi", + "rbi/workos/organization_membership_deleted.rbi", + "rbi/workos/organization_membership_deleted_data.rbi", + "rbi/workos/organization_membership_updated.rbi", + "rbi/workos/organization_membership_updated_data.rbi", + "rbi/workos/organization_role_created.rbi", + "rbi/workos/organization_role_created_data.rbi", + "rbi/workos/organization_role_deleted.rbi", + "rbi/workos/organization_role_deleted_data.rbi", + "rbi/workos/organization_role_updated.rbi", + "rbi/workos/organization_role_updated_data.rbi", + "rbi/workos/organization_selection_session_authenticate_request.rbi", + "rbi/workos/organization_updated.rbi", + "rbi/workos/organization_updated_data.rbi", + "rbi/workos/organization_updated_data_domain.rbi", + "rbi/workos/organizations.rbi", + "rbi/workos/password_reset.rbi", + "rbi/workos/password_reset_created.rbi", + "rbi/workos/password_reset_created_data.rbi", + "rbi/workos/password_reset_succeeded.rbi", + "rbi/workos/password_reset_succeeded_data.rbi", + "rbi/workos/password_session_authenticate_request.rbi", + "rbi/workos/permission.rbi", + "rbi/workos/permission_created.rbi", + "rbi/workos/permission_created_data.rbi", + "rbi/workos/permission_deleted.rbi", + "rbi/workos/permission_deleted_data.rbi", + "rbi/workos/permission_updated.rbi", + "rbi/workos/permission_updated_data.rbi", + "rbi/workos/pipes.rbi", + "rbi/workos/portal_link_response.rbi", + "rbi/workos/profile.rbi", + "rbi/workos/radar.rbi", + "rbi/workos/radar_list_entry_already_present_response.rbi", + "rbi/workos/radar_standalone_assess_request.rbi", + "rbi/workos/radar_standalone_delete_radar_list_entry_request.rbi", + "rbi/workos/radar_standalone_response.rbi", + "rbi/workos/radar_standalone_update_radar_attempt_request.rbi", + "rbi/workos/radar_standalone_update_radar_list_request.rbi", + "rbi/workos/redirect_uri.rbi", + "rbi/workos/redirect_uri_input.rbi", + "rbi/workos/refresh_token_session_authenticate_request.rbi", + "rbi/workos/remove_role.rbi", + "rbi/workos/resend_user_invite_options.rbi", + "rbi/workos/reset_password_response.rbi", + "rbi/workos/revoke_session.rbi", + "rbi/workos/role.rbi", + "rbi/workos/role_assignment.rbi", + "rbi/workos/role_assignment_resource.rbi", + "rbi/workos/role_created.rbi", + "rbi/workos/role_created_data.rbi", + "rbi/workos/role_deleted.rbi", + "rbi/workos/role_deleted_data.rbi", + "rbi/workos/role_list.rbi", + "rbi/workos/role_updated.rbi", + "rbi/workos/role_updated_data.rbi", + "rbi/workos/send_email_change.rbi", + "rbi/workos/send_verification_email_response.rbi", + "rbi/workos/session_created.rbi", + "rbi/workos/session_created_data.rbi", + "rbi/workos/session_created_data_impersonator.rbi", + "rbi/workos/session_revoked.rbi", + "rbi/workos/session_revoked_data.rbi", + "rbi/workos/session_revoked_data_impersonator.rbi", + "rbi/workos/set_role_permissions.rbi", + "rbi/workos/slim_role.rbi", + "rbi/workos/sso.rbi", + "rbi/workos/sso_authorize_url_response.rbi", + "rbi/workos/sso_device_authorization_request.rbi", + "rbi/workos/sso_intent_options.rbi", + "rbi/workos/sso_logout_authorize_request.rbi", + "rbi/workos/sso_logout_authorize_response.rbi", + "rbi/workos/sso_token_response.rbi", + "rbi/workos/sso_token_response_oauth_token.rbi", + "rbi/workos/token_query.rbi", + "rbi/workos/update_audit_logs_retention.rbi", + "rbi/workos/update_authorization_permission.rbi", + "rbi/workos/update_authorization_resource.rbi", + "rbi/workos/update_jwt_template.rbi", + "rbi/workos/update_oauth_application.rbi", + "rbi/workos/update_organization.rbi", + "rbi/workos/update_organization_role.rbi", + "rbi/workos/update_role.rbi", + "rbi/workos/update_user.rbi", + "rbi/workos/update_user_organization_membership.rbi", + "rbi/workos/update_webhook_endpoint.rbi", + "rbi/workos/user.rbi", + "rbi/workos/user_authentication_factor_enroll_response.rbi", + "rbi/workos/user_consent_option.rbi", + "rbi/workos/user_consent_option_choice.rbi", + "rbi/workos/user_created.rbi", + "rbi/workos/user_deleted.rbi", + "rbi/workos/user_identities_get_item.rbi", + "rbi/workos/user_invite.rbi", + "rbi/workos/user_management.rbi", + "rbi/workos/user_management_login_request.rbi", + "rbi/workos/user_object.rbi", + "rbi/workos/user_organization_membership.rbi", + "rbi/workos/user_organization_membership_base_list_data.rbi", + "rbi/workos/user_sessions_impersonator.rbi", + "rbi/workos/user_sessions_list_item.rbi", + "rbi/workos/user_updated.rbi", + "rbi/workos/validate_api_key.rbi", + "rbi/workos/vault_byok_key_verification_completed.rbi", + "rbi/workos/vault_byok_key_verification_completed_data.rbi", + "rbi/workos/vault_data_created.rbi", + "rbi/workos/vault_data_created_data.rbi", + "rbi/workos/vault_data_deleted.rbi", + "rbi/workos/vault_data_deleted_data.rbi", + "rbi/workos/vault_data_read.rbi", + "rbi/workos/vault_data_read_data.rbi", + "rbi/workos/vault_data_updated.rbi", + "rbi/workos/vault_data_updated_data.rbi", + "rbi/workos/vault_dek_decrypted.rbi", + "rbi/workos/vault_dek_decrypted_data.rbi", + "rbi/workos/vault_dek_read.rbi", + "rbi/workos/vault_dek_read_data.rbi", + "rbi/workos/vault_kek_created.rbi", + "rbi/workos/vault_kek_created_data.rbi", + "rbi/workos/vault_metadata_read.rbi", + "rbi/workos/vault_metadata_read_data.rbi", + "rbi/workos/vault_names_listed.rbi", + "rbi/workos/vault_names_listed_data.rbi", + "rbi/workos/verify_email_address.rbi", + "rbi/workos/verify_email_response.rbi", + "rbi/workos/webhook_endpoint.rbi", + "rbi/workos/webhooks.rbi", + "rbi/workos/widget_session_token.rbi", + "rbi/workos/widget_session_token_response.rbi", + "rbi/workos/widgets.rbi", + "test/workos/test_admin_portal.rb", + "test/workos/test_api_keys.rb", + "test/workos/test_audit_logs.rb", + "test/workos/test_authorization.rb", + "test/workos/test_connect.rb", + "test/workos/test_directory_sync.rb", + "test/workos/test_events.rb", + "test/workos/test_feature_flags.rb", + "test/workos/test_model_round_trip.rb", + "test/workos/test_multi_factor_auth.rb", + "test/workos/test_organization_domains.rb", + "test/workos/test_organizations.rb", + "test/workos/test_pipes.rb", + "test/workos/test_radar.rb", + "test/workos/test_sso.rb", + "test/workos/test_user_management.rb", + "test/workos/test_webhooks.rb", + "test/workos/test_widgets.rb" + ] +} diff --git a/.rspec b/.rspec deleted file mode 100644 index c99d2e73..00000000 --- a/.rspec +++ /dev/null @@ -1 +0,0 @@ ---require spec_helper diff --git a/Gemfile.lock b/Gemfile.lock index ce0246a0..80fa2c62 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,8 +2,9 @@ PATH remote: . specs: workos (6.2.0) - encryptor (~> 3.0) jwt (~> 3.1) + logger (~> 1.7) + zeitwerk (~> 2.6) GEM remote: https://rubygems.org/ @@ -16,14 +17,17 @@ GEM crack (1.0.1) bigdecimal rexml - encryptor (3.0.0) + drb (2.2.3) hashdiff (1.2.1) json (2.19.3) jwt (3.1.2) base64 language_server-protocol (3.17.0.5) lint_roller (1.1.0) - minitest (5.27.0) + logger (1.7.0) + minitest (6.0.4) + drb (~> 2.0) + prism (~> 1.5) parallel (1.28.0) parser (3.3.11.1) ast (~> 2.4.1) @@ -69,11 +73,11 @@ GEM unicode-display_width (3.2.0) unicode-emoji (~> 4.1) unicode-emoji (4.2.0) - vcr (6.4.0) webmock (3.26.2) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + zeitwerk (2.7.5) PLATFORMS arm64-darwin-25 @@ -81,11 +85,10 @@ PLATFORMS DEPENDENCIES bundler (>= 2.0.1) - minitest (~> 5.25) + minitest (~> 6.0) rake standard (~> 1.49) - vcr (~> 6.0) - webmock + webmock (~> 3.26) workos! CHECKSUMS @@ -94,13 +97,14 @@ CHECKSUMS base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b bigdecimal (4.1.1) sha256=1c09efab961da45203c8316b0cdaec0ff391dfadb952dd459584b63ebf8054ca crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e - encryptor (3.0.0) sha256=abf23f94ab4d864b8cea85b43f3432044a60001982cda7c33c1cd90da8db1969 + drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373 hashdiff (1.2.1) sha256=9c079dbc513dfc8833ab59c0c2d8f230fa28499cc5efb4b8dd276cf931457cd1 json (2.19.3) sha256=289b0bb53052a1fa8c34ab33cc750b659ba14a5c45f3fcf4b18762dc67c78646 jwt (3.1.2) sha256=af6991f19a6bb4060d618d9add7a66f0eeb005ac0bc017cd01f63b42e122d535 language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87 - minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5 + logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 + minitest (6.0.4) sha256=df1304664589d40f46089247fdc451f866b0ce0d7cae1457a15fc1eb7d48dca1 parallel (1.28.0) sha256=33e6de1484baf2524792d178b0913fc8eb94c628d6cfe45599ad4458c638c970 parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54 prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85 @@ -119,9 +123,9 @@ CHECKSUMS standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2 unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42 unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f - vcr (6.4.0) sha256=077ac92cc16efc5904eb90492a18153b5e6ca5398046d8a249a7c96a9ea24ae6 webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90 workos (6.2.0) + zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd BUNDLED WITH 4.0.3 diff --git a/README.md b/README.md index 47758011..de8553a7 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,149 @@ # WorkOS Ruby Library -The WorkOS library for Ruby provides convenient access to the WorkOS API from applications written in Ruby. +The WorkOS Ruby SDK provides convenient access to the WorkOS API from applications written in Ruby. ## Documentation -See the [API Reference](https://workos.com/docs/reference/client-libraries) for Ruby usage examples. +- [Ruby SDK documentation](https://docs.workos.com/sdk/ruby) +- [API reference](https://workos.com/docs/reference/client-libraries) ## Installation Install the package with: -``` +```sh gem install workos ``` If you're using Bundler to manage your application's gems, add the WorkOS gem to your Gemfile: -``` -source 'https://rubygems.org' +```ruby +source "https://rubygems.org" -gem 'workos' +gem "workos" ``` ## Configuration -To use the library you must provide an API key, located in the WorkOS dashboard, as an environment variable `WORKOS_API_KEY`: +To use the library, provide your WorkOS API key as `WORKOS_API_KEY` and, for AuthKit and SSO flows, your client ID as `WORKOS_CLIENT_ID`: ```sh -$ WORKOS_API_KEY=[your api key] ruby app.rb +WORKOS_API_KEY=sk_test_123 WORKOS_CLIENT_ID=client_123 ruby app.rb ``` -Or, you may set the key yourself, such as in an initializer in your application load path: +Or configure the SDK in an initializer: ```ruby # /config/initializers/workos.rb +require "workos" +require "workos/configuration" + WorkOS.configure do |config| - config.key = '[your api key]' + config.api_key = ENV.fetch("WORKOS_API_KEY") + config.client_id = ENV["WORKOS_CLIENT_ID"] config.timeout = 120 + config.logger = Logger.new($stdout) + config.log_level = :info +end + +client = WorkOS.client +``` + +## Per-request options + +Every API call accepts `request_options:` for per-call overrides: + +```ruby +organization = WorkOS.client.organizations.get_organization( + id: "org_123", + request_options: { + timeout: 10, + extra_headers: {"X-Request-Source" => "admin"}, + idempotency_key: "org-create-123" + } +) +``` + +`Idempotency-Key` is only sent when you provide `request_options[:idempotency_key]`, or when the SDK retries a mutating request after a transient failure. + +## Usage Examples + +### List organizations + +```ruby +organizations = WorkOS.client.organizations.list_organizations(limit: 10) + +organizations.data.each do |organization| + puts "#{organization.id}: #{organization.name}" +end +``` + +### Get an organization + +```ruby +organization = WorkOS.client.organizations.get_organization(id: "org_123") +puts organization.name +``` + +### Create a user + +```ruby +user = WorkOS.client.user_management.create_user( + email: "marceline@example.com", + first_name: "Marceline", + last_name: "Abadeer" +) + +puts user.id +``` + +### Verify a webhook + +```ruby +payload = request.body.read +signature = request.env.fetch("HTTP_WORKOS_SIGNATURE") +secret = ENV.fetch("WORKOS_WEBHOOK_SECRET") + +event = WorkOS.client.webhooks.construct_event( + payload: payload, + sig_header: signature, + secret: secret +) + +puts event.event +``` + +## Pagination + +List endpoints return `WorkOS::Types::ListStruct`, which supports inspecting pagination metadata or iterating through every record automatically. + +```ruby +users = WorkOS.client.user_management.list_users(limit: 100) + +users.auto_paging_each do |user| + puts user.email +end +``` + +You can also iterate page by page: + +```ruby +users.each_page do |page| + puts page.list_metadata +end +``` + +## Error Handling + +The SDK raises typed errors for API and transport failures. + +```ruby +begin + WorkOS.client.organizations.get_organization(id: "org_123") +rescue WorkOS::APIError => e + warn "#{e.class}: #{e.message}" + warn "status=#{e.http_status} request_id=#{e.request_id} code=#{e.code}" end ``` @@ -60,7 +166,7 @@ can move to using the stable version. ## More Information -* [Single Sign-On Guide](https://workos.com/docs/sso/guide) -* [Directory Sync Guide](https://workos.com/docs/directory-sync/guide) -* [Admin Portal Guide](https://workos.com/docs/admin-portal/guide) -* [Magic Link Guide](https://workos.com/docs/magic-link/guide) +- [Ruby SDK documentation](https://docs.workos.com/sdk/ruby) +- [Single Sign-On Guide](https://workos.com/docs/sso/guide) +- [Directory Sync Guide](https://workos.com/docs/directory-sync/guide) +- [Admin Portal Guide](https://workos.com/docs/admin-portal/guide) diff --git a/docs/V7_MIGRATION_GUIDE.md b/docs/V7_MIGRATION_GUIDE.md new file mode 100644 index 00000000..28c603d7 --- /dev/null +++ b/docs/V7_MIGRATION_GUIDE.md @@ -0,0 +1,418 @@ +# WorkOS Ruby SDK v7 Migration Guide + +This guide covers the changes required to migrate from the v6 Ruby SDK to the next major release of `workos`. + +The biggest change is architectural: the SDK is now centered around an instantiated `WorkOS::Client` with client-scoped service accessors, generated request/response models, and a hand-maintained instance-scoped HTTP runtime. + +## Quick Start + +1. Upgrade to Ruby 3.3 or newer. +2. Upgrade the gem: + + ```ruby + gem "workos", "~> 7.0" + ``` + +3. Replace module-style service calls with a `WorkOS::Client` or `WorkOS.client`: + + ```ruby + require "workos" + require "workos/configuration" + + WorkOS.configure do |config| + config.api_key = ENV.fetch("WORKOS_API_KEY") + config.client_id = ENV["WORKOS_CLIENT_ID"] + end + + client = WorkOS.client + ``` + +4. Update renamed services, changed method signatures, and changed return types. +5. Re-run your tests and verify auth, session, SSO, webhook, and pagination flows end-to-end. + +--- + +## Ruby and Dependency Requirements + +### Minimum Ruby version is now 3.3+ + +The new SDK requires Ruby 3.3 or newer. + +### Runtime dependencies changed + +- `zeitwerk` is now required. +- `logger` is now a runtime dependency. +- `encryptor` was removed from the main gemspec. + +--- + +## Biggest Conceptual Changes + +### 1. The SDK now revolves around an instantiated client + +Before: + +```ruby +WorkOS.configure do |config| + config.key = ENV["WORKOS_API_KEY"] +end + +organizations = WorkOS::Organizations.list_organizations +``` + +After: + +```ruby +WorkOS.configure do |config| + config.api_key = ENV.fetch("WORKOS_API_KEY") + config.client_id = ENV["WORKOS_CLIENT_ID"] +end + +client = WorkOS.client +organizations = client.organizations.list_organizations +``` + +`WorkOS.configure` still exists, but the configuration object changed and the intended integration style is now a client instance. + +### 2. Most product areas are now accessed through client methods + +Instead of calling module methods like `WorkOS::Organizations.list_organizations` or `WorkOS::Portal.generate_link`, you now call lazy client accessors: + +- `client.organizations` +- `client.user_management` +- `client.sso` +- `client.directory_sync` +- `client.multi_factor_auth` +- `client.admin_portal` +- `client.audit_logs` +- `client.authorization` +- `client.webhooks` +- `client.passwordless` + +### 3. The runtime is instance-scoped and supports per-request overrides + +The new runtime stores credentials, base URL, timeout, retry settings, and service wiring on the client instance. + +Methods now consistently accept: + +```ruby +request_options: { + timeout: 10, + base_url: "https://api.workos.com", + max_retries: 1, + idempotency_key: "org-create-123", + extra_headers: {"X-Request-Source" => "admin"} +} +``` + +If your integration depended on global mutable config being the source of truth for requests, review that code carefully. + +### 4. AuthKit and session helpers moved to client-based helpers + +Before: + +```ruby +session = WorkOS::UserManagement.load_sealed_session( + client_id: client_id, + session_data: session_data, + cookie_password: cookie_password +) +``` + +After: + +```ruby +client = WorkOS::Client.new( + api_key: ENV.fetch("WORKOS_API_KEY"), + client_id: ENV.fetch("WORKOS_CLIENT_ID") +) + +session = client.session_manager.load( + seal_data: session_data, + cookie_password: cookie_password +) +``` + +If you use AuthKit session sealing, refresh, PKCE, or logout helpers, review those flows carefully. + +--- + +## Breaking Changes by Area + +### Client bootstrap and configuration + +#### Configuration field names changed + +Before: + +```ruby +WorkOS.configure do |config| + config.key = ENV["WORKOS_API_KEY"] + config.api_hostname = "api.workos.com" +end +``` + +After: + +```ruby +WorkOS.configure do |config| + config.api_key = ENV.fetch("WORKOS_API_KEY") + config.base_url = "https://api.workos.com" + config.client_id = ENV["WORKOS_CLIENT_ID"] + config.timeout = 30 + config.max_retries = 2 +end +``` + +#### Direct module-style service access is no longer the default integration pattern + +Code like this should be removed: + +```ruby +WorkOS::Organizations.list_organizations +WorkOS::Portal.generate_link(...) +WorkOS::MFA.verify_challenge(...) +WorkOS::UserManagement.authenticate_with_code(...) +``` + +Use the client methods instead: + +```ruby +client.organizations.list_organizations +client.admin_portal.generate_link(...) +client.multi_factor_auth.verify_challenge(...) +client.user_management.authenticate_with_code(...) +``` + +### Service renames and access patterns + +#### Several top-level service names changed + +Update these references: + +- `WorkOS::Portal` -> `client.admin_portal` +- `WorkOS::MFA` -> `client.multi_factor_auth` +- `WorkOS::Organizations` -> `client.organizations` +- `WorkOS::UserManagement` -> `client.user_management` +- `WorkOS::DirectorySync` -> `client.directory_sync` +- `WorkOS::AuditLogs` -> `client.audit_logs` + +#### Non-spec helpers are still available, but they moved behind the client + +Helpers for PKCE, public clients, passwordless, vault, and session management still exist, but they are no longer organized the same way as the v5 surface. + +Examples: + +```ruby +client.session_manager +client.passwordless +client.pkce +WorkOS::PublicClient.create(client_id: "client_123") +``` + +### Method signatures + +#### Many methods moved from option hashes or old keywords to explicit named arguments + +Before: + +```ruby +WorkOS::Organizations.list_organizations(after: "org_123", limit: 25) +WorkOS::Organizations.update_organization(organization: "org_123", name: "Acme") +``` + +After: + +```ruby +client.organizations.list_organizations(after: "org_123", limit: 25) +client.organizations.update_organization(id: "org_123", name: "Acme") +``` + +Notable signature changes: + +- `update_organization(organization: ...)` -> `update_organization(id: ...)` +- mutating calls now take `request_options:` instead of ad hoc transport arguments like `idempotency_key:` +- auth helpers infer `client_id` and `client_secret` from the client instead of requiring them on every call + +#### Auth helper signatures changed substantially + +Before: + +```ruby +response = WorkOS::UserManagement.authenticate_with_code( + code: code, + client_id: client_id, + ip_address: ip_address, + user_agent: user_agent, + session: { seal_session: true, cookie_password: cookie_password } +) +``` + +After: + +```ruby +response = client.user_management.authenticate_with_code( + code: code, + ip_address: ip_address, + device_id: device_id, + user_agent: user_agent, + request_options: {} +) +``` + +Review all usages of: + +- `authenticate_with_code` +- `authenticate_with_password` +- `authenticate_with_refresh_token` +- `authenticate_with_magic_auth` +- `authenticate_with_email_verification` + +#### Authorization URL helpers were renamed + +Before: + +```ruby +WorkOS::UserManagement.authorization_url(...) +WorkOS::SSO.authorization_url(...) +``` + +After: + +```ruby +client.user_management.get_authorization_url(...) +client.user_management.get_authorization_url_with_pkce(...) +client.sso.get_authorization_url(...) +client.sso.get_authorization_url_with_pkce(...) +``` + +### Return types and models + +#### Some methods now return typed models instead of primitives + +Before: + +```ruby +link = WorkOS::Portal.generate_link( + intent: "sso", + organization: "org_123" +) +``` + +After: + +```ruby +response = client.admin_portal.generate_link( + organization: "org_123", + intent: "sso" +) + +link = response.link +``` + +If your code expects a raw string or hash, check the return type again. + +#### Some auth and MFA model class names changed + +Examples: + +- `WorkOS::AuthenticationResponse` -> `WorkOS::AuthenticateResponse` +- `WorkOS::Factor` -> `WorkOS::AuthenticationFactor` +- `WorkOS::Challenge` -> `WorkOS::AuthenticationChallenge` +- `WorkOS::VerifyChallenge` -> `WorkOS::AuthenticationChallengeVerifyResponse` + +If your code imports, type-checks, or pattern matches on these classes, update those references. + +### Error handling + +#### Error classes are still typed, but the base class contract changed + +Before: + +```ruby +begin + WorkOS::Organizations.get_organization(id: "org_123") +rescue WorkOS::TimeoutError => e + warn e.retry_after + warn e.data +end +``` + +After: + +```ruby +begin + client.organizations.get_organization(id: "org_123") +rescue WorkOS::APIConnectionError => e + warn e.message + warn e.request_id + warn e.code + warn e.body.inspect +end +``` + +Important differences: + +- transport failures now raise `WorkOS::APIConnectionError` +- the old `WorkOS::TimeoutError` is no longer part of the new error surface +- the old extra fields like `retry_after`, `errors`, `error_description`, and `data` are not exposed the same way + +If your code rescues specific exception types or reads fields from exceptions, review every rescue path. + +### Pagination + +#### `ListStruct` is still the pagination wrapper, but it is more capable now + +Before: + +```ruby +result = WorkOS::Organizations.list_organizations +result.data +result.list_metadata +``` + +After: + +```ruby +result = client.organizations.list_organizations(limit: 100) + +result.data +result.list_metadata +result.auto_paging_each do |organization| + puts organization.id +end +``` + +This is mostly an improvement, but if you implemented your own pagination assumptions around the old response shape, test those code paths again. + +### AuthKit sessions and cookies + +#### Session management moved out of `UserManagement` and into `SessionManager` + +Before: + +```ruby +session = WorkOS::UserManagement.load_sealed_session( + client_id: client_id, + session_data: session_data, + cookie_password: cookie_password +) +``` + +After: + +```ruby +session = client.session_manager.load( + seal_data: session_data, + cookie_password: cookie_password +) +``` + +Refresh and authenticate helpers also moved: + +```ruby +client.session_manager.authenticate(...) +client.session_manager.refresh(...) +``` + +If your app relies on session sealing or cookie refresh behavior, verify those flows carefully in integration tests. diff --git a/lib/workos.rb b/lib/workos.rb index 4b92c309..5a582df6 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -1,101 +1,90 @@ # frozen_string_literal: true -require "workos/version" -require "json" -require "workos/hash_provider" -require "workos/configuration" +# This file is auto-generated by oagen. Do not edit. -# Use the WorkOS module to authenticate your -# requests to the WorkOS API. The gem will read -# your API key automatically from the ENV var `WORKOS_API_KEY`. -# Alternatively, you can set the key yourself with -# `WorkOS.configure { |config| config.key = [your api key] }` somewhere -# in the load path of your application, such as an initializer. -module WorkOS - def self.default_config - Configuration.new.tap do |config| - config.api_hostname = ENV["WORKOS_API_HOSTNAME"] || "api.workos.com" - # Remove WORKOS_KEY at some point in the future. Keeping it here now for - # backwards compatibility. - config.key = ENV["WORKOS_API_KEY"] || ENV["WORKOS_KEY"] - end - end - - def self.config - @config ||= default_config - end - - def self.configure - yield(config) - end - - def self.key=(value) - warn "`WorkOS.key=` is deprecated. Use `WorkOS.configure` instead." - - config.key = value - end +require "zeitwerk" - def self.key - warn "`WorkOS.key` is deprecated. Use `WorkOS.configure` instead." - - config.key - end +module WorkOS +end - autoload :AuditLogExport, "workos/audit_log_export" - autoload :AuthenticationFactorAndChallenge, "workos/authentication_factor_and_challenge" - autoload :AuthenticationResponse, "workos/authentication_response" - autoload :AuditLogs, "workos/audit_logs" - autoload :Cache, "workos/cache" - autoload :Challenge, "workos/challenge" - autoload :Client, "workos/client" - autoload :Connection, "workos/connection" - autoload :DeprecatedHashWrapper, "workos/deprecated_hash_wrapper" - autoload :Deprecation, "workos/deprecation" - autoload :Directory, "workos/directory" - autoload :DirectoryGroup, "workos/directory_group" - autoload :DirectorySync, "workos/directory_sync" - autoload :DirectoryUser, "workos/directory_user" - autoload :EmailVerification, "workos/email_verification" - autoload :Encryptors, "workos/encryptors" - autoload :Event, "workos/event" - autoload :Events, "workos/events" - autoload :Factor, "workos/factor" - autoload :FeatureFlag, "workos/feature_flag" - autoload :Impersonator, "workos/impersonator" - autoload :Invitation, "workos/invitation" - autoload :MagicAuth, "workos/magic_auth" - autoload :MFA, "workos/mfa" - autoload :OAuthTokens, "workos/oauth_tokens" - autoload :Organization, "workos/organization" - autoload :Organizations, "workos/organizations" - autoload :OrganizationMembership, "workos/organization_membership" - autoload :Passwordless, "workos/passwordless" - autoload :PasswordReset, "workos/password_reset" - autoload :Portal, "workos/portal" - autoload :Profile, "workos/profile" - autoload :ProfileAndToken, "workos/profile_and_token" - autoload :RefreshAuthenticationResponse, "workos/refresh_authentication_response" - autoload :Role, "workos/role" - autoload :Session, "workos/session" - autoload :SSO, "workos/sso" - autoload :Types, "workos/types" - autoload :User, "workos/user" - autoload :UserAndToken, "workos/user_and_token" - autoload :UserManagement, "workos/user_management" - autoload :UserResponse, "workos/user_response" - autoload :VerifyChallenge, "workos/verify_challenge" - autoload :Webhook, "workos/webhook" - autoload :Webhooks, "workos/webhooks" - autoload :Widgets, "workos/widgets" +loader = Zeitwerk::Loader.for_gem +loader.inflector.inflect( + "authenticate_response_oauth_token" => "AuthenticateResponseOAuthToken", + "authentication_mfa_failed" => "AuthenticationMFAFailed", + "authentication_mfa_failed_data" => "AuthenticationMFAFailedData", + "authentication_mfa_failed_data_error" => "AuthenticationMFAFailedDataError", + "authentication_mfa_succeeded" => "AuthenticationMFASucceeded", + "authentication_mfa_succeeded_data" => "AuthenticationMFASucceededData", + "authentication_oauth_failed" => "AuthenticationOAuthFailed", + "authentication_oauth_failed_data" => "AuthenticationOAuthFailedData", + "authentication_oauth_failed_data_error" => "AuthenticationOAuthFailedDataError", + "authentication_oauth_succeeded" => "AuthenticationOAuthSucceeded", + "authentication_oauth_succeeded_data" => "AuthenticationOAuthSucceededData", + "authentication_sso_failed" => "AuthenticationSSOFailed", + "authentication_sso_failed_data" => "AuthenticationSSOFailedData", + "authentication_sso_failed_data_error" => "AuthenticationSSOFailedDataError", + "authentication_sso_failed_data_sso" => "AuthenticationSSOFailedDataSSO", + "authentication_sso_started" => "AuthenticationSSOStarted", + "authentication_sso_started_data" => "AuthenticationSSOStartedData", + "authentication_sso_started_data_sso" => "AuthenticationSSOStartedDataSSO", + "authentication_sso_succeeded" => "AuthenticationSSOSucceeded", + "authentication_sso_succeeded_data" => "AuthenticationSSOSucceededData", + "authentication_sso_succeeded_data_sso" => "AuthenticationSSOSucceededDataSSO", + "authentication_sso_timed_out" => "AuthenticationSSOTimedOut", + "authentication_sso_timed_out_data" => "AuthenticationSSOTimedOutData", + "authentication_sso_timed_out_data_error" => "AuthenticationSSOTimedOutDataError", + "authentication_sso_timed_out_data_sso" => "AuthenticationSSOTimedOutDataSSO", + "connection_saml_certificate_renewal_required" => "ConnectionSAMLCertificateRenewalRequired", + "connection_saml_certificate_renewal_required_data" => "ConnectionSAMLCertificateRenewalRequiredData", + "connection_saml_certificate_renewal_required_data_certificate" => "ConnectionSAMLCertificateRenewalRequiredDataCertificate", + "connection_saml_certificate_renewal_required_data_certificate_certificate_type" => "ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType", + "connection_saml_certificate_renewal_required_data_connection" => "ConnectionSAMLCertificateRenewalRequiredDataConnection", + "connection_saml_certificate_renewed" => "ConnectionSAMLCertificateRenewed", + "connection_saml_certificate_renewed_data" => "ConnectionSAMLCertificateRenewedData", + "connection_saml_certificate_renewed_data_certificate" => "ConnectionSAMLCertificateRenewedDataCertificate", + "connection_saml_certificate_renewed_data_certificate_certificate_type" => "ConnectionSAMLCertificateRenewedDataCertificateCertificateType", + "connection_saml_certificate_renewed_data_connection" => "ConnectionSAMLCertificateRenewedDataConnection", + "cors_origin_response" => "CORSOriginResponse", + "create_cors_origin" => "CreateCORSOrigin", + "create_m2m_application" => "CreateM2MApplication", + "create_oauth_application" => "CreateOAuthApplication", + "jwt_template_response" => "JWTTemplateResponse", + "m2m" => "M2M", + "mfa_totp_session_authenticate_request" => "MFATotpSessionAuthenticateRequest", + "pkce" => "PKCE", + "sso" => "SSO", + "sso_authorize_url_response" => "SSOAuthorizeUrlResponse", + "sso_device_authorization_request" => "SSODeviceAuthorizationRequest", + "sso_intent_options" => "SSOIntentOptions", + "sso_logout_authorize_request" => "SSOLogoutAuthorizeRequest", + "sso_logout_authorize_response" => "SSOLogoutAuthorizeResponse", + "sso_provider" => "SSOProvider", + "sso_token_response" => "SSOTokenResponse", + "sso_token_response_oauth_token" => "SSOTokenResponseOAuthToken", + "update_jwt_template" => "UpdateJWTTemplate", + "update_oauth_application" => "UpdateOAuthApplication", + "workos" => "WorkOS" +) +loader.collapse("#{__dir__}/workos/admin_portal") +loader.collapse("#{__dir__}/workos/api_keys") +loader.collapse("#{__dir__}/workos/audit_logs") +loader.collapse("#{__dir__}/workos/authorization") +loader.collapse("#{__dir__}/workos/connect") +loader.collapse("#{__dir__}/workos/directory_sync") +loader.collapse("#{__dir__}/workos/events") +loader.collapse("#{__dir__}/workos/feature_flags") +loader.collapse("#{__dir__}/workos/multi_factor_auth") +loader.collapse("#{__dir__}/workos/organization_domains") +loader.collapse("#{__dir__}/workos/organizations") +loader.collapse("#{__dir__}/workos/pipes") +loader.collapse("#{__dir__}/workos/radar") +loader.collapse("#{__dir__}/workos/shared") +loader.collapse("#{__dir__}/workos/sso") +loader.collapse("#{__dir__}/workos/user_management") +loader.collapse("#{__dir__}/workos/vault") +loader.collapse("#{__dir__}/workos/webhooks") +loader.collapse("#{__dir__}/workos/widgets") +loader.ignore("#{__dir__}/workos/errors.rb") +loader.setup - # Errors - autoload :APIError, "workos/errors" - autoload :AuthenticationError, "workos/errors" - autoload :InvalidRequestError, "workos/errors" - autoload :ForbiddenRequestError, "workos/errors" - autoload :SignatureVerificationError, "workos/errors" - autoload :TimeoutError, "workos/errors" - autoload :NotFoundError, "workos/errors" - autoload :UnprocessableEntityError, "workos/errors" - autoload :RateLimitExceededError, "workos/errors" -end +require "workos/errors" diff --git a/lib/workos/actions.rb b/lib/workos/actions.rb new file mode 100644 index 00000000..6113e7a9 --- /dev/null +++ b/lib/workos/actions.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +# Hand-maintained AuthKit Actions helpers (H03): +# - request signature verification (incoming) +# - response signing (outgoing Allow/Deny verdict) +# These are client-side cryptographic helpers and never spec-driven. + +require "json" +require "openssl" +require "workos/util/signature" + +module WorkOS + # AuthKit Actions request verification + response signing. + # + # action = client.actions.construct_action( + # payload: req.body, sig_header: req.headers["WorkOS-Signature"], + # secret: ENV["WORKOS_ACTIONS_SECRET"] + # ) + # resp = client.actions.sign_response( + # action_type: "authentication", verdict: "Allow", + # secret: ENV["WORKOS_ACTIONS_SECRET"] + # ) + module Actions + DEFAULT_TOLERANCE_SECONDS = 30 + + ACTION_TYPE_TO_RESPONSE_OBJECT = { + "authentication" => "authentication_action_response", + "user_registration" => "user_registration_action_response" + }.freeze + + module_function + + # Verify a request signature; raises on failure. + def verify_header(payload:, sig_header:, secret:, tolerance: DEFAULT_TOLERANCE_SECONDS) + timestamp_ms, signature_hash = parse_signature_header(sig_header) + issued_at = timestamp_ms.to_i / 1000.0 + if (Time.now.to_f - issued_at) > tolerance + raise WorkOS::SignatureVerificationError.new( + message: "Timestamp outside the tolerance zone", + http_status: nil + ) + end + expected = compute_signature(payload: payload, timestamp: timestamp_ms, secret: secret) + unless secure_compare(signature_hash, expected) + raise WorkOS::SignatureVerificationError.new( + message: "Signature hash does not match the expected signature hash for payload", + http_status: nil + ) + end + true + end + + # Verify and deserialize an Actions request payload. + def construct_action(payload:, sig_header:, secret:, tolerance: DEFAULT_TOLERANCE_SECONDS) + verify_header(payload: payload, sig_header: sig_header, secret: secret, tolerance: tolerance) + JSON.parse(payload) + end + + # Build and sign an Actions response. action_type is "authentication" or + # "user_registration"; verdict is "Allow" or "Deny". + def sign_response(action_type:, verdict:, secret:, error_message: nil) + object_type = ACTION_TYPE_TO_RESPONSE_OBJECT[action_type.to_s] + raise ArgumentError, "Unknown action_type: #{action_type}" unless object_type + timestamp_ms = (Time.now.to_f * 1000).to_i + response_payload = {"timestamp" => timestamp_ms, "verdict" => verdict} + response_payload["error_message"] = error_message if error_message + payload_json = JSON.generate(response_payload) + signed_payload = "#{timestamp_ms}.#{payload_json}" + { + "object" => object_type, + "payload" => response_payload, + "signature" => OpenSSL::HMAC.hexdigest("SHA256", secret, signed_payload) + } + end + + # Compute HMAC-SHA256 hex signature for a (timestamp, payload) pair. + def compute_signature(payload:, timestamp:, secret:) + WorkOS::Util::Signature.compute(payload: payload, timestamp: timestamp, secret: secret) + end + + # Parse a "t=, v1=" header into [timestamp, signature]. + def parse_signature_header(sig_header) + WorkOS::Util::Signature.parse_header(sig_header) + rescue ArgumentError => e + raise WorkOS::SignatureVerificationError.new(message: e.message, http_status: nil) + end + + def secure_compare(a, b) + WorkOS::Util::Signature.secure_compare(a, b) + end + end +end diff --git a/lib/workos/admin_portal.rb b/lib/workos/admin_portal.rb new file mode 100644 index 00000000..4e670c22 --- /dev/null +++ b/lib/workos/admin_portal.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AdminPortal + def initialize(client) + @client = client + end + + # Generate a Portal Link + # @param return_url [String, nil] The URL to go to when an admin clicks on your logo in the Admin Portal. If not specified, the return URL configured on the [Redirects](https://dashboard.workos.com/redirects) page will be used. + # @param success_url [String, nil] The URL to redirect the admin to when they finish setup. If not specified, the success URL configured on the [Redirects](https://dashboard.workos.com/redirects) page will be used. + # @param organization [String] An [Organization](https://workos.com/docs/reference/organization) identifier. + # @param intent [WorkOS::Types::GenerateLinkIntent, nil] The intent of the Admin Portal. - `sso` - Launch Admin Portal for creating SSO connections - `dsync` - Launch Admin Portal for creating Directory Sync connections - `audit_logs` - Launch Admin Portal for viewing Audit Logs - `log_streams` - Launch Admin Portal for creating Log Streams - `domain_verification` - Launch Admin Portal for Domain Verification - `certificate_renewal` - Launch Admin Portal for renewing SAML Certificates - `bring_your_own_key` - Launch Admin Portal for configuring Bring Your Own Key + # @param intent_options [WorkOS::IntentOptions, nil] Options to configure the Admin Portal based on the intent. + # @param admin_emails [Array, nil] The email addresses of the IT admins to grant access to the Admin Portal for the given organization. Accepts up to 20 emails. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::PortalLinkResponse] + def generate_link( + organization:, + return_url: nil, + success_url: nil, + intent: nil, + intent_options: nil, + admin_emails: nil, + request_options: {} + ) + body = { + "return_url" => return_url, + "success_url" => success_url, + "organization" => organization, + "intent" => intent, + "intent_options" => intent_options, + "admin_emails" => admin_emails + }.compact + response = @client.request(method: :post, path: "/portal/generate_link", auth: true, body: body, request_options: request_options) + WorkOS::PortalLinkResponse.new(response.body) + end + end +end diff --git a/lib/workos/admin_portal/generate_link.rb b/lib/workos/admin_portal/generate_link.rb new file mode 100644 index 00000000..fd03a657 --- /dev/null +++ b/lib/workos/admin_portal/generate_link.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class GenerateLink + include HashProvider + + HASH_ATTRS = { + return_url: :return_url, + success_url: :success_url, + organization: :organization, + intent: :intent, + intent_options: :intent_options, + admin_emails: :admin_emails + }.freeze + + attr_accessor \ + :return_url, + :success_url, + :organization, + :intent, + :intent_options, + :admin_emails + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @return_url = hash[:return_url] + @success_url = hash[:success_url] + @organization = hash[:organization] + @intent = hash[:intent] + @intent_options = hash[:intent_options] ? WorkOS::IntentOptions.new(hash[:intent_options]) : nil + @admin_emails = hash[:admin_emails] || [] + end + end +end diff --git a/lib/workos/admin_portal/intent_options.rb b/lib/workos/admin_portal/intent_options.rb new file mode 100644 index 00000000..68e14db6 --- /dev/null +++ b/lib/workos/admin_portal/intent_options.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class IntentOptions + include HashProvider + + HASH_ATTRS = { + sso: :sso + }.freeze + + attr_accessor :sso + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @sso = hash[:sso] ? WorkOS::SSOIntentOptions.new(hash[:sso]) : nil + end + end +end diff --git a/lib/workos/admin_portal/portal_link_response.rb b/lib/workos/admin_portal/portal_link_response.rb new file mode 100644 index 00000000..75051dc7 --- /dev/null +++ b/lib/workos/admin_portal/portal_link_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class PortalLinkResponse + include HashProvider + + HASH_ATTRS = { + link: :link + }.freeze + + attr_accessor :link + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @link = hash[:link] + end + end +end diff --git a/lib/workos/admin_portal/sso_intent_options.rb b/lib/workos/admin_portal/sso_intent_options.rb new file mode 100644 index 00000000..979132c6 --- /dev/null +++ b/lib/workos/admin_portal/sso_intent_options.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SSOIntentOptions + include HashProvider + + HASH_ATTRS = { + bookmark_slug: :bookmark_slug, + provider_type: :provider_type + }.freeze + + attr_accessor \ + :bookmark_slug, + :provider_type + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @bookmark_slug = hash[:bookmark_slug] + @provider_type = hash[:provider_type] + end + end +end diff --git a/lib/workos/api_keys.rb b/lib/workos/api_keys.rb new file mode 100644 index 00000000..14d1ca5c --- /dev/null +++ b/lib/workos/api_keys.rb @@ -0,0 +1,108 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ApiKeys + def initialize(client) + @client = client + end + + # Validate API key + # @param value [String] The value for an API key. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::ApiKeyValidationResponse] + def create_validation( + value:, + request_options: {} + ) + body = { + "value" => value + }.compact + response = @client.request(method: :post, path: "/api_keys/validations", auth: true, body: body, request_options: request_options) + WorkOS::ApiKeyValidationResponse.new(response.body) + end + + # Delete an API key + # @param id [String] The unique ID of the API key. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_api_key( + id:, + request_options: {} + ) + @client.request(method: :delete, path: "/api_keys/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + nil + end + + # List API keys for an organization + # @param organization_id [String] Unique identifier of the Organization. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::OrganizationsApiKeysOrder, nil] Order the results by the creation time. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_organization_api_keys( + organization_id:, + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/api_keys", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::ApiKey, filters: {organization_id: organization_id, before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_organization_api_keys( + organization_id: organization_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_organization_api_keys( + organization_id: organization_id, + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options + ) + end + ) + end + + # Create an API key for an organization + # @param organization_id [String] Unique identifier of the Organization. + # @param name [String] The name for the API key. + # @param permissions [Array, nil] The permission slugs to assign to the API key. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::ApiKeyWithValue] + def create_organization_api_key( + organization_id:, + name:, + permissions: nil, + request_options: {} + ) + body = { + "name" => name, + "permissions" => permissions + }.compact + response = @client.request(method: :post, path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/api_keys", auth: true, body: body, request_options: request_options) + WorkOS::ApiKeyWithValue.new(response.body) + end + end +end diff --git a/lib/workos/api_keys/api_key.rb b/lib/workos/api_keys/api_key.rb new file mode 100644 index 00000000..abc6b12d --- /dev/null +++ b/lib/workos/api_keys/api_key.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ApiKey + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + owner: :owner, + name: :name, + obfuscated_value: :obfuscated_value, + last_used_at: :last_used_at, + permissions: :permissions, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :owner, + :name, + :obfuscated_value, + :last_used_at, + :permissions, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @owner = hash[:owner] ? WorkOS::ApiKeyOwner.new(hash[:owner]) : nil + @name = hash[:name] + @obfuscated_value = hash[:obfuscated_value] + @last_used_at = hash[:last_used_at] + @permissions = hash[:permissions] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/api_keys/api_key_created.rb b/lib/workos/api_keys/api_key_created.rb new file mode 100644 index 00000000..a114601f --- /dev/null +++ b/lib/workos/api_keys/api_key_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ApiKeyCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::ApiKeyCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/api_keys/api_key_created_data.rb b/lib/workos/api_keys/api_key_created_data.rb new file mode 100644 index 00000000..7044faad --- /dev/null +++ b/lib/workos/api_keys/api_key_created_data.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ApiKeyCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + owner: :owner, + name: :name, + obfuscated_value: :obfuscated_value, + last_used_at: :last_used_at, + permissions: :permissions, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :owner, + :name, + :obfuscated_value, + :last_used_at, + :permissions, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @owner = hash[:owner] ? WorkOS::ApiKeyCreatedDataOwner.new(hash[:owner]) : nil + @name = hash[:name] + @obfuscated_value = hash[:obfuscated_value] + @last_used_at = hash[:last_used_at] + @permissions = hash[:permissions] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/api_keys/api_key_created_data_owner.rb b/lib/workos/api_keys/api_key_created_data_owner.rb new file mode 100644 index 00000000..792e929f --- /dev/null +++ b/lib/workos/api_keys/api_key_created_data_owner.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ApiKeyCreatedDataOwner + include HashProvider + + HASH_ATTRS = { + type: :type, + id: :id + }.freeze + + attr_accessor \ + :type, + :id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @id = hash[:id] + end + end +end diff --git a/lib/workos/api_keys/api_key_owner.rb b/lib/workos/api_keys/api_key_owner.rb new file mode 100644 index 00000000..3540d188 --- /dev/null +++ b/lib/workos/api_keys/api_key_owner.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + ApiKeyOwner = ApiKeyCreatedDataOwner +end diff --git a/lib/workos/api_keys/api_key_revoked.rb b/lib/workos/api_keys/api_key_revoked.rb new file mode 100644 index 00000000..e1ce8941 --- /dev/null +++ b/lib/workos/api_keys/api_key_revoked.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ApiKeyRevoked + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::ApiKeyRevokedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/api_keys/api_key_revoked_data.rb b/lib/workos/api_keys/api_key_revoked_data.rb new file mode 100644 index 00000000..a0d21f82 --- /dev/null +++ b/lib/workos/api_keys/api_key_revoked_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + ApiKeyRevokedData = ApiKeyCreatedData +end diff --git a/lib/workos/api_keys/api_key_revoked_data_owner.rb b/lib/workos/api_keys/api_key_revoked_data_owner.rb new file mode 100644 index 00000000..d209e591 --- /dev/null +++ b/lib/workos/api_keys/api_key_revoked_data_owner.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + ApiKeyRevokedDataOwner = ApiKeyCreatedDataOwner +end diff --git a/lib/workos/api_keys/api_key_validation_response.rb b/lib/workos/api_keys/api_key_validation_response.rb new file mode 100644 index 00000000..2c7a4f19 --- /dev/null +++ b/lib/workos/api_keys/api_key_validation_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ApiKeyValidationResponse + include HashProvider + + HASH_ATTRS = { + api_key: :api_key + }.freeze + + attr_accessor :api_key + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @api_key = hash[:api_key] ? WorkOS::ApiKey.new(hash[:api_key]) : nil + end + end +end diff --git a/lib/workos/api_keys/api_key_with_value.rb b/lib/workos/api_keys/api_key_with_value.rb new file mode 100644 index 00000000..5eab2a5b --- /dev/null +++ b/lib/workos/api_keys/api_key_with_value.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ApiKeyWithValue + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + owner: :owner, + name: :name, + obfuscated_value: :obfuscated_value, + last_used_at: :last_used_at, + permissions: :permissions, + created_at: :created_at, + updated_at: :updated_at, + value: :value + }.freeze + + attr_accessor \ + :object, + :id, + :owner, + :name, + :obfuscated_value, + :last_used_at, + :permissions, + :created_at, + :updated_at, + :value + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @owner = hash[:owner] ? WorkOS::ApiKeyWithValueOwner.new(hash[:owner]) : nil + @name = hash[:name] + @obfuscated_value = hash[:obfuscated_value] + @last_used_at = hash[:last_used_at] + @permissions = hash[:permissions] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @value = hash[:value] + end + end +end diff --git a/lib/workos/api_keys/api_key_with_value_owner.rb b/lib/workos/api_keys/api_key_with_value_owner.rb new file mode 100644 index 00000000..20ed52cd --- /dev/null +++ b/lib/workos/api_keys/api_key_with_value_owner.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + ApiKeyWithValueOwner = ApiKeyCreatedDataOwner +end diff --git a/lib/workos/api_keys/create_organization_api_key.rb b/lib/workos/api_keys/create_organization_api_key.rb new file mode 100644 index 00000000..16f43ba4 --- /dev/null +++ b/lib/workos/api_keys/create_organization_api_key.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateOrganizationApiKey + include HashProvider + + HASH_ATTRS = { + name: :name, + permissions: :permissions + }.freeze + + attr_accessor \ + :name, + :permissions + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @name = hash[:name] + @permissions = hash[:permissions] || [] + end + end +end diff --git a/lib/workos/api_keys/validate_api_key.rb b/lib/workos/api_keys/validate_api_key.rb new file mode 100644 index 00000000..e0624f23 --- /dev/null +++ b/lib/workos/api_keys/validate_api_key.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ValidateApiKey + include HashProvider + + HASH_ATTRS = { + value: :value + }.freeze + + attr_accessor :value + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @value = hash[:value] + end + end +end diff --git a/lib/workos/audit_log_export.rb b/lib/workos/audit_log_export.rb deleted file mode 100644 index 0c38c258..00000000 --- a/lib/workos/audit_log_export.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The AuditLogExport class represents the WorkOS entity created when exporting Audit Log Events. - class AuditLogExport - include HashProvider - - attr_accessor :object, :id, :state, :url, :created_at, :updated_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @object = hash[:object] - @id = hash[:id] - @state = hash[:state] - @url = hash[:url] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - - def to_json(*) - { - object: object, - id: id, - state: state, - url: url, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/audit_logs.rb b/lib/workos/audit_logs.rb index 3d521155..dee34bfe 100644 --- a/lib/workos/audit_logs.rb +++ b/lib/workos/audit_logs.rb @@ -1,88 +1,223 @@ # frozen_string_literal: true -require "net/http" -require "uri" +# This file is auto-generated by oagen. Do not edit. -module WorkOS - # The Audit Logs module provides convenience methods for working with the - # WorkOS Audit Logs platform. You'll need a valid API key. - module AuditLogs - class << self - include Client - - # Create an Audit Log Event. - # - # @param [String] organization An Organization ID - # @param [Hash] event An Audit Log Event - # @param [String] idempotency_key An idempotency key - # - # @return [nil] - def create_event(organization:, event:, idempotency_key: nil) - request = post_request( - path: "/audit_logs/events", - auth: true, - idempotency_key: idempotency_key, - body: { - organization_id: organization, - event: event - } - ) +require "json" - execute_request(request: request) - end +module WorkOS + class AuditLogs + def initialize(client) + @client = client + end - # Create an Export of Audit Log Events. - # - # @param [String] organization An Organization ID - # @param [String] range_start ISO-8601 datetime - # @param [String] range_end ISO-8601 datetime - # @param [Array] actions A list of actions to filter by - # @param [Array] @deprecated use `actor_names` instead - # @param [Array] actor_names A list of actor names to filter by - # @param [Array] actor_ids A list of actor ids to filter by - # @param [Array] targets A list of target types to filter by - # - # @return [WorkOS::AuditLogExport] - def create_export(organization:, range_start:, range_end:, actions: nil, # rubocop:disable Metrics/ParameterLists - actors: nil, targets: nil, actor_names: nil, actor_ids: nil) - body = { - organization_id: organization, - range_start: range_start, - range_end: range_end - } + # Get Retention + # @param id [String] Unique identifier of the Organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuditLogsRetention] + def get_organization_audit_logs_retention( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/organizations/#{WorkOS::Util.encode_path(id)}/audit_logs_retention", auth: true, request_options: request_options) + WorkOS::AuditLogsRetention.new(response.body) + end - body["actions"] = actions unless actions.nil? - body["actors"] = actors unless actors.nil? - body["actor_names"] = actor_names unless actor_names.nil? - body["actor_ids"] = actor_ids unless actor_ids.nil? - body["targets"] = targets unless targets.nil? + # Set Retention + # @param id [String] Unique identifier of the Organization. + # @param retention_period_in_days [Integer] The number of days Audit Log events will be retained. Valid values are `30` and `365`. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuditLogsRetention] + def update_organization_audit_logs_retention( + id:, + retention_period_in_days:, + request_options: {} + ) + body = { + "retention_period_in_days" => retention_period_in_days + }.compact + response = @client.request(method: :put, path: "/organizations/#{WorkOS::Util.encode_path(id)}/audit_logs_retention", auth: true, body: body, request_options: request_options) + WorkOS::AuditLogsRetention.new(response.body) + end - request = post_request( - path: "/audit_logs/exports", - auth: true, - body: body - ) + # List Actions + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::AuditLogsOrder, nil] Order the results by the creation time. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_actions( + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/audit_logs/actions", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::AuditLogAction, filters: {before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_actions( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_actions( + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options + ) + end + ) + end - response = execute_request(request: request) + # List Schemas + # @param action_name [String] The name of the Audit Log action. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::AuditLogsOrder, nil] Order the results by the creation time. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_action_schemas( + action_name:, + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/audit_logs/actions/#{WorkOS::Util.encode_path(action_name)}/schemas", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::AuditLogSchema, filters: {action_name: action_name, before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_action_schemas( + action_name: action_name, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_action_schemas( + action_name: action_name, + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options + ) + end + ) + end - WorkOS::AuditLogExport.new(response.body) - end + # Create Schema + # @param action_name [String] The name of the Audit Log action. + # @param actor [WorkOS::AuditLogSchemaActor, nil] The metadata schema for the actor. + # @param targets [Array] The list of targets for the schema. + # @param metadata [Hash{String => Object}, nil] Optional JSON schema for event metadata. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuditLogSchema] + def create_schema( + action_name:, + targets:, + actor: nil, + metadata: nil, + request_options: {} + ) + body = { + "actor" => actor, + "targets" => targets, + "metadata" => metadata + }.compact + response = @client.request(method: :post, path: "/audit_logs/actions/#{WorkOS::Util.encode_path(action_name)}/schemas", auth: true, body: body, request_options: request_options) + WorkOS::AuditLogSchema.new(response.body) + end - # Retrieves an Export of Audit Log Events - # - # @param [String] id An Audit Log Export ID - # - # @return [WorkOS::AuditLogExport] - def get_export(id:) - request = get_request( - auth: true, - path: "/audit_logs/exports/#{id}" - ) + # Create Event + # @param organization_id [String] The unique ID of the Organization. + # @param event [WorkOS::AuditLogEvent] The audit log event to create. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuditLogEventCreateResponse] + def create_event( + organization_id:, + event:, + request_options: {} + ) + body = { + "organization_id" => organization_id, + "event" => event + }.compact + response = @client.request(method: :post, path: "/audit_logs/events", auth: true, body: body, request_options: request_options) + WorkOS::AuditLogEventCreateResponse.new(response.body) + end - response = execute_request(request: request) + # Create Export + # @param organization_id [String] The unique ID of the Organization. + # @param range_start [String] ISO-8601 value for start of the export range. + # @param range_end [String] ISO-8601 value for end of the export range. + # @param actions [Array, nil] List of actions to filter against. + # @param actors [Array, nil] (deprecated) Deprecated. Use `actor_names` instead. + # @param actor_names [Array, nil] List of actor names to filter against. + # @param actor_ids [Array, nil] List of actor IDs to filter against. + # @param targets [Array, nil] List of target types to filter against. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuditLogExport] + def create_export( + organization_id:, + range_start:, + range_end:, + actions: nil, + actors: nil, + actor_names: nil, + actor_ids: nil, + targets: nil, + request_options: {} + ) + body = { + "organization_id" => organization_id, + "range_start" => range_start, + "range_end" => range_end, + "actions" => actions, + "actors" => actors, + "actor_names" => actor_names, + "actor_ids" => actor_ids, + "targets" => targets + }.compact + response = @client.request(method: :post, path: "/audit_logs/exports", auth: true, body: body, request_options: request_options) + WorkOS::AuditLogExport.new(response.body) + end - WorkOS::AuditLogExport.new(response.body) - end + # Get Export + # @param audit_log_export_id [String] The unique ID of the Audit Log Export. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuditLogExport] + def get_export( + audit_log_export_id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/audit_logs/exports/#{WorkOS::Util.encode_path(audit_log_export_id)}", auth: true, request_options: request_options) + WorkOS::AuditLogExport.new(response.body) end end end diff --git a/lib/workos/audit_logs/audit_log_action.rb b/lib/workos/audit_logs/audit_log_action.rb new file mode 100644 index 00000000..05f51dbf --- /dev/null +++ b/lib/workos/audit_logs/audit_log_action.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogAction + include HashProvider + + HASH_ATTRS = { + object: :object, + name: :name, + schema: :schema, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :name, + :schema, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @name = hash[:name] + @schema = hash[:schema] ? WorkOS::AuditLogSchema.new(hash[:schema]) : nil + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/audit_logs/audit_log_event.rb b/lib/workos/audit_logs/audit_log_event.rb new file mode 100644 index 00000000..fa0ab77e --- /dev/null +++ b/lib/workos/audit_logs/audit_log_event.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogEvent + include HashProvider + + HASH_ATTRS = { + action: :action, + occurred_at: :occurred_at, + actor: :actor, + targets: :targets, + context: :context, + metadata: :metadata, + version: :version + }.freeze + + attr_accessor \ + :action, + :occurred_at, + :actor, + :targets, + :context, + :metadata, + :version + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @action = hash[:action] + @occurred_at = hash[:occurred_at] + @actor = hash[:actor] ? WorkOS::AuditLogEventActor.new(hash[:actor]) : nil + @targets = (hash[:targets] || []).map { |item| item ? WorkOS::AuditLogEventTarget.new(item) : nil } + @context = hash[:context] ? WorkOS::AuditLogEventContext.new(hash[:context]) : nil + @metadata = hash[:metadata] || {} + @version = hash[:version] + end + end +end diff --git a/lib/workos/audit_logs/audit_log_event_actor.rb b/lib/workos/audit_logs/audit_log_event_actor.rb new file mode 100644 index 00000000..2da2ce10 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_event_actor.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogEventActor + include HashProvider + + HASH_ATTRS = { + id: :id, + type: :type, + name: :name, + metadata: :metadata + }.freeze + + attr_accessor \ + :id, + :type, + :name, + :metadata + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @type = hash[:type] + @name = hash[:name] + @metadata = hash[:metadata] || {} + end + end +end diff --git a/lib/workos/audit_logs/audit_log_event_context.rb b/lib/workos/audit_logs/audit_log_event_context.rb new file mode 100644 index 00000000..4afc893e --- /dev/null +++ b/lib/workos/audit_logs/audit_log_event_context.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogEventContext + include HashProvider + + HASH_ATTRS = { + location: :location, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :location, + :user_agent + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @location = hash[:location] + @user_agent = hash[:user_agent] + end + end +end diff --git a/lib/workos/audit_logs/audit_log_event_create_response.rb b/lib/workos/audit_logs/audit_log_event_create_response.rb new file mode 100644 index 00000000..d913821a --- /dev/null +++ b/lib/workos/audit_logs/audit_log_event_create_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogEventCreateResponse + include HashProvider + + HASH_ATTRS = { + success: :success + }.freeze + + attr_accessor :success + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @success = hash[:success] + end + end +end diff --git a/lib/workos/audit_logs/audit_log_event_ingestion.rb b/lib/workos/audit_logs/audit_log_event_ingestion.rb new file mode 100644 index 00000000..f49ae753 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_event_ingestion.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogEventIngestion + include HashProvider + + HASH_ATTRS = { + organization_id: :organization_id, + event: :event + }.freeze + + attr_accessor \ + :organization_id, + :event + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @organization_id = hash[:organization_id] + @event = hash[:event] ? WorkOS::AuditLogEvent.new(hash[:event]) : nil + end + end +end diff --git a/lib/workos/audit_logs/audit_log_event_target.rb b/lib/workos/audit_logs/audit_log_event_target.rb new file mode 100644 index 00000000..ed10f38f --- /dev/null +++ b/lib/workos/audit_logs/audit_log_event_target.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuditLogEventTarget = AuditLogEventActor +end diff --git a/lib/workos/audit_logs/audit_log_export.rb b/lib/workos/audit_logs/audit_log_export.rb new file mode 100644 index 00000000..b3d56fdf --- /dev/null +++ b/lib/workos/audit_logs/audit_log_export.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogExport + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + state: :state, + url: :url, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :state, + :url, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @state = hash[:state] + @url = hash[:url] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/audit_logs/audit_log_export_creation.rb b/lib/workos/audit_logs/audit_log_export_creation.rb new file mode 100644 index 00000000..9a167896 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_export_creation.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogExportCreation + include HashProvider + + HASH_ATTRS = { + organization_id: :organization_id, + range_start: :range_start, + range_end: :range_end, + actions: :actions, + actors: :actors, + actor_names: :actor_names, + actor_ids: :actor_ids, + targets: :targets + }.freeze + + # @!attribute actors + # @deprecated Deprecated. Use `actor_names` instead. + + attr_accessor \ + :organization_id, + :range_start, + :range_end, + :actions, + :actor_names, + :actor_ids, + :targets + + def actors + warn "[DEPRECATION] `actors` is deprecated. Deprecated. Use `actor_names` instead.", uplevel: 1, category: :deprecated + @actors + end + + attr_writer :actors + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @organization_id = hash[:organization_id] + @range_start = hash[:range_start] + @range_end = hash[:range_end] + @actions = hash[:actions] || [] + @actors = hash[:actors] || [] + @actor_names = hash[:actor_names] || [] + @actor_ids = hash[:actor_ids] || [] + @targets = hash[:targets] || [] + end + end +end diff --git a/lib/workos/audit_logs/audit_log_schema.rb b/lib/workos/audit_logs/audit_log_schema.rb new file mode 100644 index 00000000..cc8d0b69 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_schema.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogSchema + include HashProvider + + HASH_ATTRS = { + object: :object, + version: :version, + actor: :actor, + targets: :targets, + metadata: :metadata, + created_at: :created_at + }.freeze + + attr_accessor \ + :object, + :version, + :actor, + :targets, + :metadata, + :created_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @version = hash[:version] + @actor = hash[:actor] ? WorkOS::AuditLogSchemaActor.new(hash[:actor]) : nil + @targets = (hash[:targets] || []).map { |item| item ? WorkOS::AuditLogSchemaTarget.new(item) : nil } + @metadata = hash[:metadata] || {} + @created_at = hash[:created_at] + end + end +end diff --git a/lib/workos/audit_logs/audit_log_schema_actor.rb b/lib/workos/audit_logs/audit_log_schema_actor.rb new file mode 100644 index 00000000..8c6bfa65 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_schema_actor.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogSchemaActor + include HashProvider + + HASH_ATTRS = { + metadata: :metadata + }.freeze + + attr_accessor :metadata + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @metadata = hash[:metadata] || {} + end + end +end diff --git a/lib/workos/audit_logs/audit_log_schema_target.rb b/lib/workos/audit_logs/audit_log_schema_target.rb new file mode 100644 index 00000000..8afdf12f --- /dev/null +++ b/lib/workos/audit_logs/audit_log_schema_target.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogSchemaTarget + include HashProvider + + HASH_ATTRS = { + type: :type, + metadata: :metadata + }.freeze + + attr_accessor \ + :type, + :metadata + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @metadata = hash[:metadata] || {} + end + end +end diff --git a/lib/workos/authentication_factor_and_challenge.rb b/lib/workos/authentication_factor_and_challenge.rb deleted file mode 100644 index 12ad5a3f..00000000 --- a/lib/workos/authentication_factor_and_challenge.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The AuthenticationFactorAndChallenge class represents - # an authentication factor and challenge for a given user. - class AuthenticationFactorAndChallenge - include HashProvider - - attr_accessor :authentication_factor, :authentication_challenge - - def initialize(authentication_response_json) - json = JSON.parse(authentication_response_json, symbolize_names: true) - @authentication_factor = WorkOS::Factor.new( - json[:authentication_factor].to_json - ) - @authentication_challenge = WorkOS::Challenge.new( - json[:authentication_challenge].to_json - ) - end - - def to_json(*) - { - authentication_factor: authentication_factor.to_json, - authentication_challenge: authentication_challenge.to_json - } - end - end -end diff --git a/lib/workos/authentication_response.rb b/lib/workos/authentication_response.rb deleted file mode 100644 index 5ea9d8dc..00000000 --- a/lib/workos/authentication_response.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The AuthenticationResponse class represents an Authentication Response as well as an corresponding - # response data that can later be appended on. - class AuthenticationResponse - include HashProvider - - attr_accessor :user, - :organization_id, - :impersonator, - :access_token, - :refresh_token, - :authentication_method, - :sealed_session, - :oauth_tokens - - # rubocop:disable Metrics/AbcSize - def initialize(authentication_response_json, session = nil) - json = JSON.parse(authentication_response_json, symbolize_names: true) - @access_token = json[:access_token] - @refresh_token = json[:refresh_token] - @user = WorkOS::User.new(json[:user].to_json) - @organization_id = json[:organization_id] - @impersonator = - if (impersonator_json = json[:impersonator]) - Impersonator.new(email: impersonator_json[:email], - reason: impersonator_json[:reason]) - end - @authentication_method = json[:authentication_method] - @oauth_tokens = json[:oauth_tokens] ? WorkOS::OAuthTokens.new(json[:oauth_tokens].to_json) : nil - @sealed_session = - if session && session[:seal_session] - WorkOS::Session.seal_data( - { - access_token: access_token, - refresh_token: refresh_token, - user: user.to_json, - organization_id: organization_id, - impersonator: impersonator.to_json - }, - session[:cookie_password], - encryptor: session[:encryptor] - ) - end - end - # rubocop:enable Metrics/AbcSize - - def to_json(*) - { - user: user.to_json, - organization_id: organization_id, - impersonator: impersonator.to_json, - access_token: access_token, - refresh_token: refresh_token, - authentication_method: authentication_method, - sealed_session: sealed_session, - oauth_tokens: oauth_tokens&.to_json - } - end - end -end diff --git a/lib/workos/authorization.rb b/lib/workos/authorization.rb new file mode 100644 index 00000000..39834045 --- /dev/null +++ b/lib/workos/authorization.rb @@ -0,0 +1,1095 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Authorization + def initialize(client) + @client = client + end + + # Check authorization + # @param organization_membership_id [String] The ID of the organization membership to check. + # @param permission_slug [String] The slug of the permission to check. + # @param resource_id [String, nil] The ID of the resource. Mutually exclusive with `resource_external_id` and `resource_type_slug`. + # @param resource_external_id [String, nil] The external ID of the resource. Required with `resource_type_slug`. Mutually exclusive with `resource_id`. + # @param resource_type_slug [String, nil] The slug of the resource type. Required with `resource_external_id`. Mutually exclusive with `resource_id`. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthorizationCheck] + def check( + organization_membership_id:, + permission_slug:, + resource_target:, + resource_id: nil, + resource_external_id: nil, + resource_type_slug: nil, + request_options: {} + ) + params = {} + case resource_target[:type] + when "by_id" + params["resource_id"] = resource_target[:resource_id] + when "by_external_id" + params["resource_external_id"] = resource_target[:resource_external_id] + params["resource_type_slug"] = resource_target[:resource_type_slug] + end + body = { + "permission_slug" => permission_slug, + "resource_id" => resource_id, + "resource_external_id" => resource_external_id, + "resource_type_slug" => resource_type_slug + }.compact + response = @client.request(method: :post, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/check", auth: true, params: params, body: body, request_options: request_options) + WorkOS::AuthorizationCheck.new(response.body) + end + + # List resources for organization membership + # @param organization_membership_id [String] The ID of the organization membership. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param permission_slug [String] The permission slug to filter by. Only child resources where the organization membership has this permission are returned. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_organization_membership_resources( + organization_membership_id:, + permission_slug:, + parent_resource:, + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "permission_slug" => permission_slug + }.compact + case parent_resource[:type] + when "by_id" + params["parent_resource_id"] = parent_resource[:parent_resource_id] + when "by_external_id" + params["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] + params["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] + end + response = @client.request(method: :get, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/resources", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::AuthorizationResource, filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order, permission_slug: permission_slug, parent_resource: parent_resource}, + fetch_next: lambda do |cursor| + list_organization_membership_resources( + organization_membership_id: organization_membership_id, + before: before, + after: cursor, + limit: limit, + order: order, + permission_slug: permission_slug, + parent_resource: parent_resource, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_organization_membership_resources( + organization_membership_id: organization_membership_id, + before: cursor, + after: nil, + limit: limit, + order: order, + permission_slug: permission_slug, + parent_resource: parent_resource, + request_options: request_options + ) + end + ) + end + + # List effective permissions for an organization membership on a resource + # @param organization_membership_id [String] The ID of the organization membership. + # @param resource_id [String] The ID of the authorization resource. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_resource_permissions( + organization_membership_id:, + resource_id:, + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/resources/#{WorkOS::Util.encode_path(resource_id)}/permissions", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::AuthorizationPermission, filters: {organization_membership_id: organization_membership_id, resource_id: resource_id, before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_resource_permissions( + organization_membership_id: organization_membership_id, + resource_id: resource_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_resource_permissions( + organization_membership_id: organization_membership_id, + resource_id: resource_id, + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options + ) + end + ) + end + + # List effective permissions for an organization membership on a resource by external ID + # @param organization_membership_id [String] The ID of the organization membership. + # @param resource_type_slug [String] The slug of the resource type. + # @param external_id [String] An identifier you provide to reference the resource in your system. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_effective_permissions_by_external_id( + organization_membership_id:, + resource_type_slug:, + external_id:, + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}/permissions", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::AuthorizationPermission, filters: {organization_membership_id: organization_membership_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_effective_permissions_by_external_id( + organization_membership_id: organization_membership_id, + resource_type_slug: resource_type_slug, + external_id: external_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_effective_permissions_by_external_id( + organization_membership_id: organization_membership_id, + resource_type_slug: resource_type_slug, + external_id: external_id, + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options + ) + end + ) + end + + # List role assignments + # @param organization_membership_id [String] The ID of the organization membership. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_organization_membership_role_assignments( + organization_membership_id:, + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::RoleAssignment, filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_organization_membership_role_assignments( + organization_membership_id: organization_membership_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_organization_membership_role_assignments( + organization_membership_id: organization_membership_id, + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options + ) + end + ) + end + + # Assign a role + # @param organization_membership_id [String] The ID of the organization membership. + # @param role_slug [String] The slug of the role to assign. + # @param resource_id [String, nil] The ID of the resource. Mutually exclusive with `resource_external_id` and `resource_type_slug`. + # @param resource_external_id [String, nil] The external ID of the resource. Required with `resource_type_slug`. Mutually exclusive with `resource_id`. + # @param resource_type_slug [String, nil] The resource type slug. Required with `resource_external_id`. Mutually exclusive with `resource_id`. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::RoleAssignment] + def assign_role( + organization_membership_id:, + role_slug:, + resource_target:, + resource_id: nil, + resource_external_id: nil, + resource_type_slug: nil, + request_options: {} + ) + params = {} + case resource_target[:type] + when "by_id" + params["resource_id"] = resource_target[:resource_id] + when "by_external_id" + params["resource_external_id"] = resource_target[:resource_external_id] + params["resource_type_slug"] = resource_target[:resource_type_slug] + end + body = { + "role_slug" => role_slug, + "resource_id" => resource_id, + "resource_external_id" => resource_external_id, + "resource_type_slug" => resource_type_slug + }.compact + response = @client.request(method: :post, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments", auth: true, params: params, body: body, request_options: request_options) + WorkOS::RoleAssignment.new(response.body) + end + + # Remove a role assignment + # @param organization_membership_id [String] The ID of the organization membership. + # @param role_slug [String] The slug of the role to remove. + # @param resource_id [String, nil] The ID of the resource. Mutually exclusive with `resource_external_id` and `resource_type_slug`. + # @param resource_external_id [String, nil] The external ID of the resource. Required with `resource_type_slug`. Mutually exclusive with `resource_id`. + # @param resource_type_slug [String, nil] The resource type slug. Required with `resource_external_id`. Mutually exclusive with `resource_id`. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def remove_role( + organization_membership_id:, + role_slug:, + resource_target:, + resource_id: nil, + resource_external_id: nil, + resource_type_slug: nil, + request_options: {} + ) + params = {} + case resource_target[:type] + when "by_id" + params["resource_id"] = resource_target[:resource_id] + when "by_external_id" + params["resource_external_id"] = resource_target[:resource_external_id] + params["resource_type_slug"] = resource_target[:resource_type_slug] + end + body = { + "role_slug" => role_slug, + "resource_id" => resource_id, + "resource_external_id" => resource_external_id, + "resource_type_slug" => resource_type_slug + }.compact + @client.request(method: :delete, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments", auth: true, params: params, body: body, request_options: request_options) + nil + end + + # Remove a role assignment by ID + # @param organization_membership_id [String] The ID of the organization membership. + # @param role_assignment_id [String] The ID of the role assignment to remove. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_organization_membership_role_assignment( + organization_membership_id:, + role_assignment_id:, + request_options: {} + ) + @client.request(method: :delete, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments/#{WorkOS::Util.encode_path(role_assignment_id)}", auth: true, request_options: request_options) + nil + end + + # List custom roles + # @param organization_id [String] The ID of the organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::RoleList] + def list_organization_roles( + organization_id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles", auth: true, request_options: request_options) + WorkOS::RoleList.new(response.body) + end + + # Create a custom role + # @param organization_id [String] The ID of the organization. + # @param slug [String, nil] A unique identifier for the role within the organization. When provided, must begin with 'org-' and contain only lowercase letters, numbers, hyphens, and underscores. When omitted, a slug is auto-generated from the role name and a random suffix. + # @param name [String] A descriptive name for the role. + # @param description [String, nil] An optional description of the role's purpose. + # @param resource_type_slug [String, nil] The slug of the resource type the role is scoped to. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Role] + def create_organization_role( + organization_id:, + name:, + slug: nil, + description: nil, + resource_type_slug: nil, + request_options: {} + ) + body = { + "slug" => slug, + "name" => name, + "description" => description, + "resource_type_slug" => resource_type_slug + }.compact + response = @client.request(method: :post, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles", auth: true, body: body, request_options: request_options) + WorkOS::Role.new(response.body) + end + + # Get a custom role + # @param organization_id [String] The ID of the organization. + # @param slug [String] The slug of the role. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Role] + def get_organization_role( + organization_id:, + slug:, + request_options: {} + ) + response = @client.request(method: :get, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + WorkOS::Role.new(response.body) + end + + # Update a custom role + # @param organization_id [String] The ID of the organization. + # @param slug [String] The slug of the role. + # @param name [String, nil] A descriptive name for the role. + # @param description [String, nil] An optional description of the role's purpose. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Role] + def update_organization_role( + organization_id:, + slug:, + name: nil, + description: nil, + request_options: {} + ) + body = { + "name" => name, + "description" => description + }.compact + response = @client.request(method: :patch, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}", auth: true, body: body, request_options: request_options) + WorkOS::Role.new(response.body) + end + + # Delete a custom role + # @param organization_id [String] The ID of the organization. + # @param slug [String] The slug of the role. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_organization_role( + organization_id:, + slug:, + request_options: {} + ) + @client.request(method: :delete, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + nil + end + + # Add a permission to a custom role + # @param organization_id [String] The ID of the organization. + # @param slug [String] The slug of the role. + # @param body_slug [String] The slug of the permission to add to the role. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Role] + def create_role_permission( + organization_id:, + slug:, + body_slug:, + request_options: {} + ) + body = { + "slug" => body_slug + }.compact + response = @client.request(method: :post, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}/permissions", auth: true, body: body, request_options: request_options) + WorkOS::Role.new(response.body) + end + + # Set permissions for a custom role + # @param organization_id [String] The ID of the organization. + # @param slug [String] The slug of the role. + # @param permissions [Array] The permission slugs to assign to the role. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Role] + def update_role_permissions( + organization_id:, + slug:, + permissions:, + request_options: {} + ) + body = { + "permissions" => permissions + }.compact + response = @client.request(method: :put, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}/permissions", auth: true, body: body, request_options: request_options) + WorkOS::Role.new(response.body) + end + + # Remove a permission from a custom role + # @param organization_id [String] The ID of the organization. + # @param slug [String] The slug of the role. + # @param permission_slug [String] The slug of the permission to remove. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Role] + def delete_role_permission( + organization_id:, + slug:, + permission_slug:, + request_options: {} + ) + response = @client.request(method: :delete, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}/permissions/#{WorkOS::Util.encode_path(permission_slug)}", auth: true, request_options: request_options) + WorkOS::Role.new(response.body) + end + + # Get a resource by external ID + # @param organization_id [String] The ID of the organization that owns the resource. + # @param resource_type_slug [String] The slug of the resource type. + # @param external_id [String] An identifier you provide to reference the resource in your system. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthorizationResource] + def get_organization_resource( + organization_id:, + resource_type_slug:, + external_id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}", auth: true, request_options: request_options) + WorkOS::AuthorizationResource.new(response.body) + end + + # Update a resource by external ID + # @param organization_id [String] The ID of the organization that owns the resource. + # @param resource_type_slug [String] The slug of the resource type. + # @param external_id [String] An identifier you provide to reference the resource in your system. + # @param name [String, nil] A display name for the resource. + # @param description [String, nil] An optional description of the resource. + # @param parent_resource_id [String, nil] The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`. + # @param parent_resource_external_id [String, nil] The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`. + # @param parent_resource_type_slug [String, nil] The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthorizationResource] + def update_organization_resource( + organization_id:, + resource_type_slug:, + external_id:, + name: nil, + description: nil, + parent_resource_id: nil, + parent_resource_external_id: nil, + parent_resource_type_slug: nil, + parent_resource: nil, + request_options: {} + ) + params = {} + if parent_resource + case parent_resource[:type] + when "by_id" + params["parent_resource_id"] = parent_resource[:parent_resource_id] + when "by_external_id" + params["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] + params["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] + end + end + body = { + "name" => name, + "description" => description, + "parent_resource_id" => parent_resource_id, + "parent_resource_external_id" => parent_resource_external_id, + "parent_resource_type_slug" => parent_resource_type_slug + }.compact + response = @client.request(method: :patch, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}", auth: true, params: params, body: body, request_options: request_options) + WorkOS::AuthorizationResource.new(response.body) + end + + # Delete an authorization resource by external ID + # @param organization_id [String] The ID of the organization that owns the resource. + # @param resource_type_slug [String] The slug of the resource type. + # @param external_id [String] An identifier you provide to reference the resource in your system. + # @param cascade_delete [Boolean, nil] If true, deletes all descendant resources and role assignments. If not set and the resource has children or assignments, the request will fail. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_organization_resource( + organization_id:, + resource_type_slug:, + external_id:, + cascade_delete: nil, + request_options: {} + ) + params = { + "cascade_delete" => cascade_delete + }.compact + @client.request(method: :delete, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}", auth: true, params: params, request_options: request_options) + nil + end + + # List memberships for a resource by external ID + # @param organization_id [String] The ID of the organization that owns the resource. + # @param resource_type_slug [String] The slug of the resource type this resource belongs to. + # @param external_id [String] An identifier you provide to reference the resource in your system. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param permission_slug [String] The permission slug to filter by. Only users with this permission on the resource are returned. + # @param assignment [WorkOS::Types::AuthorizationAssignment, nil] Filter by assignment type. Use "direct" for direct assignments only, or "indirect" to include inherited assignments. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_resource_organization_memberships( + organization_id:, + resource_type_slug:, + external_id:, + permission_slug:, + before: nil, + after: nil, + limit: nil, + order: nil, + assignment: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "permission_slug" => permission_slug, + "assignment" => assignment + }.compact + response = @client.request(method: :get, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}/organization_memberships", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::UserOrganizationMembershipBaseListData, filters: {organization_id: organization_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order, permission_slug: permission_slug, assignment: assignment}, + fetch_next: lambda do |cursor| + list_resource_organization_memberships( + organization_id: organization_id, + resource_type_slug: resource_type_slug, + external_id: external_id, + before: before, + after: cursor, + limit: limit, + order: order, + permission_slug: permission_slug, + assignment: assignment, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_resource_organization_memberships( + organization_id: organization_id, + resource_type_slug: resource_type_slug, + external_id: external_id, + before: cursor, + after: nil, + limit: limit, + order: order, + permission_slug: permission_slug, + assignment: assignment, + request_options: request_options + ) + end + ) + end + + # List resources + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param organization_id [String, nil] Filter resources by organization ID. + # @param resource_type_slug [String, nil] Filter resources by resource type slug. + # @param search [String, nil] Search resources by name. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_resources( + before: nil, + after: nil, + limit: nil, + order: nil, + organization_id: nil, + resource_type_slug: nil, + search: nil, + parent: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "organization_id" => organization_id, + "resource_type_slug" => resource_type_slug, + "search" => search + }.compact + if parent + case parent[:type] + when "by_id" + params["parent_resource_id"] = parent[:parent_resource_id] + when "by_external_id" + params["parent_resource_type_slug"] = parent[:parent_resource_type_slug] + params["parent_external_id"] = parent[:parent_external_id] + end + end + response = @client.request(method: :get, path: "/authorization/resources", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::AuthorizationResource, filters: {before: before, limit: limit, order: order, organization_id: organization_id, resource_type_slug: resource_type_slug, search: search, parent: parent}, + fetch_next: lambda do |cursor| + list_resources( + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + resource_type_slug: resource_type_slug, + search: search, + parent: parent, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_resources( + before: cursor, + after: nil, + limit: limit, + order: order, + organization_id: organization_id, + resource_type_slug: resource_type_slug, + search: search, + parent: parent, + request_options: request_options + ) + end + ) + end + + # Create an authorization resource + # @param external_id [String] An external identifier for the resource. + # @param name [String] A display name for the resource. + # @param description [String, nil] An optional description of the resource. + # @param resource_type_slug [String] The slug of the resource type. + # @param organization_id [String] The ID of the organization this resource belongs to. + # @param parent_resource_id [String, nil] The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`. + # @param parent_resource_external_id [String, nil] The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`. + # @param parent_resource_type_slug [String, nil] The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthorizationResource] + def create_resource( + external_id:, + name:, + resource_type_slug:, + organization_id:, + description: nil, + parent_resource_id: nil, + parent_resource_external_id: nil, + parent_resource_type_slug: nil, + parent_resource: nil, + request_options: {} + ) + params = {} + if parent_resource + case parent_resource[:type] + when "by_id" + params["parent_resource_id"] = parent_resource[:parent_resource_id] + when "by_external_id" + params["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] + params["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] + end + end + body = { + "external_id" => external_id, + "name" => name, + "description" => description, + "resource_type_slug" => resource_type_slug, + "organization_id" => organization_id, + "parent_resource_id" => parent_resource_id, + "parent_resource_external_id" => parent_resource_external_id, + "parent_resource_type_slug" => parent_resource_type_slug + }.compact + response = @client.request(method: :post, path: "/authorization/resources", auth: true, params: params, body: body, request_options: request_options) + WorkOS::AuthorizationResource.new(response.body) + end + + # Get a resource + # @param resource_id [String] The ID of the authorization resource. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthorizationResource] + def get_resource( + resource_id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}", auth: true, request_options: request_options) + WorkOS::AuthorizationResource.new(response.body) + end + + # Update a resource + # @param resource_id [String] The ID of the authorization resource. + # @param name [String, nil] A display name for the resource. + # @param description [String, nil] An optional description of the resource. + # @param parent_resource_id [String, nil] The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`. + # @param parent_resource_external_id [String, nil] The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`. + # @param parent_resource_type_slug [String, nil] The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthorizationResource] + def update_resource( + resource_id:, + name: nil, + description: nil, + parent_resource_id: nil, + parent_resource_external_id: nil, + parent_resource_type_slug: nil, + parent_resource: nil, + request_options: {} + ) + params = {} + if parent_resource + case parent_resource[:type] + when "by_id" + params["parent_resource_id"] = parent_resource[:parent_resource_id] + when "by_external_id" + params["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] + params["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] + end + end + body = { + "name" => name, + "description" => description, + "parent_resource_id" => parent_resource_id, + "parent_resource_external_id" => parent_resource_external_id, + "parent_resource_type_slug" => parent_resource_type_slug + }.compact + response = @client.request(method: :patch, path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}", auth: true, params: params, body: body, request_options: request_options) + WorkOS::AuthorizationResource.new(response.body) + end + + # Delete an authorization resource + # @param resource_id [String] The ID of the authorization resource. + # @param cascade_delete [Boolean, nil] If true, deletes all descendant resources and role assignments. If not set and the resource has children or assignments, the request will fail. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_resource( + resource_id:, + cascade_delete: nil, + request_options: {} + ) + params = { + "cascade_delete" => cascade_delete + }.compact + @client.request(method: :delete, path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}", auth: true, params: params, request_options: request_options) + nil + end + + # List organization memberships for resource + # @param resource_id [String] The ID of the authorization resource. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param permission_slug [String] The permission slug to filter by. Only users with this permission on the resource are returned. + # @param assignment [WorkOS::Types::AuthorizationAssignment, nil] Filter by assignment type. Use `direct` for direct assignments only, or `indirect` to include inherited assignments. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_memberships_for_resource( + resource_id:, + permission_slug:, + before: nil, + after: nil, + limit: nil, + order: nil, + assignment: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "permission_slug" => permission_slug, + "assignment" => assignment + }.compact + response = @client.request(method: :get, path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}/organization_memberships", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::UserOrganizationMembershipBaseListData, filters: {resource_id: resource_id, before: before, limit: limit, order: order, permission_slug: permission_slug, assignment: assignment}, + fetch_next: lambda do |cursor| + list_memberships_for_resource( + resource_id: resource_id, + before: before, + after: cursor, + limit: limit, + order: order, + permission_slug: permission_slug, + assignment: assignment, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_memberships_for_resource( + resource_id: resource_id, + before: cursor, + after: nil, + limit: limit, + order: order, + permission_slug: permission_slug, + assignment: assignment, + request_options: request_options + ) + end + ) + end + + # List environment roles + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::RoleList] + def list_environment_roles(request_options: {}) + response = @client.request(method: :get, path: "/authorization/roles", auth: true, request_options: request_options) + WorkOS::RoleList.new(response.body) + end + + # Create an environment role + # @param slug [String] A unique slug for the role. + # @param name [String] A descriptive name for the role. + # @param description [String, nil] An optional description of the role. + # @param resource_type_slug [String, nil] The slug of the resource type the role is scoped to. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Role] + def create_environment_role( + slug:, + name:, + description: nil, + resource_type_slug: nil, + request_options: {} + ) + body = { + "slug" => slug, + "name" => name, + "description" => description, + "resource_type_slug" => resource_type_slug + }.compact + response = @client.request(method: :post, path: "/authorization/roles", auth: true, body: body, request_options: request_options) + WorkOS::Role.new(response.body) + end + + # Get an environment role + # @param slug [String] The slug of the environment role. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Role] + def get_environment_role( + slug:, + request_options: {} + ) + response = @client.request(method: :get, path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + WorkOS::Role.new(response.body) + end + + # Update an environment role + # @param slug [String] The slug of the environment role. + # @param name [String, nil] A descriptive name for the role. + # @param description [String, nil] An optional description of the role. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Role] + def update_environment_role( + slug:, + name: nil, + description: nil, + request_options: {} + ) + body = { + "name" => name, + "description" => description + }.compact + response = @client.request(method: :patch, path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}", auth: true, body: body, request_options: request_options) + WorkOS::Role.new(response.body) + end + + # Add a permission to an environment role + # @param slug [String] The slug of the environment role. + # @param body_slug [String] The slug of the permission to add to the role. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Role] + def add_environment_role_permission( + slug:, + body_slug:, + request_options: {} + ) + body = { + "slug" => body_slug + }.compact + response = @client.request(method: :post, path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}/permissions", auth: true, body: body, request_options: request_options) + WorkOS::Role.new(response.body) + end + + # Set permissions for an environment role + # @param slug [String] The slug of the environment role. + # @param permissions [Array] The permission slugs to assign to the role. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Role] + def set_environment_role_permissions( + slug:, + permissions:, + request_options: {} + ) + body = { + "permissions" => permissions + }.compact + response = @client.request(method: :put, path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}/permissions", auth: true, body: body, request_options: request_options) + WorkOS::Role.new(response.body) + end + + # List permissions + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::PermissionsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_permissions( + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/authorization/permissions", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::AuthorizationPermission, filters: {before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_permissions( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_permissions( + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options + ) + end + ) + end + + # Create a permission + # @param slug [String] A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks. + # @param name [String] A descriptive name for the Permission. + # @param description [String, nil] An optional description of the Permission. + # @param resource_type_slug [String, nil] The slug of the resource type this permission is scoped to. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Permission] + def create_permission( + slug:, + name:, + description: nil, + resource_type_slug: nil, + request_options: {} + ) + body = { + "slug" => slug, + "name" => name, + "description" => description, + "resource_type_slug" => resource_type_slug + }.compact + response = @client.request(method: :post, path: "/authorization/permissions", auth: true, body: body, request_options: request_options) + WorkOS::Permission.new(response.body) + end + + # Get a permission + # @param slug [String] A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthorizationPermission] + def get_permission( + slug:, + request_options: {} + ) + response = @client.request(method: :get, path: "/authorization/permissions/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + WorkOS::AuthorizationPermission.new(response.body) + end + + # Update a permission + # @param slug [String] A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks. + # @param name [String, nil] A descriptive name for the Permission. + # @param description [String, nil] An optional description of the Permission. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthorizationPermission] + def update_permission( + slug:, + name: nil, + description: nil, + request_options: {} + ) + body = { + "name" => name, + "description" => description + }.compact + response = @client.request(method: :patch, path: "/authorization/permissions/#{WorkOS::Util.encode_path(slug)}", auth: true, body: body, request_options: request_options) + WorkOS::AuthorizationPermission.new(response.body) + end + + # Delete a permission + # @param slug [String] A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_permission( + slug:, + request_options: {} + ) + @client.request(method: :delete, path: "/authorization/permissions/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + nil + end + end +end diff --git a/lib/workos/authorization/add_role_permission.rb b/lib/workos/authorization/add_role_permission.rb new file mode 100644 index 00000000..e7af4e22 --- /dev/null +++ b/lib/workos/authorization/add_role_permission.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AddRolePermission + include HashProvider + + HASH_ATTRS = { + slug: :slug + }.freeze + + attr_accessor :slug + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @slug = hash[:slug] + end + end +end diff --git a/lib/workos/authorization/assign_role.rb b/lib/workos/authorization/assign_role.rb new file mode 100644 index 00000000..205671d0 --- /dev/null +++ b/lib/workos/authorization/assign_role.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AssignRole + include HashProvider + + HASH_ATTRS = { + role_slug: :role_slug, + resource_id: :resource_id, + resource_external_id: :resource_external_id, + resource_type_slug: :resource_type_slug + }.freeze + + attr_accessor \ + :role_slug, + :resource_id, + :resource_external_id, + :resource_type_slug + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @role_slug = hash[:role_slug] + @resource_id = hash[:resource_id] + @resource_external_id = hash[:resource_external_id] + @resource_type_slug = hash[:resource_type_slug] + end + end +end diff --git a/lib/workos/authorization/authorization_check.rb b/lib/workos/authorization/authorization_check.rb new file mode 100644 index 00000000..b3971c98 --- /dev/null +++ b/lib/workos/authorization/authorization_check.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthorizationCheck + include HashProvider + + HASH_ATTRS = { + authorized: :authorized + }.freeze + + attr_accessor :authorized + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @authorized = hash[:authorized] + end + end +end diff --git a/lib/workos/authorization/authorization_permission.rb b/lib/workos/authorization/authorization_permission.rb new file mode 100644 index 00000000..a0dfb4c2 --- /dev/null +++ b/lib/workos/authorization/authorization_permission.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthorizationPermission + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + slug: :slug, + name: :name, + description: :description, + system: :system, + resource_type_slug: :resource_type_slug, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :slug, + :name, + :description, + :system, + :resource_type_slug, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @slug = hash[:slug] + @name = hash[:name] + @description = hash[:description] + @system = hash[:system] + @resource_type_slug = hash[:resource_type_slug] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/authorization/authorization_resource.rb b/lib/workos/authorization/authorization_resource.rb new file mode 100644 index 00000000..a30dac8f --- /dev/null +++ b/lib/workos/authorization/authorization_resource.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthorizationResource + include HashProvider + + HASH_ATTRS = { + object: :object, + name: :name, + description: :description, + organization_id: :organization_id, + parent_resource_id: :parent_resource_id, + id: :id, + external_id: :external_id, + resource_type_slug: :resource_type_slug, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :name, + :description, + :organization_id, + :parent_resource_id, + :id, + :external_id, + :resource_type_slug, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @name = hash[:name] + @description = hash[:description] + @organization_id = hash[:organization_id] + @parent_resource_id = hash[:parent_resource_id] + @id = hash[:id] + @external_id = hash[:external_id] + @resource_type_slug = hash[:resource_type_slug] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/authorization/check_authorization.rb b/lib/workos/authorization/check_authorization.rb new file mode 100644 index 00000000..a4661462 --- /dev/null +++ b/lib/workos/authorization/check_authorization.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CheckAuthorization + include HashProvider + + HASH_ATTRS = { + permission_slug: :permission_slug, + resource_id: :resource_id, + resource_external_id: :resource_external_id, + resource_type_slug: :resource_type_slug + }.freeze + + attr_accessor \ + :permission_slug, + :resource_id, + :resource_external_id, + :resource_type_slug + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @permission_slug = hash[:permission_slug] + @resource_id = hash[:resource_id] + @resource_external_id = hash[:resource_external_id] + @resource_type_slug = hash[:resource_type_slug] + end + end +end diff --git a/lib/workos/authorization/create_authorization_permission.rb b/lib/workos/authorization/create_authorization_permission.rb new file mode 100644 index 00000000..d5316d1d --- /dev/null +++ b/lib/workos/authorization/create_authorization_permission.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateAuthorizationPermission + include HashProvider + + HASH_ATTRS = { + slug: :slug, + name: :name, + description: :description, + resource_type_slug: :resource_type_slug + }.freeze + + attr_accessor \ + :slug, + :name, + :description, + :resource_type_slug + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @slug = hash[:slug] + @name = hash[:name] + @description = hash[:description] + @resource_type_slug = hash[:resource_type_slug] + end + end +end diff --git a/lib/workos/authorization/create_authorization_resource.rb b/lib/workos/authorization/create_authorization_resource.rb new file mode 100644 index 00000000..cc74f011 --- /dev/null +++ b/lib/workos/authorization/create_authorization_resource.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateAuthorizationResource + include HashProvider + + HASH_ATTRS = { + external_id: :external_id, + name: :name, + description: :description, + resource_type_slug: :resource_type_slug, + organization_id: :organization_id, + parent_resource_id: :parent_resource_id, + parent_resource_external_id: :parent_resource_external_id, + parent_resource_type_slug: :parent_resource_type_slug + }.freeze + + attr_accessor \ + :external_id, + :name, + :description, + :resource_type_slug, + :organization_id, + :parent_resource_id, + :parent_resource_external_id, + :parent_resource_type_slug + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @external_id = hash[:external_id] + @name = hash[:name] + @description = hash[:description] + @resource_type_slug = hash[:resource_type_slug] + @organization_id = hash[:organization_id] + @parent_resource_id = hash[:parent_resource_id] + @parent_resource_external_id = hash[:parent_resource_external_id] + @parent_resource_type_slug = hash[:parent_resource_type_slug] + end + end +end diff --git a/lib/workos/authorization/create_organization_role.rb b/lib/workos/authorization/create_organization_role.rb new file mode 100644 index 00000000..6ac70868 --- /dev/null +++ b/lib/workos/authorization/create_organization_role.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateOrganizationRole + include HashProvider + + HASH_ATTRS = { + slug: :slug, + name: :name, + description: :description, + resource_type_slug: :resource_type_slug + }.freeze + + attr_accessor \ + :slug, + :name, + :description, + :resource_type_slug + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @slug = hash[:slug] + @name = hash[:name] + @description = hash[:description] + @resource_type_slug = hash[:resource_type_slug] + end + end +end diff --git a/lib/workos/authorization/create_role.rb b/lib/workos/authorization/create_role.rb new file mode 100644 index 00000000..b8e617f1 --- /dev/null +++ b/lib/workos/authorization/create_role.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + CreateRole = CreateAuthorizationPermission +end diff --git a/lib/workos/authorization/permission.rb b/lib/workos/authorization/permission.rb new file mode 100644 index 00000000..745284a1 --- /dev/null +++ b/lib/workos/authorization/permission.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + Permission = AuthorizationPermission +end diff --git a/lib/workos/authorization/permission_created.rb b/lib/workos/authorization/permission_created.rb new file mode 100644 index 00000000..92abfa40 --- /dev/null +++ b/lib/workos/authorization/permission_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class PermissionCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::PermissionCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/authorization/permission_created_data.rb b/lib/workos/authorization/permission_created_data.rb new file mode 100644 index 00000000..beb8abbc --- /dev/null +++ b/lib/workos/authorization/permission_created_data.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class PermissionCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + slug: :slug, + name: :name, + description: :description, + system: :system, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :slug, + :name, + :description, + :system, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @slug = hash[:slug] + @name = hash[:name] + @description = hash[:description] + @system = hash[:system] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/authorization/permission_deleted.rb b/lib/workos/authorization/permission_deleted.rb new file mode 100644 index 00000000..5de52b64 --- /dev/null +++ b/lib/workos/authorization/permission_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class PermissionDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::PermissionDeletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/authorization/permission_deleted_data.rb b/lib/workos/authorization/permission_deleted_data.rb new file mode 100644 index 00000000..99152a37 --- /dev/null +++ b/lib/workos/authorization/permission_deleted_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + PermissionDeletedData = PermissionCreatedData +end diff --git a/lib/workos/authorization/permission_updated.rb b/lib/workos/authorization/permission_updated.rb new file mode 100644 index 00000000..53d76974 --- /dev/null +++ b/lib/workos/authorization/permission_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class PermissionUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::PermissionUpdatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/authorization/permission_updated_data.rb b/lib/workos/authorization/permission_updated_data.rb new file mode 100644 index 00000000..5af757df --- /dev/null +++ b/lib/workos/authorization/permission_updated_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + PermissionUpdatedData = PermissionCreatedData +end diff --git a/lib/workos/authorization/remove_role.rb b/lib/workos/authorization/remove_role.rb new file mode 100644 index 00000000..8fca3899 --- /dev/null +++ b/lib/workos/authorization/remove_role.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + RemoveRole = AssignRole +end diff --git a/lib/workos/authorization/role.rb b/lib/workos/authorization/role.rb new file mode 100644 index 00000000..edac70f8 --- /dev/null +++ b/lib/workos/authorization/role.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Role + include HashProvider + + HASH_ATTRS = { + slug: :slug, + object: :object, + id: :id, + name: :name, + description: :description, + type: :type, + resource_type_slug: :resource_type_slug, + permissions: :permissions, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :slug, + :object, + :id, + :name, + :description, + :type, + :resource_type_slug, + :permissions, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @slug = hash[:slug] + @object = hash[:object] + @id = hash[:id] + @name = hash[:name] + @description = hash[:description] + @type = hash[:type] + @resource_type_slug = hash[:resource_type_slug] + @permissions = hash[:permissions] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/authorization/role_assignment.rb b/lib/workos/authorization/role_assignment.rb new file mode 100644 index 00000000..76ec9d4f --- /dev/null +++ b/lib/workos/authorization/role_assignment.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RoleAssignment + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + role: :role, + resource: :resource, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :role, + :resource, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @resource = hash[:resource] ? WorkOS::RoleAssignmentResource.new(hash[:resource]) : nil + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/authorization/role_assignment_resource.rb b/lib/workos/authorization/role_assignment_resource.rb new file mode 100644 index 00000000..822ed84b --- /dev/null +++ b/lib/workos/authorization/role_assignment_resource.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RoleAssignmentResource + include HashProvider + + HASH_ATTRS = { + id: :id, + external_id: :external_id, + resource_type_slug: :resource_type_slug + }.freeze + + attr_accessor \ + :id, + :external_id, + :resource_type_slug + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @external_id = hash[:external_id] + @resource_type_slug = hash[:resource_type_slug] + end + end +end diff --git a/lib/workos/authorization/role_created.rb b/lib/workos/authorization/role_created.rb new file mode 100644 index 00000000..775a880a --- /dev/null +++ b/lib/workos/authorization/role_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RoleCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::RoleCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/authorization/role_created_data.rb b/lib/workos/authorization/role_created_data.rb new file mode 100644 index 00000000..c0c09556 --- /dev/null +++ b/lib/workos/authorization/role_created_data.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RoleCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + slug: :slug, + resource_type_slug: :resource_type_slug, + permissions: :permissions, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :slug, + :resource_type_slug, + :permissions, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @slug = hash[:slug] + @resource_type_slug = hash[:resource_type_slug] + @permissions = hash[:permissions] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/authorization/role_deleted.rb b/lib/workos/authorization/role_deleted.rb new file mode 100644 index 00000000..2c90d733 --- /dev/null +++ b/lib/workos/authorization/role_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RoleDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::RoleDeletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/authorization/role_deleted_data.rb b/lib/workos/authorization/role_deleted_data.rb new file mode 100644 index 00000000..fdb74ff5 --- /dev/null +++ b/lib/workos/authorization/role_deleted_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + RoleDeletedData = RoleCreatedData +end diff --git a/lib/workos/authorization/role_list.rb b/lib/workos/authorization/role_list.rb new file mode 100644 index 00000000..34961630 --- /dev/null +++ b/lib/workos/authorization/role_list.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RoleList + include HashProvider + + HASH_ATTRS = { + object: :object, + data: :data + }.freeze + + attr_accessor \ + :object, + :data + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @data = (hash[:data] || []).map { |item| item ? WorkOS::Role.new(item) : nil } + end + end +end diff --git a/lib/workos/authorization/role_updated.rb b/lib/workos/authorization/role_updated.rb new file mode 100644 index 00000000..acf27f97 --- /dev/null +++ b/lib/workos/authorization/role_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RoleUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::RoleUpdatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/authorization/role_updated_data.rb b/lib/workos/authorization/role_updated_data.rb new file mode 100644 index 00000000..ae681399 --- /dev/null +++ b/lib/workos/authorization/role_updated_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + RoleUpdatedData = RoleCreatedData +end diff --git a/lib/workos/authorization/set_role_permissions.rb b/lib/workos/authorization/set_role_permissions.rb new file mode 100644 index 00000000..475fd026 --- /dev/null +++ b/lib/workos/authorization/set_role_permissions.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SetRolePermissions + include HashProvider + + HASH_ATTRS = { + permissions: :permissions + }.freeze + + attr_accessor :permissions + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @permissions = hash[:permissions] || [] + end + end +end diff --git a/lib/workos/authorization/slim_role.rb b/lib/workos/authorization/slim_role.rb new file mode 100644 index 00000000..7e98507b --- /dev/null +++ b/lib/workos/authorization/slim_role.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + SlimRole = AddRolePermission +end diff --git a/lib/workos/authorization/update_authorization_permission.rb b/lib/workos/authorization/update_authorization_permission.rb new file mode 100644 index 00000000..638045b7 --- /dev/null +++ b/lib/workos/authorization/update_authorization_permission.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UpdateAuthorizationPermission + include HashProvider + + HASH_ATTRS = { + name: :name, + description: :description + }.freeze + + attr_accessor \ + :name, + :description + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @name = hash[:name] + @description = hash[:description] + end + end +end diff --git a/lib/workos/authorization/update_authorization_resource.rb b/lib/workos/authorization/update_authorization_resource.rb new file mode 100644 index 00000000..c89c6382 --- /dev/null +++ b/lib/workos/authorization/update_authorization_resource.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UpdateAuthorizationResource + include HashProvider + + HASH_ATTRS = { + name: :name, + description: :description, + parent_resource_id: :parent_resource_id, + parent_resource_external_id: :parent_resource_external_id, + parent_resource_type_slug: :parent_resource_type_slug + }.freeze + + attr_accessor \ + :name, + :description, + :parent_resource_id, + :parent_resource_external_id, + :parent_resource_type_slug + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @name = hash[:name] + @description = hash[:description] + @parent_resource_id = hash[:parent_resource_id] + @parent_resource_external_id = hash[:parent_resource_external_id] + @parent_resource_type_slug = hash[:parent_resource_type_slug] + end + end +end diff --git a/lib/workos/authorization/update_organization_role.rb b/lib/workos/authorization/update_organization_role.rb new file mode 100644 index 00000000..68573440 --- /dev/null +++ b/lib/workos/authorization/update_organization_role.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + UpdateOrganizationRole = UpdateAuthorizationPermission +end diff --git a/lib/workos/authorization/update_role.rb b/lib/workos/authorization/update_role.rb new file mode 100644 index 00000000..cdaa6c16 --- /dev/null +++ b/lib/workos/authorization/update_role.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + UpdateRole = UpdateAuthorizationPermission +end diff --git a/lib/workos/authorization/user_organization_membership_base_list_data.rb b/lib/workos/authorization/user_organization_membership_base_list_data.rb new file mode 100644 index 00000000..d15d8a8e --- /dev/null +++ b/lib/workos/authorization/user_organization_membership_base_list_data.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserOrganizationMembershipBaseListData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + organization_id: :organization_id, + status: :status, + directory_managed: :directory_managed, + organization_name: :organization_name, + custom_attributes: :custom_attributes, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :organization_id, + :status, + :directory_managed, + :organization_name, + :custom_attributes, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + @status = hash[:status] + @directory_managed = hash[:directory_managed] + @organization_name = hash[:organization_name] + @custom_attributes = hash[:custom_attributes] || {} + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/base_client.rb b/lib/workos/base_client.rb new file mode 100644 index 00000000..f9836d41 --- /dev/null +++ b/lib/workos/base_client.rb @@ -0,0 +1,318 @@ +# frozen_string_literal: true + +# @oagen-ignore-file — hand-maintained runtime +require "json" +require "logger" +require "net/http" +require "securerandom" +require "uri" +require "workos/errors" + +module WorkOS + # Instance-scoped HTTP runtime that implements request execution, + # retry policy with exponential backoff + jitter, error translation, + # and per-request option overrides. + class BaseClient + DEFAULT_BASE_URL = "https://api.workos.com" + DEFAULT_TIMEOUT = 30 + DEFAULT_MAX_RETRIES = 2 + RETRYABLE_STATUSES = [408, 409, 429, 500, 502, 503, 504].freeze + RETRY_BACKOFF_BASE = 0.5 + LOG_SEVERITY = {debug: 0, info: 1, warn: 2, error: 3, unknown: 4}.freeze + + USER_AGENT = "workos-ruby/#{WorkOS::VERSION} ruby/#{RUBY_VERSION} (#{RUBY_PLATFORM})" + + attr_reader :api_key, :base_url, :client_id, :timeout, :max_retries, :logger, :log_level + + def initialize(api_key: nil, base_url: DEFAULT_BASE_URL, client_id: nil, + timeout: DEFAULT_TIMEOUT, max_retries: DEFAULT_MAX_RETRIES, logger: nil, log_level: nil) + @api_key = api_key + @base_url = base_url + @client_id = client_id + @timeout = timeout + @max_retries = max_retries + @logger = logger + @log_level = log_level + end + + # -- Request builders ------------------------------------------------- + + def get_request(path:, auth: false, params: {}, request_options: nil) + build_request(Net::HTTP::Get, append_query(path, params), + auth: auth, request_options: request_options) + end + + def post_request(path:, auth: false, body: {}, params: {}, request_options: nil) + req = build_request(Net::HTTP::Post, append_query(path, params), + auth: auth, request_options: request_options) + req.body = body.nil? ? "" : body.compact.to_json + req["Content-Type"] = "application/json" + inject_idempotency_key(req, request_options) + req + end + + def put_request(path:, auth: false, body: {}, params: {}, request_options: nil) + req = build_request(Net::HTTP::Put, append_query(path, params), + auth: auth, request_options: request_options) + req.body = body.nil? ? "" : body.compact.to_json + req["Content-Type"] = "application/json" + inject_idempotency_key(req, request_options) + req + end + + def patch_request(path:, auth: false, body: {}, params: {}, request_options: nil) + req = build_request(Net::HTTP::Patch, append_query(path, params), + auth: auth, request_options: request_options) + req.body = body.nil? ? "" : body.compact.to_json + req["Content-Type"] = "application/json" + inject_idempotency_key(req, request_options) + req + end + + def delete_request(path:, auth: false, body: nil, params: {}, request_options: nil) + req = build_request(Net::HTTP::Delete, append_query(path, params), + auth: auth, request_options: request_options) + if body + req.body = body.compact.to_json + req["Content-Type"] = "application/json" + end + req + end + + # -- Convenience entry point ------------------------------------------ + + # Unified request helper: builds the verb-specific request and executes + # it in a single call, removing the need for callers to pass + # request_options twice. + def request(method:, path:, auth: true, params: {}, body: nil, request_options: nil) + raise ArgumentError, "unsupported method" unless %i[get post put patch delete].include?(method) + + req = case method + when :get + get_request(path: path, auth: auth, params: params, request_options: request_options) + when :post + post_request(path: path, auth: auth, body: body, params: params, request_options: request_options) + when :put + put_request(path: path, auth: auth, body: body, params: params, request_options: request_options) + when :patch + patch_request(path: path, auth: auth, body: body, params: params, request_options: request_options) + when :delete + delete_request(path: path, auth: auth, body: body, params: params, request_options: request_options) + end + execute_request(request: req, request_options: request_options) + end + + # -- Execution -------------------------------------------------------- + + def execute_request(request:, request_options: nil) + opts = request_options || {} + base = opts[:base_url] || @base_url + timeout = opts[:timeout] || @timeout + retries = opts[:max_retries] || @max_retries + attempt = 0 + + loop do + log(:debug, "request start", method: request.method, path: request.path, attempt: attempt + 1) + http = connection_for(base, timeout) + response = http.request(request) + return response if response.is_a?(Net::HTTPSuccess) + + if attempt < retries && retryable?(response) + attempt += 1 + inject_retry_idempotency_key(request) + log(:info, "request retry", method: request.method, path: request.path, attempt: attempt + 1, status: response.code.to_i) + sleep(retry_delay(response, attempt)) + next + end + log(:warn, "request error", method: request.method, path: request.path, status: response.code.to_i, request_id: response["x-request-id"] || response["X-Request-Id"]) + handle_error_response(response) + rescue Net::OpenTimeout, Net::ReadTimeout, + Errno::ECONNRESET, Errno::ECONNREFUSED, + IOError, Errno::EPIPE => e + evict_connection(base) + if attempt < retries + attempt += 1 + inject_retry_idempotency_key(request) + log(:info, "request retry", method: request.method, path: request.path, attempt: attempt + 1, error: e.class.name) + sleep(retry_delay(nil, attempt)) + next + end + log(:warn, "connection error", method: request.method, path: request.path, error: e.class.name, message: e.message) + raise WorkOS::APIConnectionError.new(message: e.message) + end + end + + # Close all persistent connections. + def shutdown + connections = thread_connections.values + thread_connections.clear + connections.each { |connection| connection.finish if connection.started? } + end + + private + + def append_query(path, params) + return path unless params.is_a?(Hash) && !params.empty? + + query = URI.encode_www_form(params.compact) + return path if query.empty? + + path.include?("?") ? "#{path}&#{query}" : "#{path}?#{query}" + end + + def connection_for(base_url, timeout) + uri = URI(base_url) + key = connection_key(uri, timeout) + conn = thread_connections[key] + + if conn&.started? + conn.read_timeout = timeout + conn.open_timeout = timeout + return conn + end + + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = (uri.scheme == "https") + http.read_timeout = timeout + http.open_timeout = timeout + http.keep_alive_timeout = 30 + http.start + thread_connections[key] = http + http + end + + def evict_connection(base_url) + uri = URI(base_url) + keys = thread_connections.keys.select { |key| key.start_with?("#{uri.scheme}:#{uri.host}:#{uri.port}:") } + keys.each do |key| + connection = thread_connections.delete(key) + connection&.finish if connection&.started? + end + rescue IOError + # Already closed, ignore + end + + def connection_key(uri, timeout) + "#{uri.scheme}:#{uri.host}:#{uri.port}:#{timeout}" + end + + def thread_connections + Thread.current[:workos_connections] ||= {} + end + + def resolve_option(opts, key) + return nil unless opts.is_a?(Hash) + opts[key] || opts[key.to_s] + end + + def build_request(klass, path, auth:, request_options:) + request = klass.new(path) + if auth + key = resolve_option(request_options, :api_key) || @api_key + request["Authorization"] = "Bearer #{key}" if key && !key.empty? + end + request["User-Agent"] = USER_AGENT + # Apply user headers before idempotency injection so caller-supplied + # Idempotency-Key values win. + apply_extra_headers(request, request_options) + request + end + + def apply_extra_headers(request, request_options) + return unless request_options.is_a?(Hash) + + extra = request_options[:extra_headers] || request_options["extra_headers"] + return unless extra.is_a?(Hash) + + extra.each { |k, v| request[k.to_s] = v.to_s } + end + + def inject_idempotency_key(request, request_options) + key = resolve_option(request_options, :idempotency_key) + return if key.nil? || key.to_s.empty? + + request["Idempotency-Key"] ||= key + end + + def inject_retry_idempotency_key(request) + return unless %w[POST PUT PATCH].include?(request.method) + return if request["Idempotency-Key"] + + request["Idempotency-Key"] = SecureRandom.uuid + end + + def log(level, message, details = {}) + sink = @logger + return unless sink + return unless loggable?(level) + + formatter = details.compact.map { |key, value| "#{key}=#{value}" }.join(" ") + line = formatter.empty? ? message : "#{message} #{formatter}" + if sink.respond_to?(level) + sink.public_send(level, line) + elsif sink.respond_to?(:add) + sink.add(log_level_to_severity(level), line) + end + end + + def loggable?(level) + LOG_SEVERITY.fetch(level, LOG_SEVERITY[:unknown]) >= LOG_SEVERITY.fetch(@log_level || :debug, LOG_SEVERITY[:debug]) + end + + def log_level_to_severity(level) + case level + when :debug then ::Logger::DEBUG + when :info then ::Logger::INFO + when :warn then ::Logger::WARN + when :error then ::Logger::ERROR + else ::Logger::UNKNOWN + end + end + + def retryable?(response) + RETRYABLE_STATUSES.include?(response.code.to_i) + end + + def retry_delay(response, attempt) + if response + retry_after = response["Retry-After"] + return retry_after.to_f if retry_after&.to_f&.positive? + end + + base = RETRY_BACKOFF_BASE * (2**(attempt - 1)) + jitter = rand * 0.25 * base + base + jitter + end + + def handle_error_response(response) + status = response.code.to_i + body = begin + JSON.parse(response.body.to_s) + rescue JSON::ParserError + {} + end + request_id = response["x-request-id"] || response["X-Request-Id"] + error_args = { + message: body["message"] || "HTTP #{status}", + http_status: status, + request_id: request_id, + code: body["code"], + body: body + } + + case status + when 400 then raise WorkOS::InvalidRequestError.new(**error_args) + when 401 then raise WorkOS::AuthenticationError.new(**error_args) + when 403 then raise WorkOS::ForbiddenRequestError.new(**error_args) + when 404 then raise WorkOS::NotFoundError.new(**error_args) + when 409 + raise WorkOS::IdempotencyError.new(**error_args) if body["code"] == "idempotency_error" + + raise WorkOS::APIError.new(**error_args) + when 422 then raise WorkOS::UnprocessableEntityError.new(**error_args) + when 429 then raise WorkOS::RateLimitExceededError.new(**error_args) + else raise WorkOS::APIError.new(**error_args) + end + end + end +end diff --git a/lib/workos/cache.rb b/lib/workos/cache.rb deleted file mode 100644 index 7bd594ca..00000000 --- a/lib/workos/cache.rb +++ /dev/null @@ -1,94 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The Cache module provides a simple in-memory cache for storing values - # This module is not meant to be instantiated in a user space, and is used internally by the SDK - module Cache - # The Entry class represents a cache entry with a value and an expiration time - class Entry - attr_reader :value, :expires_at - - # Initializes a new cache entry - # @param value [Object] The value to store in the cache - # @param expires_in_seconds [Integer, nil] The expiration time for the value in seconds, or nil for no expiration - def initialize(value, expires_in_seconds) - @value = value - @expires_at = expires_in_seconds ? Time.now + expires_in_seconds : nil - end - - # Checks if the entry has expired - # @return [Boolean] True if the entry has expired, false otherwise - def expired? - return false if expires_at.nil? - - Time.now > @expires_at - end - end - - class << self - # Fetches a value from the cache, or calls the block to fetch the value if it is not present - # @param key [String] The key to fetch the value for - # @param expires_in [Integer] The expiration time for the value in seconds - # @param force [Boolean] If true, the value will be fetched from the block even if it is present in the cache - # @param block [Proc] The block to call to fetch the value if it is not present in the cache - # @return [Object] The value fetched from the cache or the block - def fetch(key, expires_in: nil, force: false, &block) - entry = store[key] - - if force || entry.nil? || entry.expired? - value = block.call - store[key] = Entry.new(value, expires_in) - return value - end - - entry.value - end - - # Reads a value from the cache - # @param key [String] The key to read the value for - # @return [Object] The value read from the cache, or nil if the value is not present or has expired - def read(key) - entry = store[key] - return nil if entry.nil? || entry.expired? - - entry.value - end - - # Writes a value to the cache - # @param key [String] The key to write the value for - # @param value [Object] The value to write to the cache - # @param expires_in [Integer] The expiration time for the value in seconds - # @return [Object] The value written to the cache - def write(key, value, expires_in: nil) - store[key] = Entry.new(value, expires_in) - value - end - - # Deletes a value from the cache - # @param key [String] The key to delete the value for - def delete(key) - store.delete(key) - end - - # Clears all values from the cache - def clear - store.clear - end - - # Checks if a value exists in the cache - # @param key [String] The key to check for - # @return [Boolean] True if the value exists and has not expired, false otherwise - def exist?(key) - entry = store[key] - !(entry.nil? || entry.expired?) - end - - private - - # The in-memory store for the cache - def store - @store ||= {} - end - end - end -end diff --git a/lib/workos/challenge.rb b/lib/workos/challenge.rb deleted file mode 100644 index b403021e..00000000 --- a/lib/workos/challenge.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The Challnge class provides a lightweight wrapper around - # a WorkOS DirectoryUser resource. This class is not meant to be instantiated - # in DirectoryUser space, and is instantiated internally but exposed. - class Challenge - include HashProvider - - attr_accessor :id, :object, :expires_at, :code, :authentication_factor_id, :updated_at, :created_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @object = hash[:object] - @expires_at = hash[:expires_at] - @code = hash[:code] - @authentication_factor_id = hash[:authentication_factor_id] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - - def to_json(*) - { - id: id, - object: object, - expires_at: expires_at, - code: code, - authentication_factor_id: authentication_factor_id, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/client.rb b/lib/workos/client.rb index 2d2544c3..c9af3643 100644 --- a/lib/workos/client.rb +++ b/lib/workos/client.rb @@ -1,165 +1,100 @@ # frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + module WorkOS - # A Net::HTTP based API client for interacting with the WorkOS API - module Client - include Kernel - - def client - Net::HTTP.new(WorkOS.config.api_hostname, 443).tap do |http_client| - http_client.use_ssl = true - http_client.open_timeout = WorkOS.config.timeout - http_client.read_timeout = WorkOS.config.timeout - http_client.write_timeout = WorkOS.config.timeout if RUBY_VERSION >= "2.6.0" - end - end - - def execute_request(request:) - begin - response = client.request(request) - rescue Net::OpenTimeout, Net::ReadTimeout, Net::WriteTimeout - raise TimeoutError.new( - message: "API Timeout Error" - ) - end - - http_status = response.code.to_i - handle_error_response(response: response) if http_status >= 400 - - response - end - - def get_request(path:, auth: false, params: {}, access_token: nil) - uri = URI(path) - uri.query = URI.encode_www_form(params) if params - - request = Net::HTTP::Get.new( - uri.to_s, - "Content-Type" => "application/json" - ) - - request["Authorization"] = "Bearer #{access_token || WorkOS.config.key!}" if auth - request["User-Agent"] = user_agent - request - end - - def post_request(path:, auth: false, idempotency_key: nil, body: nil) - request = Net::HTTP::Post.new(path, "Content-Type" => "application/json") - request.body = body.to_json if body - request["Authorization"] = "Bearer #{WorkOS.config.key!}" if auth - request["Idempotency-Key"] = idempotency_key if idempotency_key - request["User-Agent"] = user_agent - request - end - - def delete_request(path:, auth: false, params: {}) - uri = URI(path) - uri.query = URI.encode_www_form(params) if params - - request = Net::HTTP::Delete.new( - uri.to_s, - "Content-Type" => "application/json" - ) - - request["Authorization"] = "Bearer #{WorkOS.config.key!}" if auth - request["User-Agent"] = user_agent - request - end - - def put_request(path:, auth: false, idempotency_key: nil, body: nil) - request = Net::HTTP::Put.new(path, "Content-Type" => "application/json") - request.body = body.to_json if body - request["Authorization"] = "Bearer #{WorkOS.config.key!}" if auth - request["Idempotency-Key"] = idempotency_key if idempotency_key - request["User-Agent"] = user_agent - request - end - - def user_agent - engine = defined?(::RUBY_ENGINE) ? ::RUBY_ENGINE : "Ruby" - - [ - "WorkOS", - "#{engine}/#{RUBY_VERSION}", - RUBY_PLATFORM, - "v#{WorkOS::VERSION}" - ].join("; ") - end - - # rubocop:disable Metrics/AbcSize - def handle_error_response(response:) - http_status = response.code.to_i - json = JSON.parse(response.body) - - case http_status - when 400 - raise InvalidRequestError.new( - message: json["message"], - http_status: http_status, - request_id: response["x-request-id"], - code: json["code"], - errors: json["errors"], - error: json["error"], - error_description: json["error_description"], - data: json - ) - when 401 - raise AuthenticationError.new( - message: json["message"], - http_status: http_status, - request_id: response["x-request-id"] - ) - when 403 - raise ForbiddenRequestError.new( - message: json["message"], - http_status: http_status, - request_id: response["x-request-id"], - code: json["code"], - data: json - ) - when 404 - raise NotFoundError.new( - message: json["message"], - http_status: http_status, - request_id: response["x-request-id"] - ) - when 422 - message = json["message"] - code = json["code"] - errors = extract_error(json["errors"]) if json["errors"] - message += " (#{errors})" if errors - - raise UnprocessableEntityError.new( - message: message, - http_status: http_status, - request_id: response["x-request-id"], - error: json["error"], - errors: errors, - code: code - ) - when 429 - raise RateLimitExceededError.new( - message: json["message"], - http_status: http_status, - request_id: response["x-request-id"], - retry_after: response["Retry-After"] - ) - else - raise APIError.new( - message: json["message"], - http_status: http_status, - request_id: response["x-request-id"] - ) - end - end - # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity - - private - - def extract_error(errors) - errors.map do |error| - "#{error["field"]}: #{error["code"]}" - end.join("; ") + class Client < BaseClient + def api_keys + @api_keys ||= WorkOS::ApiKeys.new(self) + end + + def multi_factor_auth + @multi_factor_auth ||= WorkOS::MultiFactorAuth.new(self) + end + + def connect + @connect ||= WorkOS::Connect.new(self) + end + + def authorization + @authorization ||= WorkOS::Authorization.new(self) + end + + def sso + @sso ||= WorkOS::SSO.new(self) + end + + def pipes + @pipes ||= WorkOS::Pipes.new(self) + end + + def directory_sync + @directory_sync ||= WorkOS::DirectorySync.new(self) + end + + def events + @events ||= WorkOS::Events.new(self) + end + + def feature_flags + @feature_flags ||= WorkOS::FeatureFlags.new(self) + end + + def organization_domains + @organization_domains ||= WorkOS::OrganizationDomains.new(self) + end + + def organizations + @organizations ||= WorkOS::Organizations.new(self) + end + + def admin_portal + @admin_portal ||= WorkOS::AdminPortal.new(self) + end + + def radar + @radar ||= WorkOS::Radar.new(self) + end + + def user_management + @user_management ||= WorkOS::UserManagement.new(self) + end + + def webhooks + @webhooks ||= WorkOS::Webhooks.new(self) + end + + def widgets + @widgets ||= WorkOS::Widgets.new(self) + end + + def audit_logs + @audit_logs ||= WorkOS::AuditLogs.new(self) + end + + # @oagen-ignore-start — non-spec service accessors (hand-maintained) + + def passwordless + @passwordless ||= WorkOS::Passwordless.new(self) + end + + def vault + @vault ||= WorkOS::Vault.new(self) + end + + def actions + @actions ||= WorkOS::Actions + end + + def session_manager(encryptor: nil) + return @session_manager if @session_manager && encryptor.nil? + + @session_manager = WorkOS::SessionManager.new(self, encryptor: encryptor) + end + + def pkce + @pkce ||= WorkOS::PKCE end + # @oagen-ignore-end end end diff --git a/lib/workos/configuration.rb b/lib/workos/configuration.rb index 980c8080..29c744f4 100644 --- a/lib/workos/configuration.rb +++ b/lib/workos/configuration.rb @@ -1,16 +1,52 @@ # frozen_string_literal: true +# @oagen-ignore-file — hand-maintained runtime module WorkOS - # Configuration class sets config initializer + # Simple holder for configuration parameters. class Configuration - attr_accessor :api_hostname, :timeout, :key + attr_accessor :api_key, :base_url, :client_id, :timeout, :max_retries, :logger, :log_level def initialize - @timeout = 60 + @base_url = WorkOS::BaseClient::DEFAULT_BASE_URL + @timeout = WorkOS::BaseClient::DEFAULT_TIMEOUT + @max_retries = WorkOS::BaseClient::DEFAULT_MAX_RETRIES + end + end + + class << self + # Yield the global configuration for modification. + # + # WorkOS.configure do |config| + # config.api_key = "sk_..." + # config.client_id = "client_..." + # end + def configure + yield(configuration) + end + + # The global configuration instance. + def configuration + @configuration ||= Configuration.new + end + + # A convenience client built from the global configuration. + # Lazy-initialized; reset by calling WorkOS.reset_client. + def client + @client ||= Client.new( + api_key: configuration.api_key, + base_url: configuration.base_url, + client_id: configuration.client_id, + timeout: configuration.timeout, + max_retries: configuration.max_retries, + logger: configuration.logger, + log_level: configuration.log_level + ) end - def key! - key or raise "`WorkOS.config.key` not set" + # Reset the cached client (e.g., after reconfiguring). + def reset_client + @client&.shutdown + @client = nil end end end diff --git a/lib/workos/connect.rb b/lib/workos/connect.rb new file mode 100644 index 00000000..90680aad --- /dev/null +++ b/lib/workos/connect.rb @@ -0,0 +1,263 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Connect + def initialize(client) + @client = client + end + + # Complete external authentication + # @param external_auth_id [String] Identifier provided when AuthKit redirected to your login page. + # @param user [WorkOS::UserObject] The user to create or update in AuthKit. + # @param user_consent_options [Array, nil] Array of [User Consent Options](https://workos.com/docs/reference/workos-connect/standalone/user-consent-options) to store with the session. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::ExternalAuthCompleteResponse] + def complete_oauth2( + external_auth_id:, + user:, + user_consent_options: nil, + request_options: {} + ) + body = { + "external_auth_id" => external_auth_id, + "user" => user, + "user_consent_options" => user_consent_options + }.compact + response = @client.request(method: :post, path: "/authkit/oauth2/complete", auth: true, body: body, request_options: request_options) + WorkOS::ExternalAuthCompleteResponse.new(response.body) + end + + # List Connect Applications + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::ApplicationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param organization_id [String, nil] Filter Connect Applications by organization ID. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_applications( + before: nil, + after: nil, + limit: nil, + order: nil, + organization_id: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "organization_id" => organization_id + }.compact + response = @client.request(method: :get, path: "/connect/applications", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::ConnectApplication, filters: {before: before, limit: limit, order: order, organization_id: organization_id}, + fetch_next: lambda do |cursor| + list_applications( + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_applications( + before: cursor, + after: nil, + limit: limit, + order: order, + organization_id: organization_id, + request_options: request_options + ) + end + ) + end + + # Create a Connect Application + # @param name [String] The name of the application. + # @param application_type [String] The type of application to create. + # @param description [String, nil] A description for the application. + # @param scopes [Array, nil] The OAuth scopes granted to the application. + # @param redirect_uris [Array, nil] Redirect URIs for the application. + # @param uses_pkce [Boolean, nil] Whether the application uses PKCE (Proof Key for Code Exchange). + # @param is_first_party [Boolean, nil] Whether this is a first-party application. Third-party applications require an organization_id. + # @param organization_id [String, nil] The organization ID this application belongs to. Required when is_first_party is false. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::ConnectApplication] + def create_application( + name:, + application_type:, + description: nil, + scopes: nil, + redirect_uris: nil, + uses_pkce: nil, + is_first_party: nil, + organization_id: nil, + request_options: {} + ) + body = { + "name" => name, + "application_type" => application_type, + "description" => description, + "scopes" => scopes, + "redirect_uris" => redirect_uris, + "uses_pkce" => uses_pkce, + "is_first_party" => is_first_party, + "organization_id" => organization_id + }.compact + response = @client.request(method: :post, path: "/connect/applications", auth: true, body: body, request_options: request_options) + WorkOS::ConnectApplication.new(response.body) + end + + # Create oauth application. + # @param name [String] + # @param is_first_party [Boolean] + # @param description [String, nil] + # @param scopes [Array, nil] + # @param redirect_uris [Array, nil] + # @param uses_pkce [Boolean, nil] + # @param organization_id [String, nil] + # @param request_options [Hash] Per-request overrides. + # @return [WorkOS::ConnectApplication] + def create_oauth_application( + name:, + is_first_party:, + description: nil, + scopes: nil, + redirect_uris: nil, + uses_pkce: nil, + organization_id: nil, + request_options: {} + ) + create_application( + application_type: "oauth", + name: name, + is_first_party: is_first_party, + description: description, + scopes: scopes, + redirect_uris: redirect_uris, + uses_pkce: uses_pkce, + organization_id: organization_id, + request_options: request_options + ) + end + + # Create m2m application. + # @param name [String] + # @param organization_id [String] + # @param description [String, nil] + # @param scopes [Array, nil] + # @param request_options [Hash] Per-request overrides. + # @return [WorkOS::ConnectApplication] + def create_m2m_application( + name:, + organization_id:, + description: nil, + scopes: nil, + request_options: {} + ) + create_application( + application_type: "m2m", + name: name, + organization_id: organization_id, + description: description, + scopes: scopes, + request_options: request_options + ) + end + + # Get a Connect Application + # @param id [String] The application ID or client ID of the Connect Application. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::ConnectApplication] + def get_application( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/connect/applications/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::ConnectApplication.new(response.body) + end + + # Update a Connect Application + # @param id [String] The application ID or client ID of the Connect Application. + # @param name [String, nil] The name of the application. + # @param description [String, nil] A description for the application. + # @param scopes [Array, nil] The OAuth scopes granted to the application. + # @param redirect_uris [Array, nil] Updated redirect URIs for the application. OAuth applications only. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::ConnectApplication] + def update_application( + id:, + name: nil, + description: nil, + scopes: nil, + redirect_uris: nil, + request_options: {} + ) + body = { + "name" => name, + "description" => description, + "scopes" => scopes, + "redirect_uris" => redirect_uris + }.compact + response = @client.request(method: :put, path: "/connect/applications/#{WorkOS::Util.encode_path(id)}", auth: true, body: body, request_options: request_options) + WorkOS::ConnectApplication.new(response.body) + end + + # Delete a Connect Application + # @param id [String] The application ID or client ID of the Connect Application. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_application( + id:, + request_options: {} + ) + @client.request(method: :delete, path: "/connect/applications/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + nil + end + + # List Client Secrets for a Connect Application + # @param id [String] The application ID or client ID of the Connect Application. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [Array] + def list_application_client_secrets( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/connect/applications/#{WorkOS::Util.encode_path(id)}/client_secrets", auth: true, request_options: request_options) + parsed = JSON.parse(response.body) + (parsed || []).map { |item| WorkOS::ApplicationCredentialsListItem.new(item) } + end + + # Create a new client secret for a Connect Application + # @param id [String] The application ID or client ID of the Connect Application. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::NewConnectApplicationSecret] + def create_application_client_secret( + id:, + request_options: {} + ) + response = @client.request(method: :post, path: "/connect/applications/#{WorkOS::Util.encode_path(id)}/client_secrets", auth: true, request_options: request_options) + WorkOS::NewConnectApplicationSecret.new(response.body) + end + + # Delete a Client Secret + # @param id [String] The unique ID of the client secret. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_client_secret( + id:, + request_options: {} + ) + @client.request(method: :delete, path: "/connect/client_secrets/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + nil + end + end +end diff --git a/lib/workos/connect/application_credentials_list_item.rb b/lib/workos/connect/application_credentials_list_item.rb new file mode 100644 index 00000000..000f265f --- /dev/null +++ b/lib/workos/connect/application_credentials_list_item.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ApplicationCredentialsListItem + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + secret_hint: :secret_hint, + last_used_at: :last_used_at, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :secret_hint, + :last_used_at, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @secret_hint = hash[:secret_hint] + @last_used_at = hash[:last_used_at] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/connect/connect_application.rb b/lib/workos/connect/connect_application.rb new file mode 100644 index 00000000..1e6bf323 --- /dev/null +++ b/lib/workos/connect/connect_application.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectApplication + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + client_id: :client_id, + description: :description, + name: :name, + scopes: :scopes, + created_at: :created_at, + updated_at: :updated_at, + application_type: :application_type, + organization_id: :organization_id + }.freeze + + attr_accessor \ + :object, + :id, + :client_id, + :description, + :name, + :scopes, + :created_at, + :updated_at, + :application_type, + :organization_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @client_id = hash[:client_id] + @description = hash[:description] + @name = hash[:name] + @scopes = hash[:scopes] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @application_type = hash[:application_type] + @organization_id = hash[:organization_id] + end + end +end diff --git a/lib/workos/connect/create_application_secret.rb b/lib/workos/connect/create_application_secret.rb new file mode 100644 index 00000000..4ee44d1b --- /dev/null +++ b/lib/workos/connect/create_application_secret.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateApplicationSecret + include HashProvider + + HASH_ATTRS = {}.freeze + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + end + end +end diff --git a/lib/workos/connect/create_m2m_application.rb b/lib/workos/connect/create_m2m_application.rb new file mode 100644 index 00000000..fdeb67d2 --- /dev/null +++ b/lib/workos/connect/create_m2m_application.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateM2MApplication + include HashProvider + + HASH_ATTRS = { + name: :name, + application_type: :application_type, + description: :description, + scopes: :scopes, + organization_id: :organization_id + }.freeze + + attr_accessor \ + :name, + :application_type, + :description, + :scopes, + :organization_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @name = hash[:name] + @application_type = hash[:application_type] + @description = hash[:description] + @scopes = hash[:scopes] || [] + @organization_id = hash[:organization_id] + end + end +end diff --git a/lib/workos/connect/create_oauth_application.rb b/lib/workos/connect/create_oauth_application.rb new file mode 100644 index 00000000..8c6fce66 --- /dev/null +++ b/lib/workos/connect/create_oauth_application.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateOAuthApplication + include HashProvider + + HASH_ATTRS = { + name: :name, + application_type: :application_type, + description: :description, + scopes: :scopes, + redirect_uris: :redirect_uris, + uses_pkce: :uses_pkce, + is_first_party: :is_first_party, + organization_id: :organization_id + }.freeze + + attr_accessor \ + :name, + :application_type, + :description, + :scopes, + :redirect_uris, + :uses_pkce, + :is_first_party, + :organization_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @name = hash[:name] + @application_type = hash[:application_type] + @description = hash[:description] + @scopes = hash[:scopes] || [] + @redirect_uris = (hash[:redirect_uris] || []).map { |item| item ? WorkOS::RedirectUriInput.new(item) : nil } + @uses_pkce = hash[:uses_pkce] + @is_first_party = hash[:is_first_party] + @organization_id = hash[:organization_id] + end + end +end diff --git a/lib/workos/connect/external_auth_complete_response.rb b/lib/workos/connect/external_auth_complete_response.rb new file mode 100644 index 00000000..bdc87db3 --- /dev/null +++ b/lib/workos/connect/external_auth_complete_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ExternalAuthCompleteResponse + include HashProvider + + HASH_ATTRS = { + redirect_uri: :redirect_uri + }.freeze + + attr_accessor :redirect_uri + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @redirect_uri = hash[:redirect_uri] + end + end +end diff --git a/lib/workos/connect/new_connect_application_secret.rb b/lib/workos/connect/new_connect_application_secret.rb new file mode 100644 index 00000000..74fc497e --- /dev/null +++ b/lib/workos/connect/new_connect_application_secret.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class NewConnectApplicationSecret + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + secret_hint: :secret_hint, + last_used_at: :last_used_at, + created_at: :created_at, + updated_at: :updated_at, + secret: :secret + }.freeze + + attr_accessor \ + :object, + :id, + :secret_hint, + :last_used_at, + :created_at, + :updated_at, + :secret + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @secret_hint = hash[:secret_hint] + @last_used_at = hash[:last_used_at] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @secret = hash[:secret] + end + end +end diff --git a/lib/workos/connect/redirect_uri_input.rb b/lib/workos/connect/redirect_uri_input.rb new file mode 100644 index 00000000..8c93066f --- /dev/null +++ b/lib/workos/connect/redirect_uri_input.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RedirectUriInput + include HashProvider + + HASH_ATTRS = { + uri: :uri, + default: :default + }.freeze + + attr_accessor \ + :uri, + :default + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @uri = hash[:uri] + @default = hash[:default] + end + end +end diff --git a/lib/workos/connect/update_oauth_application.rb b/lib/workos/connect/update_oauth_application.rb new file mode 100644 index 00000000..be18e52e --- /dev/null +++ b/lib/workos/connect/update_oauth_application.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UpdateOAuthApplication + include HashProvider + + HASH_ATTRS = { + name: :name, + description: :description, + scopes: :scopes, + redirect_uris: :redirect_uris + }.freeze + + attr_accessor \ + :name, + :description, + :scopes, + :redirect_uris + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @name = hash[:name] + @description = hash[:description] + @scopes = hash[:scopes] || [] + @redirect_uris = (hash[:redirect_uris] || []).map { |item| item ? WorkOS::RedirectUriInput.new(item) : nil } + end + end +end diff --git a/lib/workos/connect/user_consent_option.rb b/lib/workos/connect/user_consent_option.rb new file mode 100644 index 00000000..ac6c8e04 --- /dev/null +++ b/lib/workos/connect/user_consent_option.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserConsentOption + include HashProvider + + HASH_ATTRS = { + claim: :claim, + type: :type, + label: :label, + choices: :choices + }.freeze + + attr_accessor \ + :claim, + :type, + :label, + :choices + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @claim = hash[:claim] + @type = hash[:type] + @label = hash[:label] + @choices = (hash[:choices] || []).map { |item| item ? WorkOS::UserConsentOptionChoice.new(item) : nil } + end + end +end diff --git a/lib/workos/connect/user_consent_option_choice.rb b/lib/workos/connect/user_consent_option_choice.rb new file mode 100644 index 00000000..769e76e3 --- /dev/null +++ b/lib/workos/connect/user_consent_option_choice.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserConsentOptionChoice + include HashProvider + + HASH_ATTRS = { + value: :value, + label: :label + }.freeze + + attr_accessor \ + :value, + :label + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @value = hash[:value] + @label = hash[:label] + end + end +end diff --git a/lib/workos/connect/user_management_login_request.rb b/lib/workos/connect/user_management_login_request.rb new file mode 100644 index 00000000..62c6a9cf --- /dev/null +++ b/lib/workos/connect/user_management_login_request.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserManagementLoginRequest + include HashProvider + + HASH_ATTRS = { + external_auth_id: :external_auth_id, + user: :user, + user_consent_options: :user_consent_options + }.freeze + + attr_accessor \ + :external_auth_id, + :user, + :user_consent_options + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @external_auth_id = hash[:external_auth_id] + @user = hash[:user] ? WorkOS::UserObject.new(hash[:user]) : nil + @user_consent_options = (hash[:user_consent_options] || []).map { |item| item ? WorkOS::UserConsentOption.new(item) : nil } + end + end +end diff --git a/lib/workos/connect/user_object.rb b/lib/workos/connect/user_object.rb new file mode 100644 index 00000000..d0ac7b25 --- /dev/null +++ b/lib/workos/connect/user_object.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserObject + include HashProvider + + HASH_ATTRS = { + id: :id, + email: :email, + first_name: :first_name, + last_name: :last_name, + metadata: :metadata + }.freeze + + attr_accessor \ + :id, + :email, + :first_name, + :last_name, + :metadata + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @email = hash[:email] + @first_name = hash[:first_name] + @last_name = hash[:last_name] + @metadata = hash[:metadata] || {} + end + end +end diff --git a/lib/workos/connection.rb b/lib/workos/connection.rb deleted file mode 100644 index 9e6e931d..00000000 --- a/lib/workos/connection.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The Connection class provides a lightweight wrapper around - # a WorkOS Connection resource. This class is not meant to be instantiated - # in user space, and is instantiated internally but exposed. - # Note: status is deprecated - use state instead - class Connection - include HashProvider - - attr_accessor :id, :name, :connection_type, :domains, :organization_id, - :state, :status, :created_at, :updated_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @name = hash[:name] - @connection_type = hash[:connection_type] - @domains = hash[:domains] - @organization_id = hash[:organization_id] - @state = hash[:state] - @status = hash[:status] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - - def to_json(*) - { - id: id, - name: name, - connection_type: connection_type, - domains: domains, - organization_id: organization_id, - state: state, - status: status, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/deprecated_hash_wrapper.rb b/lib/workos/deprecated_hash_wrapper.rb deleted file mode 100644 index 314b0a1e..00000000 --- a/lib/workos/deprecated_hash_wrapper.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # A Temporary wrapper class for a Hash, currently the base class for - # WorOS::DirectoryGroup and WorkOS::DirectoryUser. Makes all the Hash - # methods available to those classes, but will also emit a deprecation - # warning whenever any of them are used. - # - # Once we deprecate Hash compatibility, this model can be deleted. - class DeprecatedHashWrapper < Hash - (public_instance_methods - Object.methods).each do |method_name| - define_method method_name do |*args, &block| - print_deprecation_warning(method_name) - super(*args, &block) - end - end - - # call the original implementation of :replace in Hash, - # so we don't show the deprecation warning - def replace_without_warning(new_hash) - method(:replace).super_method&.call(new_hash) - end - - def [](attribute_name) - usage = "#{object_name}.#{attribute_name}" - warning_message = "WARNING: The Hash style access for #{class_name} attributes is deprecated -and will be removed in a future version. Please use `#{usage}` or equivalent accessor.\n" - - print_deprecation_warning("[]", warning_message) - - super(attribute_name.to_sym) - end - - private - - def deprecation_warning(method_name) - usage = "#{object_name}.to_h.#{method_name}" - - "WARNING: Hash compatibility for #{class_name} is deprecated and will be removed -in a future version. Please use `#{usage}` to access methods on the attribute Hash object.\n" - end - - def print_deprecation_warning(method_name, warning_message = deprecation_warning(method_name)) - if RUBY_VERSION > "3" - warn warning_message, category: :deprecated - else - warn warning_message - end - end - - def class_name - self.class.name - end - - # We want to do class_name.demodulize.underscore here, but that's not available in Ruby 1.9, so - # implementing the demodulize and underscore methods here. - def object_name - i = class_name.rindex("::") - object_name = i ? class_name[(i + 2)..] : class_name - underscore(object_name) - end - - def underscore(camel_cased_word) - return camel_cased_word.to_s unless /[A-Z-]|::/.match?(camel_cased_word) - - word = camel_cased_word.to_s.gsub("::", "/") - word.gsub!(/(?:(?<=([A-Za-z\d]))|\b)((?=a)b)(?=\b|[^a-z])/) do - "#{Regexp.last_match(1) && "_"}#{Regexp.last_match(2).downcase}" - end - word.gsub!(/([A-Z]+)(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) { (Regexp.last_match(1) || Regexp.last_match(2)) << "_" } - word.tr!("-", "_") - word.downcase! - word - end - end -end diff --git a/lib/workos/deprecation.rb b/lib/workos/deprecation.rb deleted file mode 100644 index 7a27114c..00000000 --- a/lib/workos/deprecation.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # Provides helpers for working with deprecated SDK and API features. - module Deprecation - def warn_deprecation(message) - full_message = "[DEPRECATION] #{message}" - - if RUBY_VERSION > "3" - warn full_message, category: :deprecated - else - warn full_message - end - end - end -end diff --git a/lib/workos/directory.rb b/lib/workos/directory.rb deleted file mode 100644 index dcec48cb..00000000 --- a/lib/workos/directory.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The Directory class provides a lightweight wrapper around - # a WorkOS Directory resource. This class is not meant to be instantiated - # in user space, and is instantiated internally but exposed. - class Directory - include HashProvider - - attr_accessor :id, :domain, :name, :type, :state, :organization_id, :created_at, :updated_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @name = hash[:name] - @domain = hash[:domain] - @type = hash[:type] - @state = hash[:state] - @organization_id = hash[:organization_id] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - - def to_json(*) - { - id: id, - name: name, - domain: domain, - type: type, - state: state, - organization_id: organization_id, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/directory_group.rb b/lib/workos/directory_group.rb deleted file mode 100644 index b1d29d48..00000000 --- a/lib/workos/directory_group.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The DirectoryGroup class provides a lightweight wrapper around - # a WorkOS DirectoryGroup resource. This class is not meant to be instantiated - # in user space, and is instantiated internally but exposed. - class DirectoryGroup < DeprecatedHashWrapper - include HashProvider - - attr_accessor :id, :directory_id, :idp_id, :name, :created_at, :updated_at, - :raw_attributes, :organization_id - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @directory_id = hash[:directory_id] - @organization_id = hash[:organization_id] - @idp_id = hash[:idp_id] - @name = hash[:name] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - @raw_attributes = hash[:raw_attributes] - - replace_without_warning(to_json) - end - - def to_json(*) - { - id: id, - directory_id: directory_id, - organization_id: organization_id, - idp_id: idp_id, - name: name, - created_at: created_at, - updated_at: updated_at, - raw_attributes: raw_attributes - } - end - end -end diff --git a/lib/workos/directory_sync.rb b/lib/workos/directory_sync.rb index 10a9a607..a29faec0 100644 --- a/lib/workos/directory_sync.rb +++ b/lib/workos/directory_sync.rb @@ -1,198 +1,228 @@ # frozen_string_literal: true -require "net/http" +# This file is auto-generated by oagen. Do not edit. + +require "json" module WorkOS - # The Directory Sync module provides convenience methods for working with the - # WorkOS Directory Sync platform. You'll need a valid API key and to have - # created a Directory Sync connection on your WorkOS dashboard. - # - # @see https://docs.workos.com/directory-sync/overview - module DirectorySync - class << self - include Client + class DirectorySync + def initialize(client) + @client = client + end - # Retrieve directories. - # - # @param [Hash] options An options hash - # @option options [String] search A search term for direcory names. - # @option options [String] limit Maximum number of records to return. - # @option options [String] order The order in which to paginate records - # @option options [String] before Pagination cursor to receive records - # before a provided Directory ID. - # @option options [String] after Pagination cursor to receive records - # before a provided Directory ID. - # @option options [String] organization_id The ID for an Organization configured on WorkOS. - # - # @return [Hash] - def list_directories(options = {}) - options[:order] ||= "desc" - response = execute_request( - request: get_request( - path: "/directories", - auth: true, - params: options + # List Directories + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::DirectoriesOrder, nil] Order the results by the creation time. + # @param organization_id [String, nil] Filter Directories by their associated organization. + # @param search [String, nil] Searchable text to match against Directory names. + # @param domain [String, nil] (deprecated) Filter Directories by their associated domain. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_directories( + before: nil, + after: nil, + limit: nil, + order: nil, + organization_id: nil, + search: nil, + domain: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "organization_id" => organization_id, + "search" => search, + "domain" => domain + }.compact + response = @client.request(method: :get, path: "/directories", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::Directory, filters: {before: before, limit: limit, order: order, organization_id: organization_id, search: search, domain: domain}, + fetch_next: lambda do |cursor| + list_directories( + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + search: search, + domain: domain, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_directories( + before: cursor, + after: nil, + limit: limit, + order: order, + organization_id: organization_id, + search: search, + domain: domain, + request_options: request_options ) - ) - - parsed_response = JSON.parse(response.body) - directories = parsed_response["data"].map do |directory| - ::WorkOS::Directory.new(directory.to_json) end + ) + end - WorkOS::Types::ListStruct.new( - data: directories, - list_metadata: parsed_response["listMetadata"] - ) - end - - # Retrieve directory. - # - # @param [String] id Directory unique identifier - # - # @example - # WorkOS::SSO.get_directory(id: 'directory_01FK17DWRHH7APAFXT5B52PV0W') - # => # before, + "after" => after, + "limit" => limit, + "order" => order, + "directory" => directory, + "user" => user + }.compact + response = @client.request(method: :get, path: "/directory_groups", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::DirectoryGroup, filters: {before: before, limit: limit, order: order, directory: directory, user: user}, + fetch_next: lambda do |cursor| + list_groups( + before: before, + after: cursor, + limit: limit, + order: order, + directory: directory, + user: user, + request_options: request_options ) - ) - - parsed_response = JSON.parse(response.body) - groups = parsed_response["data"].map do |group| - ::WorkOS::DirectoryGroup.new(group.to_json) - end - - WorkOS::Types::ListStruct.new( - data: groups, - list_metadata: parsed_response["listMetadata"] - ) - end - - # Retrieve directory users. - # - # @param [Hash] options An options hash - # @option options [String] directory The ID of the directory whose - # directory users will be retrieved. - # @option options [String] group The ID of the directory group whose - # directory users will be retrieved. - # @option options [String] limit Maximum number of records to return. - # @option options [String] order The order in which to paginate records - # @option options [String] before Pagination cursor to receive records - # before a provided Directory User ID. - # @option options [String] after Pagination cursor to receive records - # before a provided Directory User ID. - # - # @return [WorkOS::DirectoryUser] - def list_users(options = {}) - options[:order] ||= "desc" - response = execute_request( - request: get_request( - path: "/directory_users", - auth: true, - params: options + end, + fetch_previous: lambda do |cursor| + list_groups( + before: cursor, + after: nil, + limit: limit, + order: order, + directory: directory, + user: user, + request_options: request_options ) - ) - - parsed_response = JSON.parse(response.body) - users = parsed_response["data"].map do |user| - ::WorkOS::DirectoryUser.new(user.to_json) end + ) + end - WorkOS::Types::ListStruct.new( - data: users, - list_metadata: parsed_response["listMetadata"] - ) - end + # Get a Directory Group + # @param id [String] Unique identifier for the Directory Group. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::DirectoryGroup] + def get_group( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/directory_groups/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::DirectoryGroup.new(response.body) + end - # Retrieve the directory group with the given ID. - # - # @param [String] id The ID of the directory group. - # - # @return WorkOS::DirectoryGroup - def get_group(id) - response = execute_request( - request: get_request( - path: "/directory_groups/#{id}", - auth: true + # List Directory Users + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::DirectoryUsersOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param directory [String, nil] Unique identifier of the WorkOS Directory. This value can be obtained from the WorkOS dashboard or from the WorkOS API. + # @param group [String, nil] Unique identifier of the WorkOS Directory Group. This value can be obtained from the WorkOS API. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_users( + before: nil, + after: nil, + limit: nil, + order: nil, + directory: nil, + group: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "directory" => directory, + "group" => group + }.compact + response = @client.request(method: :get, path: "/directory_users", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::DirectoryUserWithGroups, filters: {before: before, limit: limit, order: order, directory: directory, group: group}, + fetch_next: lambda do |cursor| + list_users( + before: before, + after: cursor, + limit: limit, + order: order, + directory: directory, + group: group, + request_options: request_options ) - ) - - ::WorkOS::DirectoryGroup.new(response.body) - end - - # Retrieve the directory user with the given ID. - # - # @param [String] id The ID of the directory user. - # - # @return WorkOS::DirectoryUser - def get_user(id) - response = execute_request( - request: get_request( - path: "/directory_users/#{id}", - auth: true + end, + fetch_previous: lambda do |cursor| + list_users( + before: cursor, + after: nil, + limit: limit, + order: order, + directory: directory, + group: group, + request_options: request_options ) - ) - - ::WorkOS::DirectoryUser.new(response.body) - end - - # Delete the directory with the given ID. - # - # @param [String] id The ID of the directory. - # - # @return Boolean - def delete_directory(id) - request = delete_request( - auth: true, - path: "/directories/#{id}" - ) - - response = execute_request(request: request) + end + ) + end - response.is_a? Net::HTTPSuccess - end + # Get a Directory User + # @param id [String] Unique identifier for the Directory User. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::DirectoryUserWithGroups] + def get_user( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/directory_users/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::DirectoryUserWithGroups.new(response.body) end end end diff --git a/lib/workos/directory_sync/directory.rb b/lib/workos/directory_sync/directory.rb new file mode 100644 index 00000000..3e2409bb --- /dev/null +++ b/lib/workos/directory_sync/directory.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Directory + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + external_key: :external_key, + type: :type, + state: :state, + name: :name, + domain: :domain, + metadata: :metadata, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :external_key, + :type, + :state, + :name, + :domain, + :metadata, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @external_key = hash[:external_key] + @type = hash[:type] + @state = hash[:state] + @name = hash[:name] + @domain = hash[:domain] + @metadata = hash[:metadata] ? WorkOS::DirectoryMetadata.new(hash[:metadata]) : nil + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/directory_sync/directory_group.rb b/lib/workos/directory_sync/directory_group.rb new file mode 100644 index 00000000..00bd0dc2 --- /dev/null +++ b/lib/workos/directory_sync/directory_group.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DirectoryGroup + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + idp_id: :idp_id, + directory_id: :directory_id, + organization_id: :organization_id, + name: :name, + raw_attributes: :raw_attributes, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :idp_id, + :directory_id, + :organization_id, + :name, + :raw_attributes, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @idp_id = hash[:idp_id] + @directory_id = hash[:directory_id] + @organization_id = hash[:organization_id] + @name = hash[:name] + @raw_attributes = hash[:raw_attributes] || {} + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/directory_sync/directory_metadata.rb b/lib/workos/directory_sync/directory_metadata.rb new file mode 100644 index 00000000..a5990008 --- /dev/null +++ b/lib/workos/directory_sync/directory_metadata.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DirectoryMetadata + include HashProvider + + HASH_ATTRS = { + users: :users, + groups: :groups + }.freeze + + attr_accessor \ + :users, + :groups + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @users = hash[:users] ? WorkOS::DirectoryMetadataUser.new(hash[:users]) : nil + @groups = hash[:groups] + end + end +end diff --git a/lib/workos/directory_sync/directory_metadata_user.rb b/lib/workos/directory_sync/directory_metadata_user.rb new file mode 100644 index 00000000..732638ec --- /dev/null +++ b/lib/workos/directory_sync/directory_metadata_user.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DirectoryMetadataUser + include HashProvider + + HASH_ATTRS = { + active: :active, + inactive: :inactive + }.freeze + + attr_accessor \ + :active, + :inactive + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @active = hash[:active] + @inactive = hash[:inactive] + end + end +end diff --git a/lib/workos/directory_sync/directory_user.rb b/lib/workos/directory_sync/directory_user.rb new file mode 100644 index 00000000..82a3fbe1 --- /dev/null +++ b/lib/workos/directory_sync/directory_user.rb @@ -0,0 +1,108 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DirectoryUser + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + directory_id: :directory_id, + organization_id: :organization_id, + idp_id: :idp_id, + email: :email, + first_name: :first_name, + last_name: :last_name, + emails: :emails, + job_title: :job_title, + username: :username, + state: :state, + raw_attributes: :raw_attributes, + custom_attributes: :custom_attributes, + role: :role, + roles: :roles, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + # @!attribute emails + # @deprecated A list of email addresses for the user. + # @!attribute job_title + # @deprecated The job title of the user. + # @!attribute username + # @deprecated The username of the user. + # @!attribute raw_attributes + # @deprecated The raw attributes received from the directory provider. + + attr_accessor \ + :object, + :id, + :directory_id, + :organization_id, + :idp_id, + :email, + :first_name, + :last_name, + :state, + :custom_attributes, + :role, + :roles, + :created_at, + :updated_at + + def emails + warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1, category: :deprecated + @emails + end + + attr_writer :emails + + def job_title + warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1, category: :deprecated + @job_title + end + + attr_writer :job_title + + def username + warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1, category: :deprecated + @username + end + + attr_writer :username + + def raw_attributes + warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1, category: :deprecated + @raw_attributes + end + + attr_writer :raw_attributes + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @directory_id = hash[:directory_id] + @organization_id = hash[:organization_id] + @idp_id = hash[:idp_id] + @email = hash[:email] + @first_name = hash[:first_name] + @last_name = hash[:last_name] + @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DirectoryUserEmail.new(item) : nil } + @job_title = hash[:job_title] + @username = hash[:username] + @state = hash[:state] + @raw_attributes = hash[:raw_attributes] || {} + @custom_attributes = hash[:custom_attributes] || {} + @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @roles = (hash[:roles] || []).map { |item| item ? WorkOS::SlimRole.new(item) : nil } + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/directory_sync/directory_user_email.rb b/lib/workos/directory_sync/directory_user_email.rb new file mode 100644 index 00000000..39f035cd --- /dev/null +++ b/lib/workos/directory_sync/directory_user_email.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DirectoryUserEmail + include HashProvider + + HASH_ATTRS = { + primary: :primary, + type: :type, + value: :value + }.freeze + + attr_accessor \ + :primary, + :type, + :value + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @primary = hash[:primary] + @type = hash[:type] + @value = hash[:value] + end + end +end diff --git a/lib/workos/directory_sync/directory_user_with_groups.rb b/lib/workos/directory_sync/directory_user_with_groups.rb new file mode 100644 index 00000000..39266c76 --- /dev/null +++ b/lib/workos/directory_sync/directory_user_with_groups.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DirectoryUserWithGroups + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + directory_id: :directory_id, + organization_id: :organization_id, + idp_id: :idp_id, + email: :email, + first_name: :first_name, + last_name: :last_name, + emails: :emails, + job_title: :job_title, + username: :username, + state: :state, + raw_attributes: :raw_attributes, + custom_attributes: :custom_attributes, + role: :role, + roles: :roles, + created_at: :created_at, + updated_at: :updated_at, + groups: :groups + }.freeze + + # @!attribute emails + # @deprecated A list of email addresses for the user. + # @!attribute job_title + # @deprecated The job title of the user. + # @!attribute username + # @deprecated The username of the user. + # @!attribute raw_attributes + # @deprecated The raw attributes received from the directory provider. + + attr_accessor \ + :object, + :id, + :directory_id, + :organization_id, + :idp_id, + :email, + :first_name, + :last_name, + :state, + :custom_attributes, + :role, + :roles, + :created_at, + :updated_at, + :groups + + def emails + warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1, category: :deprecated + @emails + end + + attr_writer :emails + + def job_title + warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1, category: :deprecated + @job_title + end + + attr_writer :job_title + + def username + warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1, category: :deprecated + @username + end + + attr_writer :username + + def raw_attributes + warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1, category: :deprecated + @raw_attributes + end + + attr_writer :raw_attributes + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @directory_id = hash[:directory_id] + @organization_id = hash[:organization_id] + @idp_id = hash[:idp_id] + @email = hash[:email] + @first_name = hash[:first_name] + @last_name = hash[:last_name] + @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DirectoryUserWithGroupsEmail.new(item) : nil } + @job_title = hash[:job_title] + @username = hash[:username] + @state = hash[:state] + @raw_attributes = hash[:raw_attributes] || {} + @custom_attributes = hash[:custom_attributes] || {} + @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @roles = (hash[:roles] || []).map { |item| item ? WorkOS::SlimRole.new(item) : nil } + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @groups = (hash[:groups] || []).map { |item| item ? WorkOS::DirectoryGroup.new(item) : nil } + end + end +end diff --git a/lib/workos/directory_sync/directory_user_with_groups_email.rb b/lib/workos/directory_sync/directory_user_with_groups_email.rb new file mode 100644 index 00000000..8c558690 --- /dev/null +++ b/lib/workos/directory_sync/directory_user_with_groups_email.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + DirectoryUserWithGroupsEmail = DirectoryUserEmail +end diff --git a/lib/workos/directory_sync/dsync_activated.rb b/lib/workos/directory_sync/dsync_activated.rb new file mode 100644 index 00000000..815ea88b --- /dev/null +++ b/lib/workos/directory_sync/dsync_activated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncActivated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::DsyncActivatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/directory_sync/dsync_activated_data.rb b/lib/workos/directory_sync/dsync_activated_data.rb new file mode 100644 index 00000000..dfb2346b --- /dev/null +++ b/lib/workos/directory_sync/dsync_activated_data.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncActivatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + type: :type, + state: :state, + name: :name, + created_at: :created_at, + updated_at: :updated_at, + external_key: :external_key, + domains: :domains + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :type, + :state, + :name, + :created_at, + :updated_at, + :external_key, + :domains + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @type = hash[:type] + @state = hash[:state] + @name = hash[:name] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @external_key = hash[:external_key] + @domains = (hash[:domains] || []).map { |item| item ? WorkOS::DsyncActivatedDataDomain.new(item) : nil } + end + end +end diff --git a/lib/workos/directory_sync/dsync_activated_data_domain.rb b/lib/workos/directory_sync/dsync_activated_data_domain.rb new file mode 100644 index 00000000..1f96add5 --- /dev/null +++ b/lib/workos/directory_sync/dsync_activated_data_domain.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncActivatedDataDomain + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + domain: :domain + }.freeze + + attr_accessor \ + :object, + :id, + :domain + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @domain = hash[:domain] + end + end +end diff --git a/lib/workos/directory_sync/dsync_deactivated.rb b/lib/workos/directory_sync/dsync_deactivated.rb new file mode 100644 index 00000000..a8213e49 --- /dev/null +++ b/lib/workos/directory_sync/dsync_deactivated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncDeactivated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::DsyncDeactivatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/directory_sync/dsync_deactivated_data.rb b/lib/workos/directory_sync/dsync_deactivated_data.rb new file mode 100644 index 00000000..c43d5233 --- /dev/null +++ b/lib/workos/directory_sync/dsync_deactivated_data.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncDeactivatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + type: :type, + state: :state, + name: :name, + created_at: :created_at, + updated_at: :updated_at, + external_key: :external_key, + domains: :domains + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :type, + :state, + :name, + :created_at, + :updated_at, + :external_key, + :domains + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @type = hash[:type] + @state = hash[:state] + @name = hash[:name] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @external_key = hash[:external_key] + @domains = (hash[:domains] || []).map { |item| item ? WorkOS::DsyncDeactivatedDataDomain.new(item) : nil } + end + end +end diff --git a/lib/workos/directory_sync/dsync_deactivated_data_domain.rb b/lib/workos/directory_sync/dsync_deactivated_data_domain.rb new file mode 100644 index 00000000..e131f29d --- /dev/null +++ b/lib/workos/directory_sync/dsync_deactivated_data_domain.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + DsyncDeactivatedDataDomain = DsyncActivatedDataDomain +end diff --git a/lib/workos/directory_sync/dsync_deleted.rb b/lib/workos/directory_sync/dsync_deleted.rb new file mode 100644 index 00000000..1dd32454 --- /dev/null +++ b/lib/workos/directory_sync/dsync_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::DsyncDeletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/directory_sync/dsync_deleted_data.rb b/lib/workos/directory_sync/dsync_deleted_data.rb new file mode 100644 index 00000000..488db3bf --- /dev/null +++ b/lib/workos/directory_sync/dsync_deleted_data.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncDeletedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + type: :type, + state: :state, + name: :name, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :type, + :state, + :name, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @type = hash[:type] + @state = hash[:state] + @name = hash[:name] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/directory_sync/dsync_group_created.rb b/lib/workos/directory_sync/dsync_group_created.rb new file mode 100644 index 00000000..2d7bc179 --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncGroupCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::DirectoryGroup.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/directory_sync/dsync_group_deleted.rb b/lib/workos/directory_sync/dsync_group_deleted.rb new file mode 100644 index 00000000..2ede2801 --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncGroupDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::DirectoryGroup.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/directory_sync/dsync_group_updated.rb b/lib/workos/directory_sync/dsync_group_updated.rb new file mode 100644 index 00000000..454f7730 --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncGroupUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::DsyncGroupUpdatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/directory_sync/dsync_group_updated_data.rb b/lib/workos/directory_sync/dsync_group_updated_data.rb new file mode 100644 index 00000000..225e743e --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_updated_data.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncGroupUpdatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + idp_id: :idp_id, + directory_id: :directory_id, + organization_id: :organization_id, + name: :name, + raw_attributes: :raw_attributes, + created_at: :created_at, + updated_at: :updated_at, + previous_attributes: :previous_attributes + }.freeze + + attr_accessor \ + :object, + :id, + :idp_id, + :directory_id, + :organization_id, + :name, + :raw_attributes, + :created_at, + :updated_at, + :previous_attributes + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @idp_id = hash[:idp_id] + @directory_id = hash[:directory_id] + @organization_id = hash[:organization_id] + @name = hash[:name] + @raw_attributes = hash[:raw_attributes] || {} + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @previous_attributes = hash[:previous_attributes] || {} + end + end +end diff --git a/lib/workos/directory_sync/dsync_group_user_added.rb b/lib/workos/directory_sync/dsync_group_user_added.rb new file mode 100644 index 00000000..10c9e6bd --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_user_added.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncGroupUserAdded + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::DsyncGroupUserAddedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/directory_sync/dsync_group_user_added_data.rb b/lib/workos/directory_sync/dsync_group_user_added_data.rb new file mode 100644 index 00000000..04bb925e --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_user_added_data.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncGroupUserAddedData + include HashProvider + + HASH_ATTRS = { + directory_id: :directory_id, + user: :user, + group: :group + }.freeze + + attr_accessor \ + :directory_id, + :user, + :group + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @directory_id = hash[:directory_id] + @user = hash[:user] ? WorkOS::DirectoryUser.new(hash[:user]) : nil + @group = hash[:group] ? WorkOS::DirectoryGroup.new(hash[:group]) : nil + end + end +end diff --git a/lib/workos/directory_sync/dsync_group_user_removed.rb b/lib/workos/directory_sync/dsync_group_user_removed.rb new file mode 100644 index 00000000..d4cbae31 --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_user_removed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncGroupUserRemoved + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::DsyncGroupUserRemovedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/directory_sync/dsync_group_user_removed_data.rb b/lib/workos/directory_sync/dsync_group_user_removed_data.rb new file mode 100644 index 00000000..12dc6905 --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_user_removed_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + DsyncGroupUserRemovedData = DsyncGroupUserAddedData +end diff --git a/lib/workos/directory_sync/dsync_user_created.rb b/lib/workos/directory_sync/dsync_user_created.rb new file mode 100644 index 00000000..456f6751 --- /dev/null +++ b/lib/workos/directory_sync/dsync_user_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncUserCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::DirectoryUser.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/directory_sync/dsync_user_deleted.rb b/lib/workos/directory_sync/dsync_user_deleted.rb new file mode 100644 index 00000000..662923c6 --- /dev/null +++ b/lib/workos/directory_sync/dsync_user_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncUserDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::DirectoryUser.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/directory_sync/dsync_user_updated.rb b/lib/workos/directory_sync/dsync_user_updated.rb new file mode 100644 index 00000000..6d8ed918 --- /dev/null +++ b/lib/workos/directory_sync/dsync_user_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncUserUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::DsyncUserUpdatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/directory_sync/dsync_user_updated_data.rb b/lib/workos/directory_sync/dsync_user_updated_data.rb new file mode 100644 index 00000000..040438d8 --- /dev/null +++ b/lib/workos/directory_sync/dsync_user_updated_data.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DsyncUserUpdatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + directory_id: :directory_id, + organization_id: :organization_id, + idp_id: :idp_id, + email: :email, + first_name: :first_name, + last_name: :last_name, + emails: :emails, + job_title: :job_title, + username: :username, + state: :state, + raw_attributes: :raw_attributes, + custom_attributes: :custom_attributes, + role: :role, + roles: :roles, + created_at: :created_at, + updated_at: :updated_at, + previous_attributes: :previous_attributes + }.freeze + + # @!attribute emails + # @deprecated A list of email addresses for the user. + # @!attribute job_title + # @deprecated The job title of the user. + # @!attribute username + # @deprecated The username of the user. + # @!attribute raw_attributes + # @deprecated The raw attributes received from the directory provider. + + attr_accessor \ + :object, + :id, + :directory_id, + :organization_id, + :idp_id, + :email, + :first_name, + :last_name, + :state, + :custom_attributes, + :role, + :roles, + :created_at, + :updated_at, + :previous_attributes + + def emails + warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1, category: :deprecated + @emails + end + + attr_writer :emails + + def job_title + warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1, category: :deprecated + @job_title + end + + attr_writer :job_title + + def username + warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1, category: :deprecated + @username + end + + attr_writer :username + + def raw_attributes + warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1, category: :deprecated + @raw_attributes + end + + attr_writer :raw_attributes + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @directory_id = hash[:directory_id] + @organization_id = hash[:organization_id] + @idp_id = hash[:idp_id] + @email = hash[:email] + @first_name = hash[:first_name] + @last_name = hash[:last_name] + @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DsyncUserUpdatedDataEmail.new(item) : nil } + @job_title = hash[:job_title] + @username = hash[:username] + @state = hash[:state] + @raw_attributes = hash[:raw_attributes] || {} + @custom_attributes = hash[:custom_attributes] || {} + @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @roles = (hash[:roles] || []).map { |item| item ? WorkOS::SlimRole.new(item) : nil } + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @previous_attributes = hash[:previous_attributes] || {} + end + end +end diff --git a/lib/workos/directory_sync/dsync_user_updated_data_email.rb b/lib/workos/directory_sync/dsync_user_updated_data_email.rb new file mode 100644 index 00000000..8dadcb20 --- /dev/null +++ b/lib/workos/directory_sync/dsync_user_updated_data_email.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + DsyncUserUpdatedDataEmail = DirectoryUserEmail +end diff --git a/lib/workos/directory_user.rb b/lib/workos/directory_user.rb deleted file mode 100644 index 8a9b6e2f..00000000 --- a/lib/workos/directory_user.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The DirectoryUser class provides a lightweight wrapper around - # a WorkOS DirectoryUser resource. This class is not meant to be instantiated - # in DirectoryUser space, and is instantiated internally but exposed. - class DirectoryUser < DeprecatedHashWrapper - include HashProvider - - attr_accessor :id, :idp_id, :email, :emails, :first_name, :last_name, :job_title, :username, :state, - :groups, :role, :roles, :custom_attributes, :raw_attributes, :directory_id, :organization_id, - :created_at, :updated_at - - # rubocop:disable Metrics/AbcSize - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @directory_id = hash[:directory_id] - @organization_id = hash[:organization_id] - @idp_id = hash[:idp_id] - @email = hash[:email] - # @deprecated Will be removed in a future major version. - # Enable the `emails` custom attribute in dashboard and pull from customAttributes instead. - # See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details. - @emails = hash[:emails] - @first_name = hash[:first_name] - @last_name = hash[:last_name] - # @deprecated Will be removed in a future major version. - # Enable the `job_title` custom attribute in dashboard and pull from customAttributes instead. - # See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details. - @job_title = hash[:job_title] - # @deprecated Will be removed in a future major version. - # Enable the `username` custom attribute in dashboard and pull from customAttributes instead. - # See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details. - @username = hash[:username] - @state = hash[:state] - @groups = hash[:groups] - @role = hash[:role] - @roles = hash[:roles] - @custom_attributes = hash[:custom_attributes] - @raw_attributes = hash[:raw_attributes] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - - replace_without_warning(to_json) - end - # rubocop:enable Metrics/AbcSize - - def to_json(*) - base_attributes - .merge(authorization_attributes) - end - - private - - def base_attributes - { - id: id, - directory_id: directory_id, - organization_id: organization_id, - idp_id: idp_id, - email: email, - emails: emails, - first_name: first_name, - last_name: last_name, - job_title: job_title, - username: username, - state: state, - groups: groups, - custom_attributes: custom_attributes, - raw_attributes: raw_attributes, - created_at: created_at, - updated_at: updated_at - } - end - - def authorization_attributes - { - role: role, - roles: roles - } - end - - public - - # @deprecated Will be removed in a future major version. Use {#email} instead. - def primary_email - primary_email = (emails || []).find { |email| email[:primary] } - primary_email[:value] if primary_email - end - end -end diff --git a/lib/workos/email_verification.rb b/lib/workos/email_verification.rb deleted file mode 100644 index 4c63b2de..00000000 --- a/lib/workos/email_verification.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The EmailVerification class provides a lightweight wrapper around a WorkOS email - # verification resource. This class is not meant to be instantiated in a user space, - # and is instantiated internally but exposed. - class EmailVerification - include HashProvider - - attr_accessor :id, :user_id, :email, - :expires_at, :code, :created_at, :updated_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @user_id = hash[:user_id] - @email = hash[:email] - @code = hash[:code] - @expires_at = hash[:expires_at] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - - def to_json(*) - { - id: id, - user_id: user_id, - email: email, - code: code, - expires_at: expires_at, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/encryptors.rb b/lib/workos/encryptors.rb index 8384dcf5..5ef4d190 100644 --- a/lib/workos/encryptors.rb +++ b/lib/workos/encryptors.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true +# @oagen-ignore-file +# Namespace for pluggable session encryptors. + module WorkOS - # Encryptors module provides pluggable encryption implementations for session data. - # The default encryptor is AesGcm, which uses AES-256-GCM encryption. module Encryptors - autoload :AesGcm, "workos/encryptors/aes_gcm" end end diff --git a/lib/workos/encryptors/aes_gcm.rb b/lib/workos/encryptors/aes_gcm.rb index c5f4fcf5..f40be22b 100644 --- a/lib/workos/encryptors/aes_gcm.rb +++ b/lib/workos/encryptors/aes_gcm.rb @@ -1,48 +1,55 @@ # frozen_string_literal: true -require "encryptor" -require "securerandom" -require "json" +# @oagen-ignore-file +# Default AES-256-GCM encryptor for sealed session cookies. +# Implements the seal/unseal interface expected by SessionManager. + require "base64" +require "digest" +require "json" +require "openssl" +require "securerandom" module WorkOS module Encryptors - # Default encryptor using AES-256-GCM. - # Implements the encryptor interface: #seal(data, key) and #unseal(sealed_data, key) class AesGcm - # Encrypts and seals data using AES-256-GCM - # @param data [Hash] The data to seal - # @param key [String] The encryption key - # @return [String] Base64-encoded sealed data + SEAL_VERSION = 0x01 + def seal(data, key) + json = data.is_a?(String) ? data : JSON.generate(data) + cipher = OpenSSL::Cipher.new("aes-256-gcm").encrypt + cipher.key = derive_key(key) iv = SecureRandom.random_bytes(12) - - encrypted_data = Encryptor.encrypt( - value: JSON.generate(data), - key: key, - iv: iv, - algorithm: "aes-256-gcm" - ) - Base64.encode64(iv + encrypted_data) + cipher.iv = iv + ciphertext = cipher.update(json) + cipher.final + Base64.strict_encode64(SEAL_VERSION.chr + iv + cipher.auth_tag + ciphertext) end - # Decrypts and unseals data using AES-256-GCM - # @param sealed_data [String] The sealed data to unseal - # @param key [String] The decryption key - # @return [Hash] The unsealed data with symbolized keys - def unseal(sealed_data, key) - decoded_data = Base64.decode64(sealed_data) - iv = decoded_data[0..11] - encrypted_data = decoded_data[12..] + def unseal(sealed, key) + raw = Base64.decode64(sealed.to_s) + raise ArgumentError, "Sealed payload too short" if raw.bytesize < 1 + 12 + 16 + version = raw.byteslice(0, 1).bytes.first + raise ArgumentError, "Unknown seal version: #{version}" unless version == SEAL_VERSION + iv = raw.byteslice(1, 12) + tag = raw.byteslice(13, 16) + ciphertext = raw.byteslice(29, raw.bytesize - 29) + cipher = OpenSSL::Cipher.new("aes-256-gcm").decrypt + cipher.key = derive_key(key) + cipher.iv = iv + cipher.auth_tag = tag + decoded = cipher.update(ciphertext) + cipher.final + decoded.force_encoding(Encoding::UTF_8) + begin + JSON.parse(decoded) + rescue JSON::ParserError + decoded + end + end - decrypted_data = Encryptor.decrypt( - value: encrypted_data, - key: key, - iv: iv, - algorithm: "aes-256-gcm" - ) + private - JSON.parse(decrypted_data, symbolize_names: true) + def derive_key(passphrase) + Digest::SHA256.digest(passphrase.to_s) end end end diff --git a/lib/workos/errors.rb b/lib/workos/errors.rb index 2001ab13..af2df39b 100644 --- a/lib/workos/errors.rb +++ b/lib/workos/errors.rb @@ -1,86 +1,28 @@ # frozen_string_literal: true +# @oagen-ignore-file — hand-maintained runtime module WorkOS - # Parent class for WorkOS related errors - class WorkOSError < StandardError - attr_reader :http_status - attr_reader :request_id - attr_reader :code - attr_reader :errors - attr_reader :error - attr_reader :error_description - attr_reader :data - attr_reader :retry_after + # Base class for all SDK errors. + class Error < StandardError + attr_reader :http_status, :request_id, :code, :body - # rubocop:disable Metrics/ParameterLists - def initialize( - message: nil, - error: nil, - error_description: nil, - http_status: nil, - request_id: nil, - code: nil, - errors: nil, - data: nil, - retry_after: nil - ) - @message = message - @error = error - @error_description = error_description + def initialize(message:, http_status: nil, request_id: nil, code: nil, body: nil) + super(message) @http_status = http_status @request_id = request_id @code = code - @errors = errors - @data = data - @retry_after = retry_after - end - # rubocop:enable Metrics/ParameterLists - - def to_s - status_string = @http_status.nil? ? "" : "Status #{@http_status}, " - id_string = @request_id.nil? ? "" : " - request ID: #{@request_id}" - if @error && @error_description - error_string = "error: #{@error}, error_description: #{@error_description}" - "#{status_string}#{error_string}#{id_string}" - elsif @error - "#{status_string}#{@error}#{id_string}" - else - "#{status_string}#{@message}#{id_string}" - end + @body = body end end - # APIError is a generic error that may be raised in cases where none of the - # other named errors cover the problem. It could also be raised in the case - # that a new error has been introduced in the API, but this version of the - # Ruby SDK doesn't know how to handle it. - class APIError < WorkOSError; end - - # AuthenticationError is raised when invalid credentials are used to connect - # to WorkOS's servers. - class AuthenticationError < WorkOSError; end - - # InvalidRequestError is raised when a request is initiated with invalid - # parameters. - class InvalidRequestError < WorkOSError; end - - # ForbiddenError is raised when a request is forbidden, likely due to missing a step - # (i.e. verifying email ownership before authenticating). - class ForbiddenRequestError < WorkOSError; end - - # SignatureVerificationError is raised when the signature verification for a - # webhook fails - class SignatureVerificationError < WorkOSError; end - - # TimeoutError is raised when the HTTP request to the API times out - class TimeoutError < WorkOSError; end - - # RateLimitExceededError is raised when the rate limit for the API has been hit - class RateLimitExceededError < WorkOSError; end - - # NotFoundError is raised when a resource is not found - class NotFoundError < WorkOSError; end - - # UnprocessableEntityError is raised when a request is made that cannot be processed - class UnprocessableEntityError < WorkOSError; end + class APIError < Error; end + class APIConnectionError < Error; end + class AuthenticationError < APIError; end + class ForbiddenRequestError < APIError; end + class IdempotencyError < APIError; end + class InvalidRequestError < APIError; end + class NotFoundError < APIError; end + class RateLimitExceededError < APIError; end + class UnprocessableEntityError < APIError; end + class SignatureVerificationError < Error; end end diff --git a/lib/workos/event.rb b/lib/workos/event.rb deleted file mode 100644 index 5a337b70..00000000 --- a/lib/workos/event.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The Event class provides a lightweight wrapper around - # a WorkOS Event resource. This class is not meant to be instantiated - # in user space, and is instantiated internally but exposed. - class Event - include HashProvider - - attr_accessor :id, :event, :data, :created_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @event = hash[:event] - @created_at = hash[:created_at] - @data = hash[:data] - end - - def to_json(*) - { - id: id, - event: event, - data: data, - created_at: created_at - } - end - end -end diff --git a/lib/workos/events.rb b/lib/workos/events.rb index 354e6ad6..1b1b77ec 100644 --- a/lib/workos/events.rb +++ b/lib/workos/events.rb @@ -1,47 +1,77 @@ # frozen_string_literal: true -require "net/http" +# This file is auto-generated by oagen. Do not edit. -module WorkOS - # The Events module provides convenience methods for working with the - # WorkOS Events platform. You'll need a valid API key and be in the - # Events beta to be able to access the API - # - module Events - class << self - include Client +require "json" - # Retrieve events. - # - # @param [Hash] options An options hash - # @option options [String] event The type of event - # @option options [String] organization_id Limit scope of events to an organization - # @option options [String] limit Maximum number of records to return. - # @option options [String] after Pagination cursor to receive records - # after a provided Event ID. - # - # @return [Hash] - def list_events(options = {}) - raise ArgumentError, "Events parameter is required." if options[:events].nil? +module WorkOS + class Events + def initialize(client) + @client = client + end - response = execute_request( - request: get_request( - path: "/events", - auth: true, - params: options + # List events + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::EventsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param events [Array, nil] Filter events by one or more event types (e.g. `dsync.user.created`). + # @param range_start [String, nil] ISO-8601 date string to filter events created after this date. + # @param range_end [String, nil] ISO-8601 date string to filter events created before this date. + # @param organization_id [String, nil] Filter events by the [Organization](https://workos.com/docs/reference/organization) that the event is associated with. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_events( + before: nil, + after: nil, + limit: nil, + order: nil, + events: nil, + range_start: nil, + range_end: nil, + organization_id: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "events" => events, + "range_start" => range_start, + "range_end" => range_end, + "organization_id" => organization_id + }.compact + response = @client.request(method: :get, path: "/events", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::EventSchema, filters: {before: before, limit: limit, order: order, events: events, range_start: range_start, range_end: range_end, organization_id: organization_id}, + fetch_next: lambda do |cursor| + list_events( + before: before, + after: cursor, + limit: limit, + order: order, + events: events, + range_start: range_start, + range_end: range_end, + organization_id: organization_id, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_events( + before: cursor, + after: nil, + limit: limit, + order: order, + events: events, + range_start: range_start, + range_end: range_end, + organization_id: organization_id, + request_options: request_options ) - ) - - parsed_response = JSON.parse(response.body) - events = parsed_response["data"].map do |event| - ::WorkOS::Event.new(event.to_json) end - - WorkOS::Types::ListStruct.new( - data: events, - list_metadata: parsed_response["list_metadata"] - ) - end + ) end end end diff --git a/lib/workos/events/event_list_list_metadata.rb b/lib/workos/events/event_list_list_metadata.rb new file mode 100644 index 00000000..07dae44e --- /dev/null +++ b/lib/workos/events/event_list_list_metadata.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EventListListMetadata + include HashProvider + + HASH_ATTRS = { + after: :after + }.freeze + + attr_accessor :after + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @after = hash[:after] + end + end +end diff --git a/lib/workos/events/event_schema.rb b/lib/workos/events/event_schema.rb new file mode 100644 index 00000000..7c035608 --- /dev/null +++ b/lib/workos/events/event_schema.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EventSchema + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context + }.freeze + + attr_accessor \ + :object, + :id, + :event, + :data, + :created_at, + :context + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] || {} + @created_at = hash[:created_at] + @context = hash[:context] || {} + end + end +end diff --git a/lib/workos/factor.rb b/lib/workos/factor.rb deleted file mode 100644 index 8c6b565c..00000000 --- a/lib/workos/factor.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The Factor class provides a lightweight wrapper around - # a WorkOS DirectoryUser resource. This class is not meant to be instantiated - # in DirectoryUser space, and is instantiated internally but exposed. - class Factor - include HashProvider - - attr_accessor :id, :object, :type, :sms, :totp, :updated_at, :created_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @object = hash[:object] - @type = hash[:type] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - @totp = hash[:totp] - @sms = hash[:sms] - end - - def to_json(*) - { - id: id, - object: object, - type: type, - totp: totp, - sms: sms, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/feature_flag.rb b/lib/workos/feature_flag.rb deleted file mode 100644 index 021eac38..00000000 --- a/lib/workos/feature_flag.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The FeatureFlag class provides a lightweight wrapper around - # a WorkOS Feature Flag resource. This class is not meant to be instantiated - # in user space, and is instantiated internally but exposed. - class FeatureFlag - include HashProvider - - attr_accessor :id, :name, :slug, :description, :created_at, :updated_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @name = hash[:name] - @slug = hash[:slug] - @description = hash[:description] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - - def to_json(*) - { - id: id, - name: name, - slug: slug, - description: description, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/feature_flags.rb b/lib/workos/feature_flags.rb new file mode 100644 index 00000000..73422a94 --- /dev/null +++ b/lib/workos/feature_flags.rb @@ -0,0 +1,217 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FeatureFlags + def initialize(client) + @client = client + end + + # List feature flags + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::FeatureFlagsOrder, nil] Order the results by the creation time. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_feature_flags( + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/feature-flags", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::Flag, filters: {before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_feature_flags( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_feature_flags( + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options + ) + end + ) + end + + # Get a feature flag + # @param slug [String] A unique key to reference the Feature Flag. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Flag] + def get_feature_flag( + slug:, + request_options: {} + ) + response = @client.request(method: :get, path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + WorkOS::Flag.new(response.body) + end + + # Disable a feature flag + # @param slug [String] A unique key to reference the Feature Flag. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::FeatureFlag] + def disable_feature_flag( + slug:, + request_options: {} + ) + response = @client.request(method: :put, path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/disable", auth: true, request_options: request_options) + WorkOS::FeatureFlag.new(response.body) + end + + # Enable a feature flag + # @param slug [String] A unique key to reference the Feature Flag. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::FeatureFlag] + def enable_feature_flag( + slug:, + request_options: {} + ) + response = @client.request(method: :put, path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/enable", auth: true, request_options: request_options) + WorkOS::FeatureFlag.new(response.body) + end + + # Add a feature flag target + # @param resource_id [String] The resource ID in format "user_" or "org_". + # @param slug [String] The unique slug identifier of the feature flag. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def add_flag_target( + resource_id:, + slug:, + request_options: {} + ) + @client.request(method: :post, path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/targets/#{WorkOS::Util.encode_path(resource_id)}", auth: true, request_options: request_options) + nil + end + + # Remove a feature flag target + # @param resource_id [String] The resource ID in format "user_" or "org_". + # @param slug [String] The unique slug identifier of the feature flag. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def remove_flag_target( + resource_id:, + slug:, + request_options: {} + ) + @client.request(method: :delete, path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/targets/#{WorkOS::Util.encode_path(resource_id)}", auth: true, request_options: request_options) + nil + end + + # List enabled feature flags for an organization + # @param organization_id [String] Unique identifier of the Organization. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::OrganizationsFeatureFlagsOrder, nil] Order the results by the creation time. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_organization_feature_flags( + organization_id:, + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/feature-flags", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::Flag, filters: {organization_id: organization_id, before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_organization_feature_flags( + organization_id: organization_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_organization_feature_flags( + organization_id: organization_id, + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options + ) + end + ) + end + + # List enabled feature flags for a user + # @param user_id [String] The ID of the user. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::UserManagementUsersFeatureFlagsOrder, nil] Order the results by the creation time. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_user_feature_flags( + user_id:, + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/feature-flags", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::Flag, filters: {user_id: user_id, before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_user_feature_flags( + user_id: user_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_user_feature_flags( + user_id: user_id, + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options + ) + end + ) + end + end +end diff --git a/lib/workos/feature_flags/feature_flag.rb b/lib/workos/feature_flags/feature_flag.rb new file mode 100644 index 00000000..e1cd05e2 --- /dev/null +++ b/lib/workos/feature_flags/feature_flag.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FeatureFlag + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + slug: :slug, + name: :name, + description: :description, + owner: :owner, + tags: :tags, + enabled: :enabled, + default_value: :default_value, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :slug, + :name, + :description, + :owner, + :tags, + :enabled, + :default_value, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @slug = hash[:slug] + @name = hash[:name] + @description = hash[:description] + @owner = hash[:owner] ? WorkOS::FeatureFlagOwner.new(hash[:owner]) : nil + @tags = hash[:tags] || [] + @enabled = hash[:enabled] + @default_value = hash[:default_value] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/feature_flags/feature_flag_owner.rb b/lib/workos/feature_flags/feature_flag_owner.rb new file mode 100644 index 00000000..84ad995e --- /dev/null +++ b/lib/workos/feature_flags/feature_flag_owner.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FeatureFlagOwner + include HashProvider + + HASH_ATTRS = { + email: :email, + first_name: :first_name, + last_name: :last_name + }.freeze + + attr_accessor \ + :email, + :first_name, + :last_name + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @email = hash[:email] + @first_name = hash[:first_name] + @last_name = hash[:last_name] + end + end +end diff --git a/lib/workos/feature_flags/flag.rb b/lib/workos/feature_flags/flag.rb new file mode 100644 index 00000000..60092a2b --- /dev/null +++ b/lib/workos/feature_flags/flag.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + Flag = FeatureFlag +end diff --git a/lib/workos/feature_flags/flag_created.rb b/lib/workos/feature_flags/flag_created.rb new file mode 100644 index 00000000..6e76fa16 --- /dev/null +++ b/lib/workos/feature_flags/flag_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::FlagCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::FlagCreatedContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/feature_flags/flag_created_context.rb b/lib/workos/feature_flags/flag_created_context.rb new file mode 100644 index 00000000..82c04aad --- /dev/null +++ b/lib/workos/feature_flags/flag_created_context.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagCreatedContext + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + actor: :actor + }.freeze + + attr_accessor \ + :client_id, + :actor + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @actor = hash[:actor] ? WorkOS::FlagCreatedContextActor.new(hash[:actor]) : nil + end + end +end diff --git a/lib/workos/feature_flags/flag_created_context_actor.rb b/lib/workos/feature_flags/flag_created_context_actor.rb new file mode 100644 index 00000000..bc848b12 --- /dev/null +++ b/lib/workos/feature_flags/flag_created_context_actor.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagCreatedContextActor + include HashProvider + + HASH_ATTRS = { + id: :id, + source: :source, + name: :name + }.freeze + + attr_accessor \ + :id, + :source, + :name + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @source = hash[:source] + @name = hash[:name] + end + end +end diff --git a/lib/workos/feature_flags/flag_created_data.rb b/lib/workos/feature_flags/flag_created_data.rb new file mode 100644 index 00000000..17fb7c57 --- /dev/null +++ b/lib/workos/feature_flags/flag_created_data.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + environment_id: :environment_id, + slug: :slug, + name: :name, + description: :description, + owner: :owner, + tags: :tags, + enabled: :enabled, + default_value: :default_value, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :environment_id, + :slug, + :name, + :description, + :owner, + :tags, + :enabled, + :default_value, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @environment_id = hash[:environment_id] + @slug = hash[:slug] + @name = hash[:name] + @description = hash[:description] + @owner = hash[:owner] ? WorkOS::FlagCreatedDataOwner.new(hash[:owner]) : nil + @tags = hash[:tags] || [] + @enabled = hash[:enabled] + @default_value = hash[:default_value] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/feature_flags/flag_created_data_owner.rb b/lib/workos/feature_flags/flag_created_data_owner.rb new file mode 100644 index 00000000..4a43b76c --- /dev/null +++ b/lib/workos/feature_flags/flag_created_data_owner.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + FlagCreatedDataOwner = FeatureFlagOwner +end diff --git a/lib/workos/feature_flags/flag_deleted.rb b/lib/workos/feature_flags/flag_deleted.rb new file mode 100644 index 00000000..ff1c9f30 --- /dev/null +++ b/lib/workos/feature_flags/flag_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::FlagDeletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::FlagDeletedContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/feature_flags/flag_deleted_context.rb b/lib/workos/feature_flags/flag_deleted_context.rb new file mode 100644 index 00000000..e8e7a3fd --- /dev/null +++ b/lib/workos/feature_flags/flag_deleted_context.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagDeletedContext + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + actor: :actor + }.freeze + + attr_accessor \ + :client_id, + :actor + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @actor = hash[:actor] ? WorkOS::FlagDeletedContextActor.new(hash[:actor]) : nil + end + end +end diff --git a/lib/workos/feature_flags/flag_deleted_context_actor.rb b/lib/workos/feature_flags/flag_deleted_context_actor.rb new file mode 100644 index 00000000..727dd10f --- /dev/null +++ b/lib/workos/feature_flags/flag_deleted_context_actor.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagDeletedContextActor + include HashProvider + + HASH_ATTRS = { + id: :id, + source: :source, + name: :name + }.freeze + + attr_accessor \ + :id, + :source, + :name + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @source = hash[:source] + @name = hash[:name] + end + end +end diff --git a/lib/workos/feature_flags/flag_deleted_data.rb b/lib/workos/feature_flags/flag_deleted_data.rb new file mode 100644 index 00000000..c599d787 --- /dev/null +++ b/lib/workos/feature_flags/flag_deleted_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + FlagDeletedData = FlagCreatedData +end diff --git a/lib/workos/feature_flags/flag_deleted_data_owner.rb b/lib/workos/feature_flags/flag_deleted_data_owner.rb new file mode 100644 index 00000000..d71a86e7 --- /dev/null +++ b/lib/workos/feature_flags/flag_deleted_data_owner.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + FlagDeletedDataOwner = FeatureFlagOwner +end diff --git a/lib/workos/feature_flags/flag_owner.rb b/lib/workos/feature_flags/flag_owner.rb new file mode 100644 index 00000000..159a30ee --- /dev/null +++ b/lib/workos/feature_flags/flag_owner.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + FlagOwner = FeatureFlagOwner +end diff --git a/lib/workos/feature_flags/flag_rule_updated.rb b/lib/workos/feature_flags/flag_rule_updated.rb new file mode 100644 index 00000000..fdb1d3e0 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagRuleUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::FlagRuleUpdatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::FlagRuleUpdatedContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/feature_flags/flag_rule_updated_context.rb b/lib/workos/feature_flags/flag_rule_updated_context.rb new file mode 100644 index 00000000..2f33af0f --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagRuleUpdatedContext + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + actor: :actor, + access_type: :access_type, + configured_targets: :configured_targets, + previous_attributes: :previous_attributes + }.freeze + + attr_accessor \ + :client_id, + :actor, + :access_type, + :configured_targets, + :previous_attributes + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @actor = hash[:actor] ? WorkOS::FlagRuleUpdatedContextActor.new(hash[:actor]) : nil + @access_type = hash[:access_type] + @configured_targets = hash[:configured_targets] ? WorkOS::FlagRuleUpdatedContextConfiguredTarget.new(hash[:configured_targets]) : nil + @previous_attributes = hash[:previous_attributes] ? WorkOS::FlagRuleUpdatedContextPreviousAttribute.new(hash[:previous_attributes]) : nil + end + end +end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_actor.rb b/lib/workos/feature_flags/flag_rule_updated_context_actor.rb new file mode 100644 index 00000000..88c23f39 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_actor.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagRuleUpdatedContextActor + include HashProvider + + HASH_ATTRS = { + id: :id, + source: :source, + name: :name + }.freeze + + attr_accessor \ + :id, + :source, + :name + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @source = hash[:source] + @name = hash[:name] + end + end +end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_configured_target.rb b/lib/workos/feature_flags/flag_rule_updated_context_configured_target.rb new file mode 100644 index 00000000..adec82aa --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_configured_target.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagRuleUpdatedContextConfiguredTarget + include HashProvider + + HASH_ATTRS = { + organizations: :organizations, + users: :users + }.freeze + + attr_accessor \ + :organizations, + :users + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @organizations = (hash[:organizations] || []).map { |item| item ? WorkOS::FlagRuleUpdatedContextConfiguredTargetOrganization.new(item) : nil } + @users = (hash[:users] || []).map { |item| item ? WorkOS::FlagRuleUpdatedContextConfiguredTargetUser.new(item) : nil } + end + end +end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb b/lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb new file mode 100644 index 00000000..1cc709d6 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagRuleUpdatedContextConfiguredTargetOrganization + include HashProvider + + HASH_ATTRS = { + id: :id, + name: :name + }.freeze + + attr_accessor \ + :id, + :name + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @name = hash[:name] + end + end +end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_configured_target_user.rb b/lib/workos/feature_flags/flag_rule_updated_context_configured_target_user.rb new file mode 100644 index 00000000..a5abf15c --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_configured_target_user.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagRuleUpdatedContextConfiguredTargetUser + include HashProvider + + HASH_ATTRS = { + id: :id, + email: :email + }.freeze + + attr_accessor \ + :id, + :email + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @email = hash[:email] + end + end +end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute.rb b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute.rb new file mode 100644 index 00000000..cc257f0e --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagRuleUpdatedContextPreviousAttribute + include HashProvider + + HASH_ATTRS = { + data: :data, + context: :context + }.freeze + + attr_accessor \ + :data, + :context + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @data = hash[:data] ? WorkOS::FlagRuleUpdatedContextPreviousAttributeData.new(hash[:data]) : nil + @context = hash[:context] ? WorkOS::FlagRuleUpdatedContextPreviousAttributeContext.new(hash[:context]) : nil + end + end +end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context.rb b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context.rb new file mode 100644 index 00000000..905a70f7 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagRuleUpdatedContextPreviousAttributeContext + include HashProvider + + HASH_ATTRS = { + access_type: :access_type, + configured_targets: :configured_targets + }.freeze + + attr_accessor \ + :access_type, + :configured_targets + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @access_type = hash[:access_type] + @configured_targets = hash[:configured_targets] ? WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.new(hash[:configured_targets]) : nil + end + end +end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target.rb b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target.rb new file mode 100644 index 00000000..7c16548f --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget = FlagRuleUpdatedContextConfiguredTarget +end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rb b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rb new file mode 100644 index 00000000..76d9b785 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization = FlagRuleUpdatedContextConfiguredTargetOrganization +end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_user.rb b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_user.rb new file mode 100644 index 00000000..b65292d3 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context_configured_target_user.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser = FlagRuleUpdatedContextConfiguredTargetUser +end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_data.rb b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_data.rb new file mode 100644 index 00000000..871f54c9 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_data.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagRuleUpdatedContextPreviousAttributeData + include HashProvider + + HASH_ATTRS = { + enabled: :enabled, + default_value: :default_value + }.freeze + + attr_accessor \ + :enabled, + :default_value + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @enabled = hash[:enabled] + @default_value = hash[:default_value] + end + end +end diff --git a/lib/workos/feature_flags/flag_rule_updated_data.rb b/lib/workos/feature_flags/flag_rule_updated_data.rb new file mode 100644 index 00000000..9562b293 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + FlagRuleUpdatedData = FlagCreatedData +end diff --git a/lib/workos/feature_flags/flag_rule_updated_data_owner.rb b/lib/workos/feature_flags/flag_rule_updated_data_owner.rb new file mode 100644 index 00000000..e92d909c --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_data_owner.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + FlagRuleUpdatedDataOwner = FeatureFlagOwner +end diff --git a/lib/workos/feature_flags/flag_updated.rb b/lib/workos/feature_flags/flag_updated.rb new file mode 100644 index 00000000..8ce9422a --- /dev/null +++ b/lib/workos/feature_flags/flag_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::FlagUpdatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::FlagUpdatedContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/feature_flags/flag_updated_context.rb b/lib/workos/feature_flags/flag_updated_context.rb new file mode 100644 index 00000000..f298b5b7 --- /dev/null +++ b/lib/workos/feature_flags/flag_updated_context.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagUpdatedContext + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + actor: :actor, + previous_attributes: :previous_attributes + }.freeze + + attr_accessor \ + :client_id, + :actor, + :previous_attributes + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @actor = hash[:actor] ? WorkOS::FlagUpdatedContextActor.new(hash[:actor]) : nil + @previous_attributes = hash[:previous_attributes] ? WorkOS::FlagUpdatedContextPreviousAttribute.new(hash[:previous_attributes]) : nil + end + end +end diff --git a/lib/workos/feature_flags/flag_updated_context_actor.rb b/lib/workos/feature_flags/flag_updated_context_actor.rb new file mode 100644 index 00000000..08f3408d --- /dev/null +++ b/lib/workos/feature_flags/flag_updated_context_actor.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagUpdatedContextActor + include HashProvider + + HASH_ATTRS = { + id: :id, + source: :source, + name: :name + }.freeze + + attr_accessor \ + :id, + :source, + :name + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @source = hash[:source] + @name = hash[:name] + end + end +end diff --git a/lib/workos/feature_flags/flag_updated_context_previous_attribute.rb b/lib/workos/feature_flags/flag_updated_context_previous_attribute.rb new file mode 100644 index 00000000..241c8b9d --- /dev/null +++ b/lib/workos/feature_flags/flag_updated_context_previous_attribute.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagUpdatedContextPreviousAttribute + include HashProvider + + HASH_ATTRS = { + data: :data + }.freeze + + attr_accessor :data + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @data = hash[:data] ? WorkOS::FlagUpdatedContextPreviousAttributeData.new(hash[:data]) : nil + end + end +end diff --git a/lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb b/lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb new file mode 100644 index 00000000..589ac92f --- /dev/null +++ b/lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class FlagUpdatedContextPreviousAttributeData + include HashProvider + + HASH_ATTRS = { + name: :name, + description: :description, + tags: :tags, + enabled: :enabled, + default_value: :default_value + }.freeze + + attr_accessor \ + :name, + :description, + :tags, + :enabled, + :default_value + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @name = hash[:name] + @description = hash[:description] + @tags = hash[:tags] || [] + @enabled = hash[:enabled] + @default_value = hash[:default_value] + end + end +end diff --git a/lib/workos/feature_flags/flag_updated_data.rb b/lib/workos/feature_flags/flag_updated_data.rb new file mode 100644 index 00000000..30a2d7a8 --- /dev/null +++ b/lib/workos/feature_flags/flag_updated_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + FlagUpdatedData = FlagCreatedData +end diff --git a/lib/workos/feature_flags/flag_updated_data_owner.rb b/lib/workos/feature_flags/flag_updated_data_owner.rb new file mode 100644 index 00000000..dce0a7a0 --- /dev/null +++ b/lib/workos/feature_flags/flag_updated_data_owner.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + FlagUpdatedDataOwner = FeatureFlagOwner +end diff --git a/lib/workos/hash_provider.rb b/lib/workos/hash_provider.rb index 8a55b191..474a3944 100644 --- a/lib/workos/hash_provider.rb +++ b/lib/workos/hash_provider.rb @@ -1,18 +1,44 @@ # frozen_string_literal: true +# @oagen-ignore-file — hand-maintained runtime module WorkOS - # Module to include an explicit method for converting a model into a Hash containing - # its attributes. Default implementation will simply call to_json. Individual classes - # may override. module HashProvider - include Kernel + def to_h + self.class::HASH_ATTRS.each_with_object({}) do |(raw_key, attr_name), hash| + hash[raw_key] = serialize_field(instance_variable_get(:"@#{attr_name}")) + end + end - def to_json(*) - raise "Must be implemented by including class." + def to_json(*args) + to_h.to_json(*args) end - def to_h - to_json + def inspect + attrs = self.class::HASH_ATTRS.values.filter_map do |attr_name| + value = instance_variable_get(:"@#{attr_name}") + next if value.nil? + + "#{attr_name}=#{value.inspect}" + end + + return "#<#{self.class}>" if attrs.empty? + + "#<#{self.class} #{attrs.join(" ")}>" + end + + private + + def serialize_field(value) + case value + when nil + nil + when Array + value.map { |item| serialize_field(item) } + when Hash + value.each_with_object({}) { |(key, item), hash| hash[key] = serialize_field(item) } + else + (value.respond_to?(:to_h) && !value.is_a?(Hash)) ? value.to_h : value + end end end end diff --git a/lib/workos/impersonator.rb b/lib/workos/impersonator.rb deleted file mode 100644 index 20507425..00000000 --- a/lib/workos/impersonator.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # Contains information about a WorkOS Dashboard user impersonating - # a User Management user. - class Impersonator - include HashProvider - - attr_accessor :email, :reason - - def initialize(email:, reason:) - @email = email - @reason = reason - end - - def to_json(*) - { - email: email, - reason: reason - } - end - end -end diff --git a/lib/workos/invitation.rb b/lib/workos/invitation.rb deleted file mode 100644 index a65d2a97..00000000 --- a/lib/workos/invitation.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The Invitation class provides a lightweight wrapper around a WorkOS Invitation - # resource. This class is not meant to be instantiated in a user space, - # and is instantiated internally but exposed. - class Invitation - include HashProvider - - attr_accessor :id, :email, :state, :accepted_at, :revoked_at, :accept_invitation_url, - :expires_at, :token, :organization_id, :inviter_user_id, :created_at, :updated_at - - # rubocop:disable Metrics/AbcSize - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @email = hash[:email] - @state = hash[:state] - @token = hash[:token] - @accept_invitation_url = hash[:accept_invitation_url] - @organization_id = hash[:organization_id] - @inviter_user_id = hash[:inviter_user_id] - @accepted_at = hash[:accepted_at] - @revoked_at = hash[:revoked_at] - @expires_at = hash[:expires_at] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - # rubocop:enable Metrics/AbcSize - - def to_json(*) - { - id: id, - email: email, - state: state, - token: token, - accept_invitation_url: accept_invitation_url, - organization_id: organization_id, - inviter_user_id: inviter_user_id, - accepted_at: accepted_at, - revoked_at: revoked_at, - expires_at: expires_at, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/magic_auth.rb b/lib/workos/magic_auth.rb deleted file mode 100644 index 410c4a25..00000000 --- a/lib/workos/magic_auth.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The MagicAuth class provides a lightweight wrapper around a WorkOS MagicAuth - # resource. This class is not meant to be instantiated in a user space, - # and is instantiated internally but exposed. - class MagicAuth - include HashProvider - - attr_accessor :id, :user_id, :email, - :expires_at, :code, :created_at, :updated_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @user_id = hash[:user_id] - @email = hash[:email] - @code = hash[:code] - @expires_at = hash[:expires_at] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - - def to_json(*) - { - id: id, - user_id: user_id, - email: email, - code: code, - expires_at: expires_at, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/mfa.rb b/lib/workos/mfa.rb deleted file mode 100644 index aa4913c8..00000000 --- a/lib/workos/mfa.rb +++ /dev/null @@ -1,135 +0,0 @@ -# frozen_string_literal: true - -require "net/http" -require "uri" - -module WorkOS - # The MFA module provides convenience methods for working with the WorkOS - # MFA platform. You'll need a valid API key - module MFA - class << self - include Client, Deprecation - - def delete_factor(id:) - response = execute_request( - request: delete_request( - path: "/auth/factors/#{id}", - auth: true - ) - ) - response.is_a? Net::HTTPSuccess - end - - def get_factor( - id: - ) - response = execute_request( - request: get_request( - path: "/auth/factors/#{id}", - auth: true - ) - ) - WorkOS::Factor.new(response.body) - end - - # rubocop:disable Metrics/PerceivedComplexity - def validate_args( - type:, - totp_issuer: nil, - totp_user: nil, - phone_number: nil - ) - if type != "sms" && type != "totp" && type != "generic_otp" - raise ArgumentError, "Type argument must be either 'sms' or 'totp'" - end - if (type == "totp" && totp_issuer.nil?) || (type == "totp" && totp_user.nil?) - raise ArgumentError, "Incomplete arguments. Need to specify both totp_issuer and totp_user when type is totp" - end - return unless type == "sms" && phone_number.nil? - - raise ArgumentError, "Incomplete arguments. Need to specify phone_number when type is sms" - end - # rubocop:enable Metrics/CyclomaticComplexity - # rubocop:enable Metrics/PerceivedComplexity - - def enroll_factor( - type:, - totp_issuer: nil, - totp_user: nil, - phone_number: nil - ) - validate_args( - type: type, - totp_issuer: totp_issuer, - totp_user: totp_user, - phone_number: phone_number - ) - response = execute_request(request: post_request( - auth: true, - body: { - type: type, - totp_issuer: totp_issuer, - totp_user: totp_user, - phone_number: phone_number - }, - path: "/auth/factors/enroll" - )) - WorkOS::Factor.new(response.body) - end - - def challenge_factor( - authentication_factor_id: nil, - sms_template: nil - ) - if authentication_factor_id.nil? - raise ArgumentError, "Incomplete arguments: 'authentication_factor_id' is a required argument" - end - - request = post_request( - auth: true, - body: { - sms_template: sms_template - }, - path: "/auth/factors/#{authentication_factor_id}/challenge" - ) - - response = execute_request(request: request) - WorkOS::Challenge.new(response.body) - end - - def verify_factor( - authentication_challenge_id: nil, - code: nil - ) - warn_deprecation "`verify_factor` is deprecated. Please use `verify_challenge` instead." - - verify_challenge( - authentication_challenge_id: authentication_challenge_id, - code: code - ) - end - - def verify_challenge( - authentication_challenge_id: nil, - code: nil - ) - if authentication_challenge_id.nil? || code.nil? - raise ArgumentError, "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments" - end - - options = { - code: code - } - - response = execute_request( - request: post_request( - path: "/auth/challenges/#{authentication_challenge_id}/verify", - auth: true, - body: options - ) - ) - WorkOS::VerifyChallenge.new(response.body) - end - end - end -end diff --git a/lib/workos/multi_factor_auth.rb b/lib/workos/multi_factor_auth.rb new file mode 100644 index 00000000..27b3e16b --- /dev/null +++ b/lib/workos/multi_factor_auth.rb @@ -0,0 +1,172 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class MultiFactorAuth + def initialize(client) + @client = client + end + + # Verify Challenge + # @param id [String] The unique ID of the Authentication Challenge. + # @param code [String] The one-time code to verify. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthenticationChallengeVerifyResponse] + def verify_challenge( + id:, + code:, + request_options: {} + ) + body = { + "code" => code + }.compact + response = @client.request(method: :post, path: "/auth/challenges/#{WorkOS::Util.encode_path(id)}/verify", auth: true, body: body, request_options: request_options) + WorkOS::AuthenticationChallengeVerifyResponse.new(response.body) + end + + # Enroll Factor + # @param type [WorkOS::Types::AuthenticationFactorsCreateRequestType] The type of factor to enroll. + # @param phone_number [String, nil] Required when type is 'sms'. + # @param totp_issuer [String, nil] Required when type is 'totp'. + # @param totp_user [String, nil] Required when type is 'totp'. + # @param user_id [String, nil] The ID of the user to associate the factor with. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthenticationFactorEnrolled] + def enroll_factor( + type:, + phone_number: nil, + totp_issuer: nil, + totp_user: nil, + user_id: nil, + request_options: {} + ) + body = { + "type" => type, + "phone_number" => phone_number, + "totp_issuer" => totp_issuer, + "totp_user" => totp_user, + "user_id" => user_id + }.compact + response = @client.request(method: :post, path: "/auth/factors/enroll", auth: true, body: body, request_options: request_options) + WorkOS::AuthenticationFactorEnrolled.new(response.body) + end + + # Get Factor + # @param id [String] The unique ID of the Factor. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthenticationFactor] + def get_factor( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/auth/factors/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::AuthenticationFactor.new(response.body) + end + + # Delete Factor + # @param id [String] The unique ID of the Factor. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_factor( + id:, + request_options: {} + ) + @client.request(method: :delete, path: "/auth/factors/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + nil + end + + # Challenge Factor + # @param id [String] The unique ID of the Authentication Factor to be challenged. + # @param sms_template [String, nil] A custom template for the SMS message. Use the {{code}} placeholder to include the verification code. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthenticationChallenge] + def challenge_factor( + id:, + sms_template: nil, + request_options: {} + ) + body = { + "sms_template" => sms_template + }.compact + response = @client.request(method: :post, path: "/auth/factors/#{WorkOS::Util.encode_path(id)}/challenge", auth: true, body: body, request_options: request_options) + WorkOS::AuthenticationChallenge.new(response.body) + end + + # List authentication factors + # @param userland_user_id [String] The ID of the [user](https://workos.com/docs/reference/authkit/user). + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::UserManagementMultiFactorAuthenticationOrder, nil] Order the results by the creation time. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_user_auth_factors( + userland_user_id:, + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(userland_user_id)}/auth_factors", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::AuthenticationFactor, filters: {userland_user_id: userland_user_id, before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_user_auth_factors( + userland_user_id: userland_user_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_user_auth_factors( + userland_user_id: userland_user_id, + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options + ) + end + ) + end + + # Enroll an authentication factor + # @param userland_user_id [String] The ID of the [user](https://workos.com/docs/reference/authkit/user). + # @param type [String] The type of the factor to enroll. + # @param totp_issuer [String, nil] Your application or company name displayed in the user's authenticator app. + # @param totp_user [String, nil] The user's account name displayed in their authenticator app. + # @param totp_secret [String, nil] The Base32-encoded shared secret for TOTP factors. This can be provided when creating the auth factor, otherwise it will be generated. The algorithm used to derive TOTP codes is SHA-1, the code length is 6 digits, and the timestep is 30 seconds – the secret must be compatible with these parameters. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::UserAuthenticationFactorEnrollResponse] + def create_user_auth_factor( + userland_user_id:, + type:, + totp_issuer: nil, + totp_user: nil, + totp_secret: nil, + request_options: {} + ) + body = { + "type" => type, + "totp_issuer" => totp_issuer, + "totp_user" => totp_user, + "totp_secret" => totp_secret + }.compact + response = @client.request(method: :post, path: "/user_management/users/#{WorkOS::Util.encode_path(userland_user_id)}/auth_factors", auth: true, body: body, request_options: request_options) + WorkOS::UserAuthenticationFactorEnrollResponse.new(response.body) + end + end +end diff --git a/lib/workos/multi_factor_auth/authentication_challenge.rb b/lib/workos/multi_factor_auth/authentication_challenge.rb new file mode 100644 index 00000000..283e52cb --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_challenge.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationChallenge + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + expires_at: :expires_at, + code: :code, + authentication_factor_id: :authentication_factor_id, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :expires_at, + :code, + :authentication_factor_id, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @expires_at = hash[:expires_at] + @code = hash[:code] + @authentication_factor_id = hash[:authentication_factor_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb b/lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb new file mode 100644 index 00000000..61218c28 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationChallengeVerifyResponse + include HashProvider + + HASH_ATTRS = { + challenge: :challenge, + valid: :valid + }.freeze + + attr_accessor \ + :challenge, + :valid + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @challenge = hash[:challenge] ? WorkOS::AuthenticationChallenge.new(hash[:challenge]) : nil + @valid = hash[:valid] + end + end +end diff --git a/lib/workos/multi_factor_auth/authentication_challenges_verify_request.rb b/lib/workos/multi_factor_auth/authentication_challenges_verify_request.rb new file mode 100644 index 00000000..63bd5209 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_challenges_verify_request.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationChallengesVerifyRequest + include HashProvider + + HASH_ATTRS = { + code: :code + }.freeze + + attr_accessor :code + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @code = hash[:code] + end + end +end diff --git a/lib/workos/multi_factor_auth/authentication_factor.rb b/lib/workos/multi_factor_auth/authentication_factor.rb new file mode 100644 index 00000000..55199012 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factor.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationFactor + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + type: :type, + user_id: :user_id, + sms: :sms, + totp: :totp, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :type, + :user_id, + :sms, + :totp, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @type = hash[:type] + @user_id = hash[:user_id] + @sms = hash[:sms] ? WorkOS::AuthenticationFactorSms.new(hash[:sms]) : nil + @totp = hash[:totp] ? WorkOS::AuthenticationFactorTotp.new(hash[:totp]) : nil + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/multi_factor_auth/authentication_factor_enrolled.rb b/lib/workos/multi_factor_auth/authentication_factor_enrolled.rb new file mode 100644 index 00000000..06f65a8a --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factor_enrolled.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationFactorEnrolled + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + type: :type, + user_id: :user_id, + sms: :sms, + totp: :totp, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :type, + :user_id, + :sms, + :totp, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @type = hash[:type] + @user_id = hash[:user_id] + @sms = hash[:sms] ? WorkOS::AuthenticationFactorEnrolledSms.new(hash[:sms]) : nil + @totp = hash[:totp] ? WorkOS::AuthenticationFactorEnrolledTotp.new(hash[:totp]) : nil + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/multi_factor_auth/authentication_factor_enrolled_sms.rb b/lib/workos/multi_factor_auth/authentication_factor_enrolled_sms.rb new file mode 100644 index 00000000..e1e935de --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factor_enrolled_sms.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationFactorEnrolledSms + include HashProvider + + HASH_ATTRS = { + phone_number: :phone_number + }.freeze + + attr_accessor :phone_number + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @phone_number = hash[:phone_number] + end + end +end diff --git a/lib/workos/multi_factor_auth/authentication_factor_enrolled_totp.rb b/lib/workos/multi_factor_auth/authentication_factor_enrolled_totp.rb new file mode 100644 index 00000000..cd5fe39e --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factor_enrolled_totp.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationFactorEnrolledTotp + include HashProvider + + HASH_ATTRS = { + issuer: :issuer, + user: :user, + secret: :secret, + qr_code: :qr_code, + uri: :uri + }.freeze + + attr_accessor \ + :issuer, + :user, + :secret, + :qr_code, + :uri + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @issuer = hash[:issuer] + @user = hash[:user] + @secret = hash[:secret] + @qr_code = hash[:qr_code] + @uri = hash[:uri] + end + end +end diff --git a/lib/workos/multi_factor_auth/authentication_factor_sms.rb b/lib/workos/multi_factor_auth/authentication_factor_sms.rb new file mode 100644 index 00000000..5ecbb900 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factor_sms.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuthenticationFactorSms = AuthenticationFactorEnrolledSms +end diff --git a/lib/workos/multi_factor_auth/authentication_factor_totp.rb b/lib/workos/multi_factor_auth/authentication_factor_totp.rb new file mode 100644 index 00000000..2ba358ea --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factor_totp.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationFactorTotp + include HashProvider + + HASH_ATTRS = { + issuer: :issuer, + user: :user + }.freeze + + attr_accessor \ + :issuer, + :user + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @issuer = hash[:issuer] + @user = hash[:user] + end + end +end diff --git a/lib/workos/multi_factor_auth/authentication_factors_create_request.rb b/lib/workos/multi_factor_auth/authentication_factors_create_request.rb new file mode 100644 index 00000000..1a268384 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factors_create_request.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationFactorsCreateRequest + include HashProvider + + HASH_ATTRS = { + type: :type, + phone_number: :phone_number, + totp_issuer: :totp_issuer, + totp_user: :totp_user, + user_id: :user_id + }.freeze + + attr_accessor \ + :type, + :phone_number, + :totp_issuer, + :totp_user, + :user_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @phone_number = hash[:phone_number] + @totp_issuer = hash[:totp_issuer] + @totp_user = hash[:totp_user] + @user_id = hash[:user_id] + end + end +end diff --git a/lib/workos/multi_factor_auth/challenge_authentication_factor.rb b/lib/workos/multi_factor_auth/challenge_authentication_factor.rb new file mode 100644 index 00000000..f075460a --- /dev/null +++ b/lib/workos/multi_factor_auth/challenge_authentication_factor.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ChallengeAuthenticationFactor + include HashProvider + + HASH_ATTRS = { + sms_template: :sms_template + }.freeze + + attr_accessor :sms_template + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @sms_template = hash[:sms_template] + end + end +end diff --git a/lib/workos/multi_factor_auth/enroll_user_authentication_factor.rb b/lib/workos/multi_factor_auth/enroll_user_authentication_factor.rb new file mode 100644 index 00000000..98fb5c64 --- /dev/null +++ b/lib/workos/multi_factor_auth/enroll_user_authentication_factor.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EnrollUserAuthenticationFactor + include HashProvider + + HASH_ATTRS = { + type: :type, + totp_issuer: :totp_issuer, + totp_user: :totp_user, + totp_secret: :totp_secret + }.freeze + + attr_accessor \ + :type, + :totp_issuer, + :totp_user, + :totp_secret + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @totp_issuer = hash[:totp_issuer] + @totp_user = hash[:totp_user] + @totp_secret = hash[:totp_secret] + end + end +end diff --git a/lib/workos/multi_factor_auth/user_authentication_factor_enroll_response.rb b/lib/workos/multi_factor_auth/user_authentication_factor_enroll_response.rb new file mode 100644 index 00000000..8b62dee6 --- /dev/null +++ b/lib/workos/multi_factor_auth/user_authentication_factor_enroll_response.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserAuthenticationFactorEnrollResponse + include HashProvider + + HASH_ATTRS = { + authentication_factor: :authentication_factor, + authentication_challenge: :authentication_challenge + }.freeze + + attr_accessor \ + :authentication_factor, + :authentication_challenge + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @authentication_factor = hash[:authentication_factor] ? WorkOS::AuthenticationFactorEnrolled.new(hash[:authentication_factor]) : nil + @authentication_challenge = hash[:authentication_challenge] ? WorkOS::AuthenticationChallenge.new(hash[:authentication_challenge]) : nil + end + end +end diff --git a/lib/workos/oauth_tokens.rb b/lib/workos/oauth_tokens.rb deleted file mode 100644 index 9456d38f..00000000 --- a/lib/workos/oauth_tokens.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The OAuthTokens class represents the third party provider OAuth tokens returned in the authentication response. - # This class is not meant to be instantiated in user space, and is instantiated internally but exposed. - class OAuthTokens - include HashProvider - - attr_accessor :access_token, :refresh_token, :scopes, :expires_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @access_token = hash[:access_token] - @refresh_token = hash[:refresh_token] - @scopes = hash[:scopes] - @expires_at = hash[:expires_at] - end - - def to_json(*) - { - access_token: access_token, - refresh_token: refresh_token, - scopes: scopes, - expires_at: expires_at - } - end - end -end diff --git a/lib/workos/organization.rb b/lib/workos/organization.rb deleted file mode 100644 index 8c88fdaa..00000000 --- a/lib/workos/organization.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The Organization class provides a lightweight wrapper around - # a WorkOS Organization resource. This class is not meant to be instantiated - # in user space, and is instantiated internally but exposed. - class Organization - include HashProvider - - attr_accessor( - :id, - :domains, - :stripe_customer_id, - :name, - :external_id, - :allow_profiles_outside_organization, - :created_at, - :updated_at - ) - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @name = hash[:name] - @external_id = hash[:external_id] - @allow_profiles_outside_organization = hash[:allow_profiles_outside_organization] - @domains = hash[:domains] - @stripe_customer_id = hash[:stripe_customer_id] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - - def to_json(*) - { - id: id, - name: name, - external_id: external_id, - allow_profiles_outside_organization: allow_profiles_outside_organization, - domains: domains, - stripe_customer_id: stripe_customer_id, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/organization_domains.rb b/lib/workos/organization_domains.rb new file mode 100644 index 00000000..1f5d1273 --- /dev/null +++ b/lib/workos/organization_domains.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomains + def initialize(client) + @client = client + end + + # Create an Organization Domain + # @param domain [String] The domain to add to the organization. + # @param organization_id [String] The ID of the organization to add the domain to. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::OrganizationDomain] + def create_organization_domain( + domain:, + organization_id:, + request_options: {} + ) + body = { + "domain" => domain, + "organization_id" => organization_id + }.compact + response = @client.request(method: :post, path: "/organization_domains", auth: true, body: body, request_options: request_options) + WorkOS::OrganizationDomain.new(response.body) + end + + # Get an Organization Domain + # @param id [String] Unique identifier of the organization domain. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::OrganizationDomainStandAlone] + def get_organization_domain( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/organization_domains/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::OrganizationDomainStandAlone.new(response.body) + end + + # Delete an Organization Domain + # @param id [String] Unique identifier of the organization domain. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_organization_domain( + id:, + request_options: {} + ) + @client.request(method: :delete, path: "/organization_domains/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + nil + end + + # Verify an Organization Domain + # @param id [String] Unique identifier of the organization domain. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::OrganizationDomainStandAlone] + def verify_organization_domain( + id:, + request_options: {} + ) + response = @client.request(method: :post, path: "/organization_domains/#{WorkOS::Util.encode_path(id)}/verify", auth: true, request_options: request_options) + WorkOS::OrganizationDomainStandAlone.new(response.body) + end + end +end diff --git a/lib/workos/organization_domains/create_organization_domain.rb b/lib/workos/organization_domains/create_organization_domain.rb new file mode 100644 index 00000000..114a7bdf --- /dev/null +++ b/lib/workos/organization_domains/create_organization_domain.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateOrganizationDomain + include HashProvider + + HASH_ATTRS = { + domain: :domain, + organization_id: :organization_id + }.freeze + + attr_accessor \ + :domain, + :organization_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @domain = hash[:domain] + @organization_id = hash[:organization_id] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain.rb b/lib/workos/organization_domains/organization_domain.rb new file mode 100644 index 00000000..de072ab7 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomain + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + domain: :domain, + state: :state, + verification_prefix: :verification_prefix, + verification_token: :verification_token, + verification_strategy: :verification_strategy, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :domain, + :state, + :verification_prefix, + :verification_token, + :verification_strategy, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @domain = hash[:domain] + @state = hash[:state] + @verification_prefix = hash[:verification_prefix] + @verification_token = hash[:verification_token] + @verification_strategy = hash[:verification_strategy] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_created.rb b/lib/workos/organization_domains/organization_domain_created.rb new file mode 100644 index 00000000..bb5a2574 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationDomainCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_created_data.rb b/lib/workos/organization_domains/organization_domain_created_data.rb new file mode 100644 index 00000000..238ee3da --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_created_data.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + domain: :domain, + state: :state, + verification_prefix: :verification_prefix, + verification_token: :verification_token, + verification_strategy: :verification_strategy, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :domain, + :state, + :verification_prefix, + :verification_token, + :verification_strategy, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @domain = hash[:domain] + @state = hash[:state] + @verification_prefix = hash[:verification_prefix] + @verification_token = hash[:verification_token] + @verification_strategy = hash[:verification_strategy] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_deleted.rb b/lib/workos/organization_domains/organization_domain_deleted.rb new file mode 100644 index 00000000..d8a330d6 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationDomainDeletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_deleted_data.rb b/lib/workos/organization_domains/organization_domain_deleted_data.rb new file mode 100644 index 00000000..131680b1 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_deleted_data.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainDeletedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + domain: :domain, + state: :state, + verification_prefix: :verification_prefix, + verification_token: :verification_token, + verification_strategy: :verification_strategy, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :domain, + :state, + :verification_prefix, + :verification_token, + :verification_strategy, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @domain = hash[:domain] + @state = hash[:state] + @verification_prefix = hash[:verification_prefix] + @verification_token = hash[:verification_token] + @verification_strategy = hash[:verification_strategy] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_stand_alone.rb b/lib/workos/organization_domains/organization_domain_stand_alone.rb new file mode 100644 index 00000000..21cee0f4 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_stand_alone.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainStandAlone + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + domain: :domain, + state: :state, + verification_prefix: :verification_prefix, + verification_token: :verification_token, + verification_strategy: :verification_strategy, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :domain, + :state, + :verification_prefix, + :verification_token, + :verification_strategy, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @domain = hash[:domain] + @state = hash[:state] + @verification_prefix = hash[:verification_prefix] + @verification_token = hash[:verification_token] + @verification_strategy = hash[:verification_strategy] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_updated.rb b/lib/workos/organization_domains/organization_domain_updated.rb new file mode 100644 index 00000000..bd881fe6 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationDomainUpdatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_updated_data.rb b/lib/workos/organization_domains/organization_domain_updated_data.rb new file mode 100644 index 00000000..20d2e24a --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_updated_data.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainUpdatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + domain: :domain, + state: :state, + verification_prefix: :verification_prefix, + verification_token: :verification_token, + verification_strategy: :verification_strategy, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :domain, + :state, + :verification_prefix, + :verification_token, + :verification_strategy, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @domain = hash[:domain] + @state = hash[:state] + @verification_prefix = hash[:verification_prefix] + @verification_token = hash[:verification_token] + @verification_strategy = hash[:verification_strategy] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_verification_failed.rb b/lib/workos/organization_domains/organization_domain_verification_failed.rb new file mode 100644 index 00000000..c04d6690 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_verification_failed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainVerificationFailed + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationDomainVerificationFailedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_verification_failed_data.rb b/lib/workos/organization_domains/organization_domain_verification_failed_data.rb new file mode 100644 index 00000000..75a606a0 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_verification_failed_data.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainVerificationFailedData + include HashProvider + + HASH_ATTRS = { + reason: :reason, + organization_domain: :organization_domain + }.freeze + + attr_accessor \ + :reason, + :organization_domain + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @reason = hash[:reason] + @organization_domain = hash[:organization_domain] ? WorkOS::OrganizationDomainVerificationFailedDataOrganizationDomain.new(hash[:organization_domain]) : nil + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_verification_failed_data_organization_domain.rb b/lib/workos/organization_domains/organization_domain_verification_failed_data_organization_domain.rb new file mode 100644 index 00000000..68bea7d4 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_verification_failed_data_organization_domain.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainVerificationFailedDataOrganizationDomain + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + domain: :domain, + state: :state, + verification_prefix: :verification_prefix, + verification_token: :verification_token, + verification_strategy: :verification_strategy, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :domain, + :state, + :verification_prefix, + :verification_token, + :verification_strategy, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @domain = hash[:domain] + @state = hash[:state] + @verification_prefix = hash[:verification_prefix] + @verification_token = hash[:verification_token] + @verification_strategy = hash[:verification_strategy] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_verified.rb b/lib/workos/organization_domains/organization_domain_verified.rb new file mode 100644 index 00000000..ea15514b --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_verified.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainVerified + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationDomainVerifiedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organization_domains/organization_domain_verified_data.rb b/lib/workos/organization_domains/organization_domain_verified_data.rb new file mode 100644 index 00000000..46ef4071 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_verified_data.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainVerifiedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + domain: :domain, + state: :state, + verification_prefix: :verification_prefix, + verification_token: :verification_token, + verification_strategy: :verification_strategy, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :domain, + :state, + :verification_prefix, + :verification_token, + :verification_strategy, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @domain = hash[:domain] + @state = hash[:state] + @verification_prefix = hash[:verification_prefix] + @verification_token = hash[:verification_token] + @verification_strategy = hash[:verification_strategy] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organization_membership.rb b/lib/workos/organization_membership.rb deleted file mode 100644 index 18a51ea3..00000000 --- a/lib/workos/organization_membership.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The OrganizationMembership class provides a lightweight wrapper around a WorkOS OrganizationMembership - # resource. This class is not meant to be instantiated in a user space, - # and is instantiated internally but exposed. - class OrganizationMembership - include HashProvider - - attr_accessor :id, :user_id, :organization_id, :status, :role, :roles, :custom_attributes, :directory_managed, - :created_at, :updated_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @user_id = hash[:user_id] - @organization_id = hash[:organization_id] - @status = hash[:status] - @role = hash[:role] - @roles = hash[:roles] - @custom_attributes = hash[:custom_attributes] - @directory_managed = hash[:directory_managed] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - - def to_json(*) - { - id: id, - user_id: user_id, - organization_id: organization_id, - status: status, - role: role, - roles: roles, - custom_attributes: custom_attributes, - directory_managed: directory_managed, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index d7bc14c4..23be696b 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -1,287 +1,180 @@ # frozen_string_literal: true -require "net/http" +# This file is auto-generated by oagen. Do not edit. -module WorkOS - # The Organizations module provides resource methods for working with Organizations - module Organizations - class << self - include Client - include Deprecation - - # Retrieve a list of organizations that have connections configured - # within your WorkOS dashboard. - # - # @param [Array] domains Filter organizations to only return those - # that are associated with the provided domains. - # @param [String] before A pagination argument used to request - # organizations before the provided Organization ID. - # @param [String] after A pagination argument used to request - # organizations after the provided Organization ID. - # @param [Integer] limit A pagination argument used to limit the number - # @param [String] order The order in which to paginate records - # of listed Organizations that are returned. - def list_organizations(options = {}) - options[:order] ||= "desc" - response = execute_request( - request: get_request( - path: "/organizations", - auth: true, - params: options - ) - ) - - parsed_response = JSON.parse(response.body) - - organizations = parsed_response["data"].map do |organization| - ::WorkOS::Organization.new(organization.to_json) - end - - WorkOS::Types::ListStruct.new( - data: organizations, - list_metadata: parsed_response["listMetadata"] - ) - end - - # Get an Organization - # - # @param [String] id Organization unique identifier - # - # @example - # WorkOS::Portal.get_organization(id: 'org_02DRA1XNSJDZ19A31F183ECQW9') - # => #"organization_domain", - # :id=>"org_domain_01E6PK9N3XMD8RHWF7S66380AR", - # :domain=>"foo-corp.com"}]> - # - # @return [WorkOS::Organization] - def get_organization(id:) - request = get_request( - auth: true, - path: "/organizations/#{id}" - ) - - response = execute_request(request: request) - - WorkOS::Organization.new(response.body) - end - - # Create an organization - # - # @param [Array] domain_data List of domain hashes describing an organization domain. - # @option domain_data [String] domain The domain that belongs to the organization. - # @option domain_data [String] state The state of the domain. "verified" or "pending" - # @param [String] name A unique, descriptive name for the organization - # @param [String] external_id The organization's external ID. - # @param [String] idempotency_key An idempotency key - # @param [Boolean, nil] allow_profiles_outside_organization Whether Connections - # within the Organization allow profiles that are outside of the Organization's configured User Email Domains. - # Deprecated: If you need to allow sign-ins from any email domain, contact suppport@workos.com. - # @param [Array] domains List of domains that belong to the organization. - # Deprecated: Use domain_data instead. - def create_organization( - name:, domain_data: nil, - domains: nil, - external_id: nil, - allow_profiles_outside_organization: nil, - idempotency_key: nil - ) - body = {name: name} - body[:domain_data] = domain_data if domain_data - body[:external_id] = external_id if external_id - - if domains - warn_deprecation "`domains` is deprecated. Use `domain_data` instead." - body[:domains] = domains - end - - unless allow_profiles_outside_organization.nil? - warn_deprecation "`allow_profiles_outside_organization` is deprecated. " \ - "If you need to allow sign-ins from any email domain, contact support@workos.com." - body[:allow_profiles_outside_organization] = allow_profiles_outside_organization - end - - request = post_request( - auth: true, - body: body, - path: "/organizations", - idempotency_key: idempotency_key - ) - - response = execute_request(request: request) - check_and_raise_organization_error(response: response) - - WorkOS::Organization.new(response.body) - end - - # Update an organization - # - # @param [String] organization Organization unique identifier - # @param [Array] domain_data List of domain hashes describing an organization domain. - # @option domain_data [String] domain The domain that belongs to the organization. - # @option domain_data [String] state The state of the domain. "verified" or "pending" - # @param [String] stripe_customer_id The Stripe customer ID associated with this organization. - # @param [String] name A unique, descriptive name for the organization - # @param [String] external_id The organization's external ID. - # @param [Boolean, nil] allow_profiles_outside_organization Whether Connections - # within the Organization allow profiles that are outside of the Organization's configured User Email Domains. - # Deprecated: If you need to allow sign-ins from any email domain, contact suppport@workos.com. - # @param [Array] domains List of domains that belong to the organization. - # Deprecated: Use domain_data instead. - # rubocop:disable Metrics/ParameterLists - def update_organization( - organization:, - stripe_customer_id: nil, - domain_data: nil, - domains: nil, - name: nil, - external_id: :not_set, - allow_profiles_outside_organization: nil - ) - body = {name: name} - body[:domain_data] = domain_data if domain_data - body[:stripe_customer_id] = stripe_customer_id if stripe_customer_id - body[:external_id] = external_id if external_id != :not_set - - if domains - warn_deprecation "`domains` is deprecated. Use `domain_data` instead." - body[:domains] = domains - end - - unless allow_profiles_outside_organization.nil? - warn_deprecation "`allow_profiles_outside_organization` is deprecated. " \ - "If you need to allow sign-ins from any email domain, contact support@workos.com." - body[:allow_profiles_outside_organization] = allow_profiles_outside_organization - end - - request = put_request( - auth: true, - body: body, - path: "/organizations/#{organization}" - ) - - response = execute_request(request: request) - check_and_raise_organization_error(response: response) - - WorkOS::Organization.new(response.body) - end - # rubocop:enable Metrics/ParameterLists - - # Delete an Organization - # - # @param [String] id Organization unique identifier - # - # @example - # WorkOS::SSO.delete_organization(id: 'org_01EHZNVPK3SFK441A1RGBFSHRT') - # => true - # - # @return [Bool] - returns `true` if successful - def delete_organization(id:) - request = delete_request( - auth: true, - path: "/organizations/#{id}" - ) - - response = execute_request(request: request) +require "json" - response.is_a? Net::HTTPSuccess - end +module WorkOS + class Organizations + def initialize(client) + @client = client + end - # Retrieve a list of roles for the given organization. - # - # @param [String] organization_id The ID of the organization to fetch roles for. - # - # @example - # WorkOS::Organizations.list_organization_roles(organization_id: 'org_01EHZNVPK3SFK441A1RGBFSHRT') - # => #] ...> - # - # @return [WorkOS::Types::ListStruct] - Collection of Role objects, each including permissions array - def list_organization_roles(organization_id:) - response = execute_request( - request: get_request( - path: "/organizations/#{organization_id}/roles", - auth: true + # List Organizations + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::OrganizationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param domains [Array, nil] The domains of an Organization. Any Organization with a matching domain will be returned. + # @param search [String, nil] Searchable text for an Organization. Matches against the organization name. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_organizations( + before: nil, + after: nil, + limit: nil, + order: nil, + domains: nil, + search: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "domains" => domains, + "search" => search + }.compact + response = @client.request(method: :get, path: "/organizations", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::Organization, filters: {before: before, limit: limit, order: order, domains: domains, search: search}, + fetch_next: lambda do |cursor| + list_organizations( + before: before, + after: cursor, + limit: limit, + order: order, + domains: domains, + search: search, + request_options: request_options ) - ) - - parsed_response = JSON.parse(response.body) - - roles = parsed_response["data"].map do |role| - WorkOS::Role.new(role.to_json) - end - - WorkOS::Types::ListStruct.new( - data: roles, - list_metadata: { + end, + fetch_previous: lambda do |cursor| + list_organizations( + before: cursor, after: nil, - before: nil - } - ) - end - - # Retrieve a list of feature flags for the given organization. - # - # @param [String] organization_id The ID of the organization to fetch feature flags for. - # @param [Hash] options - # @option options [String] before A pagination argument used to request - # feature flags before the provided FeatureFlag ID. - # @option options [String] after A pagination argument used to request - # feature flags after the provided FeatureFlag ID. - # @option options [Integer] limit A pagination argument used to limit the number - # of listed FeatureFlags that are returned. - # @option options [String] order The order in which to paginate records - # - # @example - # WorkOS::Organizations.list_organization_feature_flags(organization_id: 'org_01EHZNVPK3SFK441A1RGBFSHRT') - # => #] ...> - # - # @return [WorkOS::Types::ListStruct] - Collection of FeatureFlag objects - def list_organization_feature_flags(organization_id:, options: {}) - options[:order] ||= "desc" - response = execute_request( - request: get_request( - path: "/organizations/#{organization_id}/feature-flags", - auth: true, - params: options + limit: limit, + order: order, + domains: domains, + search: search, + request_options: request_options ) - ) - - parsed_response = JSON.parse(response.body) - - feature_flags = parsed_response["data"].map do |feature_flag| - WorkOS::FeatureFlag.new(feature_flag.to_json) end + ) + end + + # Create an Organization + # @param name [String] The name of the organization. + # @param allow_profiles_outside_organization [Boolean, nil] Whether the organization allows profiles from outside the organization to sign in. + # @param domains [Array, nil] The domains associated with the organization. Deprecated in favor of `domain_data`. + # @param domain_data [Array, nil] The domains associated with the organization, including verification state. + # @param metadata [Hash{String => String}, nil] Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization. + # @param external_id [String, nil] An external identifier for the Organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Organization] + def create_organization( + name:, + allow_profiles_outside_organization: nil, + domains: nil, + domain_data: nil, + metadata: nil, + external_id: nil, + request_options: {} + ) + body = { + "name" => name, + "allow_profiles_outside_organization" => allow_profiles_outside_organization, + "domains" => domains, + "domain_data" => domain_data, + "metadata" => metadata, + "external_id" => external_id + }.compact + response = @client.request(method: :post, path: "/organizations", auth: true, body: body, request_options: request_options) + WorkOS::Organization.new(response.body) + end - WorkOS::Types::ListStruct.new( - data: feature_flags, - list_metadata: parsed_response["list_metadata"]&.transform_keys(&:to_sym) - ) - end + # Get an Organization by External ID + # @param external_id [String] The external ID of the Organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Organization] + def get_organization_by_external_id( + external_id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/organizations/external_id/#{WorkOS::Util.encode_path(external_id)}", auth: true, request_options: request_options) + WorkOS::Organization.new(response.body) + end - private + # Get an Organization + # @param id [String] Unique identifier of the Organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Organization] + def get_organization( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/organizations/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::Organization.new(response.body) + end - def check_and_raise_organization_error(response:) - begin - body = JSON.parse(response.body) - return unless body["message"] + # Update an Organization + # @param id [String] Unique identifier of the Organization. + # @param name [String, nil] The name of the organization. + # @param allow_profiles_outside_organization [Boolean, nil] Whether the organization allows profiles from outside the organization to sign in. + # @param domains [Array, nil] (deprecated) The domains associated with the organization. Deprecated in favor of `domain_data`. + # @param domain_data [Array, nil] The domains associated with the organization, including verification state. + # @param stripe_customer_id [String, nil] The Stripe customer ID associated with the organization. + # @param metadata [Hash{String => String}, nil] Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization. + # @param external_id [String, nil] An external identifier for the Organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Organization] + def update_organization( + id:, + name: nil, + allow_profiles_outside_organization: nil, + domains: nil, + domain_data: nil, + stripe_customer_id: nil, + metadata: nil, + external_id: nil, + request_options: {} + ) + body = { + "name" => name, + "allow_profiles_outside_organization" => allow_profiles_outside_organization, + "domains" => domains, + "domain_data" => domain_data, + "stripe_customer_id" => stripe_customer_id, + "metadata" => metadata, + "external_id" => external_id + }.compact + response = @client.request(method: :put, path: "/organizations/#{WorkOS::Util.encode_path(id)}", auth: true, body: body, request_options: request_options) + WorkOS::Organization.new(response.body) + end - message = body["message"] - request_id = response["x-request-id"] - rescue - message = "Something went wrong" - end + # Delete an Organization + # @param id [String] Unique identifier of the Organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_organization( + id:, + request_options: {} + ) + @client.request(method: :delete, path: "/organizations/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + nil + end - raise APIError.new( - message: message, - http_status: nil, - request_id: request_id - ) - end + # Get Audit Log Configuration + # @param id [String] Unique identifier of the Organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuditLogConfiguration] + def get_audit_log_configuration( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/organizations/#{WorkOS::Util.encode_path(id)}/audit_log_configuration", auth: true, request_options: request_options) + WorkOS::AuditLogConfiguration.new(response.body) end end end diff --git a/lib/workos/organizations/audit_log_configuration.rb b/lib/workos/organizations/audit_log_configuration.rb new file mode 100644 index 00000000..05013d13 --- /dev/null +++ b/lib/workos/organizations/audit_log_configuration.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogConfiguration + include HashProvider + + HASH_ATTRS = { + organization_id: :organization_id, + retention_period_in_days: :retention_period_in_days, + state: :state, + log_stream: :log_stream + }.freeze + + attr_accessor \ + :organization_id, + :retention_period_in_days, + :state, + :log_stream + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @organization_id = hash[:organization_id] + @retention_period_in_days = hash[:retention_period_in_days] + @state = hash[:state] + @log_stream = hash[:log_stream] ? WorkOS::AuditLogConfigurationLogStream.new(hash[:log_stream]) : nil + end + end +end diff --git a/lib/workos/organizations/audit_log_configuration_log_stream.rb b/lib/workos/organizations/audit_log_configuration_log_stream.rb new file mode 100644 index 00000000..bea1b609 --- /dev/null +++ b/lib/workos/organizations/audit_log_configuration_log_stream.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogConfigurationLogStream + include HashProvider + + HASH_ATTRS = { + id: :id, + type: :type, + state: :state, + last_synced_at: :last_synced_at, + created_at: :created_at + }.freeze + + attr_accessor \ + :id, + :type, + :state, + :last_synced_at, + :created_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @type = hash[:type] + @state = hash[:state] + @last_synced_at = hash[:last_synced_at] + @created_at = hash[:created_at] + end + end +end diff --git a/lib/workos/organizations/audit_logs_retention.rb b/lib/workos/organizations/audit_logs_retention.rb new file mode 100644 index 00000000..c7fe1ab2 --- /dev/null +++ b/lib/workos/organizations/audit_logs_retention.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogsRetention + include HashProvider + + HASH_ATTRS = { + retention_period_in_days: :retention_period_in_days + }.freeze + + attr_accessor :retention_period_in_days + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @retention_period_in_days = hash[:retention_period_in_days] + end + end +end diff --git a/lib/workos/organizations/organization.rb b/lib/workos/organizations/organization.rb new file mode 100644 index 00000000..25920000 --- /dev/null +++ b/lib/workos/organizations/organization.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Organization + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + name: :name, + domains: :domains, + metadata: :metadata, + external_id: :external_id, + stripe_customer_id: :stripe_customer_id, + created_at: :created_at, + updated_at: :updated_at, + allow_profiles_outside_organization: :allow_profiles_outside_organization + }.freeze + + # @!attribute allow_profiles_outside_organization + # @deprecated Whether the Organization allows profiles outside of its managed domains. + + attr_accessor \ + :object, + :id, + :name, + :domains, + :metadata, + :external_id, + :stripe_customer_id, + :created_at, + :updated_at + + def allow_profiles_outside_organization + warn "[DEPRECATION] `allow_profiles_outside_organization` is deprecated. Whether the Organization allows profiles outside of its managed domains.", uplevel: 1, category: :deprecated + @allow_profiles_outside_organization + end + + attr_writer :allow_profiles_outside_organization + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @name = hash[:name] + @domains = (hash[:domains] || []).map { |item| item ? WorkOS::OrganizationDomain.new(item) : nil } + @metadata = hash[:metadata] || {} + @external_id = hash[:external_id] + @stripe_customer_id = hash[:stripe_customer_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @allow_profiles_outside_organization = hash[:allow_profiles_outside_organization] + end + end +end diff --git a/lib/workos/organizations/organization_created.rb b/lib/workos/organizations/organization_created.rb new file mode 100644 index 00000000..98b6d47e --- /dev/null +++ b/lib/workos/organizations/organization_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organizations/organization_created_data.rb b/lib/workos/organizations/organization_created_data.rb new file mode 100644 index 00000000..a629e068 --- /dev/null +++ b/lib/workos/organizations/organization_created_data.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + name: :name, + domains: :domains, + metadata: :metadata, + external_id: :external_id, + stripe_customer_id: :stripe_customer_id, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :name, + :domains, + :metadata, + :external_id, + :stripe_customer_id, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @name = hash[:name] + @domains = (hash[:domains] || []).map { |item| item ? WorkOS::OrganizationCreatedDataDomain.new(item) : nil } + @metadata = hash[:metadata] || {} + @external_id = hash[:external_id] + @stripe_customer_id = hash[:stripe_customer_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organizations/organization_created_data_domain.rb b/lib/workos/organizations/organization_created_data_domain.rb new file mode 100644 index 00000000..7e46a2a3 --- /dev/null +++ b/lib/workos/organizations/organization_created_data_domain.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationCreatedDataDomain + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + domain: :domain, + state: :state, + verification_prefix: :verification_prefix, + verification_token: :verification_token, + verification_strategy: :verification_strategy, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :domain, + :state, + :verification_prefix, + :verification_token, + :verification_strategy, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @domain = hash[:domain] + @state = hash[:state] + @verification_prefix = hash[:verification_prefix] + @verification_token = hash[:verification_token] + @verification_strategy = hash[:verification_strategy] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organizations/organization_deleted.rb b/lib/workos/organizations/organization_deleted.rb new file mode 100644 index 00000000..9e16e031 --- /dev/null +++ b/lib/workos/organizations/organization_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationDeletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organizations/organization_deleted_data.rb b/lib/workos/organizations/organization_deleted_data.rb new file mode 100644 index 00000000..44a22980 --- /dev/null +++ b/lib/workos/organizations/organization_deleted_data.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDeletedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + name: :name, + domains: :domains, + metadata: :metadata, + external_id: :external_id, + stripe_customer_id: :stripe_customer_id, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :name, + :domains, + :metadata, + :external_id, + :stripe_customer_id, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @name = hash[:name] + @domains = (hash[:domains] || []).map { |item| item ? WorkOS::OrganizationDeletedDataDomain.new(item) : nil } + @metadata = hash[:metadata] || {} + @external_id = hash[:external_id] + @stripe_customer_id = hash[:stripe_customer_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organizations/organization_deleted_data_domain.rb b/lib/workos/organizations/organization_deleted_data_domain.rb new file mode 100644 index 00000000..0427bf95 --- /dev/null +++ b/lib/workos/organizations/organization_deleted_data_domain.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDeletedDataDomain + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + domain: :domain, + state: :state, + verification_prefix: :verification_prefix, + verification_token: :verification_token, + verification_strategy: :verification_strategy, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :domain, + :state, + :verification_prefix, + :verification_token, + :verification_strategy, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @domain = hash[:domain] + @state = hash[:state] + @verification_prefix = hash[:verification_prefix] + @verification_token = hash[:verification_token] + @verification_strategy = hash[:verification_strategy] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organizations/organization_domain_data.rb b/lib/workos/organizations/organization_domain_data.rb new file mode 100644 index 00000000..2f7f7ddc --- /dev/null +++ b/lib/workos/organizations/organization_domain_data.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationDomainData + include HashProvider + + HASH_ATTRS = { + domain: :domain, + state: :state + }.freeze + + attr_accessor \ + :domain, + :state + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @domain = hash[:domain] + @state = hash[:state] + end + end +end diff --git a/lib/workos/organizations/organization_input.rb b/lib/workos/organizations/organization_input.rb new file mode 100644 index 00000000..837d47d4 --- /dev/null +++ b/lib/workos/organizations/organization_input.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationInput + include HashProvider + + HASH_ATTRS = { + name: :name, + allow_profiles_outside_organization: :allow_profiles_outside_organization, + domains: :domains, + domain_data: :domain_data, + metadata: :metadata, + external_id: :external_id + }.freeze + + attr_accessor \ + :name, + :allow_profiles_outside_organization, + :domains, + :domain_data, + :metadata, + :external_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @name = hash[:name] + @allow_profiles_outside_organization = hash[:allow_profiles_outside_organization] + @domains = hash[:domains] || [] + @domain_data = (hash[:domain_data] || []).map { |item| item ? WorkOS::OrganizationDomainData.new(item) : nil } + @metadata = hash[:metadata] || {} + @external_id = hash[:external_id] + end + end +end diff --git a/lib/workos/organizations/organization_membership_created.rb b/lib/workos/organizations/organization_membership_created.rb new file mode 100644 index 00000000..3e11e16f --- /dev/null +++ b/lib/workos/organizations/organization_membership_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationMembershipCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationMembershipCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organizations/organization_membership_created_data.rb b/lib/workos/organizations/organization_membership_created_data.rb new file mode 100644 index 00000000..886ec4f6 --- /dev/null +++ b/lib/workos/organizations/organization_membership_created_data.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationMembershipCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + organization_id: :organization_id, + status: :status, + role: :role, + roles: :roles, + custom_attributes: :custom_attributes, + directory_managed: :directory_managed, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :organization_id, + :status, + :role, + :roles, + :custom_attributes, + :directory_managed, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + @status = hash[:status] + @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @roles = (hash[:roles] || []).map { |item| item ? WorkOS::SlimRole.new(item) : nil } + @custom_attributes = hash[:custom_attributes] || {} + @directory_managed = hash[:directory_managed] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organizations/organization_membership_deleted.rb b/lib/workos/organizations/organization_membership_deleted.rb new file mode 100644 index 00000000..2e213464 --- /dev/null +++ b/lib/workos/organizations/organization_membership_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationMembershipDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationMembershipDeletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organizations/organization_membership_deleted_data.rb b/lib/workos/organizations/organization_membership_deleted_data.rb new file mode 100644 index 00000000..43139089 --- /dev/null +++ b/lib/workos/organizations/organization_membership_deleted_data.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationMembershipDeletedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + organization_id: :organization_id, + status: :status, + role: :role, + roles: :roles, + custom_attributes: :custom_attributes, + directory_managed: :directory_managed, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :organization_id, + :status, + :role, + :roles, + :custom_attributes, + :directory_managed, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + @status = hash[:status] + @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @roles = (hash[:roles] || []).map { |item| item ? WorkOS::SlimRole.new(item) : nil } + @custom_attributes = hash[:custom_attributes] || {} + @directory_managed = hash[:directory_managed] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organizations/organization_membership_updated.rb b/lib/workos/organizations/organization_membership_updated.rb new file mode 100644 index 00000000..765c34fc --- /dev/null +++ b/lib/workos/organizations/organization_membership_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationMembershipUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationMembershipUpdatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organizations/organization_membership_updated_data.rb b/lib/workos/organizations/organization_membership_updated_data.rb new file mode 100644 index 00000000..e2c892a5 --- /dev/null +++ b/lib/workos/organizations/organization_membership_updated_data.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationMembershipUpdatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + organization_id: :organization_id, + status: :status, + role: :role, + roles: :roles, + custom_attributes: :custom_attributes, + directory_managed: :directory_managed, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :organization_id, + :status, + :role, + :roles, + :custom_attributes, + :directory_managed, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + @status = hash[:status] + @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @roles = (hash[:roles] || []).map { |item| item ? WorkOS::SlimRole.new(item) : nil } + @custom_attributes = hash[:custom_attributes] || {} + @directory_managed = hash[:directory_managed] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organizations/organization_role_created.rb b/lib/workos/organizations/organization_role_created.rb new file mode 100644 index 00000000..389af7a3 --- /dev/null +++ b/lib/workos/organizations/organization_role_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationRoleCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationRoleCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organizations/organization_role_created_data.rb b/lib/workos/organizations/organization_role_created_data.rb new file mode 100644 index 00000000..95cd235a --- /dev/null +++ b/lib/workos/organizations/organization_role_created_data.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationRoleCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + organization_id: :organization_id, + slug: :slug, + name: :name, + description: :description, + resource_type_slug: :resource_type_slug, + permissions: :permissions, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :organization_id, + :slug, + :name, + :description, + :resource_type_slug, + :permissions, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @organization_id = hash[:organization_id] + @slug = hash[:slug] + @name = hash[:name] + @description = hash[:description] + @resource_type_slug = hash[:resource_type_slug] + @permissions = hash[:permissions] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organizations/organization_role_deleted.rb b/lib/workos/organizations/organization_role_deleted.rb new file mode 100644 index 00000000..e99ef07f --- /dev/null +++ b/lib/workos/organizations/organization_role_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationRoleDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationRoleDeletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organizations/organization_role_deleted_data.rb b/lib/workos/organizations/organization_role_deleted_data.rb new file mode 100644 index 00000000..d981a609 --- /dev/null +++ b/lib/workos/organizations/organization_role_deleted_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + OrganizationRoleDeletedData = OrganizationRoleCreatedData +end diff --git a/lib/workos/organizations/organization_role_updated.rb b/lib/workos/organizations/organization_role_updated.rb new file mode 100644 index 00000000..2def5043 --- /dev/null +++ b/lib/workos/organizations/organization_role_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationRoleUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationRoleUpdatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organizations/organization_role_updated_data.rb b/lib/workos/organizations/organization_role_updated_data.rb new file mode 100644 index 00000000..e6390838 --- /dev/null +++ b/lib/workos/organizations/organization_role_updated_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + OrganizationRoleUpdatedData = OrganizationRoleCreatedData +end diff --git a/lib/workos/organizations/organization_updated.rb b/lib/workos/organizations/organization_updated.rb new file mode 100644 index 00000000..2fda6553 --- /dev/null +++ b/lib/workos/organizations/organization_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::OrganizationUpdatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/organizations/organization_updated_data.rb b/lib/workos/organizations/organization_updated_data.rb new file mode 100644 index 00000000..afbb97be --- /dev/null +++ b/lib/workos/organizations/organization_updated_data.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationUpdatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + name: :name, + domains: :domains, + metadata: :metadata, + external_id: :external_id, + stripe_customer_id: :stripe_customer_id, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :name, + :domains, + :metadata, + :external_id, + :stripe_customer_id, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @name = hash[:name] + @domains = (hash[:domains] || []).map { |item| item ? WorkOS::OrganizationUpdatedDataDomain.new(item) : nil } + @metadata = hash[:metadata] || {} + @external_id = hash[:external_id] + @stripe_customer_id = hash[:stripe_customer_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organizations/organization_updated_data_domain.rb b/lib/workos/organizations/organization_updated_data_domain.rb new file mode 100644 index 00000000..8a2dbc91 --- /dev/null +++ b/lib/workos/organizations/organization_updated_data_domain.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationUpdatedDataDomain + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + domain: :domain, + state: :state, + verification_prefix: :verification_prefix, + verification_token: :verification_token, + verification_strategy: :verification_strategy, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :domain, + :state, + :verification_prefix, + :verification_token, + :verification_strategy, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @domain = hash[:domain] + @state = hash[:state] + @verification_prefix = hash[:verification_prefix] + @verification_token = hash[:verification_token] + @verification_strategy = hash[:verification_strategy] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/organizations/update_audit_logs_retention.rb b/lib/workos/organizations/update_audit_logs_retention.rb new file mode 100644 index 00000000..41e81009 --- /dev/null +++ b/lib/workos/organizations/update_audit_logs_retention.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UpdateAuditLogsRetention + include HashProvider + + HASH_ATTRS = { + retention_period_in_days: :retention_period_in_days + }.freeze + + attr_accessor :retention_period_in_days + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @retention_period_in_days = hash[:retention_period_in_days] + end + end +end diff --git a/lib/workos/organizations/update_organization.rb b/lib/workos/organizations/update_organization.rb new file mode 100644 index 00000000..fb4d2a61 --- /dev/null +++ b/lib/workos/organizations/update_organization.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UpdateOrganization + include HashProvider + + HASH_ATTRS = { + name: :name, + allow_profiles_outside_organization: :allow_profiles_outside_organization, + domains: :domains, + domain_data: :domain_data, + stripe_customer_id: :stripe_customer_id, + metadata: :metadata, + external_id: :external_id + }.freeze + + # @!attribute domains + # @deprecated The domains associated with the organization. Deprecated in favor of `domain_data`. + + attr_accessor \ + :name, + :allow_profiles_outside_organization, + :domain_data, + :stripe_customer_id, + :metadata, + :external_id + + def domains + warn "[DEPRECATION] `domains` is deprecated. The domains associated with the organization. Deprecated in favor of `domain_data`.", uplevel: 1, category: :deprecated + @domains + end + + attr_writer :domains + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @name = hash[:name] + @allow_profiles_outside_organization = hash[:allow_profiles_outside_organization] + @domains = hash[:domains] || [] + @domain_data = (hash[:domain_data] || []).map { |item| item ? WorkOS::OrganizationDomainData.new(item) : nil } + @stripe_customer_id = hash[:stripe_customer_id] + @metadata = hash[:metadata] || {} + @external_id = hash[:external_id] + end + end +end diff --git a/lib/workos/password_reset.rb b/lib/workos/password_reset.rb deleted file mode 100644 index bff82840..00000000 --- a/lib/workos/password_reset.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The PasswordReset class provides a lightweight wrapper around a WorkOS password - # reset resource. This class is not meant to be instantiated in a user space, - # and is instantiated internally but exposed. - class PasswordReset - include HashProvider - - attr_accessor :id, :user_id, :email, :password_reset_token, - :password_reset_url, :expires_at, :created_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @user_id = hash[:user_id] - @email = hash[:email] - @password_reset_token = hash[:password_reset_token] - @password_reset_url = hash[:password_reset_url] - @expires_at = hash[:expires_at] - @created_at = hash[:created_at] - end - - def to_json(*) - { - id: id, - user_id: user_id, - email: email, - password_reset_token: password_reset_token, - password_reset_url: password_reset_url, - expires_at: expires_at, - created_at: created_at - } - end - end -end diff --git a/lib/workos/passwordless.rb b/lib/workos/passwordless.rb index 3dab658f..f36009d2 100644 --- a/lib/workos/passwordless.rb +++ b/lib/workos/passwordless.rb @@ -1,71 +1,76 @@ # frozen_string_literal: true -require "net/http" +# @oagen-ignore-file +# Hand-maintained: Passwordless session endpoints are not yet in the OpenAPI +# spec, so this module wraps them until they are. +# See https://workos.com/docs/reference/magic-link. +require "json" module WorkOS - # The Passwordless module provides convenience methods for working with - # passwordless sessions including the WorkOS Magic Link. You'll need a valid - # API key. + # Passwordless authentication sessions (magic-link). # - # @see https://workos.com/docs/sso/configuring-magic-link - module Passwordless - class << self - include Client - - # Create a Passwordless Session. - # - # @param [Hash] options A hash with options for the session - # @option options [String] email The email of the user to authenticate. - # @option options [String] state Optional parameter that the redirect URI - # received from WorkOS will contain. The state parameter can be used to - # encode arbitrary information to help restore application state between - # redirects. - # @option options [String] connection Optional parameter for the ID of a - # specific connection. This can be used to create a Passwordless Session - # for a specific connection rather than using the domain from the email - # to determine the Organization and Connection. - # @option options [String] type The type of Passwordless Session to - # create. Currently, the only supported value is 'MagicLink'. - # @option options [String] redirect_uri The URI where users are directed - # after completing the authentication step. Must match a - # configured redirect URI on your WorkOS dashboard. - # - # @return Hash - def create_session(options) - response = execute_request( - request: post_request( - path: "/passwordless/sessions", - auth: true, - body: options - ) - ) - - hash = JSON.parse(response.body) - - WorkOS::Types::PasswordlessSessionStruct.new( + # session = client.passwordless.create_session(email: "user@example.com") + # client.passwordless.send_session(session.id) + class Passwordless + PasswordlessSession = Struct.new(:id, :email, :expires_at, :link, :object, keyword_init: true) do + def self.from_hash(hash) + new( id: hash["id"], email: hash["email"], - expires_at: Date.parse(hash["expires_at"]), - link: hash["link"] + expires_at: hash["expires_at"], + link: hash["link"], + object: hash["object"] || "passwordless_session" ) end - # Send a Passwordless Session via email. - # - # @param [String] session_id The unique identifier of the Passwordless - # Session to send an email for. - # - # @return Hash - def send_session(session_id) - response = execute_request( - request: post_request( - path: "/passwordless/sessions/#{session_id}/send", - auth: true - ) - ) - - JSON.parse(response.body) + def to_h + super.compact end end + + def initialize(client) + @client = client + end + + # Create a passwordless session. + # + # @param email [String] Email of the user to authenticate. + # @param type [String] Session type. Currently only "MagicLink" is supported. + # @param redirect_uri [String, nil] Where to redirect the user after auth. + # @param state [String, nil] Arbitrary state echoed back on redirect. + # @param connection [String, nil] Specific connection ID to use. + # @param expires_in [Integer, nil] Lifetime in seconds. + # @param request_options [Hash] Per-request overrides. + # @return [PasswordlessSession] + def create_session(email:, type: "MagicLink", redirect_uri: nil, state: nil, connection: nil, expires_in: nil, request_options: {}) + body = { + "email" => email, + "type" => type, + "redirect_uri" => redirect_uri, + "state" => state, + "connection" => connection, + "expires_in" => expires_in + }.compact + response = @client.request(method: :post, path: "/passwordless/sessions", auth: true, body: body, request_options: request_options) + PasswordlessSession.from_hash(JSON.parse(response.body)) + end + + # Send the magic-link email for an existing passwordless session. + # + # @param session_id [String] Unique identifier of the passwordless session. + # @param request_options [Hash] Per-request overrides. + # @return [Hash] Server response payload. + def send_session(session_id, request_options: {}) + response = @client.request( + method: :post, + path: "/passwordless/sessions/#{WorkOS::Util.encode_path(session_id)}/send", + auth: true, + body: {}, + request_options: request_options + ) + JSON.parse(response.body || "{}") + rescue JSON::ParserError + {} + end end end diff --git a/lib/workos/pipes.rb b/lib/workos/pipes.rb new file mode 100644 index 00000000..c3239482 --- /dev/null +++ b/lib/workos/pipes.rb @@ -0,0 +1,111 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Pipes + def initialize(client) + @client = client + end + + # Get authorization URL + # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + # @param user_id [String] The ID of the user to authorize. + # @param organization_id [String, nil] An organization ID to scope the authorization to a specific organization. + # @param return_to [String, nil] The URL to redirect the user to after authorization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::DataIntegrationAuthorizeUrlResponse] + def authorize_data_integration( + slug:, + user_id:, + organization_id: nil, + return_to: nil, + request_options: {} + ) + body = { + "user_id" => user_id, + "organization_id" => organization_id, + "return_to" => return_to + }.compact + response = @client.request(method: :post, path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/authorize", auth: true, body: body, request_options: request_options) + WorkOS::DataIntegrationAuthorizeUrlResponse.new(response.body) + end + + # Get an access token for a connected account + # @param slug [String] The identifier of the integration. + # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier. + # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::DataIntegrationAccessTokenResponse] + def create_data_integration_token( + slug:, + user_id:, + organization_id: nil, + request_options: {} + ) + body = { + "user_id" => user_id, + "organization_id" => organization_id + }.compact + response = @client.request(method: :post, path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/token", auth: true, body: body, request_options: request_options) + WorkOS::DataIntegrationAccessTokenResponse.new(response.body) + end + + # Get a connected account + # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier. + # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::ConnectedAccount] + def get_user_connected_account( + user_id:, + slug:, + organization_id: nil, + request_options: {} + ) + params = { + "organization_id" => organization_id + }.compact + response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", auth: true, params: params, request_options: request_options) + WorkOS::ConnectedAccount.new(response.body) + end + + # Delete a connected account + # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier. + # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). + # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_user_connected_account( + user_id:, + slug:, + organization_id: nil, + request_options: {} + ) + params = { + "organization_id" => organization_id + }.compact + @client.request(method: :delete, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", auth: true, params: params, request_options: request_options) + nil + end + + # List providers + # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier to list providers and connected accounts for. + # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to filter connections for a specific organization. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::DataIntegrationsListResponse] + def list_user_data_providers( + user_id:, + organization_id: nil, + request_options: {} + ) + params = { + "organization_id" => organization_id + }.compact + response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/data_providers", auth: true, params: params, request_options: request_options) + WorkOS::DataIntegrationsListResponse.new(response.body) + end + end +end diff --git a/lib/workos/pipes/connected_account.rb b/lib/workos/pipes/connected_account.rb new file mode 100644 index 00000000..4b3933ca --- /dev/null +++ b/lib/workos/pipes/connected_account.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectedAccount + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + organization_id: :organization_id, + scopes: :scopes, + state: :state, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :organization_id, + :scopes, + :state, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + @scopes = hash[:scopes] || [] + @state = hash[:state] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/pipes/data_integration_access_token_response.rb b/lib/workos/pipes/data_integration_access_token_response.rb new file mode 100644 index 00000000..1e54270f --- /dev/null +++ b/lib/workos/pipes/data_integration_access_token_response.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DataIntegrationAccessTokenResponse + include HashProvider + + HASH_ATTRS = { + active: :active, + access_token: :access_token, + error: :error + }.freeze + + attr_accessor \ + :active, + :access_token, + :error + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @active = hash[:active] + @access_token = hash[:access_token] ? WorkOS::DataIntegrationAccessTokenResponseAccessToken.new(hash[:access_token]) : nil + @error = hash[:error] + end + end +end diff --git a/lib/workos/pipes/data_integration_access_token_response_access_token.rb b/lib/workos/pipes/data_integration_access_token_response_access_token.rb new file mode 100644 index 00000000..418c71d4 --- /dev/null +++ b/lib/workos/pipes/data_integration_access_token_response_access_token.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DataIntegrationAccessTokenResponseAccessToken + include HashProvider + + HASH_ATTRS = { + object: :object, + access_token: :access_token, + expires_at: :expires_at, + scopes: :scopes, + missing_scopes: :missing_scopes + }.freeze + + attr_accessor \ + :object, + :access_token, + :expires_at, + :scopes, + :missing_scopes + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @access_token = hash[:access_token] + @expires_at = hash[:expires_at] + @scopes = hash[:scopes] || [] + @missing_scopes = hash[:missing_scopes] || [] + end + end +end diff --git a/lib/workos/pipes/data_integration_authorize_url_response.rb b/lib/workos/pipes/data_integration_authorize_url_response.rb new file mode 100644 index 00000000..ff4989b9 --- /dev/null +++ b/lib/workos/pipes/data_integration_authorize_url_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DataIntegrationAuthorizeUrlResponse + include HashProvider + + HASH_ATTRS = { + url: :url + }.freeze + + attr_accessor :url + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @url = hash[:url] + end + end +end diff --git a/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb b/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb new file mode 100644 index 00000000..6146416d --- /dev/null +++ b/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DataIntegrationsGetDataIntegrationAuthorizeUrlRequest + include HashProvider + + HASH_ATTRS = { + user_id: :user_id, + organization_id: :organization_id, + return_to: :return_to + }.freeze + + attr_accessor \ + :user_id, + :organization_id, + :return_to + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + @return_to = hash[:return_to] + end + end +end diff --git a/lib/workos/pipes/data_integrations_get_user_token_request.rb b/lib/workos/pipes/data_integrations_get_user_token_request.rb new file mode 100644 index 00000000..acd8afe4 --- /dev/null +++ b/lib/workos/pipes/data_integrations_get_user_token_request.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DataIntegrationsGetUserTokenRequest + include HashProvider + + HASH_ATTRS = { + user_id: :user_id, + organization_id: :organization_id + }.freeze + + attr_accessor \ + :user_id, + :organization_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + end + end +end diff --git a/lib/workos/pipes/data_integrations_list_response.rb b/lib/workos/pipes/data_integrations_list_response.rb new file mode 100644 index 00000000..1b9df2a1 --- /dev/null +++ b/lib/workos/pipes/data_integrations_list_response.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DataIntegrationsListResponse + include HashProvider + + HASH_ATTRS = { + object: :object, + data: :data + }.freeze + + attr_accessor \ + :object, + :data + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @data = (hash[:data] || []).map { |item| item ? WorkOS::DataIntegrationsListResponseData.new(item) : nil } + end + end +end diff --git a/lib/workos/pipes/data_integrations_list_response_data.rb b/lib/workos/pipes/data_integrations_list_response_data.rb new file mode 100644 index 00000000..60d9909b --- /dev/null +++ b/lib/workos/pipes/data_integrations_list_response_data.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DataIntegrationsListResponseData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + name: :name, + description: :description, + slug: :slug, + integration_type: :integration_type, + credentials_type: :credentials_type, + scopes: :scopes, + ownership: :ownership, + created_at: :created_at, + updated_at: :updated_at, + connected_account: :connected_account + }.freeze + + attr_accessor \ + :object, + :id, + :name, + :description, + :slug, + :integration_type, + :credentials_type, + :scopes, + :ownership, + :created_at, + :updated_at, + :connected_account + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @name = hash[:name] + @description = hash[:description] + @slug = hash[:slug] + @integration_type = hash[:integration_type] + @credentials_type = hash[:credentials_type] + @scopes = hash[:scopes] || [] + @ownership = hash[:ownership] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @connected_account = hash[:connected_account] ? WorkOS::DataIntegrationsListResponseDataConnectedAccount.new(hash[:connected_account]) : nil + end + end +end diff --git a/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb b/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb new file mode 100644 index 00000000..e949f5cf --- /dev/null +++ b/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DataIntegrationsListResponseDataConnectedAccount + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + organization_id: :organization_id, + scopes: :scopes, + state: :state, + created_at: :created_at, + updated_at: :updated_at, + userlandUserId: :userland_user_id + }.freeze + + # @!attribute userland_user_id + # @deprecated Use `user_id` instead. + + attr_accessor \ + :object, + :id, + :user_id, + :organization_id, + :scopes, + :state, + :created_at, + :updated_at + + def userland_user_id + warn "[DEPRECATION] `userland_user_id` is deprecated. Use `user_id` instead.", uplevel: 1, category: :deprecated + @userland_user_id + end + + attr_writer :userland_user_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + @scopes = hash[:scopes] || [] + @state = hash[:state] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @userland_user_id = hash[:userlandUserId] + end + end +end diff --git a/lib/workos/pkce.rb b/lib/workos/pkce.rb new file mode 100644 index 00000000..158e0678 --- /dev/null +++ b/lib/workos/pkce.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +# Hand-maintained PKCE utilities (H08). +# RFC 7636: code_verifier is 43-128 chars (high-entropy); code_challenge is +# the URL-safe base64 SHA-256 of the verifier (S256 method). + +require "base64" +require "digest" +require "securerandom" + +module WorkOS + # PKCE (Proof Key for Code Exchange) utilities for OAuth public-client flows. + # + # WorkOS::PKCE.generate_code_verifier # => "abc..." + # WorkOS::PKCE.generate_code_challenge(v) # => "xyz..." + # WorkOS::PKCE.generate_pair # => { code_verifier:, code_challenge: } + module PKCE + # Default verifier length in bytes BEFORE base64url encoding. 32 bytes + # → 43 characters of base64url, which is the RFC 7636 minimum. + DEFAULT_VERIFIER_BYTES = 32 + + module_function + + # Generate a cryptographically random PKCE code verifier. + def generate_code_verifier(byte_length = DEFAULT_VERIFIER_BYTES) + Base64.urlsafe_encode64(SecureRandom.random_bytes(byte_length), padding: false) + end + + # Compute the S256 code_challenge for a given verifier. + def generate_code_challenge(code_verifier) + Base64.urlsafe_encode64(Digest::SHA256.digest(code_verifier), padding: false) + end + + # Generate a fresh (verifier, challenge) pair. + # @return [Hash] { code_verifier:, code_challenge: } + def generate_pair + verifier = generate_code_verifier + {code_verifier: verifier, code_challenge: generate_code_challenge(verifier)} + end + end +end diff --git a/lib/workos/portal.rb b/lib/workos/portal.rb deleted file mode 100644 index 00f0ee96..00000000 --- a/lib/workos/portal.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -require "net/http" - -module WorkOS - # The Portal module provides resource methods for working with the Admin - # Portal product - module Portal - class << self - include Client - - GENERATE_LINK_INTENTS = WorkOS::Types::Intent::ALL - - # Generate a link to grant access to an organization's Admin Portal - # - # @param [String] intent The access scope for the generated Admin Portal - # link. Valid values are: ["audit_logs", "dsync", "log_streams", "sso",] - # @param [String] organization The ID of the organization the Admin - # Portal link will be generated for. - # @param [String] The URL that the end user will be redirected to upon - # exiting the generated Admin Portal. If none is provided, the default - # redirect link set in your WorkOS Dashboard will be used. - # @param [String] The URL to which WorkOS will redirect users to upon - # successfully setting up Single Sign On or Directory Sync. - def generate_link(intent:, organization:, return_url: nil, success_url: nil) - validate_intent(intent) - - request = post_request( - auth: true, - body: { - intent: intent, - organization: organization, - return_url: return_url, - success_url: success_url - }, - path: "/portal/generate_link" - ) - - response = execute_request(request: request) - - JSON.parse(response.body)["link"] - end - - private - - def validate_intent(intent) - return if GENERATE_LINK_INTENTS.include?(intent) - - raise ArgumentError, "#{intent} is not a valid value." \ - " `intent` must be in #{GENERATE_LINK_INTENTS}" - end - end - end -end diff --git a/lib/workos/profile.rb b/lib/workos/profile.rb deleted file mode 100644 index 8afdf203..00000000 --- a/lib/workos/profile.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The Profile class provides a lighweight wrapper around - # a normalized response from the various IDPs WorkOS - # supports as part of the SSO integration. This class - # is not meant to be instantiated in user space, and - # is instantiated internally but exposed. - class Profile - include HashProvider - - attr_accessor :id, :email, :first_name, :last_name, :role, :roles, :groups, :organization_id, - :connection_id, :connection_type, :idp_id, :custom_attributes, :raw_attributes - - # rubocop:disable Metrics/AbcSize - def initialize(profile_json) - hash = JSON.parse(profile_json, symbolize_names: true) - - @id = hash[:id] - @email = hash[:email] - @first_name = hash[:first_name] - @last_name = hash[:last_name] - @role = hash[:role] - @roles = hash[:roles] - @groups = hash[:groups] - @organization_id = hash[:organization_id] - @connection_id = hash[:connection_id] - @connection_type = hash[:connection_type] - @idp_id = hash[:idp_id] - @custom_attributes = hash[:custom_attributes] - @raw_attributes = hash[:raw_attributes] - end - # rubocop:enable Metrics/AbcSize - - def full_name - [first_name, last_name].compact.join(" ") - end - - def to_json(*) - { - id: id, - email: email, - first_name: first_name, - last_name: last_name, - role: role, - roles: roles, - groups: groups, - organization_id: organization_id, - connection_id: connection_id, - connection_type: connection_type, - idp_id: idp_id, - custom_attributes: custom_attributes, - raw_attributes: raw_attributes - } - end - end -end diff --git a/lib/workos/profile_and_token.rb b/lib/workos/profile_and_token.rb deleted file mode 100644 index 6109d2a3..00000000 --- a/lib/workos/profile_and_token.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The ProfileAndToken class represents a Profile and a corresponding - # Access Token. This class is not meant to be instantiated in user space, and - # is instantiated internally but exposed. - class ProfileAndToken - include HashProvider - - attr_accessor :access_token, :profile - - def initialize(profile_and_token_json) - json = JSON.parse(profile_and_token_json, symbolize_names: true) - - @access_token = json[:access_token] - @profile = WorkOS::Profile.new(json[:profile].to_json) - end - - def to_json(*) - { - access_token: access_token, - profile: profile.to_json - } - end - end -end diff --git a/lib/workos/public_client.rb b/lib/workos/public_client.rb new file mode 100644 index 00000000..3446f1b6 --- /dev/null +++ b/lib/workos/public_client.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +# Hand-maintained public-client factory (H19). +# Public clients (browser, mobile, CLI, desktop) cannot store an API key +# securely; they use PKCE flows and operate without an api_key. + +module WorkOS + module PublicClient + module_function + + # Construct a WorkOS::Client suitable for PKCE-only / public-client use. + # No api_key is required — methods that would normally send a Bearer + # Authorization header will skip it. Use PKCE flows on user_management + # and sso (`get_authorization_url_with_pkce`, `authenticate_with_code_pkce`, + # etc.) instead of methods that require server-side credentials. + # + # @param client_id [String] WorkOS client ID for the application. + # @param base_url [String] Optional override of the API base URL. + # @param timeout [Integer] HTTP timeout in seconds. + # @return [WorkOS::Client] + def create(client_id:, base_url: nil, timeout: nil) + raise ArgumentError, "client_id is required" if client_id.nil? || client_id.empty? + args = {client_id: client_id} + args[:base_url] = base_url if base_url + args[:timeout] = timeout if timeout + WorkOS::Client.new(**args) + end + end +end diff --git a/lib/workos/radar.rb b/lib/workos/radar.rb new file mode 100644 index 00000000..e61fe40d --- /dev/null +++ b/lib/workos/radar.rb @@ -0,0 +1,104 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Radar + def initialize(client) + @client = client + end + + # Create an attempt + # @param ip_address [String] The IP address of the request to assess. + # @param user_agent [String] The user agent string of the request to assess. + # @param email [String] The email address of the user making the request. + # @param auth_method [WorkOS::Types::RadarStandaloneAssessRequestAuthMethod] The authentication method being used. + # @param action [WorkOS::Types::RadarStandaloneAssessRequestAction] The action being performed. + # @param device_fingerprint [String, nil] An optional device fingerprint for the request. + # @param bot_score [String, nil] An optional bot detection score for the request. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::RadarStandaloneResponse] + def create_attempt( + ip_address:, + user_agent:, + email:, + auth_method:, + action:, + device_fingerprint: nil, + bot_score: nil, + request_options: {} + ) + body = { + "ip_address" => ip_address, + "user_agent" => user_agent, + "email" => email, + "auth_method" => auth_method, + "action" => action, + "device_fingerprint" => device_fingerprint, + "bot_score" => bot_score + }.compact + response = @client.request(method: :post, path: "/radar/attempts", auth: true, body: body, request_options: request_options) + WorkOS::RadarStandaloneResponse.new(response.body) + end + + # Update a Radar attempt + # @param id [String] The unique identifier of the Radar attempt to update. + # @param challenge_status [String, nil] Set to `"success"` to mark the challenge as completed. + # @param attempt_status [String, nil] Set to `"success"` to mark the authentication attempt as successful. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def update_attempt( + id:, + challenge_status: nil, + attempt_status: nil, + request_options: {} + ) + body = { + "challenge_status" => challenge_status, + "attempt_status" => attempt_status + }.compact + @client.request(method: :put, path: "/radar/attempts/#{WorkOS::Util.encode_path(id)}", auth: true, body: body, request_options: request_options) + nil + end + + # Add an entry to a Radar list + # @param type [WorkOS::Types::RadarType] The type of the Radar list (e.g. ip_address, domain, email). + # @param action [WorkOS::Types::RadarAction] The list action indicating whether to add the entry to the allow or block list. + # @param entry [String] The value to add to the list. Must match the format of the list type (e.g. a valid IP address for `ip_address`, a valid email for `email`). + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::RadarListEntryAlreadyPresentResponse] + def add_list_entry( + type:, + action:, + entry:, + request_options: {} + ) + body = { + "entry" => entry + }.compact + response = @client.request(method: :post, path: "/radar/lists/#{WorkOS::Util.encode_path(type)}/#{WorkOS::Util.encode_path(action)}", auth: true, body: body, request_options: request_options) + WorkOS::RadarListEntryAlreadyPresentResponse.new(response.body) + end + + # Remove an entry from a Radar list + # @param type [WorkOS::Types::RadarType] The type of the Radar list (e.g. ip_address, domain, email). + # @param action [WorkOS::Types::RadarAction] The list action indicating whether to remove the entry from the allow or block list. + # @param entry [String] The value to remove from the list. Must match an existing entry. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def remove_list_entry( + type:, + action:, + entry:, + request_options: {} + ) + body = { + "entry" => entry + }.compact + @client.request(method: :delete, path: "/radar/lists/#{WorkOS::Util.encode_path(type)}/#{WorkOS::Util.encode_path(action)}", auth: true, body: body, request_options: request_options) + nil + end + end +end diff --git a/lib/workos/radar/radar_list_entry_already_present_response.rb b/lib/workos/radar/radar_list_entry_already_present_response.rb new file mode 100644 index 00000000..b78f934f --- /dev/null +++ b/lib/workos/radar/radar_list_entry_already_present_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RadarListEntryAlreadyPresentResponse + include HashProvider + + HASH_ATTRS = { + message: :message + }.freeze + + attr_accessor :message + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @message = hash[:message] + end + end +end diff --git a/lib/workos/radar/radar_standalone_assess_request.rb b/lib/workos/radar/radar_standalone_assess_request.rb new file mode 100644 index 00000000..7ae5ce45 --- /dev/null +++ b/lib/workos/radar/radar_standalone_assess_request.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RadarStandaloneAssessRequest + include HashProvider + + HASH_ATTRS = { + ip_address: :ip_address, + user_agent: :user_agent, + email: :email, + auth_method: :auth_method, + action: :action, + device_fingerprint: :device_fingerprint, + bot_score: :bot_score + }.freeze + + attr_accessor \ + :ip_address, + :user_agent, + :email, + :auth_method, + :action, + :device_fingerprint, + :bot_score + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @email = hash[:email] + @auth_method = hash[:auth_method] + @action = hash[:action] + @device_fingerprint = hash[:device_fingerprint] + @bot_score = hash[:bot_score] + end + end +end diff --git a/lib/workos/radar/radar_standalone_delete_radar_list_entry_request.rb b/lib/workos/radar/radar_standalone_delete_radar_list_entry_request.rb new file mode 100644 index 00000000..00889e75 --- /dev/null +++ b/lib/workos/radar/radar_standalone_delete_radar_list_entry_request.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RadarStandaloneDeleteRadarListEntryRequest + include HashProvider + + HASH_ATTRS = { + entry: :entry + }.freeze + + attr_accessor :entry + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @entry = hash[:entry] + end + end +end diff --git a/lib/workos/radar/radar_standalone_response.rb b/lib/workos/radar/radar_standalone_response.rb new file mode 100644 index 00000000..e1303abd --- /dev/null +++ b/lib/workos/radar/radar_standalone_response.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RadarStandaloneResponse + include HashProvider + + HASH_ATTRS = { + verdict: :verdict, + reason: :reason, + attempt_id: :attempt_id, + control: :control, + blocklist_type: :blocklist_type + }.freeze + + attr_accessor \ + :verdict, + :reason, + :attempt_id, + :control, + :blocklist_type + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @verdict = hash[:verdict] + @reason = hash[:reason] + @attempt_id = hash[:attempt_id] + @control = hash[:control] + @blocklist_type = hash[:blocklist_type] + end + end +end diff --git a/lib/workos/radar/radar_standalone_update_radar_attempt_request.rb b/lib/workos/radar/radar_standalone_update_radar_attempt_request.rb new file mode 100644 index 00000000..0bbf07a6 --- /dev/null +++ b/lib/workos/radar/radar_standalone_update_radar_attempt_request.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RadarStandaloneUpdateRadarAttemptRequest + include HashProvider + + HASH_ATTRS = { + challenge_status: :challenge_status, + attempt_status: :attempt_status + }.freeze + + attr_accessor \ + :challenge_status, + :attempt_status + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @challenge_status = hash[:challenge_status] + @attempt_status = hash[:attempt_status] + end + end +end diff --git a/lib/workos/radar/radar_standalone_update_radar_list_request.rb b/lib/workos/radar/radar_standalone_update_radar_list_request.rb new file mode 100644 index 00000000..b628ab0a --- /dev/null +++ b/lib/workos/radar/radar_standalone_update_radar_list_request.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + RadarStandaloneUpdateRadarListRequest = RadarStandaloneDeleteRadarListEntryRequest +end diff --git a/lib/workos/refresh_authentication_response.rb b/lib/workos/refresh_authentication_response.rb deleted file mode 100644 index 3a9b7eff..00000000 --- a/lib/workos/refresh_authentication_response.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The RefreshAuthenticationResponse contains response data from a successful - # `UserManagement.authenticate_with_refresh_token` call - class RefreshAuthenticationResponse - include HashProvider - - attr_accessor :user, :organization_id, :impersonator, :access_token, :refresh_token, :sealed_session - - # rubocop:disable Metrics/AbcSize - def initialize(authentication_response_json, session = nil) - json = JSON.parse(authentication_response_json, symbolize_names: true) - @access_token = json[:access_token] - @refresh_token = json[:refresh_token] - @user = WorkOS::User.new(json[:user].to_json) - @organization_id = json[:organization_id] - @impersonator = - if (impersonator_json = json[:impersonator]) - Impersonator.new(email: impersonator_json[:email], - reason: impersonator_json[:reason]) - end - @sealed_session = - if session && session[:seal_session] - WorkOS::Session.seal_data( - { - access_token: access_token, - refresh_token: refresh_token, - user: user.to_json, - organization_id: organization_id, - impersonator: impersonator.to_json - }, - session[:cookie_password], - encryptor: session[:encryptor] - ) - end - end - # rubocop:enable Metrics/AbcSize - - def to_json(*) - { - user: user.to_json, - organization_id: organization_id, - impersonator: impersonator.to_json, - access_token: access_token, - refresh_token: refresh_token, - sealed_session: sealed_session - } - end - end -end diff --git a/lib/workos/role.rb b/lib/workos/role.rb deleted file mode 100644 index 62749e5e..00000000 --- a/lib/workos/role.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The Role class provides a lightweight wrapper around - # a WorkOS Role resource. This class is not meant to be instantiated - # in user space, and is instantiated internally but exposed. - class Role - include HashProvider - - attr_accessor :id, :name, :slug, :description, :permissions, :type, :created_at, :updated_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @name = hash[:name] - @slug = hash[:slug] - @description = hash[:description] - @permissions = hash[:permissions] || [] - @type = hash[:type] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - - def to_json(*) - { - id: id, - name: name, - slug: slug, - description: description, - permissions: permissions, - type: type, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/session.rb b/lib/workos/session.rb index 93f099bd..92b4b1a2 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -1,186 +1,109 @@ # frozen_string_literal: true +# @oagen-ignore-file +# Hand-maintained Session object (H04). Constructed by SessionManager#load. +require "json" require "jwt" +require "openssl" require "uri" -require "net/http" -require "encryptor" -require "securerandom" -require "json" module WorkOS - # The Session class provides helper methods for working with WorkOS sessions - # This class is not meant to be instantiated in a user space, and is instantiated internally but exposed. class Session - attr_accessor :jwks, :jwks_algorithms, :user_management, :cookie_password, :session_data, :client_id, :encryptor - - def initialize(user_management:, client_id:, session_data:, cookie_password:, encryptor: nil) - raise ArgumentError, "cookiePassword is required" if cookie_password.nil? || cookie_password.empty? - - @encryptor = encryptor || WorkOS::Encryptors::AesGcm.new - validate_encryptor!(@encryptor) - - @user_management = user_management + def initialize(manager, seal_data:, cookie_password:) + raise ArgumentError, "cookie_password is required" if cookie_password.nil? || cookie_password.empty? + @manager = manager + @client = manager.client + @seal_data = seal_data @cookie_password = cookie_password - @session_data = session_data - @client_id = client_id - - @jwks = Cache.fetch("jwks_#{client_id}", expires_in: 5 * 60) do - create_remote_jwk_set(URI(@user_management.get_jwks_url(client_id))) - end - @jwks_algorithms = @jwks.map { |key| key[:alg] }.compact.uniq end - # Authenticates the user based on the session data - # @param include_expired [Boolean] If true, returns decoded token data even when expired (default: false) - # @param block [Proc] Optional block to call to extract additional claims from the decoded JWT - # @return [Hash] A hash containing the authentication response and a reason if the authentication failed - # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity - def authenticate(include_expired: false, &claim_extractor) - return {authenticated: false, reason: "NO_SESSION_COOKIE_PROVIDED"} if @session_data.nil? - - begin - session = Session.unseal_data(@session_data, @cookie_password, encryptor: @encryptor) - rescue - return {authenticated: false, reason: "INVALID_SESSION_COOKIE"} - end - - return {authenticated: false, reason: "INVALID_SESSION_COOKIE"} unless session[:access_token] - - begin - decoded = JWT.decode( - session[:access_token], - nil, - true, - algorithms: @jwks_algorithms, - jwks: @jwks, - verify_expiration: false - ).first - - expired = decoded["exp"] && decoded["exp"] < Time.now.to_i + attr_reader :seal_data, :cookie_password - # Early return for expired tokens when not including expired data (backward compatible) - return {authenticated: false, reason: "INVALID_JWT"} if expired && !include_expired + def authenticate(&claim_extractor) + return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::NO_SESSION_COOKIE_PROVIDED) if @seal_data.nil? || @seal_data.empty? - # Return full data for valid tokens or when include_expired is true - result = { - authenticated: !expired, - session_id: decoded["sid"], - organization_id: decoded["org_id"], - role: decoded["role"], - roles: decoded["roles"], - permissions: decoded["permissions"], - entitlements: decoded["entitlements"], - feature_flags: decoded["feature_flags"], - user: session[:user], - impersonator: session[:impersonator], - reason: expired ? "INVALID_JWT" : nil - } - result.merge!(claim_extractor.call(decoded)) if block_given? - result - rescue JWT::DecodeError - {authenticated: false, reason: "INVALID_JWT"} - rescue => e - {authenticated: false, reason: e.message} + session = begin + @manager.unseal_data(@seal_data, @cookie_password) + rescue ArgumentError, OpenSSL::Cipher::CipherError + return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::INVALID_SESSION_COOKIE) end - end - - # Refreshes the session data using the refresh token stored in the session data - # @param options [Hash] Options for refreshing the session - # @option options [String] :cookie_password The password to use for unsealing the session data - # @option options [String] :organization_id The organization ID to use for refreshing the session - # @return [Hash] A hash containing a new sealed session, the authentication response, - # and a reason if the refresh failed - def refresh(options = nil) - cookie_password = (options.nil? || options[:cookie_password].nil?) ? @cookie_password : options[:cookie_password] + return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::INVALID_SESSION_COOKIE) unless session.is_a?(Hash) && session["access_token"] - begin - session = Session.unseal_data(@session_data, cookie_password, encryptor: @encryptor) - rescue - return {authenticated: false, reason: "INVALID_SESSION_COOKIE"} + decoded = begin + @manager.decode_jwt(session["access_token"]) + rescue JWT::DecodeError, JWT::ExpiredSignature + return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::INVALID_JWT) end - return {authenticated: false, reason: "INVALID_SESSION_COOKIE"} unless session[:refresh_token] && session[:user] - - begin - auth_response = @user_management.authenticate_with_refresh_token( - client_id: @client_id, - refresh_token: session[:refresh_token], - organization_id: (options.nil? || options[:organization_id].nil?) ? nil : options[:organization_id], - session: {seal_session: true, cookie_password: cookie_password, encryptor: @encryptor} - ) - - @session_data = auth_response.sealed_session - @cookie_password = cookie_password - - { - authenticated: true, - sealed_session: auth_response.sealed_session, - session: auth_response, - reason: nil - } - rescue => e - {authenticated: false, reason: e.message} - end + SessionManager::AuthSuccess.new( + authenticated: true, + session_id: decoded["sid"], + organization_id: decoded["org_id"], + role: decoded["role"], + roles: decoded["roles"], + permissions: decoded["permissions"], + entitlements: decoded["entitlements"], + user: session["user"], + impersonator: session["impersonator"], + feature_flags: decoded["feature_flags"], + custom_claims: claim_extractor&.call(decoded) + ) end - # rubocop:enable Metrics/AbcSize - # rubocop:enable Metrics/CyclomaticComplexity - # rubocop:enable Metrics/PerceivedComplexity - # Returns a URL to redirect the user to for logging out - # @param return_to [String] The URL to redirect the user to after logging out - # @return [String] The URL to redirect the user to for logging out - def get_logout_url(return_to: nil) - auth_response = authenticate + def refresh(organization_id: nil, cookie_password: nil) + effective_password = cookie_password || @cookie_password - unless auth_response[:authenticated] - raise "Failed to extract session ID for logout URL: #{auth_response[:reason]}" + session = begin + @manager.unseal_data(@seal_data, effective_password) + rescue ArgumentError, OpenSSL::Cipher::CipherError + return SessionManager::RefreshError.new(authenticated: false, reason: SessionManager::INVALID_SESSION_COOKIE) end - - @user_management.get_logout_url(session_id: auth_response[:session_id], return_to: return_to) - end - - # Encrypts and seals data using the provided encryptor (defaults to AES-256-GCM) - # @param data [Hash] The data to seal - # @param key [String] The key to use for encryption - # @param encryptor [Object] Optional encryptor that responds to #seal(data, key) - # @return [String] The sealed data - def self.seal_data(data, key, encryptor: nil) - enc = encryptor || WorkOS::Encryptors::AesGcm.new - enc.seal(data, key) - end - - # Decrypts and unseals data using the provided encryptor (defaults to AES-256-GCM) - # @param sealed_data [String] The sealed data to unseal - # @param key [String] The key to use for decryption - # @param encryptor [Object] Optional encryptor that responds to #unseal(sealed_data, key) - # @return [Hash] The unsealed data - def self.unseal_data(sealed_data, key, encryptor: nil) - enc = encryptor || WorkOS::Encryptors::AesGcm.new - enc.unseal(sealed_data, key) + return SessionManager::RefreshError.new(authenticated: false, reason: SessionManager::INVALID_SESSION_COOKIE) unless session.is_a?(Hash) && session["refresh_token"] + + body = { + "grant_type" => "refresh_token", + "client_id" => @client.client_id, + "client_secret" => @client.api_key, + "refresh_token" => session["refresh_token"], + "session" => {"seal_session" => true, "cookie_password" => effective_password} + } + body["organization_id"] = organization_id if organization_id + + response = @client.request(method: :post, path: "/user_management/authenticate", auth: false, body: body) + auth_response = JSON.parse(response.body) + sealed = auth_response["sealed_session"].to_s + @seal_data = sealed + @cookie_password = effective_password + + decoded = @manager.decode_jwt(auth_response["access_token"]) + SessionManager::RefreshSuccess.new( + authenticated: true, + sealed_session: sealed, + session_id: decoded["sid"], + organization_id: decoded["org_id"], + role: decoded["role"], + roles: decoded["roles"], + permissions: decoded["permissions"], + entitlements: decoded["entitlements"], + user: auth_response["user"], + impersonator: auth_response["impersonator"], + feature_flags: decoded["feature_flags"] + ) + rescue WorkOS::Error => e + SessionManager::RefreshError.new(authenticated: false, reason: e.message) end - private - - def validate_encryptor!(enc) - return if enc.respond_to?(:seal) && enc.respond_to?(:unseal) - - raise ArgumentError, "encryptor must respond to #seal(data, key) and #unseal(sealed_data, key)" - end - - # Creates a JWKS set from a remote JWKS URL - # @param uri [URI] The URI of the JWKS - # @return [JWT::JWK::Set] The JWKS set - def create_remote_jwk_set(uri) - # Fetch the JWKS from the remote URL - response = Net::HTTP.get(uri) - - jwks_hash = JSON.parse(response) - jwks = JWT::JWK::Set.new(jwks_hash) - - # filter jwks so it only returns the keys where 'use' is equal to 'sig' - jwks.keys.select! { |key| key[:use] == "sig" } - - jwks + # Build the WorkOS session-logout URL for the currently authenticated session. + # Requires #authenticate to succeed (so we have the session_id). + def get_logout_url(return_to: nil) + result = authenticate + raise WorkOS::Error.new(message: "Failed to extract session ID for logout URL: #{result.reason}") if result.is_a?(SessionManager::AuthError) + base = @client.base_url || "https://api.workos.com" + params = {"session_id" => result.session_id} + params["return_to"] = return_to if return_to + uri = URI.join(base, "/user_management/sessions/logout") + uri.query = URI.encode_www_form(params) + uri.to_s end end end diff --git a/lib/workos/session_manager.rb b/lib/workos/session_manager.rb new file mode 100644 index 00000000..b60c2d87 --- /dev/null +++ b/lib/workos/session_manager.rb @@ -0,0 +1,187 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +# Hand-maintained session-cookie helpers (H04-H07, H13): +# - SessionManager#load(seal_data:, cookie_password:) -> Session (H04) +# - SessionManager#authenticate / #refresh -> inline convenience (H05) +# - SessionManager#seal_data / #unseal_data -> raw seal/unseal (H06) +# - SessionManager#seal_session_from_auth_response -> H07 +# - Session#authenticate / #refresh / #get_logout_url +# +# Symmetric encryption: AES-256-GCM by default. Users may supply a custom +# encryptor (any object responding to `seal(data, key)` and `unseal(sealed, key)`) +# for compatibility with other sealing formats (e.g. Iron/Next.js). + +require "json" +require "jwt" + +module WorkOS + class SessionManager + JWK_ALGORITHMS = ["RS256"].freeze + + # @deprecated Use {WorkOS::Encryptors::AesGcm::SEAL_VERSION} instead. + SEAL_VERSION = 0x01 + + # H04 success / failure shapes — kept minimal & frozen. + class AuthSuccess + RESERVED_KEYS = [ + :authenticated, :session_id, :organization_id, :role, :roles, + :permissions, :entitlements, :user, :impersonator, :feature_flags + ].freeze + + attr_reader(*RESERVED_KEYS) + + def initialize( + authenticated:, + session_id:, + organization_id:, + role:, + roles:, + permissions:, + entitlements:, + user:, + impersonator:, + feature_flags:, + custom_claims: nil + ) + @authenticated = authenticated + @session_id = session_id + @organization_id = organization_id + @role = role + @roles = roles + @permissions = permissions + @entitlements = entitlements + @user = user + @impersonator = impersonator + @feature_flags = feature_flags + @custom_claims = normalize_custom_claims(custom_claims) + end + + def [](key) + sym_key = key.to_sym + return public_send(sym_key) if RESERVED_KEYS.include?(sym_key) + + @custom_claims[sym_key] + end + + def to_h + RESERVED_KEYS.to_h { |key| [key, public_send(key)] }.merge(@custom_claims) + end + + def method_missing(name, *args, &block) + return @custom_claims[name] if args.empty? && @custom_claims.key?(name) + + super + end + + def respond_to_missing?(name, include_private = false) + @custom_claims.key?(name) || super + end + + private + + def normalize_custom_claims(custom_claims) + return {} if custom_claims.nil? + raise ArgumentError, "claim_extractor must return a Hash" unless custom_claims.is_a?(Hash) + + claims = custom_claims.each_with_object({}) do |(key, value), memo| + sym_key = key.to_sym + if RESERVED_KEYS.include?(sym_key) + raise ArgumentError, "claim_extractor cannot overwrite reserved key #{sym_key.inspect}" + end + + memo[sym_key] = value + end + claims.freeze + end + end + AuthError = Struct.new(:authenticated, :reason, keyword_init: true) + + RefreshSuccess = Struct.new( + :authenticated, :sealed_session, :session_id, :organization_id, :role, + :roles, :permissions, :entitlements, :user, :impersonator, :feature_flags, + keyword_init: true + ) + RefreshError = Struct.new(:authenticated, :reason, keyword_init: true) + + # Failure reason constants + NO_SESSION_COOKIE_PROVIDED = "no_session_cookie_provided" + INVALID_SESSION_COOKIE = "invalid_session_cookie" + INVALID_JWT = "invalid_jwt" + + # @param client [WorkOS::Client] + # @param encryptor [#seal, #unseal] Optional custom encryptor. Defaults to + # {WorkOS::Encryptors::AesGcm}. A custom encryptor must respond to + # `seal(data, key) -> String` and `unseal(sealed_string, key) -> Hash`. + def initialize(client, encryptor: nil) + @client = client + @encryptor = encryptor || Encryptors::AesGcm.new + @jwks_cache = nil + @jwks_cache_at = nil + @jwks_mutex = Mutex.new + end + + attr_reader :client + + # H04 — Load a Session object from a sealed cookie. + def load(seal_data:, cookie_password:) + Session.new(self, seal_data: seal_data, cookie_password: cookie_password) + end + + # H05 — Inline convenience: authenticate without manual Session construction. + def authenticate(seal_data:, cookie_password:, &claim_extractor) + load(seal_data: seal_data, cookie_password: cookie_password).authenticate(&claim_extractor) + end + + # H05 — Inline convenience: refresh without manual Session construction. + def refresh(seal_data:, cookie_password:, organization_id: nil) + load(seal_data: seal_data, cookie_password: cookie_password) + .refresh(organization_id: organization_id) + end + + # H06 — Raw seal: encrypt arbitrary data with a key string. + # Delegates to the configured encryptor (default: AES-256-GCM). + def seal_data(data, key) + @encryptor.seal(data, key) + end + + # H06 — Raw unseal: returns parsed JSON (Hash) or raw string if not JSON. + # Delegates to the configured encryptor (default: AES-256-GCM). + def unseal_data(sealed, key) + @encryptor.unseal(sealed, key) + end + + # H07 — Build a sealed session string directly from auth-response fields. + def seal_session_from_auth_response(access_token:, refresh_token:, cookie_password:, user: nil, impersonator: nil) + payload = {"access_token" => access_token, "refresh_token" => refresh_token} + payload["user"] = user if user + payload["impersonator"] = impersonator if impersonator + seal_data(payload, cookie_password) + end + + # Verify an access-token JWT against the WorkOS JWKS for this client. + # Used by Session#authenticate; exposed publicly for advanced cases. + def decode_jwt(access_token) + jwks = fetch_jwks + JWT.decode( + access_token, + nil, + true, + algorithms: JWK_ALGORITHMS, + jwks: jwks, + verify_aud: false + ).first + end + + # Cached JWKS fetch (5-minute TTL, thread-safe). + def fetch_jwks(now: Time.now) + @jwks_mutex.synchronize do + return @jwks_cache if @jwks_cache && @jwks_cache_at && (now - @jwks_cache_at) < 300 + response = @client.user_management.get_jwks(client_id: @client.client_id) + @jwks_cache = {"keys" => response.keys.map(&:to_h)} + @jwks_cache_at = now + @jwks_cache + end + end + end +end diff --git a/lib/workos/shared/event_context.rb b/lib/workos/shared/event_context.rb new file mode 100644 index 00000000..e9450c30 --- /dev/null +++ b/lib/workos/shared/event_context.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EventContext + include HashProvider + + HASH_ATTRS = { + google_analytics_client_id: :google_analytics_client_id, + google_analytics_sessions: :google_analytics_sessions, + ajs_anonymous_id: :ajs_anonymous_id, + client_id: :client_id, + actor: :actor, + previous_attributes: :previous_attributes + }.freeze + + attr_accessor \ + :google_analytics_client_id, + :google_analytics_sessions, + :ajs_anonymous_id, + :client_id, + :actor, + :previous_attributes + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @google_analytics_client_id = hash[:google_analytics_client_id] + @google_analytics_sessions = (hash[:google_analytics_sessions] || []).map { |item| item ? WorkOS::EventContextGoogleAnalyticsSession.new(item) : nil } + @ajs_anonymous_id = hash[:ajs_anonymous_id] + @client_id = hash[:client_id] + @actor = hash[:actor] ? WorkOS::EventContextActor.new(hash[:actor]) : nil + @previous_attributes = hash[:previous_attributes] || {} + end + end +end diff --git a/lib/workos/shared/event_context_actor.rb b/lib/workos/shared/event_context_actor.rb new file mode 100644 index 00000000..089e2a2f --- /dev/null +++ b/lib/workos/shared/event_context_actor.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EventContextActor + include HashProvider + + HASH_ATTRS = { + id: :id, + source: :source, + name: :name + }.freeze + + attr_accessor \ + :id, + :source, + :name + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @source = hash[:source] + @name = hash[:name] + end + end +end diff --git a/lib/workos/shared/event_context_google_analytics_session.rb b/lib/workos/shared/event_context_google_analytics_session.rb new file mode 100644 index 00000000..ed422b60 --- /dev/null +++ b/lib/workos/shared/event_context_google_analytics_session.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EventContextGoogleAnalyticsSession + include HashProvider + + HASH_ATTRS = { + containerId: :container_id, + sessionId: :session_id, + sessionNumber: :session_number + }.freeze + + attr_accessor \ + :container_id, + :session_id, + :session_number + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @container_id = hash[:containerId] + @session_id = hash[:sessionId] + @session_number = hash[:sessionNumber] + end + end +end diff --git a/lib/workos/shared/group.rb b/lib/workos/shared/group.rb new file mode 100644 index 00000000..d8760c8b --- /dev/null +++ b/lib/workos/shared/group.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Group + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + name: :name, + description: :description, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :name, + :description, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @name = hash[:name] + @description = hash[:description] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/shared/group_created.rb b/lib/workos/shared/group_created.rb new file mode 100644 index 00000000..d60b40b5 --- /dev/null +++ b/lib/workos/shared/group_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class GroupCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::Group.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/shared/group_deleted.rb b/lib/workos/shared/group_deleted.rb new file mode 100644 index 00000000..ac3698ab --- /dev/null +++ b/lib/workos/shared/group_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class GroupDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::Group.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/shared/group_member_added.rb b/lib/workos/shared/group_member_added.rb new file mode 100644 index 00000000..7bc966f4 --- /dev/null +++ b/lib/workos/shared/group_member_added.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class GroupMemberAdded + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::GroupMemberAddedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/shared/group_member_added_data.rb b/lib/workos/shared/group_member_added_data.rb new file mode 100644 index 00000000..fd15e855 --- /dev/null +++ b/lib/workos/shared/group_member_added_data.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class GroupMemberAddedData + include HashProvider + + HASH_ATTRS = { + group_id: :group_id, + organization_membership_id: :organization_membership_id + }.freeze + + attr_accessor \ + :group_id, + :organization_membership_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @group_id = hash[:group_id] + @organization_membership_id = hash[:organization_membership_id] + end + end +end diff --git a/lib/workos/shared/group_member_removed.rb b/lib/workos/shared/group_member_removed.rb new file mode 100644 index 00000000..b59aaf59 --- /dev/null +++ b/lib/workos/shared/group_member_removed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class GroupMemberRemoved + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::GroupMemberRemovedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/shared/group_member_removed_data.rb b/lib/workos/shared/group_member_removed_data.rb new file mode 100644 index 00000000..4bee6e70 --- /dev/null +++ b/lib/workos/shared/group_member_removed_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + GroupMemberRemovedData = GroupMemberAddedData +end diff --git a/lib/workos/shared/group_updated.rb b/lib/workos/shared/group_updated.rb new file mode 100644 index 00000000..26bf93e5 --- /dev/null +++ b/lib/workos/shared/group_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class GroupUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::Group.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index fc736ba9..98222744 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -1,235 +1,223 @@ # frozen_string_literal: true -require "net/http" -require "uri" +# This file is auto-generated by oagen. Do not edit. + +require "json" module WorkOS - # The SSO module provides convenience methods for working with the WorkOS - # SSO platform. You'll need a valid API key, a client ID, and to have - # created an SSO connection on your WorkOS dashboard. - # - # @see https://docs.workos.com/sso/overview - module SSO - class << self - include Client, Deprecation - - PROVIDERS = WorkOS::Types::Provider::ALL - - # Generate an Oauth2 authorization URL where your users will - # authenticate using the configured SSO Identity Provider. - # - # @param [String] redirect_uri The URI where users are directed - # after completing the authentication step. Must match a - # configured redirect URI on your WorkOS dashboard. - # @param [String] client_id The WorkOS client ID for the environment - # where you've configured your SSO connection. - # @param [String] domain The domain for the relevant SSO Connection - # configured on your WorkOS dashboard. One of provider, domain, - # connection, or organization is required. - # The domain is deprecated. - # @param [String] provider A provider name for an Identity Provider - # configured on your WorkOS dashboard. Only 'AppleOAuth', 'GitHubOAuth', - # 'GoogleOAuth', and 'MicrosoftOAuth' are supported. - # @param [String] connection The ID for a Connection configured on - # WorkOS. - # @param [String] organization The ID for an Organization configured - # on WorkOS. - # @param [String] state An arbitrary state object - # that is preserved and available to the client in the response. - # @example - # WorkOS::SSO.authorization_url( - # connection: 'conn_123', - # client_id: 'project_01DG5TGK363GRVXP3ZS40WNGEZ', - # redirect_uri: 'https://workos.com/callback', - # state: { - # next_page: '/docs' - # }.to_s - # ) - # - # => "https://api.workos.com/sso/authorize?connection=conn_123" \ - # "&client_id=project_01DG5TGK363GRVXP3ZS40WNGEZ" \ - # "&redirect_uri=https%3A%2F%2Fworkos.com%2Fcallback&" \ - # "response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdocs%22%7D" - # - # @return [String] - # rubocop:disable Metrics/ParameterLists - def authorization_url( - redirect_uri:, - client_id: nil, - domain: nil, - domain_hint: nil, - login_hint: nil, - provider: nil, - connection: nil, - organization: nil, - state: "" - ) - if domain - warn_deprecation '[DEPRECATION] `domain` is deprecated. - Please use `organization` instead.' - end + class SSO + def initialize(client) + @client = client + end - validate_authorization_url_arguments( - provider: provider, - domain: domain, - connection: connection, - organization: organization - ) - - query = URI.encode_www_form({ - client_id: client_id, - redirect_uri: redirect_uri, - response_type: "code", - state: state, - domain: domain, - domain_hint: domain_hint, - login_hint: login_hint, - provider: provider, - connection: connection, - organization: organization - }.compact) - - "https://#{WorkOS.config.api_hostname}/sso/authorize?#{query}" - end - # rubocop:enable Metrics/ParameterLists - - def get_profile(access_token:) - response = execute_request( - request: get_request( - path: "/sso/profile", - auth: true, - access_token: access_token + # List Connections + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::ConnectionsOrder, nil] Order the results by the creation time. + # @param connection_type [WorkOS::Types::ConnectionsConnectionType, nil] Filter Connections by their type. + # @param domain [String, nil] Filter Connections by their associated domain. + # @param organization_id [String, nil] Filter Connections by their associated organization. + # @param search [String, nil] Searchable text to match against Connection names. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_connections( + before: nil, + after: nil, + limit: nil, + order: nil, + connection_type: nil, + domain: nil, + organization_id: nil, + search: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "connection_type" => connection_type, + "domain" => domain, + "organization_id" => organization_id, + "search" => search + }.compact + response = @client.request(method: :get, path: "/connections", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::Connection, filters: {before: before, limit: limit, order: order, connection_type: connection_type, domain: domain, organization_id: organization_id, search: search}, + fetch_next: lambda do |cursor| + list_connections( + before: before, + after: cursor, + limit: limit, + order: order, + connection_type: connection_type, + domain: domain, + organization_id: organization_id, + search: search, + request_options: request_options + ) + end, + fetch_previous: lambda do |cursor| + list_connections( + before: cursor, + after: nil, + limit: limit, + order: order, + connection_type: connection_type, + domain: domain, + organization_id: organization_id, + search: search, + request_options: request_options ) - ) + end + ) + end - WorkOS::Profile.new(response.body) - end + # Get a Connection + # @param id [String] Unique identifier for the Connection. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Connection] + def get_connection( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/connections/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::Connection.new(response.body) + end - # Fetch the profile details for the authenticated SSO user. - # - # @param [String] code The authorization code provided in the callback URL - # @param [String] client_id The WorkOS client ID for the environment - # where you've configured your SSO connection - # - # @return [WorkOS::ProfileAndToken] - def profile_and_token(code:, client_id: nil) - body = { - client_id: client_id, - client_secret: WorkOS.config.key!, - grant_type: "authorization_code", - code: code - } - - response = execute_request( - request: post_request(path: "/sso/token", body: body) - ) - - WorkOS::ProfileAndToken.new(response.body) - end + # Delete a Connection + # @param id [String] Unique identifier for the Connection. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_connection( + id:, + request_options: {} + ) + @client.request(method: :delete, path: "/connections/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + nil + end - # Retrieve connections. - # - # @param [Hash] options An options hash - # @option options [String] connection_type Authentication service - # provider descriptor. - # @option options [String] domain The domain of the connection to be - # retrieved. - # @option options [String] organization_id The id of the organization - # of the connections to be retrieved. - # @option options [String] limit Maximum number of records to return. - # @option options [String] order The order in which to paginate records - # @option options [String] before Pagination cursor to receive records - # before a provided Connection ID. - # @option options [String] after Pagination cursor to receive records - # before a provided Connection ID. - # - # @return [Hash] - def list_connections(options = {}) - options[:order] ||= "desc" - response = execute_request( - request: get_request( - path: "/connections", - auth: true, - params: options - ) - ) + # Logout Authorize + # @param profile_id [String] The unique ID of the profile to log out. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::SSOLogoutAuthorizeResponse] + def authorize_logout( + profile_id:, + request_options: {} + ) + body = { + "profile_id" => profile_id + }.compact + response = @client.request(method: :post, path: "/sso/logout/authorize", auth: true, body: body, request_options: request_options) + WorkOS::SSOLogoutAuthorizeResponse.new(response.body) + end - parsed_response = JSON.parse(response.body) - connections = parsed_response["data"].map do |connection| - ::WorkOS::Connection.new(connection.to_json) - end + # Get a User Profile + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Profile] + def get_profile(request_options: {}) + response = @client.request(method: :get, path: "/sso/profile", auth: true, request_options: request_options) + WorkOS::Profile.new(response.body) + end - WorkOS::Types::ListStruct.new( - data: connections, - list_metadata: parsed_response["listMetadata"] - ) - end + # Get a Profile and Token + # @param code [String] The authorization code received from the authorization callback. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::SSOTokenResponse] + def get_profile_and_token( + code:, + request_options: {} + ) + body = { + "grant_type" => "authorization_code", + "client_id" => request_options[:client_id] || request_options["client_id"] || @client.client_id, + "client_secret" => request_options[:api_key] || request_options["api_key"] || @client.api_key, + "code" => code + }.compact + response = @client.request(method: :post, path: "/sso/token", auth: true, body: body, request_options: request_options) + WorkOS::SSOTokenResponse.new(response.body) + end - # Get a Connection - # - # @param [String] id Connection unique identifier - # - # @example - # WorkOS::SSO.get_connection(id: 'conn_02DRA1XNSJDZ19A31F183ECQW9') - # => #"connection_domain", - # :id=>"domain_01E6PK9N3XMD8RHWF7S66380AR", - # :domain=>"example.com"}]> - # - # @return [WorkOS::Connection] - def get_connection(id:) - request = get_request( - auth: true, - path: "/connections/#{id}" - ) - - response = execute_request(request: request) - - WorkOS::Connection.new(response.body) + # @oagen-ignore-start — non-spec helpers (hand-maintained) + # H14 — Build an SSO authorization URL (client-side, no HTTP call). + # Overrides the generated method which incorrectly hits the API. + def get_authorization_url(redirect_uri:, client_id: nil, state: nil, connection: nil, + organization: nil, provider: nil, domain_hint: nil, + login_hint: nil, nonce: nil, provider_scopes: nil, + provider_query_params: nil, **) + cid = client_id || @client.client_id + raise ArgumentError, "client_id is required (set on Client or pass explicitly)" if cid.nil? || cid.empty? + params = { + "client_id" => cid, + "redirect_uri" => redirect_uri, + "response_type" => "code", + "state" => state, + "connection" => connection, + "organization" => organization, + "provider" => provider, + "domain_hint" => domain_hint, + "login_hint" => login_hint, + "nonce" => nonce + }.compact + params["provider_scopes"] = Array(provider_scopes).join(",") if provider_scopes + if provider_query_params.is_a?(Hash) && !provider_query_params.empty? + params["provider_query_params"] = JSON.generate(provider_query_params) end + build_url("/sso/authorize", params) + end - # Delete a Connection - # - # @param [String] id Connection unique identifier - # - # @example - # WorkOS::SSO.delete_connection(id: 'conn_02DRA1XNSJDZ19A31F183ECQW9') - # => true - # - # @return [Bool] - returns `true` if successful - def delete_connection(id:) - request = delete_request( - auth: true, - path: "/connections/#{id}" - ) - - response = execute_request(request: request) - - response.is_a? Net::HTTPSuccess - end + # H15 — SSO authorization URL with auto-generated PKCE pair + state. + # Returns [url, code_verifier, state]. + def get_authorization_url_with_pkce(redirect_uri:, client_id: nil, **opts) + pair = WorkOS::PKCE.generate_pair + state = opts.delete(:state) || WorkOS::PKCE.generate_code_verifier + url = get_authorization_url( + redirect_uri: redirect_uri, + client_id: client_id, + state: state, + **opts + ) + url = append_query(url, {"code_challenge" => pair[:code_challenge], "code_challenge_method" => "S256"}) + [url, pair[:code_verifier], state] + end - private + # H16 — Exchange an SSO authorization code for a profile/token, with PKCE + # support for public clients (no client_secret). + def get_profile_and_token_with_pkce(code:, code_verifier:, client_id: nil, request_options: {}) + cid = client_id || @client.client_id + raise ArgumentError, "client_id is required" if cid.nil? || cid.empty? + body = { + "grant_type" => "authorization_code", + "client_id" => cid, + "code" => code, + "code_verifier" => code_verifier + } + response = @client.request(method: :post, path: "/sso/token", auth: false, body: body, request_options: request_options) + WorkOS::SSOTokenResponse.new(response.body) + end - def validate_authorization_url_arguments( - domain:, - provider:, - connection:, - organization: - ) - if [domain, provider, connection, organization].all?(&:nil?) - raise ArgumentError, "Either connection, domain, " \ - "provider, or organization is required." - end + # H17 — Build the SSO logout redirect URL (no HTTP call). + def build_logout_url(token:) + build_url("/sso/logout", {"token" => token}) + end - return unless provider && !PROVIDERS.include?(provider) + private - raise ArgumentError, "#{provider} is not a valid value." \ - " `provider` must be in #{PROVIDERS}" - end + def build_url(path, params) + base = @client.base_url || "https://api.workos.com" + uri = URI.join(base, path) + uri.query = URI.encode_www_form(params) + uri.to_s + end + + def append_query(url, params) + uri = URI(url) + existing = URI.decode_www_form(uri.query || "") + merged = existing + params.to_a + uri.query = URI.encode_www_form(merged) + uri.to_s end + # @oagen-ignore-end end end diff --git a/lib/workos/sso/connection.rb b/lib/workos/sso/connection.rb new file mode 100644 index 00000000..09270b42 --- /dev/null +++ b/lib/workos/sso/connection.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Connection + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + connection_type: :connection_type, + name: :name, + state: :state, + status: :status, + domains: :domains, + options: :options, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + # @!attribute status + # @deprecated Deprecated. Use `state` instead. + + attr_accessor \ + :object, + :id, + :organization_id, + :connection_type, + :name, + :state, + :domains, + :options, + :created_at, + :updated_at + + def status + warn "[DEPRECATION] `status` is deprecated. Deprecated. Use `state` instead.", uplevel: 1, category: :deprecated + @status + end + + attr_writer :status + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @connection_type = hash[:connection_type] + @name = hash[:name] + @state = hash[:state] + @status = hash[:status] + @domains = (hash[:domains] || []).map { |item| item ? WorkOS::ConnectionDomain.new(item) : nil } + @options = hash[:options] ? WorkOS::ConnectionOption.new(hash[:options]) : nil + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/sso/connection_activated.rb b/lib/workos/sso/connection_activated.rb new file mode 100644 index 00000000..859588e2 --- /dev/null +++ b/lib/workos/sso/connection_activated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionActivated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::ConnectionActivatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/sso/connection_activated_data.rb b/lib/workos/sso/connection_activated_data.rb new file mode 100644 index 00000000..ce2c61e2 --- /dev/null +++ b/lib/workos/sso/connection_activated_data.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionActivatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + state: :state, + name: :name, + connection_type: :connection_type, + organization_id: :organization_id, + created_at: :created_at, + updated_at: :updated_at, + external_key: :external_key, + status: :status, + domains: :domains + }.freeze + + attr_accessor \ + :object, + :id, + :state, + :name, + :connection_type, + :organization_id, + :created_at, + :updated_at, + :external_key, + :status, + :domains + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @state = hash[:state] + @name = hash[:name] + @connection_type = hash[:connection_type] + @organization_id = hash[:organization_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @external_key = hash[:external_key] + @status = hash[:status] + @domains = (hash[:domains] || []).map { |item| item ? WorkOS::ConnectionActivatedDataDomain.new(item) : nil } + end + end +end diff --git a/lib/workos/sso/connection_activated_data_domain.rb b/lib/workos/sso/connection_activated_data_domain.rb new file mode 100644 index 00000000..b69b5e97 --- /dev/null +++ b/lib/workos/sso/connection_activated_data_domain.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionActivatedDataDomain + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + domain: :domain + }.freeze + + attr_accessor \ + :object, + :id, + :domain + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @domain = hash[:domain] + end + end +end diff --git a/lib/workos/sso/connection_deactivated.rb b/lib/workos/sso/connection_deactivated.rb new file mode 100644 index 00000000..9d93f48c --- /dev/null +++ b/lib/workos/sso/connection_deactivated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionDeactivated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::ConnectionDeactivatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/sso/connection_deactivated_data.rb b/lib/workos/sso/connection_deactivated_data.rb new file mode 100644 index 00000000..e7f277df --- /dev/null +++ b/lib/workos/sso/connection_deactivated_data.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionDeactivatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + state: :state, + name: :name, + connection_type: :connection_type, + organization_id: :organization_id, + created_at: :created_at, + updated_at: :updated_at, + external_key: :external_key, + status: :status, + domains: :domains + }.freeze + + attr_accessor \ + :object, + :id, + :state, + :name, + :connection_type, + :organization_id, + :created_at, + :updated_at, + :external_key, + :status, + :domains + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @state = hash[:state] + @name = hash[:name] + @connection_type = hash[:connection_type] + @organization_id = hash[:organization_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @external_key = hash[:external_key] + @status = hash[:status] + @domains = (hash[:domains] || []).map { |item| item ? WorkOS::ConnectionDeactivatedDataDomain.new(item) : nil } + end + end +end diff --git a/lib/workos/sso/connection_deactivated_data_domain.rb b/lib/workos/sso/connection_deactivated_data_domain.rb new file mode 100644 index 00000000..5be82d83 --- /dev/null +++ b/lib/workos/sso/connection_deactivated_data_domain.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + ConnectionDeactivatedDataDomain = ConnectionActivatedDataDomain +end diff --git a/lib/workos/sso/connection_deleted.rb b/lib/workos/sso/connection_deleted.rb new file mode 100644 index 00000000..61ab76d1 --- /dev/null +++ b/lib/workos/sso/connection_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::ConnectionDeletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/sso/connection_deleted_data.rb b/lib/workos/sso/connection_deleted_data.rb new file mode 100644 index 00000000..c187d140 --- /dev/null +++ b/lib/workos/sso/connection_deleted_data.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionDeletedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + state: :state, + name: :name, + connection_type: :connection_type, + organization_id: :organization_id, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :state, + :name, + :connection_type, + :organization_id, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @state = hash[:state] + @name = hash[:name] + @connection_type = hash[:connection_type] + @organization_id = hash[:organization_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/sso/connection_domain.rb b/lib/workos/sso/connection_domain.rb new file mode 100644 index 00000000..f934d882 --- /dev/null +++ b/lib/workos/sso/connection_domain.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + ConnectionDomain = ConnectionActivatedDataDomain +end diff --git a/lib/workos/sso/connection_option.rb b/lib/workos/sso/connection_option.rb new file mode 100644 index 00000000..5ede0a81 --- /dev/null +++ b/lib/workos/sso/connection_option.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionOption + include HashProvider + + HASH_ATTRS = { + signing_cert: :signing_cert + }.freeze + + attr_accessor :signing_cert + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @signing_cert = hash[:signing_cert] + end + end +end diff --git a/lib/workos/sso/connection_saml_certificate_renewal_required.rb b/lib/workos/sso/connection_saml_certificate_renewal_required.rb new file mode 100644 index 00000000..ec08027c --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewal_required.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionSAMLCertificateRenewalRequired + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::ConnectionSAMLCertificateRenewalRequiredData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/sso/connection_saml_certificate_renewal_required_data.rb b/lib/workos/sso/connection_saml_certificate_renewal_required_data.rb new file mode 100644 index 00000000..81aeabb5 --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewal_required_data.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionSAMLCertificateRenewalRequiredData + include HashProvider + + HASH_ATTRS = { + connection: :connection, + certificate: :certificate, + days_until_expiry: :days_until_expiry + }.freeze + + attr_accessor \ + :connection, + :certificate, + :days_until_expiry + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @connection = hash[:connection] ? WorkOS::ConnectionSAMLCertificateRenewalRequiredDataConnection.new(hash[:connection]) : nil + @certificate = hash[:certificate] ? WorkOS::ConnectionSAMLCertificateRenewalRequiredDataCertificate.new(hash[:certificate]) : nil + @days_until_expiry = hash[:days_until_expiry] + end + end +end diff --git a/lib/workos/sso/connection_saml_certificate_renewal_required_data_certificate.rb b/lib/workos/sso/connection_saml_certificate_renewal_required_data_certificate.rb new file mode 100644 index 00000000..665f0b74 --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewal_required_data_certificate.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionSAMLCertificateRenewalRequiredDataCertificate + include HashProvider + + HASH_ATTRS = { + certificate_type: :certificate_type, + expiry_date: :expiry_date, + is_expired: :is_expired + }.freeze + + attr_accessor \ + :certificate_type, + :expiry_date, + :is_expired + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @certificate_type = hash[:certificate_type] + @expiry_date = hash[:expiry_date] + @is_expired = hash[:is_expired] + end + end +end diff --git a/lib/workos/sso/connection_saml_certificate_renewal_required_data_connection.rb b/lib/workos/sso/connection_saml_certificate_renewal_required_data_connection.rb new file mode 100644 index 00000000..4e145b5c --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewal_required_data_connection.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionSAMLCertificateRenewalRequiredDataConnection + include HashProvider + + HASH_ATTRS = { + id: :id, + organization_id: :organization_id + }.freeze + + attr_accessor \ + :id, + :organization_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @organization_id = hash[:organization_id] + end + end +end diff --git a/lib/workos/sso/connection_saml_certificate_renewed.rb b/lib/workos/sso/connection_saml_certificate_renewed.rb new file mode 100644 index 00000000..a5cb2e38 --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionSAMLCertificateRenewed + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::ConnectionSAMLCertificateRenewedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/sso/connection_saml_certificate_renewed_data.rb b/lib/workos/sso/connection_saml_certificate_renewed_data.rb new file mode 100644 index 00000000..4301faad --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewed_data.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionSAMLCertificateRenewedData + include HashProvider + + HASH_ATTRS = { + connection: :connection, + certificate: :certificate, + renewed_at: :renewed_at + }.freeze + + attr_accessor \ + :connection, + :certificate, + :renewed_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @connection = hash[:connection] ? WorkOS::ConnectionSAMLCertificateRenewedDataConnection.new(hash[:connection]) : nil + @certificate = hash[:certificate] ? WorkOS::ConnectionSAMLCertificateRenewedDataCertificate.new(hash[:certificate]) : nil + @renewed_at = hash[:renewed_at] + end + end +end diff --git a/lib/workos/sso/connection_saml_certificate_renewed_data_certificate.rb b/lib/workos/sso/connection_saml_certificate_renewed_data_certificate.rb new file mode 100644 index 00000000..9af47f3e --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewed_data_certificate.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ConnectionSAMLCertificateRenewedDataCertificate + include HashProvider + + HASH_ATTRS = { + certificate_type: :certificate_type, + expiry_date: :expiry_date + }.freeze + + attr_accessor \ + :certificate_type, + :expiry_date + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @certificate_type = hash[:certificate_type] + @expiry_date = hash[:expiry_date] + end + end +end diff --git a/lib/workos/sso/connection_saml_certificate_renewed_data_connection.rb b/lib/workos/sso/connection_saml_certificate_renewed_data_connection.rb new file mode 100644 index 00000000..f38d74b9 --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewed_data_connection.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + ConnectionSAMLCertificateRenewedDataConnection = ConnectionSAMLCertificateRenewalRequiredDataConnection +end diff --git a/lib/workos/sso/profile.rb b/lib/workos/sso/profile.rb new file mode 100644 index 00000000..b3a6b220 --- /dev/null +++ b/lib/workos/sso/profile.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Profile + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + organization_id: :organization_id, + connection_id: :connection_id, + connection_type: :connection_type, + idp_id: :idp_id, + email: :email, + first_name: :first_name, + last_name: :last_name, + role: :role, + roles: :roles, + groups: :groups, + custom_attributes: :custom_attributes, + raw_attributes: :raw_attributes + }.freeze + + attr_accessor \ + :object, + :id, + :organization_id, + :connection_id, + :connection_type, + :idp_id, + :email, + :first_name, + :last_name, + :role, + :roles, + :groups, + :custom_attributes, + :raw_attributes + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @organization_id = hash[:organization_id] + @connection_id = hash[:connection_id] + @connection_type = hash[:connection_type] + @idp_id = hash[:idp_id] + @email = hash[:email] + @first_name = hash[:first_name] + @last_name = hash[:last_name] + @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @roles = (hash[:roles] || []).map { |item| item ? WorkOS::SlimRole.new(item) : nil } + @groups = hash[:groups] || [] + @custom_attributes = hash[:custom_attributes] || {} + @raw_attributes = hash[:raw_attributes] || {} + end + end +end diff --git a/lib/workos/sso/sso_authorize_url_response.rb b/lib/workos/sso/sso_authorize_url_response.rb new file mode 100644 index 00000000..7ffa787a --- /dev/null +++ b/lib/workos/sso/sso_authorize_url_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SSOAuthorizeUrlResponse + include HashProvider + + HASH_ATTRS = { + url: :url + }.freeze + + attr_accessor :url + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @url = hash[:url] + end + end +end diff --git a/lib/workos/sso/sso_logout_authorize_request.rb b/lib/workos/sso/sso_logout_authorize_request.rb new file mode 100644 index 00000000..30982a70 --- /dev/null +++ b/lib/workos/sso/sso_logout_authorize_request.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SSOLogoutAuthorizeRequest + include HashProvider + + HASH_ATTRS = { + profile_id: :profile_id + }.freeze + + attr_accessor :profile_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @profile_id = hash[:profile_id] + end + end +end diff --git a/lib/workos/sso/sso_logout_authorize_response.rb b/lib/workos/sso/sso_logout_authorize_response.rb new file mode 100644 index 00000000..3557cd8a --- /dev/null +++ b/lib/workos/sso/sso_logout_authorize_response.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SSOLogoutAuthorizeResponse + include HashProvider + + HASH_ATTRS = { + logout_url: :logout_url, + logout_token: :logout_token + }.freeze + + attr_accessor \ + :logout_url, + :logout_token + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @logout_url = hash[:logout_url] + @logout_token = hash[:logout_token] + end + end +end diff --git a/lib/workos/sso/sso_token_response.rb b/lib/workos/sso/sso_token_response.rb new file mode 100644 index 00000000..c7eec9f4 --- /dev/null +++ b/lib/workos/sso/sso_token_response.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SSOTokenResponse + include HashProvider + + HASH_ATTRS = { + token_type: :token_type, + access_token: :access_token, + expires_in: :expires_in, + profile: :profile, + oauth_tokens: :oauth_tokens + }.freeze + + attr_accessor \ + :token_type, + :access_token, + :expires_in, + :profile, + :oauth_tokens + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @token_type = hash[:token_type] + @access_token = hash[:access_token] + @expires_in = hash[:expires_in] + @profile = hash[:profile] ? WorkOS::Profile.new(hash[:profile]) : nil + @oauth_tokens = hash[:oauth_tokens] ? WorkOS::SSOTokenResponseOAuthToken.new(hash[:oauth_tokens]) : nil + end + end +end diff --git a/lib/workos/sso/sso_token_response_oauth_token.rb b/lib/workos/sso/sso_token_response_oauth_token.rb new file mode 100644 index 00000000..d09b2278 --- /dev/null +++ b/lib/workos/sso/sso_token_response_oauth_token.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + SSOTokenResponseOAuthToken = AuthenticateResponseOAuthToken +end diff --git a/lib/workos/sso/token_query.rb b/lib/workos/sso/token_query.rb new file mode 100644 index 00000000..659b74c2 --- /dev/null +++ b/lib/workos/sso/token_query.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class TokenQuery + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + client_secret: :client_secret, + code: :code, + grant_type: :grant_type + }.freeze + + attr_accessor \ + :client_id, + :client_secret, + :code, + :grant_type + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @client_secret = hash[:client_secret] + @code = hash[:code] + @grant_type = hash[:grant_type] + end + end +end diff --git a/lib/workos/types.rb b/lib/workos/types.rb deleted file mode 100644 index 4a91d299..00000000 --- a/lib/workos/types.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # Types contains a few structs wrapping up common data structures. - module Types - autoload :Provider, "workos/types/provider" - autoload :Intent, "workos/types/intent" - autoload :ListStruct, "workos/types/list_struct" - autoload :PasswordlessSessionStruct, "workos/types/passwordless_session_struct" - autoload :WidgetScope, "workos/types/widget_scope" - end -end diff --git a/lib/workos/types/applications_order.rb b/lib/workos/types/applications_order.rb new file mode 100644 index 00000000..08123a6d --- /dev/null +++ b/lib/workos/types/applications_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ApplicationsOrder = EventsOrder + end +end diff --git a/lib/workos/types/audit_log_configuration_log_stream_state.rb b/lib/workos/types/audit_log_configuration_log_stream_state.rb new file mode 100644 index 00000000..8bb178fd --- /dev/null +++ b/lib/workos/types/audit_log_configuration_log_stream_state.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class AuditLogConfigurationLogStreamState + ACTIVE = "active" + INACTIVE = "inactive" + ERROR = "error" + INVALID = "invalid" + ALL = [ACTIVE, INACTIVE, ERROR, INVALID].freeze + end + end +end diff --git a/lib/workos/types/audit_log_configuration_log_stream_type.rb b/lib/workos/types/audit_log_configuration_log_stream_type.rb new file mode 100644 index 00000000..4cfaa09a --- /dev/null +++ b/lib/workos/types/audit_log_configuration_log_stream_type.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class AuditLogConfigurationLogStreamType + AZURE_SENTINEL = "AzureSentinel" + DATADOG = "Datadog" + GENERIC_HTTPS = "GenericHttps" + GOOGLE_CLOUD_STORAGE = "GoogleCloudStorage" + S_3 = "S3" + SPLUNK = "Splunk" + ALL = [AZURE_SENTINEL, DATADOG, GENERIC_HTTPS, GOOGLE_CLOUD_STORAGE, S_3, SPLUNK].freeze + end + end +end diff --git a/lib/workos/types/audit_log_configuration_state.rb b/lib/workos/types/audit_log_configuration_state.rb new file mode 100644 index 00000000..dd2c59b5 --- /dev/null +++ b/lib/workos/types/audit_log_configuration_state.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class AuditLogConfigurationState + ACTIVE = "active" + INACTIVE = "inactive" + DISABLED = "disabled" + ALL = [ACTIVE, INACTIVE, DISABLED].freeze + end + end +end diff --git a/lib/workos/types/audit_log_export_state.rb b/lib/workos/types/audit_log_export_state.rb new file mode 100644 index 00000000..e3943091 --- /dev/null +++ b/lib/workos/types/audit_log_export_state.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class AuditLogExportState + PENDING = "pending" + READY = "ready" + ERROR = "error" + ALL = [PENDING, READY, ERROR].freeze + end + end +end diff --git a/lib/workos/types/audit_logs_order.rb b/lib/workos/types/audit_logs_order.rb new file mode 100644 index 00000000..01b459f2 --- /dev/null +++ b/lib/workos/types/audit_logs_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + AuditLogsOrder = EventsOrder + end +end diff --git a/lib/workos/types/authenticate_response_authentication_method.rb b/lib/workos/types/authenticate_response_authentication_method.rb new file mode 100644 index 00000000..893679bc --- /dev/null +++ b/lib/workos/types/authenticate_response_authentication_method.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class AuthenticateResponseAuthenticationMethod + SSO = "SSO" + PASSWORD = "Password" + PASSKEY = "Passkey" + APPLE_OAUTH = "AppleOAuth" + BITBUCKET_OAUTH = "BitbucketOAuth" + CROSS_APP_AUTH = "CrossAppAuth" + DISCORD_OAUTH = "DiscordOAuth" + EXTERNAL_AUTH = "ExternalAuth" + GIT_HUB_OAUTH = "GitHubOAuth" + GIT_LAB_OAUTH = "GitLabOAuth" + GOOGLE_OAUTH = "GoogleOAuth" + INTUIT_OAUTH = "IntuitOAuth" + LINKED_IN_OAUTH = "LinkedInOAuth" + MICROSOFT_OAUTH = "MicrosoftOAuth" + SALESFORCE_OAUTH = "SalesforceOAuth" + SLACK_OAUTH = "SlackOAuth" + VERCEL_MARKETPLACE_OAUTH = "VercelMarketplaceOAuth" + VERCEL_OAUTH = "VercelOAuth" + XERO_OAUTH = "XeroOAuth" + MAGIC_AUTH = "MagicAuth" + IMPERSONATION = "Impersonation" + MIGRATED_SESSION = "MigratedSession" + ALL = [SSO, PASSWORD, PASSKEY, APPLE_OAUTH, BITBUCKET_OAUTH, CROSS_APP_AUTH, DISCORD_OAUTH, EXTERNAL_AUTH, GIT_HUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, INTUIT_OAUTH, LINKED_IN_OAUTH, MICROSOFT_OAUTH, SALESFORCE_OAUTH, SLACK_OAUTH, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, XERO_OAUTH, MAGIC_AUTH, IMPERSONATION, MIGRATED_SESSION].freeze + end + end +end diff --git a/lib/workos/types/authentication_factor_enrolled_type.rb b/lib/workos/types/authentication_factor_enrolled_type.rb new file mode 100644 index 00000000..cb488016 --- /dev/null +++ b/lib/workos/types/authentication_factor_enrolled_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + AuthenticationFactorEnrolledType = AuthenticationFactorType + end +end diff --git a/lib/workos/types/authentication_factor_type.rb b/lib/workos/types/authentication_factor_type.rb new file mode 100644 index 00000000..a35f4a72 --- /dev/null +++ b/lib/workos/types/authentication_factor_type.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class AuthenticationFactorType + GENERIC_OTP = "generic_otp" + SMS = "sms" + TOTP = "totp" + WEBAUTHN = "webauthn" + ALL = [GENERIC_OTP, SMS, TOTP, WEBAUTHN].freeze + end + end +end diff --git a/lib/workos/types/authentication_factors_create_request_type.rb b/lib/workos/types/authentication_factors_create_request_type.rb new file mode 100644 index 00000000..bc32ddd0 --- /dev/null +++ b/lib/workos/types/authentication_factors_create_request_type.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class AuthenticationFactorsCreateRequestType + GENERIC_OTP = "generic_otp" + SMS = "sms" + TOTP = "totp" + ALL = [GENERIC_OTP, SMS, TOTP].freeze + end + end +end diff --git a/lib/workos/types/authentication_radar_risk_detected_data_action.rb b/lib/workos/types/authentication_radar_risk_detected_data_action.rb new file mode 100644 index 00000000..8d446618 --- /dev/null +++ b/lib/workos/types/authentication_radar_risk_detected_data_action.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class AuthenticationRadarRiskDetectedDataAction + SIGNUP = "signup" + LOGIN = "login" + ALL = [SIGNUP, LOGIN].freeze + end + end +end diff --git a/lib/workos/types/authorization_assignment.rb b/lib/workos/types/authorization_assignment.rb new file mode 100644 index 00000000..1c15d6cd --- /dev/null +++ b/lib/workos/types/authorization_assignment.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class AuthorizationAssignment + DIRECT = "direct" + INDIRECT = "indirect" + ALL = [DIRECT, INDIRECT].freeze + end + end +end diff --git a/lib/workos/types/authorization_order.rb b/lib/workos/types/authorization_order.rb new file mode 100644 index 00000000..3b763346 --- /dev/null +++ b/lib/workos/types/authorization_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + AuthorizationOrder = EventsOrder + end +end diff --git a/lib/workos/types/connected_account_state.rb b/lib/workos/types/connected_account_state.rb new file mode 100644 index 00000000..766f6c5a --- /dev/null +++ b/lib/workos/types/connected_account_state.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class ConnectedAccountState + CONNECTED = "connected" + NEEDS_REAUTHORIZATION = "needs_reauthorization" + DISCONNECTED = "disconnected" + ALL = [CONNECTED, NEEDS_REAUTHORIZATION, DISCONNECTED].freeze + end + end +end diff --git a/lib/workos/types/connection_activated_data_connection_type.rb b/lib/workos/types/connection_activated_data_connection_type.rb new file mode 100644 index 00000000..ba2ec204 --- /dev/null +++ b/lib/workos/types/connection_activated_data_connection_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ConnectionActivatedDataConnectionType = ConnectionDeletedDataConnectionType + end +end diff --git a/lib/workos/types/connection_activated_data_state.rb b/lib/workos/types/connection_activated_data_state.rb new file mode 100644 index 00000000..f9feeefb --- /dev/null +++ b/lib/workos/types/connection_activated_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ConnectionActivatedDataState = ConnectionDeletedDataState + end +end diff --git a/lib/workos/types/connection_activated_data_status.rb b/lib/workos/types/connection_activated_data_status.rb new file mode 100644 index 00000000..16238bc0 --- /dev/null +++ b/lib/workos/types/connection_activated_data_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ConnectionActivatedDataStatus = ConnectionStatus + end +end diff --git a/lib/workos/types/connection_deactivated_data_connection_type.rb b/lib/workos/types/connection_deactivated_data_connection_type.rb new file mode 100644 index 00000000..63110f3a --- /dev/null +++ b/lib/workos/types/connection_deactivated_data_connection_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ConnectionDeactivatedDataConnectionType = ConnectionDeletedDataConnectionType + end +end diff --git a/lib/workos/types/connection_deactivated_data_state.rb b/lib/workos/types/connection_deactivated_data_state.rb new file mode 100644 index 00000000..cef596f0 --- /dev/null +++ b/lib/workos/types/connection_deactivated_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ConnectionDeactivatedDataState = ConnectionDeletedDataState + end +end diff --git a/lib/workos/types/connection_deactivated_data_status.rb b/lib/workos/types/connection_deactivated_data_status.rb new file mode 100644 index 00000000..7ee9904c --- /dev/null +++ b/lib/workos/types/connection_deactivated_data_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ConnectionDeactivatedDataStatus = ConnectionStatus + end +end diff --git a/lib/workos/types/connection_deleted_data_connection_type.rb b/lib/workos/types/connection_deleted_data_connection_type.rb new file mode 100644 index 00000000..971d8c06 --- /dev/null +++ b/lib/workos/types/connection_deleted_data_connection_type.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class ConnectionDeletedDataConnectionType + ADFSSAML = "ADFSSAML" + ADP_OIDC = "AdpOidc" + APPLE_OAUTH = "AppleOAuth" + AUTH_0_MIGRATION = "Auth0Migration" + AUTH_0_SAML = "Auth0SAML" + AZURE_SAML = "AzureSAML" + BITBUCKET_OAUTH = "BitbucketOAuth" + CAS_SAML = "CasSAML" + CLASS_LINK_SAML = "ClassLinkSAML" + CLEVER_OIDC = "CleverOIDC" + CLOUDFLARE_SAML = "CloudflareSAML" + CYBER_ARK_SAML = "CyberArkSAML" + DISCORD_OAUTH = "DiscordOAuth" + DUO_SAML = "DuoSAML" + ENTRA_ID_OIDC = "EntraIdOIDC" + GENERIC_OIDC = "GenericOIDC" + GENERIC_SAML = "GenericSAML" + GIT_HUB_OAUTH = "GitHubOAuth" + GIT_LAB_OAUTH = "GitLabOAuth" + GOOGLE_OAUTH = "GoogleOAuth" + GOOGLE_OIDC = "GoogleOIDC" + GOOGLE_SAML = "GoogleSAML" + INTUIT_OAUTH = "IntuitOAuth" + JUMP_CLOUD_SAML = "JumpCloudSAML" + KEYCLOAK_SAML = "KeycloakSAML" + LAST_PASS_SAML = "LastPassSAML" + LINKED_IN_OAUTH = "LinkedInOAuth" + LOGIN_GOV_OIDC = "LoginGovOidc" + MAGIC_LINK = "MagicLink" + MICROSOFT_OAUTH = "MicrosoftOAuth" + MINI_ORANGE_SAML = "MiniOrangeSAML" + NET_IQ_SAML = "NetIqSAML" + OKTA_OIDC = "OktaOIDC" + OKTA_SAML = "OktaSAML" + ONE_LOGIN_SAML = "OneLoginSAML" + ORACLE_SAML = "OracleSAML" + PING_FEDERATE_SAML = "PingFederateSAML" + PING_ONE_SAML = "PingOneSAML" + RIPPLING_SAML = "RipplingSAML" + SALESFORCE_SAML = "SalesforceSAML" + SHIBBOLETH_GENERIC_SAML = "ShibbolethGenericSAML" + SHIBBOLETH_SAML = "ShibbolethSAML" + SIMPLE_SAML_PHP_SAML = "SimpleSamlPhpSAML" + SALESFORCE_OAUTH = "SalesforceOAuth" + SLACK_OAUTH = "SlackOAuth" + TEST_IDP = "TestIdp" + VERCEL_MARKETPLACE_OAUTH = "VercelMarketplaceOAuth" + VERCEL_OAUTH = "VercelOAuth" + V_MWARE_SAML = "VMwareSAML" + XERO_OAUTH = "XeroOAuth" + ALL = [ADFSSAML, ADP_OIDC, APPLE_OAUTH, AUTH_0_MIGRATION, AUTH_0_SAML, AZURE_SAML, BITBUCKET_OAUTH, CAS_SAML, CLASS_LINK_SAML, CLEVER_OIDC, CLOUDFLARE_SAML, CYBER_ARK_SAML, DISCORD_OAUTH, DUO_SAML, ENTRA_ID_OIDC, GENERIC_OIDC, GENERIC_SAML, GIT_HUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GOOGLE_OIDC, GOOGLE_SAML, INTUIT_OAUTH, JUMP_CLOUD_SAML, KEYCLOAK_SAML, LAST_PASS_SAML, LINKED_IN_OAUTH, LOGIN_GOV_OIDC, MAGIC_LINK, MICROSOFT_OAUTH, MINI_ORANGE_SAML, NET_IQ_SAML, OKTA_OIDC, OKTA_SAML, ONE_LOGIN_SAML, ORACLE_SAML, PING_FEDERATE_SAML, PING_ONE_SAML, RIPPLING_SAML, SALESFORCE_SAML, SHIBBOLETH_GENERIC_SAML, SHIBBOLETH_SAML, SIMPLE_SAML_PHP_SAML, SALESFORCE_OAUTH, SLACK_OAUTH, TEST_IDP, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, V_MWARE_SAML, XERO_OAUTH].freeze + end + end +end diff --git a/lib/workos/types/connection_deleted_data_state.rb b/lib/workos/types/connection_deleted_data_state.rb new file mode 100644 index 00000000..b0f16df0 --- /dev/null +++ b/lib/workos/types/connection_deleted_data_state.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class ConnectionDeletedDataState + DRAFT = "draft" + ACTIVE = "active" + VALIDATING = "validating" + INACTIVE = "inactive" + DELETING = "deleting" + ALL = [DRAFT, ACTIVE, VALIDATING, INACTIVE, DELETING].freeze + end + end +end diff --git a/lib/workos/types/connection_saml_certificate_renewal_required_data_certificate_certificate_type.rb b/lib/workos/types/connection_saml_certificate_renewal_required_data_certificate_certificate_type.rb new file mode 100644 index 00000000..77fa1203 --- /dev/null +++ b/lib/workos/types/connection_saml_certificate_renewal_required_data_certificate_certificate_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType = ConnectionSAMLCertificateRenewedDataCertificateCertificateType + end +end diff --git a/lib/workos/types/connection_saml_certificate_renewed_data_certificate_certificate_type.rb b/lib/workos/types/connection_saml_certificate_renewed_data_certificate_certificate_type.rb new file mode 100644 index 00000000..dc1945d8 --- /dev/null +++ b/lib/workos/types/connection_saml_certificate_renewed_data_certificate_certificate_type.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class ConnectionSAMLCertificateRenewedDataCertificateCertificateType + RESPONSE_SIGNING = "ResponseSigning" + REQUEST_SIGNING = "RequestSigning" + RESPONSE_ENCRYPTION = "ResponseEncryption" + ALL = [RESPONSE_SIGNING, REQUEST_SIGNING, RESPONSE_ENCRYPTION].freeze + end + end +end diff --git a/lib/workos/types/connection_state.rb b/lib/workos/types/connection_state.rb new file mode 100644 index 00000000..27ca264d --- /dev/null +++ b/lib/workos/types/connection_state.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class ConnectionState + REQUIRES_TYPE = "requires_type" + DRAFT = "draft" + ACTIVE = "active" + VALIDATING = "validating" + INACTIVE = "inactive" + DELETING = "deleting" + ALL = [REQUIRES_TYPE, DRAFT, ACTIVE, VALIDATING, INACTIVE, DELETING].freeze + end + end +end diff --git a/lib/workos/types/connection_status.rb b/lib/workos/types/connection_status.rb new file mode 100644 index 00000000..3be6c1a3 --- /dev/null +++ b/lib/workos/types/connection_status.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class ConnectionStatus + LINKED = "linked" + UNLINKED = "unlinked" + ALL = [LINKED, UNLINKED].freeze + end + end +end diff --git a/lib/workos/types/connection_type.rb b/lib/workos/types/connection_type.rb new file mode 100644 index 00000000..c377e7f3 --- /dev/null +++ b/lib/workos/types/connection_type.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class ConnectionType + PENDING = "Pending" + ADFSSAML = "ADFSSAML" + ADP_OIDC = "AdpOidc" + APPLE_OAUTH = "AppleOAuth" + AUTH_0_MIGRATION = "Auth0Migration" + AUTH_0_SAML = "Auth0SAML" + AZURE_SAML = "AzureSAML" + BITBUCKET_OAUTH = "BitbucketOAuth" + CAS_SAML = "CasSAML" + CLASS_LINK_SAML = "ClassLinkSAML" + CLEVER_OIDC = "CleverOIDC" + CLOUDFLARE_SAML = "CloudflareSAML" + CYBER_ARK_SAML = "CyberArkSAML" + DISCORD_OAUTH = "DiscordOAuth" + DUO_SAML = "DuoSAML" + ENTRA_ID_OIDC = "EntraIdOIDC" + GENERIC_OIDC = "GenericOIDC" + GENERIC_SAML = "GenericSAML" + GIT_HUB_OAUTH = "GitHubOAuth" + GIT_LAB_OAUTH = "GitLabOAuth" + GOOGLE_OAUTH = "GoogleOAuth" + GOOGLE_OIDC = "GoogleOIDC" + GOOGLE_SAML = "GoogleSAML" + INTUIT_OAUTH = "IntuitOAuth" + JUMP_CLOUD_SAML = "JumpCloudSAML" + KEYCLOAK_SAML = "KeycloakSAML" + LAST_PASS_SAML = "LastPassSAML" + LINKED_IN_OAUTH = "LinkedInOAuth" + LOGIN_GOV_OIDC = "LoginGovOidc" + MAGIC_LINK = "MagicLink" + MICROSOFT_OAUTH = "MicrosoftOAuth" + MINI_ORANGE_SAML = "MiniOrangeSAML" + NET_IQ_SAML = "NetIqSAML" + OKTA_OIDC = "OktaOIDC" + OKTA_SAML = "OktaSAML" + ONE_LOGIN_SAML = "OneLoginSAML" + ORACLE_SAML = "OracleSAML" + PING_FEDERATE_SAML = "PingFederateSAML" + PING_ONE_SAML = "PingOneSAML" + RIPPLING_SAML = "RipplingSAML" + SALESFORCE_SAML = "SalesforceSAML" + SHIBBOLETH_GENERIC_SAML = "ShibbolethGenericSAML" + SHIBBOLETH_SAML = "ShibbolethSAML" + SIMPLE_SAML_PHP_SAML = "SimpleSamlPhpSAML" + SALESFORCE_OAUTH = "SalesforceOAuth" + SLACK_OAUTH = "SlackOAuth" + TEST_IDP = "TestIdp" + VERCEL_MARKETPLACE_OAUTH = "VercelMarketplaceOAuth" + VERCEL_OAUTH = "VercelOAuth" + V_MWARE_SAML = "VMwareSAML" + XERO_OAUTH = "XeroOAuth" + ALL = [PENDING, ADFSSAML, ADP_OIDC, APPLE_OAUTH, AUTH_0_MIGRATION, AUTH_0_SAML, AZURE_SAML, BITBUCKET_OAUTH, CAS_SAML, CLASS_LINK_SAML, CLEVER_OIDC, CLOUDFLARE_SAML, CYBER_ARK_SAML, DISCORD_OAUTH, DUO_SAML, ENTRA_ID_OIDC, GENERIC_OIDC, GENERIC_SAML, GIT_HUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GOOGLE_OIDC, GOOGLE_SAML, INTUIT_OAUTH, JUMP_CLOUD_SAML, KEYCLOAK_SAML, LAST_PASS_SAML, LINKED_IN_OAUTH, LOGIN_GOV_OIDC, MAGIC_LINK, MICROSOFT_OAUTH, MINI_ORANGE_SAML, NET_IQ_SAML, OKTA_OIDC, OKTA_SAML, ONE_LOGIN_SAML, ORACLE_SAML, PING_FEDERATE_SAML, PING_ONE_SAML, RIPPLING_SAML, SALESFORCE_SAML, SHIBBOLETH_GENERIC_SAML, SHIBBOLETH_SAML, SIMPLE_SAML_PHP_SAML, SALESFORCE_OAUTH, SLACK_OAUTH, TEST_IDP, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, V_MWARE_SAML, XERO_OAUTH].freeze + end + end +end diff --git a/lib/workos/types/connections_connection_type.rb b/lib/workos/types/connections_connection_type.rb new file mode 100644 index 00000000..8854a289 --- /dev/null +++ b/lib/workos/types/connections_connection_type.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class ConnectionsConnectionType + ADFSSAML = "ADFSSAML" + ADP_OIDC = "AdpOidc" + APPLE_OAUTH = "AppleOAuth" + AUTH_0_SAML = "Auth0SAML" + AZURE_SAML = "AzureSAML" + BITBUCKET_OAUTH = "BitbucketOAuth" + CAS_SAML = "CasSAML" + CLOUDFLARE_SAML = "CloudflareSAML" + CLASS_LINK_SAML = "ClassLinkSAML" + CLEVER_OIDC = "CleverOIDC" + CYBER_ARK_SAML = "CyberArkSAML" + DISCORD_OAUTH = "DiscordOAuth" + DUO_SAML = "DuoSAML" + ENTRA_ID_OIDC = "EntraIdOIDC" + GENERIC_OIDC = "GenericOIDC" + GENERIC_SAML = "GenericSAML" + GITHUB_OAUTH = "GithubOAuth" + GIT_LAB_OAUTH = "GitLabOAuth" + GOOGLE_OAUTH = "GoogleOAuth" + GOOGLE_OIDC = "GoogleOIDC" + GOOGLE_SAML = "GoogleSAML" + INTUIT_OAUTH = "IntuitOAuth" + JUMP_CLOUD_SAML = "JumpCloudSAML" + KEYCLOAK_SAML = "KeycloakSAML" + LAST_PASS_SAML = "LastPassSAML" + LINKED_IN_OAUTH = "LinkedInOAuth" + LOGIN_GOV_OIDC = "LoginGovOidc" + MAGIC_LINK = "MagicLink" + MICROSOFT_OAUTH = "MicrosoftOAuth" + MINI_ORANGE_SAML = "MiniOrangeSAML" + NET_IQ_SAML = "NetIqSAML" + OKTA_OIDC = "OktaOIDC" + OKTA_SAML = "OktaSAML" + ONE_LOGIN_SAML = "OneLoginSAML" + ORACLE_SAML = "OracleSAML" + PING_FEDERATE_SAML = "PingFederateSAML" + PING_ONE_SAML = "PingOneSAML" + RIPPLING_SAML = "RipplingSAML" + SALESFORCE_SAML = "SalesforceSAML" + SHIBBOLETH_GENERIC_SAML = "ShibbolethGenericSAML" + SHIBBOLETH_SAML = "ShibbolethSAML" + SIMPLE_SAML_PHP_SAML = "SimpleSamlPhpSAML" + SALESFORCE_OAUTH = "SalesforceOAuth" + SLACK_OAUTH = "SlackOAuth" + VERCEL_MARKETPLACE_OAUTH = "VercelMarketplaceOAuth" + VERCEL_OAUTH = "VercelOAuth" + V_MWARE_SAML = "VMwareSAML" + XERO_OAUTH = "XeroOAuth" + ALL = [ADFSSAML, ADP_OIDC, APPLE_OAUTH, AUTH_0_SAML, AZURE_SAML, BITBUCKET_OAUTH, CAS_SAML, CLOUDFLARE_SAML, CLASS_LINK_SAML, CLEVER_OIDC, CYBER_ARK_SAML, DISCORD_OAUTH, DUO_SAML, ENTRA_ID_OIDC, GENERIC_OIDC, GENERIC_SAML, GITHUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GOOGLE_OIDC, GOOGLE_SAML, INTUIT_OAUTH, JUMP_CLOUD_SAML, KEYCLOAK_SAML, LAST_PASS_SAML, LINKED_IN_OAUTH, LOGIN_GOV_OIDC, MAGIC_LINK, MICROSOFT_OAUTH, MINI_ORANGE_SAML, NET_IQ_SAML, OKTA_OIDC, OKTA_SAML, ONE_LOGIN_SAML, ORACLE_SAML, PING_FEDERATE_SAML, PING_ONE_SAML, RIPPLING_SAML, SALESFORCE_SAML, SHIBBOLETH_GENERIC_SAML, SHIBBOLETH_SAML, SIMPLE_SAML_PHP_SAML, SALESFORCE_OAUTH, SLACK_OAUTH, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, V_MWARE_SAML, XERO_OAUTH].freeze + end + end +end diff --git a/lib/workos/types/connections_order.rb b/lib/workos/types/connections_order.rb new file mode 100644 index 00000000..793d2a42 --- /dev/null +++ b/lib/workos/types/connections_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ConnectionsOrder = EventsOrder + end +end diff --git a/lib/workos/types/create_user_invite_options_locale.rb b/lib/workos/types/create_user_invite_options_locale.rb new file mode 100644 index 00000000..1c367723 --- /dev/null +++ b/lib/workos/types/create_user_invite_options_locale.rb @@ -0,0 +1,101 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class CreateUserInviteOptionsLocale + AF = "af" + AM = "am" + AR = "ar" + BG = "bg" + BN = "bn" + BS = "bs" + CA = "ca" + CS = "cs" + DA = "da" + DE = "de" + DE_DE = "de-DE" + EL = "el" + EN = "en" + EN_AU = "en-AU" + EN_CA = "en-CA" + EN_GB = "en-GB" + EN_US = "en-US" + ES = "es" + ES_419 = "es-419" + ES_ES = "es-ES" + ES_US = "es-US" + ET = "et" + FA = "fa" + FI = "fi" + FIL = "fil" + FR = "fr" + FR_BE = "fr-BE" + FR_CA = "fr-CA" + FR_FR = "fr-FR" + FY = "fy" + GL = "gl" + GU = "gu" + HA = "ha" + HE = "he" + HI = "hi" + HR = "hr" + HU = "hu" + HY = "hy" + ID = "id" + IS = "is" + IT = "it" + IT_IT = "it-IT" + JA = "ja" + JV = "jv" + KA = "ka" + KK = "kk" + KM = "km" + KN = "kn" + KO = "ko" + LT = "lt" + LV = "lv" + MK = "mk" + ML = "ml" + MN = "mn" + MR = "mr" + MS = "ms" + MY = "my" + NB = "nb" + NE = "ne" + NL = "nl" + NL_BE = "nl-BE" + NL_NL = "nl-NL" + NN = "nn" + NO = "no" + PA = "pa" + PL = "pl" + PT = "pt" + PT_BR = "pt-BR" + PT_PT = "pt-PT" + RO = "ro" + RU = "ru" + SK = "sk" + SL = "sl" + SQ = "sq" + SR = "sr" + SV = "sv" + SW = "sw" + TA = "ta" + TE = "te" + TH = "th" + TR = "tr" + UK = "uk" + UR = "ur" + UZ = "uz" + VI = "vi" + ZH = "zh" + ZH_CN = "zh-CN" + ZH_HK = "zh-HK" + ZH_TW = "zh-TW" + ZU = "zu" + ALL = [AF, AM, AR, BG, BN, BS, CA, CS, DA, DE, DE_DE, EL, EN, EN_AU, EN_CA, EN_GB, EN_US, ES, ES_419, ES_ES, ES_US, ET, FA, FI, FIL, FR, FR_BE, FR_CA, FR_FR, FY, GL, GU, HA, HE, HI, HR, HU, HY, ID, IS, IT, IT_IT, JA, JV, KA, KK, KM, KN, KO, LT, LV, MK, ML, MN, MR, MS, MY, NB, NE, NL, NL_BE, NL_NL, NN, NO, PA, PL, PT, PT_BR, PT_PT, RO, RU, SK, SL, SQ, SR, SV, SW, TA, TE, TH, TR, UK, UR, UZ, VI, ZH, ZH_CN, ZH_HK, ZH_TW, ZU].freeze + end + end +end diff --git a/lib/workos/types/create_user_password_hash_type.rb b/lib/workos/types/create_user_password_hash_type.rb new file mode 100644 index 00000000..03935620 --- /dev/null +++ b/lib/workos/types/create_user_password_hash_type.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class CreateUserPasswordHashType + BCRYPT = "bcrypt" + FIREBASE_SCRYPT = "firebase-scrypt" + SSHA = "ssha" + SCRYPT = "scrypt" + PBKDF_2 = "pbkdf2" + ARGON_2 = "argon2" + ALL = [BCRYPT, FIREBASE_SCRYPT, SSHA, SCRYPT, PBKDF_2, ARGON_2].freeze + end + end +end diff --git a/lib/workos/types/create_webhook_endpoint_events.rb b/lib/workos/types/create_webhook_endpoint_events.rb new file mode 100644 index 00000000..035a6845 --- /dev/null +++ b/lib/workos/types/create_webhook_endpoint_events.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class CreateWebhookEndpointEvents + AUTHENTICATION_EMAIL_VERIFICATION_SUCCEEDED = "authentication.email_verification_succeeded" + AUTHENTICATION_MAGIC_AUTH_FAILED = "authentication.magic_auth_failed" + AUTHENTICATION_MAGIC_AUTH_SUCCEEDED = "authentication.magic_auth_succeeded" + AUTHENTICATION_MFA_SUCCEEDED = "authentication.mfa_succeeded" + AUTHENTICATION_OAUTH_FAILED = "authentication.oauth_failed" + AUTHENTICATION_OAUTH_SUCCEEDED = "authentication.oauth_succeeded" + AUTHENTICATION_PASSWORD_FAILED = "authentication.password_failed" + AUTHENTICATION_PASSWORD_SUCCEEDED = "authentication.password_succeeded" + AUTHENTICATION_PASSKEY_FAILED = "authentication.passkey_failed" + AUTHENTICATION_PASSKEY_SUCCEEDED = "authentication.passkey_succeeded" + AUTHENTICATION_SSO_FAILED = "authentication.sso_failed" + AUTHENTICATION_SSO_STARTED = "authentication.sso_started" + AUTHENTICATION_SSO_SUCCEEDED = "authentication.sso_succeeded" + AUTHENTICATION_SSO_TIMED_OUT = "authentication.sso_timed_out" + AUTHENTICATION_RADAR_RISK_DETECTED = "authentication.radar_risk_detected" + API_KEY_CREATED = "api_key.created" + API_KEY_REVOKED = "api_key.revoked" + CONNECTION_ACTIVATED = "connection.activated" + CONNECTION_DEACTIVATED = "connection.deactivated" + CONNECTION_SAML_CERTIFICATE_RENEWAL_REQUIRED = "connection.saml_certificate_renewal_required" + CONNECTION_SAML_CERTIFICATE_RENEWED = "connection.saml_certificate_renewed" + CONNECTION_DELETED = "connection.deleted" + DSYNC_ACTIVATED = "dsync.activated" + DSYNC_DELETED = "dsync.deleted" + DSYNC_GROUP_CREATED = "dsync.group.created" + DSYNC_GROUP_DELETED = "dsync.group.deleted" + DSYNC_GROUP_UPDATED = "dsync.group.updated" + DSYNC_GROUP_USER_ADDED = "dsync.group.user_added" + DSYNC_GROUP_USER_REMOVED = "dsync.group.user_removed" + DSYNC_USER_CREATED = "dsync.user.created" + DSYNC_USER_DELETED = "dsync.user.deleted" + DSYNC_USER_UPDATED = "dsync.user.updated" + EMAIL_VERIFICATION_CREATED = "email_verification.created" + GROUP_CREATED = "group.created" + GROUP_DELETED = "group.deleted" + GROUP_MEMBER_ADDED = "group.member_added" + GROUP_MEMBER_REMOVED = "group.member_removed" + GROUP_UPDATED = "group.updated" + FLAG_CREATED = "flag.created" + FLAG_DELETED = "flag.deleted" + FLAG_UPDATED = "flag.updated" + FLAG_RULE_UPDATED = "flag.rule_updated" + INVITATION_ACCEPTED = "invitation.accepted" + INVITATION_CREATED = "invitation.created" + INVITATION_RESENT = "invitation.resent" + INVITATION_REVOKED = "invitation.revoked" + MAGIC_AUTH_CREATED = "magic_auth.created" + ORGANIZATION_CREATED = "organization.created" + ORGANIZATION_DELETED = "organization.deleted" + ORGANIZATION_UPDATED = "organization.updated" + ORGANIZATION_DOMAIN_CREATED = "organization_domain.created" + ORGANIZATION_DOMAIN_DELETED = "organization_domain.deleted" + ORGANIZATION_DOMAIN_UPDATED = "organization_domain.updated" + ORGANIZATION_DOMAIN_VERIFIED = "organization_domain.verified" + ORGANIZATION_DOMAIN_VERIFICATION_FAILED = "organization_domain.verification_failed" + PASSWORD_RESET_CREATED = "password_reset.created" + PASSWORD_RESET_SUCCEEDED = "password_reset.succeeded" + USER_CREATED = "user.created" + USER_UPDATED = "user.updated" + USER_DELETED = "user.deleted" + ORGANIZATION_MEMBERSHIP_CREATED = "organization_membership.created" + ORGANIZATION_MEMBERSHIP_DELETED = "organization_membership.deleted" + ORGANIZATION_MEMBERSHIP_UPDATED = "organization_membership.updated" + ROLE_CREATED = "role.created" + ROLE_DELETED = "role.deleted" + ROLE_UPDATED = "role.updated" + ORGANIZATION_ROLE_CREATED = "organization_role.created" + ORGANIZATION_ROLE_DELETED = "organization_role.deleted" + ORGANIZATION_ROLE_UPDATED = "organization_role.updated" + PERMISSION_CREATED = "permission.created" + PERMISSION_DELETED = "permission.deleted" + PERMISSION_UPDATED = "permission.updated" + SESSION_CREATED = "session.created" + SESSION_REVOKED = "session.revoked" + ALL = [AUTHENTICATION_EMAIL_VERIFICATION_SUCCEEDED, AUTHENTICATION_MAGIC_AUTH_FAILED, AUTHENTICATION_MAGIC_AUTH_SUCCEEDED, AUTHENTICATION_MFA_SUCCEEDED, AUTHENTICATION_OAUTH_FAILED, AUTHENTICATION_OAUTH_SUCCEEDED, AUTHENTICATION_PASSWORD_FAILED, AUTHENTICATION_PASSWORD_SUCCEEDED, AUTHENTICATION_PASSKEY_FAILED, AUTHENTICATION_PASSKEY_SUCCEEDED, AUTHENTICATION_SSO_FAILED, AUTHENTICATION_SSO_STARTED, AUTHENTICATION_SSO_SUCCEEDED, AUTHENTICATION_SSO_TIMED_OUT, AUTHENTICATION_RADAR_RISK_DETECTED, API_KEY_CREATED, API_KEY_REVOKED, CONNECTION_ACTIVATED, CONNECTION_DEACTIVATED, CONNECTION_SAML_CERTIFICATE_RENEWAL_REQUIRED, CONNECTION_SAML_CERTIFICATE_RENEWED, CONNECTION_DELETED, DSYNC_ACTIVATED, DSYNC_DELETED, DSYNC_GROUP_CREATED, DSYNC_GROUP_DELETED, DSYNC_GROUP_UPDATED, DSYNC_GROUP_USER_ADDED, DSYNC_GROUP_USER_REMOVED, DSYNC_USER_CREATED, DSYNC_USER_DELETED, DSYNC_USER_UPDATED, EMAIL_VERIFICATION_CREATED, GROUP_CREATED, GROUP_DELETED, GROUP_MEMBER_ADDED, GROUP_MEMBER_REMOVED, GROUP_UPDATED, FLAG_CREATED, FLAG_DELETED, FLAG_UPDATED, FLAG_RULE_UPDATED, INVITATION_ACCEPTED, INVITATION_CREATED, INVITATION_RESENT, INVITATION_REVOKED, MAGIC_AUTH_CREATED, ORGANIZATION_CREATED, ORGANIZATION_DELETED, ORGANIZATION_UPDATED, ORGANIZATION_DOMAIN_CREATED, ORGANIZATION_DOMAIN_DELETED, ORGANIZATION_DOMAIN_UPDATED, ORGANIZATION_DOMAIN_VERIFIED, ORGANIZATION_DOMAIN_VERIFICATION_FAILED, PASSWORD_RESET_CREATED, PASSWORD_RESET_SUCCEEDED, USER_CREATED, USER_UPDATED, USER_DELETED, ORGANIZATION_MEMBERSHIP_CREATED, ORGANIZATION_MEMBERSHIP_DELETED, ORGANIZATION_MEMBERSHIP_UPDATED, ROLE_CREATED, ROLE_DELETED, ROLE_UPDATED, ORGANIZATION_ROLE_CREATED, ORGANIZATION_ROLE_DELETED, ORGANIZATION_ROLE_UPDATED, PERMISSION_CREATED, PERMISSION_DELETED, PERMISSION_UPDATED, SESSION_CREATED, SESSION_REVOKED].freeze + end + end +end diff --git a/lib/workos/types/data_integration_access_token_response_error.rb b/lib/workos/types/data_integration_access_token_response_error.rb new file mode 100644 index 00000000..c3b9b57c --- /dev/null +++ b/lib/workos/types/data_integration_access_token_response_error.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class DataIntegrationAccessTokenResponseError + NEEDS_REAUTHORIZATION = "needs_reauthorization" + NOT_INSTALLED = "not_installed" + ALL = [NEEDS_REAUTHORIZATION, NOT_INSTALLED].freeze + end + end +end diff --git a/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb b/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb new file mode 100644 index 00000000..5cb4e2e9 --- /dev/null +++ b/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DataIntegrationsListResponseDataConnectedAccountState = ConnectedAccountState + end +end diff --git a/lib/workos/types/data_integrations_list_response_data_ownership.rb b/lib/workos/types/data_integrations_list_response_data_ownership.rb new file mode 100644 index 00000000..ebf0a7c2 --- /dev/null +++ b/lib/workos/types/data_integrations_list_response_data_ownership.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class DataIntegrationsListResponseDataOwnership + USERLAND_USER = "userland_user" + ORGANIZATION = "organization" + ALL = [USERLAND_USER, ORGANIZATION].freeze + end + end +end diff --git a/lib/workos/types/directories_order.rb b/lib/workos/types/directories_order.rb new file mode 100644 index 00000000..08e30935 --- /dev/null +++ b/lib/workos/types/directories_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DirectoriesOrder = EventsOrder + end +end diff --git a/lib/workos/types/directory_groups_order.rb b/lib/workos/types/directory_groups_order.rb new file mode 100644 index 00000000..3ae626b1 --- /dev/null +++ b/lib/workos/types/directory_groups_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DirectoryGroupsOrder = EventsOrder + end +end diff --git a/lib/workos/types/directory_state.rb b/lib/workos/types/directory_state.rb new file mode 100644 index 00000000..728039d3 --- /dev/null +++ b/lib/workos/types/directory_state.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class DirectoryState + LINKED = "linked" + VALIDATING = "validating" + INVALID_CREDENTIALS = "invalid_credentials" + UNLINKED = "unlinked" + DELETING = "deleting" + ALL = [LINKED, VALIDATING, INVALID_CREDENTIALS, UNLINKED, DELETING].freeze + end + end +end diff --git a/lib/workos/types/directory_type.rb b/lib/workos/types/directory_type.rb new file mode 100644 index 00000000..68de73d1 --- /dev/null +++ b/lib/workos/types/directory_type.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class DirectoryType + AZURE_SCIM_V_2_0 = "azure scim v2.0" + BAMBOOHR = "bamboohr" + BREATHE_HR = "breathe hr" + CEZANNE_HR = "cezanne hr" + CYBERARK_SCIM_V_2_0 = "cyberark scim v2.0" + FOURTH_HR = "fourth hr" + GENERIC_SCIM_V_2_0 = "generic scim v2.0" + GSUITE_DIRECTORY = "gsuite directory" + HIBOB = "hibob" + SAILPOINT_SCIM_V_2_0 = "sailpoint scim v2.0" + JUMP_CLOUD_SCIM_V_2_0 = "jump cloud scim v2.0" + OKTA_SCIM_V_2_0 = "okta scim v2.0" + ONELOGIN_SCIM_V_2_0 = "onelogin scim v2.0" + PEOPLE_HR = "people hr" + PERSONIO = "personio" + PINGFEDERATE_SCIM_V_2_0 = "pingfederate scim v2.0" + RIPPLING_SCIM_V_2_0 = "rippling scim v2.0" + S_3 = "s3" + SFTP = "sftp" + SFTP_WORKDAY = "sftp workday" + WORKDAY = "workday" + ALL = [AZURE_SCIM_V_2_0, BAMBOOHR, BREATHE_HR, CEZANNE_HR, CYBERARK_SCIM_V_2_0, FOURTH_HR, GENERIC_SCIM_V_2_0, GSUITE_DIRECTORY, HIBOB, SAILPOINT_SCIM_V_2_0, JUMP_CLOUD_SCIM_V_2_0, OKTA_SCIM_V_2_0, ONELOGIN_SCIM_V_2_0, PEOPLE_HR, PERSONIO, PINGFEDERATE_SCIM_V_2_0, RIPPLING_SCIM_V_2_0, S_3, SFTP, SFTP_WORKDAY, WORKDAY].freeze + end + end +end diff --git a/lib/workos/types/directory_user_state.rb b/lib/workos/types/directory_user_state.rb new file mode 100644 index 00000000..abc76c0d --- /dev/null +++ b/lib/workos/types/directory_user_state.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class DirectoryUserState + ACTIVE = "active" + SUSPENDED = "suspended" + INACTIVE = "inactive" + ALL = [ACTIVE, SUSPENDED, INACTIVE].freeze + end + end +end diff --git a/lib/workos/types/directory_user_with_groups_state.rb b/lib/workos/types/directory_user_with_groups_state.rb new file mode 100644 index 00000000..7260fd6b --- /dev/null +++ b/lib/workos/types/directory_user_with_groups_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DirectoryUserWithGroupsState = DirectoryUserState + end +end diff --git a/lib/workos/types/directory_users_order.rb b/lib/workos/types/directory_users_order.rb new file mode 100644 index 00000000..ff3c0484 --- /dev/null +++ b/lib/workos/types/directory_users_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DirectoryUsersOrder = EventsOrder + end +end diff --git a/lib/workos/types/dsync_activated_data_state.rb b/lib/workos/types/dsync_activated_data_state.rb new file mode 100644 index 00000000..9959673c --- /dev/null +++ b/lib/workos/types/dsync_activated_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DsyncActivatedDataState = DsyncDeletedDataState + end +end diff --git a/lib/workos/types/dsync_activated_data_type.rb b/lib/workos/types/dsync_activated_data_type.rb new file mode 100644 index 00000000..7724f513 --- /dev/null +++ b/lib/workos/types/dsync_activated_data_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DsyncActivatedDataType = DsyncDeletedDataType + end +end diff --git a/lib/workos/types/dsync_deactivated_data_state.rb b/lib/workos/types/dsync_deactivated_data_state.rb new file mode 100644 index 00000000..97a661f2 --- /dev/null +++ b/lib/workos/types/dsync_deactivated_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DsyncDeactivatedDataState = DsyncDeletedDataState + end +end diff --git a/lib/workos/types/dsync_deactivated_data_type.rb b/lib/workos/types/dsync_deactivated_data_type.rb new file mode 100644 index 00000000..247de49a --- /dev/null +++ b/lib/workos/types/dsync_deactivated_data_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DsyncDeactivatedDataType = DsyncDeletedDataType + end +end diff --git a/lib/workos/types/dsync_deleted_data_state.rb b/lib/workos/types/dsync_deleted_data_state.rb new file mode 100644 index 00000000..4989bc40 --- /dev/null +++ b/lib/workos/types/dsync_deleted_data_state.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class DsyncDeletedDataState + ACTIVE = "active" + VALIDATING = "validating" + INVALID_CREDENTIALS = "invalid_credentials" + INACTIVE = "inactive" + DELETING = "deleting" + ALL = [ACTIVE, VALIDATING, INVALID_CREDENTIALS, INACTIVE, DELETING].freeze + end + end +end diff --git a/lib/workos/types/dsync_deleted_data_type.rb b/lib/workos/types/dsync_deleted_data_type.rb new file mode 100644 index 00000000..74b2d08c --- /dev/null +++ b/lib/workos/types/dsync_deleted_data_type.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class DsyncDeletedDataType + AZURE_SCIM_V_2_0 = "azure scim v2.0" + BAMBOOHR = "bamboohr" + BREATHE_HR = "breathe hr" + CEZANNE_HR = "cezanne hr" + CYBERARK_SCIM_V_2_0 = "cyberark scim v2.0" + FOURTH_HR = "fourth hr" + GENERIC_SCIM_V_2_0 = "generic scim v2.0" + GSUITE_DIRECTORY = "gsuite directory" + GUSTO = "gusto" + HIBOB = "hibob" + JUMP_CLOUD_SCIM_V_2_0 = "jump cloud scim v2.0" + OKTA_SCIM_V_2_0 = "okta scim v2.0" + ONELOGIN_SCIM_V_2_0 = "onelogin scim v2.0" + PEOPLE_HR = "people hr" + PERSONIO = "personio" + PINGFEDERATE_SCIM_V_2_0 = "pingfederate scim v2.0" + RIPPLING_SCIM_V_2_0 = "rippling scim v2.0" + RIPPLING = "rippling" + SAILPOINT_SCIM_V_2_0 = "sailpoint scim v2.0" + S_3 = "s3" + SFTP = "sftp" + SFTP_WORKDAY = "sftp workday" + WORKDAY = "workday" + ALL = [AZURE_SCIM_V_2_0, BAMBOOHR, BREATHE_HR, CEZANNE_HR, CYBERARK_SCIM_V_2_0, FOURTH_HR, GENERIC_SCIM_V_2_0, GSUITE_DIRECTORY, GUSTO, HIBOB, JUMP_CLOUD_SCIM_V_2_0, OKTA_SCIM_V_2_0, ONELOGIN_SCIM_V_2_0, PEOPLE_HR, PERSONIO, PINGFEDERATE_SCIM_V_2_0, RIPPLING_SCIM_V_2_0, RIPPLING, SAILPOINT_SCIM_V_2_0, S_3, SFTP, SFTP_WORKDAY, WORKDAY].freeze + end + end +end diff --git a/lib/workos/types/dsync_user_updated_data_state.rb b/lib/workos/types/dsync_user_updated_data_state.rb new file mode 100644 index 00000000..152efeb5 --- /dev/null +++ b/lib/workos/types/dsync_user_updated_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + DsyncUserUpdatedDataState = DirectoryUserState + end +end diff --git a/lib/workos/types/event_context_actor_source.rb b/lib/workos/types/event_context_actor_source.rb new file mode 100644 index 00000000..8ba757fa --- /dev/null +++ b/lib/workos/types/event_context_actor_source.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class EventContextActorSource + API = "api" + DASHBOARD = "dashboard" + SYSTEM = "system" + ALL = [API, DASHBOARD, SYSTEM].freeze + end + end +end diff --git a/lib/workos/types/events_order.rb b/lib/workos/types/events_order.rb new file mode 100644 index 00000000..6ab23aa1 --- /dev/null +++ b/lib/workos/types/events_order.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class EventsOrder + NORMAL = "normal" + DESC = "desc" + ASC = "asc" + ALL = [NORMAL, DESC, ASC].freeze + end + end +end diff --git a/lib/workos/types/feature_flags_order.rb b/lib/workos/types/feature_flags_order.rb new file mode 100644 index 00000000..79ed103e --- /dev/null +++ b/lib/workos/types/feature_flags_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + FeatureFlagsOrder = EventsOrder + end +end diff --git a/lib/workos/types/flag_created_context_actor_source.rb b/lib/workos/types/flag_created_context_actor_source.rb new file mode 100644 index 00000000..18965b97 --- /dev/null +++ b/lib/workos/types/flag_created_context_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + FlagCreatedContextActorSource = EventContextActorSource + end +end diff --git a/lib/workos/types/flag_deleted_context_actor_source.rb b/lib/workos/types/flag_deleted_context_actor_source.rb new file mode 100644 index 00000000..7163e414 --- /dev/null +++ b/lib/workos/types/flag_deleted_context_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + FlagDeletedContextActorSource = EventContextActorSource + end +end diff --git a/lib/workos/types/flag_rule_updated_context_access_type.rb b/lib/workos/types/flag_rule_updated_context_access_type.rb new file mode 100644 index 00000000..79eaff86 --- /dev/null +++ b/lib/workos/types/flag_rule_updated_context_access_type.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class FlagRuleUpdatedContextAccessType + NONE = "none" + SOME = "some" + VALUE_ALL = "all" + ALL = [NONE, SOME, VALUE_ALL].freeze + end + end +end diff --git a/lib/workos/types/flag_rule_updated_context_actor_source.rb b/lib/workos/types/flag_rule_updated_context_actor_source.rb new file mode 100644 index 00000000..d1b982a9 --- /dev/null +++ b/lib/workos/types/flag_rule_updated_context_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + FlagRuleUpdatedContextActorSource = EventContextActorSource + end +end diff --git a/lib/workos/types/flag_rule_updated_context_previous_attribute_context_access_type.rb b/lib/workos/types/flag_rule_updated_context_previous_attribute_context_access_type.rb new file mode 100644 index 00000000..ee9b27f9 --- /dev/null +++ b/lib/workos/types/flag_rule_updated_context_previous_attribute_context_access_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + FlagRuleUpdatedContextPreviousAttributeContextAccessType = FlagRuleUpdatedContextAccessType + end +end diff --git a/lib/workos/types/flag_updated_context_actor_source.rb b/lib/workos/types/flag_updated_context_actor_source.rb new file mode 100644 index 00000000..ce360bdf --- /dev/null +++ b/lib/workos/types/flag_updated_context_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + FlagUpdatedContextActorSource = EventContextActorSource + end +end diff --git a/lib/workos/types/intent.rb b/lib/workos/types/generate_link_intent.rb similarity index 53% rename from lib/workos/types/intent.rb rename to lib/workos/types/generate_link_intent.rb index c5ef657f..3f0613ab 100644 --- a/lib/workos/types/intent.rb +++ b/lib/workos/types/generate_link_intent.rb @@ -1,18 +1,18 @@ # frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + module WorkOS module Types - # The Intent constants are declarations of a fixed set of values for - # intents while generating an Admin Portal link. - module Intent - AUDIT_LOGS = "audit_logs" - CERTIFICATE_RENEWAL = "certificate_renewal" - DOMAIN_VERIFICATION = "domain_verification" + class GenerateLinkIntent + SSO = "sso" DSYNC = "dsync" + AUDIT_LOGS = "audit_logs" LOG_STREAMS = "log_streams" - SSO = "sso" - - ALL = [AUDIT_LOGS, CERTIFICATE_RENEWAL, DOMAIN_VERIFICATION, DSYNC, LOG_STREAMS, SSO].freeze + DOMAIN_VERIFICATION = "domain_verification" + CERTIFICATE_RENEWAL = "certificate_renewal" + BRING_YOUR_OWN_KEY = "bring_your_own_key" + ALL = [SSO, DSYNC, AUDIT_LOGS, LOG_STREAMS, DOMAIN_VERIFICATION, CERTIFICATE_RENEWAL, BRING_YOUR_OWN_KEY].freeze end end end diff --git a/lib/workos/types/invitation_accepted_data_state.rb b/lib/workos/types/invitation_accepted_data_state.rb new file mode 100644 index 00000000..679958a5 --- /dev/null +++ b/lib/workos/types/invitation_accepted_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + InvitationAcceptedDataState = InvitationState + end +end diff --git a/lib/workos/types/invitation_created_data_state.rb b/lib/workos/types/invitation_created_data_state.rb new file mode 100644 index 00000000..91e402b5 --- /dev/null +++ b/lib/workos/types/invitation_created_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + InvitationCreatedDataState = InvitationState + end +end diff --git a/lib/workos/types/invitation_resent_data_state.rb b/lib/workos/types/invitation_resent_data_state.rb new file mode 100644 index 00000000..249fcae4 --- /dev/null +++ b/lib/workos/types/invitation_resent_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + InvitationResentDataState = InvitationState + end +end diff --git a/lib/workos/types/invitation_revoked_data_state.rb b/lib/workos/types/invitation_revoked_data_state.rb new file mode 100644 index 00000000..e61ba667 --- /dev/null +++ b/lib/workos/types/invitation_revoked_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + InvitationRevokedDataState = InvitationState + end +end diff --git a/lib/workos/types/invitation_state.rb b/lib/workos/types/invitation_state.rb new file mode 100644 index 00000000..d9941640 --- /dev/null +++ b/lib/workos/types/invitation_state.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class InvitationState + PENDING = "pending" + ACCEPTED = "accepted" + EXPIRED = "expired" + REVOKED = "revoked" + ALL = [PENDING, ACCEPTED, EXPIRED, REVOKED].freeze + end + end +end diff --git a/lib/workos/types/list_struct.rb b/lib/workos/types/list_struct.rb index e03ece66..9e15dde5 100644 --- a/lib/workos/types/list_struct.rb +++ b/lib/workos/types/list_struct.rb @@ -1,15 +1,124 @@ # frozen_string_literal: true +# @oagen-ignore-file — hand-maintained runtime module WorkOS module Types - # ListStruct acts as an interface to expose lists of data and related - # metadata + # Paginated response wrapper with auto-pagination support. + # + # result = @client.organizations.list_organizations(limit: 10) + # result.data # => [WorkOS::Organization, ...] + # result.list_metadata # => { "before" => nil, "after" => "org_..." } + # result.auto_paging_each { |org| puts org.id } class ListStruct - attr_accessor :data, :list_metadata + include Enumerable - def initialize(data:, list_metadata:) - @data = data - @list_metadata = list_metadata + attr_accessor :data, :list_metadata, :fetch_next, :fetch_previous, :filters + + def initialize(data:, list_metadata:, fetch_next: nil, fetch_previous: nil, filters: {}) + @data = data || [] + @list_metadata = list_metadata || {} + @fetch_next = fetch_next + @fetch_previous = fetch_previous + @filters = filters + end + + # Build a ListStruct from a raw HTTP response, mapping items through + # an optional model class and wiring cursor-based auto-pagination. + # + # @param response [Net::HTTPResponse] Raw HTTP response with JSON body. + # @param model [Class, nil] Model class whose `.new` accepts a Hash. + # When nil, items are returned as raw Hashes. + # @param filters [Hash] Filter state forwarded to the next page. + # @param fetch_next [Proc, nil] Proc called to fetch the next page given + # the current page's `after` cursor. + # @param fetch_previous [Proc, nil] Proc called to fetch the previous page + # given the current page's `before` cursor. + # @return [ListStruct] + def self.from_response(response, model: nil, filters: {}, fetch_next: nil, fetch_previous: nil) + parsed = JSON.parse(response.body) + items = parsed["data"] || [] + items = items.map { |item| model.new(item) } if model + new( + data: items, + list_metadata: parsed["list_metadata"], + filters: filters, + fetch_next: fetch_next, + fetch_previous: fetch_previous + ) + end + + # Iterates the current page only. Use `auto_paging_each` to span pages. + # + # @return [Enumerator] + def each(&block) + @data.each(&block) + end + + def has_more? + cursor = @list_metadata.is_a?(Hash) ? (@list_metadata["after"] || @list_metadata[:after]) : nil + !cursor.nil? && !cursor.to_s.empty? + end + + # Fetch the next page when an `after` cursor is present. + # + # @return [ListStruct, nil] + def next_page + cursor = @list_metadata.is_a?(Hash) ? (@list_metadata["after"] || @list_metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + return nil unless @fetch_next + + @fetch_next.call(cursor) + end + + # Fetch the previous page when a `before` cursor is present. + # + # @return [ListStruct, nil] + def previous_page + cursor = @list_metadata.is_a?(Hash) ? (@list_metadata["before"] || @list_metadata[:before]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + return nil unless @fetch_previous + + @fetch_previous.call(cursor) + end + + # Iterate over every item across pages. + # + # Requires a fetch_next proc wired at construction time. The generator + # emits this automatically for list endpoints whose spec includes a + # cursor pagination parameter. + def auto_paging_each + return enum_for(:auto_paging_each) unless block_given? + + page = self + loop do + page.data.each { |item| yield item } + next_page = page.next_page + break if next_page.nil? + break unless next_page.is_a?(ListStruct) + break if next_page.data.nil? || next_page.data.empty? + + page = next_page + end + end + + # Iterate one page at a time across all pages. + # + # result.each_page do |page| + # page.data.each { |item| bulk_insert(item) } + # end + def each_page + return enum_for(:each_page) unless block_given? + + page = self + loop do + yield page + next_page = page.next_page + break if next_page.nil? + break unless next_page.is_a?(ListStruct) + break if next_page.data.nil? || next_page.data.empty? + + page = next_page + end end end end diff --git a/lib/workos/types/organization_created_data_domain_state.rb b/lib/workos/types/organization_created_data_domain_state.rb new file mode 100644 index 00000000..65af8d20 --- /dev/null +++ b/lib/workos/types/organization_created_data_domain_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationCreatedDataDomainState = OrganizationDomainState + end +end diff --git a/lib/workos/types/organization_created_data_domain_verification_strategy.rb b/lib/workos/types/organization_created_data_domain_verification_strategy.rb new file mode 100644 index 00000000..606b8c90 --- /dev/null +++ b/lib/workos/types/organization_created_data_domain_verification_strategy.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationCreatedDataDomainVerificationStrategy = OrganizationDomainVerificationStrategy + end +end diff --git a/lib/workos/types/organization_deleted_data_domain_state.rb b/lib/workos/types/organization_deleted_data_domain_state.rb new file mode 100644 index 00000000..4a12f4c8 --- /dev/null +++ b/lib/workos/types/organization_deleted_data_domain_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDeletedDataDomainState = OrganizationDomainState + end +end diff --git a/lib/workos/types/organization_deleted_data_domain_verification_strategy.rb b/lib/workos/types/organization_deleted_data_domain_verification_strategy.rb new file mode 100644 index 00000000..f7ebca49 --- /dev/null +++ b/lib/workos/types/organization_deleted_data_domain_verification_strategy.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDeletedDataDomainVerificationStrategy = OrganizationDomainVerificationStrategy + end +end diff --git a/lib/workos/types/organization_domain_created_data_state.rb b/lib/workos/types/organization_domain_created_data_state.rb new file mode 100644 index 00000000..615e21cf --- /dev/null +++ b/lib/workos/types/organization_domain_created_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainCreatedDataState = OrganizationDomainState + end +end diff --git a/lib/workos/types/organization_domain_created_data_verification_strategy.rb b/lib/workos/types/organization_domain_created_data_verification_strategy.rb new file mode 100644 index 00000000..282c9166 --- /dev/null +++ b/lib/workos/types/organization_domain_created_data_verification_strategy.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainCreatedDataVerificationStrategy = OrganizationDomainVerificationStrategy + end +end diff --git a/lib/workos/types/organization_domain_data_state.rb b/lib/workos/types/organization_domain_data_state.rb new file mode 100644 index 00000000..a790e62b --- /dev/null +++ b/lib/workos/types/organization_domain_data_state.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class OrganizationDomainDataState + PENDING = "pending" + VERIFIED = "verified" + ALL = [PENDING, VERIFIED].freeze + end + end +end diff --git a/lib/workos/types/organization_domain_deleted_data_state.rb b/lib/workos/types/organization_domain_deleted_data_state.rb new file mode 100644 index 00000000..9942c22d --- /dev/null +++ b/lib/workos/types/organization_domain_deleted_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainDeletedDataState = OrganizationDomainState + end +end diff --git a/lib/workos/types/organization_domain_deleted_data_verification_strategy.rb b/lib/workos/types/organization_domain_deleted_data_verification_strategy.rb new file mode 100644 index 00000000..6243421a --- /dev/null +++ b/lib/workos/types/organization_domain_deleted_data_verification_strategy.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainDeletedDataVerificationStrategy = OrganizationDomainVerificationStrategy + end +end diff --git a/lib/workos/types/organization_domain_stand_alone_state.rb b/lib/workos/types/organization_domain_stand_alone_state.rb new file mode 100644 index 00000000..ce55049f --- /dev/null +++ b/lib/workos/types/organization_domain_stand_alone_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainStandAloneState = OrganizationDomainState + end +end diff --git a/lib/workos/types/organization_domain_stand_alone_verification_strategy.rb b/lib/workos/types/organization_domain_stand_alone_verification_strategy.rb new file mode 100644 index 00000000..4c9b3177 --- /dev/null +++ b/lib/workos/types/organization_domain_stand_alone_verification_strategy.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainStandAloneVerificationStrategy = OrganizationDomainVerificationStrategy + end +end diff --git a/lib/workos/types/organization_domain_state.rb b/lib/workos/types/organization_domain_state.rb new file mode 100644 index 00000000..45351e5a --- /dev/null +++ b/lib/workos/types/organization_domain_state.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class OrganizationDomainState + FAILED = "failed" + LEGACY_VERIFIED = "legacy_verified" + PENDING = "pending" + UNVERIFIED = "unverified" + VERIFIED = "verified" + ALL = [FAILED, LEGACY_VERIFIED, PENDING, UNVERIFIED, VERIFIED].freeze + end + end +end diff --git a/lib/workos/types/organization_domain_updated_data_state.rb b/lib/workos/types/organization_domain_updated_data_state.rb new file mode 100644 index 00000000..b3f18d41 --- /dev/null +++ b/lib/workos/types/organization_domain_updated_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainUpdatedDataState = OrganizationDomainState + end +end diff --git a/lib/workos/types/organization_domain_updated_data_verification_strategy.rb b/lib/workos/types/organization_domain_updated_data_verification_strategy.rb new file mode 100644 index 00000000..c4a7045a --- /dev/null +++ b/lib/workos/types/organization_domain_updated_data_verification_strategy.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainUpdatedDataVerificationStrategy = OrganizationDomainVerificationStrategy + end +end diff --git a/lib/workos/types/organization_domain_verification_failed_data_organization_domain_state.rb b/lib/workos/types/organization_domain_verification_failed_data_organization_domain_state.rb new file mode 100644 index 00000000..f87d334f --- /dev/null +++ b/lib/workos/types/organization_domain_verification_failed_data_organization_domain_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainVerificationFailedDataOrganizationDomainState = OrganizationDomainState + end +end diff --git a/lib/workos/types/organization_domain_verification_failed_data_organization_domain_verification_strategy.rb b/lib/workos/types/organization_domain_verification_failed_data_organization_domain_verification_strategy.rb new file mode 100644 index 00000000..23fac1be --- /dev/null +++ b/lib/workos/types/organization_domain_verification_failed_data_organization_domain_verification_strategy.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainVerificationFailedDataOrganizationDomainVerificationStrategy = OrganizationDomainVerificationStrategy + end +end diff --git a/lib/workos/types/organization_domain_verification_failed_data_reason.rb b/lib/workos/types/organization_domain_verification_failed_data_reason.rb new file mode 100644 index 00000000..c68a815d --- /dev/null +++ b/lib/workos/types/organization_domain_verification_failed_data_reason.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class OrganizationDomainVerificationFailedDataReason + DOMAIN_VERIFICATION_PERIOD_EXPIRED = "domain_verification_period_expired" + DOMAIN_VERIFIED_BY_OTHER_ORGANIZATION = "domain_verified_by_other_organization" + ALL = [DOMAIN_VERIFICATION_PERIOD_EXPIRED, DOMAIN_VERIFIED_BY_OTHER_ORGANIZATION].freeze + end + end +end diff --git a/lib/workos/types/organization_domain_verification_strategy.rb b/lib/workos/types/organization_domain_verification_strategy.rb new file mode 100644 index 00000000..e4d51458 --- /dev/null +++ b/lib/workos/types/organization_domain_verification_strategy.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class OrganizationDomainVerificationStrategy + DNS = "dns" + MANUAL = "manual" + ALL = [DNS, MANUAL].freeze + end + end +end diff --git a/lib/workos/types/organization_domain_verified_data_state.rb b/lib/workos/types/organization_domain_verified_data_state.rb new file mode 100644 index 00000000..5d2ed8aa --- /dev/null +++ b/lib/workos/types/organization_domain_verified_data_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainVerifiedDataState = OrganizationDomainState + end +end diff --git a/lib/workos/types/organization_domain_verified_data_verification_strategy.rb b/lib/workos/types/organization_domain_verified_data_verification_strategy.rb new file mode 100644 index 00000000..b170b087 --- /dev/null +++ b/lib/workos/types/organization_domain_verified_data_verification_strategy.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationDomainVerifiedDataVerificationStrategy = OrganizationDomainVerificationStrategy + end +end diff --git a/lib/workos/types/organization_membership_created_data_status.rb b/lib/workos/types/organization_membership_created_data_status.rb new file mode 100644 index 00000000..b48d4008 --- /dev/null +++ b/lib/workos/types/organization_membership_created_data_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationMembershipCreatedDataStatus = OrganizationMembershipStatus + end +end diff --git a/lib/workos/types/organization_membership_deleted_data_status.rb b/lib/workos/types/organization_membership_deleted_data_status.rb new file mode 100644 index 00000000..eb1ac4b3 --- /dev/null +++ b/lib/workos/types/organization_membership_deleted_data_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationMembershipDeletedDataStatus = OrganizationMembershipStatus + end +end diff --git a/lib/workos/types/organization_membership_status.rb b/lib/workos/types/organization_membership_status.rb new file mode 100644 index 00000000..e0f54dbc --- /dev/null +++ b/lib/workos/types/organization_membership_status.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class OrganizationMembershipStatus + ACTIVE = "active" + INACTIVE = "inactive" + PENDING = "pending" + ALL = [ACTIVE, INACTIVE, PENDING].freeze + end + end +end diff --git a/lib/workos/types/organization_membership_updated_data_status.rb b/lib/workos/types/organization_membership_updated_data_status.rb new file mode 100644 index 00000000..1e0c6718 --- /dev/null +++ b/lib/workos/types/organization_membership_updated_data_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationMembershipUpdatedDataStatus = OrganizationMembershipStatus + end +end diff --git a/lib/workos/types/organization_updated_data_domain_state.rb b/lib/workos/types/organization_updated_data_domain_state.rb new file mode 100644 index 00000000..1c33717e --- /dev/null +++ b/lib/workos/types/organization_updated_data_domain_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationUpdatedDataDomainState = OrganizationDomainState + end +end diff --git a/lib/workos/types/organization_updated_data_domain_verification_strategy.rb b/lib/workos/types/organization_updated_data_domain_verification_strategy.rb new file mode 100644 index 00000000..2b5f95dd --- /dev/null +++ b/lib/workos/types/organization_updated_data_domain_verification_strategy.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationUpdatedDataDomainVerificationStrategy = OrganizationDomainVerificationStrategy + end +end diff --git a/lib/workos/types/organizations_api_keys_order.rb b/lib/workos/types/organizations_api_keys_order.rb new file mode 100644 index 00000000..92d2aff3 --- /dev/null +++ b/lib/workos/types/organizations_api_keys_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationsApiKeysOrder = EventsOrder + end +end diff --git a/lib/workos/types/organizations_feature_flags_order.rb b/lib/workos/types/organizations_feature_flags_order.rb new file mode 100644 index 00000000..ed0b68a3 --- /dev/null +++ b/lib/workos/types/organizations_feature_flags_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationsFeatureFlagsOrder = EventsOrder + end +end diff --git a/lib/workos/types/organizations_order.rb b/lib/workos/types/organizations_order.rb new file mode 100644 index 00000000..fc869f04 --- /dev/null +++ b/lib/workos/types/organizations_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + OrganizationsOrder = EventsOrder + end +end diff --git a/lib/workos/types/passwordless_session_struct.rb b/lib/workos/types/passwordless_session_struct.rb deleted file mode 100644 index 7c082cdd..00000000 --- a/lib/workos/types/passwordless_session_struct.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - module Types - # This PasswordlessSessionStruct acts as an interface - # for the Passwordless class - class PasswordlessSessionStruct - attr_accessor :id, :email, :expires_at, :link - - def initialize(id:, email:, expires_at:, link:) - @id = id - @email = email - @expires_at = expires_at - @link = link - end - end - end -end diff --git a/lib/workos/types/permissions_order.rb b/lib/workos/types/permissions_order.rb new file mode 100644 index 00000000..a63c10be --- /dev/null +++ b/lib/workos/types/permissions_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + PermissionsOrder = EventsOrder + end +end diff --git a/lib/workos/types/profile_connection_type.rb b/lib/workos/types/profile_connection_type.rb new file mode 100644 index 00000000..6886fda4 --- /dev/null +++ b/lib/workos/types/profile_connection_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ProfileConnectionType = ConnectionType + end +end diff --git a/lib/workos/types/provider.rb b/lib/workos/types/provider.rb deleted file mode 100644 index 374afce6..00000000 --- a/lib/workos/types/provider.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - module Types - # The Provider constants are declarations of a - # fixed set of values for SSO Providers. - module Provider - Apple = "AppleOAuth" - GitHub = "GitHubOAuth" - Google = "GoogleOAuth" - Microsoft = "MicrosoftOAuth" - - ALL = [Apple, GitHub, Google, Microsoft].freeze - end - end -end diff --git a/lib/workos/types/radar_action.rb b/lib/workos/types/radar_action.rb new file mode 100644 index 00000000..9f3edc38 --- /dev/null +++ b/lib/workos/types/radar_action.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class RadarAction + BLOCK = "block" + ALLOW = "allow" + ALL = [BLOCK, ALLOW].freeze + end + end +end diff --git a/lib/workos/types/radar_standalone_assess_request_action.rb b/lib/workos/types/radar_standalone_assess_request_action.rb new file mode 100644 index 00000000..03a70a54 --- /dev/null +++ b/lib/workos/types/radar_standalone_assess_request_action.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class RadarStandaloneAssessRequestAction + LOGIN = "login" + SIGNUP = "signup" + SIGN_UP = "sign-up" + SIGN_IN = "sign-in" + SIGN_UP_2 = "sign_up" + SIGN_IN_2 = "sign_in" + SIGN_IN_3 = "sign in" + SIGN_UP_3 = "sign up" + ALL = [LOGIN, SIGNUP, SIGN_UP, SIGN_IN, SIGN_UP_2, SIGN_IN_2, SIGN_IN_3, SIGN_UP_3].freeze + end + end +end diff --git a/lib/workos/types/radar_standalone_assess_request_auth_method.rb b/lib/workos/types/radar_standalone_assess_request_auth_method.rb new file mode 100644 index 00000000..c5694a28 --- /dev/null +++ b/lib/workos/types/radar_standalone_assess_request_auth_method.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class RadarStandaloneAssessRequestAuthMethod + PASSWORD = "Password" + PASSKEY = "Passkey" + AUTHENTICATOR = "Authenticator" + SMS_OTP = "SMS_OTP" + EMAIL_OTP = "Email_OTP" + SOCIAL = "Social" + SSO = "SSO" + OTHER = "Other" + ALL = [PASSWORD, PASSKEY, AUTHENTICATOR, SMS_OTP, EMAIL_OTP, SOCIAL, SSO, OTHER].freeze + end + end +end diff --git a/lib/workos/types/radar_standalone_response_blocklist_type.rb b/lib/workos/types/radar_standalone_response_blocklist_type.rb new file mode 100644 index 00000000..4f73c9a3 --- /dev/null +++ b/lib/workos/types/radar_standalone_response_blocklist_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + RadarStandaloneResponseBlocklistType = RadarType + end +end diff --git a/lib/workos/types/radar_standalone_response_control.rb b/lib/workos/types/radar_standalone_response_control.rb new file mode 100644 index 00000000..d4dd7852 --- /dev/null +++ b/lib/workos/types/radar_standalone_response_control.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class RadarStandaloneResponseControl + BOT_DETECTION = "bot_detection" + BRUTE_FORCE_ATTACK = "brute_force_attack" + CREDENTIAL_STUFFING = "credential_stuffing" + DOMAIN_SIGN_UP_RATE_LIMIT = "domain_sign_up_rate_limit" + IP_SIGN_UP_RATE_LIMIT = "ip_sign_up_rate_limit" + IMPOSSIBLE_TRAVEL = "impossible_travel" + REPEAT_SIGN_UP = "repeat_sign_up" + STALE_ACCOUNT = "stale_account" + UNRECOGNIZED_DEVICE = "unrecognized_device" + RESTRICTION = "restriction" + ALL = [BOT_DETECTION, BRUTE_FORCE_ATTACK, CREDENTIAL_STUFFING, DOMAIN_SIGN_UP_RATE_LIMIT, IP_SIGN_UP_RATE_LIMIT, IMPOSSIBLE_TRAVEL, REPEAT_SIGN_UP, STALE_ACCOUNT, UNRECOGNIZED_DEVICE, RESTRICTION].freeze + end + end +end diff --git a/lib/workos/types/radar_standalone_response_verdict.rb b/lib/workos/types/radar_standalone_response_verdict.rb new file mode 100644 index 00000000..a22978e0 --- /dev/null +++ b/lib/workos/types/radar_standalone_response_verdict.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class RadarStandaloneResponseVerdict + ALLOW = "allow" + BLOCK = "block" + CHALLENGE = "challenge" + ALL = [ALLOW, BLOCK, CHALLENGE].freeze + end + end +end diff --git a/lib/workos/types/radar_type.rb b/lib/workos/types/radar_type.rb new file mode 100644 index 00000000..ec0e4e67 --- /dev/null +++ b/lib/workos/types/radar_type.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class RadarType + IP_ADDRESS = "ip_address" + DOMAIN = "domain" + EMAIL = "email" + DEVICE = "device" + USER_AGENT = "user_agent" + DEVICE_FINGERPRINT = "device_fingerprint" + COUNTRY = "country" + ALL = [IP_ADDRESS, DOMAIN, EMAIL, DEVICE, USER_AGENT, DEVICE_FINGERPRINT, COUNTRY].freeze + end + end +end diff --git a/lib/workos/types/resend_user_invite_options_locale.rb b/lib/workos/types/resend_user_invite_options_locale.rb new file mode 100644 index 00000000..b86e2747 --- /dev/null +++ b/lib/workos/types/resend_user_invite_options_locale.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ResendUserInviteOptionsLocale = CreateUserInviteOptionsLocale + end +end diff --git a/lib/workos/types/role_type.rb b/lib/workos/types/role_type.rb new file mode 100644 index 00000000..c99d137b --- /dev/null +++ b/lib/workos/types/role_type.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class RoleType + ENVIRONMENT_ROLE = "EnvironmentRole" + ORGANIZATION_ROLE = "OrganizationRole" + ALL = [ENVIRONMENT_ROLE, ORGANIZATION_ROLE].freeze + end + end +end diff --git a/lib/workos/types/session_created_data_auth_method.rb b/lib/workos/types/session_created_data_auth_method.rb new file mode 100644 index 00000000..f1f018b0 --- /dev/null +++ b/lib/workos/types/session_created_data_auth_method.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + SessionCreatedDataAuthMethod = UserSessionsAuthMethod + end +end diff --git a/lib/workos/types/session_created_data_status.rb b/lib/workos/types/session_created_data_status.rb new file mode 100644 index 00000000..586c38ad --- /dev/null +++ b/lib/workos/types/session_created_data_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + SessionCreatedDataStatus = UserSessionsStatus + end +end diff --git a/lib/workos/types/session_revoked_data_auth_method.rb b/lib/workos/types/session_revoked_data_auth_method.rb new file mode 100644 index 00000000..c602ad86 --- /dev/null +++ b/lib/workos/types/session_revoked_data_auth_method.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + SessionRevokedDataAuthMethod = UserSessionsAuthMethod + end +end diff --git a/lib/workos/types/session_revoked_data_status.rb b/lib/workos/types/session_revoked_data_status.rb new file mode 100644 index 00000000..d54991e3 --- /dev/null +++ b/lib/workos/types/session_revoked_data_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + SessionRevokedDataStatus = UserSessionsStatus + end +end diff --git a/lib/workos/types/sso_provider.rb b/lib/workos/types/sso_provider.rb new file mode 100644 index 00000000..2159ec5a --- /dev/null +++ b/lib/workos/types/sso_provider.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class SSOProvider + APPLE_OAUTH = "AppleOAuth" + GIT_HUB_OAUTH = "GitHubOAuth" + GOOGLE_OAUTH = "GoogleOAuth" + MICROSOFT_OAUTH = "MicrosoftOAuth" + ALL = [APPLE_OAUTH, GIT_HUB_OAUTH, GOOGLE_OAUTH, MICROSOFT_OAUTH].freeze + end + end +end diff --git a/lib/workos/types/update_user_password_hash_type.rb b/lib/workos/types/update_user_password_hash_type.rb new file mode 100644 index 00000000..da79c65a --- /dev/null +++ b/lib/workos/types/update_user_password_hash_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UpdateUserPasswordHashType = CreateUserPasswordHashType + end +end diff --git a/lib/workos/types/update_webhook_endpoint_events.rb b/lib/workos/types/update_webhook_endpoint_events.rb new file mode 100644 index 00000000..37996b4e --- /dev/null +++ b/lib/workos/types/update_webhook_endpoint_events.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UpdateWebhookEndpointEvents = CreateWebhookEndpointEvents + end +end diff --git a/lib/workos/types/update_webhook_endpoint_status.rb b/lib/workos/types/update_webhook_endpoint_status.rb new file mode 100644 index 00000000..5551ba7d --- /dev/null +++ b/lib/workos/types/update_webhook_endpoint_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UpdateWebhookEndpointStatus = WebhookEndpointStatus + end +end diff --git a/lib/workos/types/user_identities_get_item_provider.rb b/lib/workos/types/user_identities_get_item_provider.rb new file mode 100644 index 00000000..bfdedd34 --- /dev/null +++ b/lib/workos/types/user_identities_get_item_provider.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class UserIdentitiesGetItemProvider + APPLE_OAUTH = "AppleOAuth" + BITBUCKET_OAUTH = "BitbucketOAuth" + DISCORD_OAUTH = "DiscordOAuth" + GITHUB_OAUTH = "GithubOAuth" + GIT_LAB_OAUTH = "GitLabOAuth" + GOOGLE_OAUTH = "GoogleOAuth" + INTUIT_OAUTH = "IntuitOAuth" + LINKED_IN_OAUTH = "LinkedInOAuth" + MICROSOFT_OAUTH = "MicrosoftOAuth" + SALESFORCE_OAUTH = "SalesforceOAuth" + SLACK_OAUTH = "SlackOAuth" + VERCEL_MARKETPLACE_OAUTH = "VercelMarketplaceOAuth" + VERCEL_OAUTH = "VercelOAuth" + XERO_OAUTH = "XeroOAuth" + ALL = [APPLE_OAUTH, BITBUCKET_OAUTH, DISCORD_OAUTH, GITHUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, INTUIT_OAUTH, LINKED_IN_OAUTH, MICROSOFT_OAUTH, SALESFORCE_OAUTH, SLACK_OAUTH, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, XERO_OAUTH].freeze + end + end +end diff --git a/lib/workos/types/user_invite_state.rb b/lib/workos/types/user_invite_state.rb new file mode 100644 index 00000000..077a8fd2 --- /dev/null +++ b/lib/workos/types/user_invite_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UserInviteState = InvitationState + end +end diff --git a/lib/workos/types/user_management_authentication_provider.rb b/lib/workos/types/user_management_authentication_provider.rb new file mode 100644 index 00000000..bdbee8eb --- /dev/null +++ b/lib/workos/types/user_management_authentication_provider.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class UserManagementAuthenticationProvider + AUTHKIT = "authkit" + APPLE_OAUTH = "AppleOAuth" + GIT_HUB_OAUTH = "GitHubOAuth" + GOOGLE_OAUTH = "GoogleOAuth" + MICROSOFT_OAUTH = "MicrosoftOAuth" + ALL = [AUTHKIT, APPLE_OAUTH, GIT_HUB_OAUTH, GOOGLE_OAUTH, MICROSOFT_OAUTH].freeze + end + end +end diff --git a/lib/workos/types/user_management_authentication_screen_hint.rb b/lib/workos/types/user_management_authentication_screen_hint.rb new file mode 100644 index 00000000..b5c2cf5b --- /dev/null +++ b/lib/workos/types/user_management_authentication_screen_hint.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class UserManagementAuthenticationScreenHint + SIGN_UP = "sign-up" + SIGN_IN = "sign-in" + ALL = [SIGN_UP, SIGN_IN].freeze + end + end +end diff --git a/lib/workos/types/user_management_invitations_order.rb b/lib/workos/types/user_management_invitations_order.rb new file mode 100644 index 00000000..99286ac3 --- /dev/null +++ b/lib/workos/types/user_management_invitations_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UserManagementInvitationsOrder = EventsOrder + end +end diff --git a/lib/workos/types/user_management_multi_factor_authentication_order.rb b/lib/workos/types/user_management_multi_factor_authentication_order.rb new file mode 100644 index 00000000..2b1f2d30 --- /dev/null +++ b/lib/workos/types/user_management_multi_factor_authentication_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UserManagementMultiFactorAuthenticationOrder = EventsOrder + end +end diff --git a/lib/workos/types/user_management_organization_membership_order.rb b/lib/workos/types/user_management_organization_membership_order.rb new file mode 100644 index 00000000..6612381b --- /dev/null +++ b/lib/workos/types/user_management_organization_membership_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UserManagementOrganizationMembershipOrder = EventsOrder + end +end diff --git a/lib/workos/types/user_management_organization_membership_statuses.rb b/lib/workos/types/user_management_organization_membership_statuses.rb new file mode 100644 index 00000000..4ec54dca --- /dev/null +++ b/lib/workos/types/user_management_organization_membership_statuses.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UserManagementOrganizationMembershipStatuses = OrganizationMembershipStatus + end +end diff --git a/lib/workos/types/user_management_users_authorized_applications_order.rb b/lib/workos/types/user_management_users_authorized_applications_order.rb new file mode 100644 index 00000000..decfb1a5 --- /dev/null +++ b/lib/workos/types/user_management_users_authorized_applications_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UserManagementUsersAuthorizedApplicationsOrder = EventsOrder + end +end diff --git a/lib/workos/types/user_management_users_feature_flags_order.rb b/lib/workos/types/user_management_users_feature_flags_order.rb new file mode 100644 index 00000000..f1ae2324 --- /dev/null +++ b/lib/workos/types/user_management_users_feature_flags_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UserManagementUsersFeatureFlagsOrder = EventsOrder + end +end diff --git a/lib/workos/types/user_management_users_order.rb b/lib/workos/types/user_management_users_order.rb new file mode 100644 index 00000000..de888172 --- /dev/null +++ b/lib/workos/types/user_management_users_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UserManagementUsersOrder = EventsOrder + end +end diff --git a/lib/workos/types/user_organization_membership_base_list_data_status.rb b/lib/workos/types/user_organization_membership_base_list_data_status.rb new file mode 100644 index 00000000..dd108464 --- /dev/null +++ b/lib/workos/types/user_organization_membership_base_list_data_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UserOrganizationMembershipBaseListDataStatus = OrganizationMembershipStatus + end +end diff --git a/lib/workos/types/user_organization_membership_status.rb b/lib/workos/types/user_organization_membership_status.rb new file mode 100644 index 00000000..1c7efa17 --- /dev/null +++ b/lib/workos/types/user_organization_membership_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UserOrganizationMembershipStatus = OrganizationMembershipStatus + end +end diff --git a/lib/workos/types/user_sessions_auth_method.rb b/lib/workos/types/user_sessions_auth_method.rb new file mode 100644 index 00000000..05607244 --- /dev/null +++ b/lib/workos/types/user_sessions_auth_method.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class UserSessionsAuthMethod + CROSS_APP_AUTH = "cross_app_auth" + EXTERNAL_AUTH = "external_auth" + IMPERSONATION = "impersonation" + MAGIC_CODE = "magic_code" + MIGRATED_SESSION = "migrated_session" + OAUTH = "oauth" + PASSKEY = "passkey" + PASSWORD = "password" + SSO = "sso" + UNKNOWN = "unknown" + ALL = [CROSS_APP_AUTH, EXTERNAL_AUTH, IMPERSONATION, MAGIC_CODE, MIGRATED_SESSION, OAUTH, PASSKEY, PASSWORD, SSO, UNKNOWN].freeze + end + end +end diff --git a/lib/workos/types/user_sessions_status.rb b/lib/workos/types/user_sessions_status.rb new file mode 100644 index 00000000..eeac4216 --- /dev/null +++ b/lib/workos/types/user_sessions_status.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class UserSessionsStatus + ACTIVE = "active" + EXPIRED = "expired" + REVOKED = "revoked" + ALL = [ACTIVE, EXPIRED, REVOKED].freeze + end + end +end diff --git a/lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb b/lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb new file mode 100644 index 00000000..f50670b3 --- /dev/null +++ b/lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class VaultByokKeyVerificationCompletedDataKeyProvider + AWS_KMS = "AWS_KMS" + GCP_KMS = "GCP_KMS" + AZURE_KEY_VAULT = "AZURE_KEY_VAULT" + ALL = [AWS_KMS, GCP_KMS, AZURE_KEY_VAULT].freeze + end + end +end diff --git a/lib/workos/types/vault_data_created_data_actor_source.rb b/lib/workos/types/vault_data_created_data_actor_source.rb new file mode 100644 index 00000000..d264b13d --- /dev/null +++ b/lib/workos/types/vault_data_created_data_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + VaultDataCreatedDataActorSource = VaultDekReadDataActorSource + end +end diff --git a/lib/workos/types/vault_data_deleted_data_actor_source.rb b/lib/workos/types/vault_data_deleted_data_actor_source.rb new file mode 100644 index 00000000..a2fecc99 --- /dev/null +++ b/lib/workos/types/vault_data_deleted_data_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + VaultDataDeletedDataActorSource = VaultDekReadDataActorSource + end +end diff --git a/lib/workos/types/vault_data_read_data_actor_source.rb b/lib/workos/types/vault_data_read_data_actor_source.rb new file mode 100644 index 00000000..5a9eba8b --- /dev/null +++ b/lib/workos/types/vault_data_read_data_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + VaultDataReadDataActorSource = VaultDekReadDataActorSource + end +end diff --git a/lib/workos/types/vault_data_updated_data_actor_source.rb b/lib/workos/types/vault_data_updated_data_actor_source.rb new file mode 100644 index 00000000..ea957a16 --- /dev/null +++ b/lib/workos/types/vault_data_updated_data_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + VaultDataUpdatedDataActorSource = VaultDekReadDataActorSource + end +end diff --git a/lib/workos/types/vault_dek_decrypted_data_actor_source.rb b/lib/workos/types/vault_dek_decrypted_data_actor_source.rb new file mode 100644 index 00000000..4fa00a6c --- /dev/null +++ b/lib/workos/types/vault_dek_decrypted_data_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + VaultDekDecryptedDataActorSource = VaultDekReadDataActorSource + end +end diff --git a/lib/workos/types/vault_dek_read_data_actor_source.rb b/lib/workos/types/vault_dek_read_data_actor_source.rb new file mode 100644 index 00000000..306c76b5 --- /dev/null +++ b/lib/workos/types/vault_dek_read_data_actor_source.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class VaultDekReadDataActorSource + API = "api" + DASHBOARD = "dashboard" + ALL = [API, DASHBOARD].freeze + end + end +end diff --git a/lib/workos/types/vault_kek_created_data_actor_source.rb b/lib/workos/types/vault_kek_created_data_actor_source.rb new file mode 100644 index 00000000..920d6c11 --- /dev/null +++ b/lib/workos/types/vault_kek_created_data_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + VaultKekCreatedDataActorSource = VaultDekReadDataActorSource + end +end diff --git a/lib/workos/types/vault_metadata_read_data_actor_source.rb b/lib/workos/types/vault_metadata_read_data_actor_source.rb new file mode 100644 index 00000000..6bc83710 --- /dev/null +++ b/lib/workos/types/vault_metadata_read_data_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + VaultMetadataReadDataActorSource = VaultDekReadDataActorSource + end +end diff --git a/lib/workos/types/vault_names_listed_data_actor_source.rb b/lib/workos/types/vault_names_listed_data_actor_source.rb new file mode 100644 index 00000000..0e391686 --- /dev/null +++ b/lib/workos/types/vault_names_listed_data_actor_source.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + VaultNamesListedDataActorSource = VaultDekReadDataActorSource + end +end diff --git a/lib/workos/types/webhook_endpoint_status.rb b/lib/workos/types/webhook_endpoint_status.rb new file mode 100644 index 00000000..d44d79c0 --- /dev/null +++ b/lib/workos/types/webhook_endpoint_status.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class WebhookEndpointStatus + ENABLED = "enabled" + DISABLED = "disabled" + ALL = [ENABLED, DISABLED].freeze + end + end +end diff --git a/lib/workos/types/webhooks_order.rb b/lib/workos/types/webhooks_order.rb new file mode 100644 index 00000000..90eaaa8b --- /dev/null +++ b/lib/workos/types/webhooks_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + WebhooksOrder = EventsOrder + end +end diff --git a/lib/workos/types/widget_scope.rb b/lib/workos/types/widget_scope.rb deleted file mode 100644 index 9e8c200e..00000000 --- a/lib/workos/types/widget_scope.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - module Types - # The WidgetScope constants are declarations of a fixed set of values for - # scopes while generating a widget token. - module WidgetScope - USERS_TABLE_MANAGE = "widgets:users-table:manage" - SSO_MANAGE = "widgets:sso:manage" - DOMAIN_VERIFICATION_MANAGE = "widgets:domain-verification:manage" - - ALL = [USERS_TABLE_MANAGE, SSO_MANAGE, DOMAIN_VERIFICATION_MANAGE].freeze - end - end -end diff --git a/lib/workos/types/widget_session_token_scopes.rb b/lib/workos/types/widget_session_token_scopes.rb new file mode 100644 index 00000000..996131d8 --- /dev/null +++ b/lib/workos/types/widget_session_token_scopes.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class WidgetSessionTokenScopes + WIDGETS_USERS_TABLE_MANAGE = "widgets:users-table:manage" + WIDGETS_DOMAIN_VERIFICATION_MANAGE = "widgets:domain-verification:manage" + WIDGETS_SSO_MANAGE = "widgets:sso:manage" + WIDGETS_API_KEYS_MANAGE = "widgets:api-keys:manage" + WIDGETS_DSYNC_MANAGE = "widgets:dsync:manage" + WIDGETS_AUDIT_LOG_STREAMING_MANAGE = "widgets:audit-log-streaming:manage" + ALL = [WIDGETS_USERS_TABLE_MANAGE, WIDGETS_DOMAIN_VERIFICATION_MANAGE, WIDGETS_SSO_MANAGE, WIDGETS_API_KEYS_MANAGE, WIDGETS_DSYNC_MANAGE, WIDGETS_AUDIT_LOG_STREAMING_MANAGE].freeze + end + end +end diff --git a/lib/workos/user.rb b/lib/workos/user.rb deleted file mode 100644 index 353a89d4..00000000 --- a/lib/workos/user.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The User class provides a lightweight wrapper around a WorkOS User - # resource. This class is not meant to be instantiated in a user space, - # and is instantiated internally but exposed. - class User - include HashProvider - - attr_accessor :id, :email, :first_name, :last_name, :email_verified, - :profile_picture_url, :external_id, :locale, :last_sign_in_at, :created_at, :updated_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @email = hash[:email] - @first_name = hash[:first_name] - @last_name = hash[:last_name] - @email_verified = hash[:email_verified] - @profile_picture_url = hash[:profile_picture_url] - @external_id = hash[:external_id] - @locale = hash[:locale] - @last_sign_in_at = hash[:last_sign_in_at] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - - def to_json(*) - { - id: id, - email: email, - first_name: first_name, - last_name: last_name, - email_verified: email_verified, - profile_picture_url: profile_picture_url, - external_id: external_id, - locale: locale, - last_sign_in_at: last_sign_in_at, - created_at: created_at, - updated_at: updated_at - } - end - end -end diff --git a/lib/workos/user_and_token.rb b/lib/workos/user_and_token.rb deleted file mode 100644 index c53e1d52..00000000 --- a/lib/workos/user_and_token.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The UserAndToken class represents a User and a corresponding Token. This - # class is not meant to be instantiated in user space, and is instantiated - # internally but exposed. - class UserAndToken - include HashProvider - - attr_accessor :token, :user - - def initialize(user_and_token_json) - json = JSON.parse(user_and_token_json, symbolize_names: true) - - @token = json[:token] - @user = WorkOS::User.new(json[:user].to_json) - end - - def to_json(*) - { - token: token, - user: user.to_json - } - end - end -end diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 68cfd08b..5f87d8c3 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -1,1257 +1,1300 @@ # frozen_string_literal: true -require "net/http" -require "uri" +# This file is auto-generated by oagen. Do not edit. -module WorkOS - # The UserManagement module provides convenience methods for working with the - # WorkOS User platform. You'll need a valid API key. - module UserManagement - autoload :Session, "workos/user_management/session" - - module Types - # The ProviderEnum is a declaration of a - # fixed set of values for User Management Providers. - class Provider - Apple = "AppleOAuth" - GitHub = "GitHubOAuth" - Google = "GoogleOAuth" - Microsoft = "MicrosoftOAuth" - AuthKit = "authkit" - - ALL = [Apple, GitHub, Google, Microsoft, AuthKit].freeze - end +require "json" - # The AuthFactorType is a declaration of a - # fixed set of factor values to enroll - class AuthFactorType - Totp = "totp" - - ALL = [Totp].freeze - end +module WorkOS + class UserManagement + def initialize(client) + @client = client end - class << self - include Client, Deprecation - - PROVIDERS = WorkOS::UserManagement::Types::Provider::ALL - AUTH_FACTOR_TYPES = WorkOS::UserManagement::Types::AuthFactorType::ALL - - # Load a sealed session - # - # @param [String] client_id The WorkOS client ID for the environment - # @param [String] session_data The sealed session data - # @param [String] cookie_password The password used to seal the session - # @param [Object] encryptor Optional custom encryptor that responds to #seal and #unseal - # - # @return WorkOS::Session - def load_sealed_session(client_id:, session_data:, cookie_password:, encryptor: nil) - WorkOS::Session.new( - user_management: self, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password, - encryptor: encryptor - ) - end - - # Generate an OAuth 2.0 authorization URL that automatically directs a user - # to their Identity Provider. - # - # @param [String] redirect_uri The URI where users are directed - # after completing the authentication step. Must match a - # configured redirect URI on your WorkOS dashboard. - # @param [String] client_id This value can be obtained from the API Keys page in the WorkOS dashboard. - # @param [String] provider A provider name is used to initiate SSO using an - # OAuth-compatible provider. Only 'authkit', 'AppleOAuth', 'GitHubOAuth', 'GoogleOAuth', - # and 'MicrosoftOAuth' are supported. - # @param [String] connection_id The ID for a Connection configured on - # WorkOS. - # @param [String] organization_id The organization_id selector is used to - # initiate SSO for an Organization. - # @param [String] state An arbitrary state object - # that is preserved and available to the client in the response. - # @param [String] login_hint Can be used to pre-fill the username/email address - # field of the IdP sign-in page for the user, if you know their username ahead of time. - # @param [String] screen_hint Specify which AuthKit screen users should land on upon redirection - # (Only applicable when provider is 'authkit'). - # @param [String] domain_hint Can be used to pre-fill the domain field when - # initiating authentication with Microsoft OAuth, or with a GoogleSAML connection type. - # @param [Array] provider_scopes An array of additional OAuth scopes to request from the provider. - # @example - # WorkOS::UserManagement.authorization_url( - # connection_id: 'conn_123', - # client_id: 'project_01DG5TGK363GRVXP3ZS40WNGEZ', - # redirect_uri: 'https://your-app.com/callback', - # state: { - # next_page: '/docs' - # }.to_s - # ) - # - # => "https://api.workos.com/user_management/authorize?connection_id=conn_123" \ - # "&client_id=project_01DG5TGK363GRVXP3ZS40WNGEZ" \ - # "&redirect_uri=https%3A%2F%2Fyour-app.com%2Fcallback&" \ - # "response_type=code&state=%7B%3Anext_page%3D%3E%22%2Fdocs%22%7D" - # - # @return [String] - # rubocop:disable Metrics/ParameterLists - def authorization_url( - redirect_uri:, - client_id: nil, - domain_hint: nil, - login_hint: nil, - screen_hint: nil, - provider: nil, - connection_id: nil, - organization_id: nil, - state: "", - provider_scopes: nil - ) - validate_authorization_url_arguments( - provider: provider, - connection_id: connection_id, - organization_id: organization_id - ) - - query = URI.encode_www_form({ - client_id: client_id, - redirect_uri: redirect_uri, - response_type: "code", - state: state, - domain_hint: domain_hint, - login_hint: login_hint, - screen_hint: screen_hint, - provider: provider, - connection_id: connection_id, - organization_id: organization_id, - provider_scopes: provider_scopes - }.compact) - - "https://#{WorkOS.config.api_hostname}/user_management/authorize?#{query}" - end - # rubocop:enable Metrics/ParameterLists - - # Get a User - # - # @param [String] id The unique ID of the User. - # - # @return WorkOS::User - def get_user(id:) - response = execute_request( - request: get_request( - path: "/user_management/users/#{id}", - auth: true - ) - ) - - WorkOS::User.new(response.body) - end - - # Retrieve a list of users. - # - # @param [Hash] options - # @option options [String] email Filter Users by their email. - # @option options [String] organization_id Filter Users by the organization they are members of. - # @option options [String] limit Maximum number of records to return. - # @option options [String] order The order in which to paginate records - # @option options [String] before Pagination cursor to receive records - # before a provided User ID. - # @option options [String] after Pagination cursor to receive records - # before a provided User ID. - # - # @return [WorkOS::User] - def list_users(options = {}) - options[:order] ||= "desc" - response = execute_request( - request: get_request( - path: "/user_management/users", - auth: true, - params: options - ) - ) - - parsed_response = JSON.parse(response.body) - - users = parsed_response["data"].map do |user| - ::WorkOS::User.new(user.to_json) - end - - WorkOS::Types::ListStruct.new( - data: users, - list_metadata: parsed_response["list_metadata"] - ) - end - - # Create a user - # - # @param [String] email The email address of the user. - # @param [String] password The password to set for the user. - # @param [String] first_name The user's first name. - # @param [String] last_name The user's last name. - # @param [Boolean] email_verified Whether the user's email address was previously verified. - # @param [String] external_id The user's external ID. - # @param [String] password_hash The user's hashed password. - # @option [String] password_hash_type The algorithm originally used to hash the password. - # - # @return [WorkOS::User] - # rubocop:disable Metrics/ParameterLists - def create_user( - email:, - password: nil, - first_name: nil, - last_name: nil, - email_verified: nil, - external_id: nil, - password_hash: nil, - password_hash_type: nil - ) - request = post_request( - path: "/user_management/users", - body: { - email: email, - password: password, - first_name: first_name, - last_name: last_name, - email_verified: email_verified, - external_id: external_id, - password_hash: password_hash, - password_hash_type: password_hash_type - }.compact, - auth: true - ) - - response = execute_request(request: request) + # Get JWKS + # @param client_id [String] Identifies the application making the request to the WorkOS server. You can obtain your client ID from the [API Keys](https://dashboard.workos.com/api-keys) page in the dashboard. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::JwksResponse] + def get_jwks( + client_id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/sso/jwks/#{WorkOS::Util.encode_path(client_id)}", auth: true, request_options: request_options) + WorkOS::JwksResponse.new(response.body) + end - WorkOS::User.new(response.body) - end + # Authenticate + # @param client_id [String] The client ID of the application. + # @param client_secret [String, nil] The client secret of the application. + # @param grant_type [String] + # @param code [String, nil] The authorization code received from the redirect. + # @param code_verifier [String, nil] The PKCE code verifier used to derive the code challenge passed to the authorization URL. + # @param invitation_token [String, nil] An invitation token to accept during authentication. + # @param ip_address [String, nil] The IP address of the user's request. + # @param device_id [String, nil] A unique identifier for the device. + # @param user_agent [String, nil] The user agent string from the user's browser. + # @param email [String, nil] The user's email address. + # @param password [String, nil] The user's password. + # @param refresh_token [String, nil] The refresh token to exchange for new tokens. + # @param organization_id [String, nil] The ID of the organization to scope the session to. + # @param pending_authentication_token [String, nil] The pending authentication token from a previous authentication attempt. + # @param authentication_challenge_id [String, nil] The ID of the MFA authentication challenge. + # @param device_code [String, nil] The device verification code. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::AuthenticateResponse] + def create_authenticate( + client_id:, + grant_type:, + client_secret: nil, + code: nil, + code_verifier: nil, + invitation_token: nil, + ip_address: nil, + device_id: nil, + user_agent: nil, + email: nil, + password: nil, + refresh_token: nil, + organization_id: nil, + pending_authentication_token: nil, + authentication_challenge_id: nil, + device_code: nil, + request_options: {} + ) + body = { + "client_id" => client_id, + "client_secret" => client_secret, + "grant_type" => grant_type, + "code" => code, + "code_verifier" => code_verifier, + "invitation_token" => invitation_token, + "ip_address" => ip_address, + "device_id" => device_id, + "user_agent" => user_agent, + "email" => email, + "password" => password, + "refresh_token" => refresh_token, + "organization_id" => organization_id, + "pending_authentication_token" => pending_authentication_token, + "authentication_challenge_id" => authentication_challenge_id, + "device_code" => device_code + }.compact + response = @client.request(method: :post, path: "/user_management/authenticate", auth: true, body: body, request_options: request_options) + WorkOS::AuthenticateResponse.new(response.body) + end - # Update a user - # - # @param [String] id of the user. - # @param [String] email of the user. - # @param [String] first_name The user's first name. - # @param [String] last_name The user's last name. - # @param [Boolean] email_verified Whether the user's email address was previously verified. - # @param [String] external_id The users's external ID - # @param [String] locale The user's locale. - # @param [String] password The user's password. - # @param [String] password_hash The user's hashed password. - # @option [String] password_hash_type The algorithm originally used to hash the password. - # Valid values are bcrypt. - # - # @return [WorkOS::User] - def update_user( - id:, - email: :not_set, - first_name: :not_set, - last_name: :not_set, - email_verified: :not_set, - external_id: :not_set, - locale: :not_set, - password: :not_set, - password_hash: :not_set, - password_hash_type: :not_set + # Authenticate with password. + # @param email [String] + # @param password [String] + # @param invitation_token [String, nil] + # @param ip_address [String, nil] + # @param device_id [String, nil] + # @param user_agent [String, nil] + # @param request_options [Hash] Per-request overrides. + # @return [WorkOS::AuthenticateResponse] + def authenticate_with_password( + email:, + password:, + invitation_token: nil, + ip_address: nil, + device_id: nil, + user_agent: nil, + request_options: {} + ) + create_authenticate( + grant_type: "password", + client_id: @client.client_id, + client_secret: @client.api_key, + email: email, + password: password, + invitation_token: invitation_token, + ip_address: ip_address, + device_id: device_id, + user_agent: user_agent, + request_options: request_options ) - request = put_request( - path: "/user_management/users/#{id}", - body: { - email: email, - first_name: first_name, - last_name: last_name, - email_verified: email_verified, - external_id: external_id, - locale: locale, - password: password, - password_hash: password_hash, - password_hash_type: password_hash_type - }.reject { |_, v| v == :not_set }, - auth: true - ) - - response = execute_request(request: request) - - WorkOS::User.new(response.body) - end - # rubocop:enable Metrics/ParameterLists - - # Delete a User - # - # @param [String] id The unique ID of the User. - # - # @return [Bool] - returns `true` if successful - def delete_user(id:) - response = execute_request( - request: delete_request( - path: "/user_management/users/#{id}", - auth: true - ) - ) - - response.is_a? Net::HTTPSuccess - end + end - # Authenticates user by email and password. - # - # @param [String] email The email address of the user. - # @param [String] password The password for the user. - # @param [String] client_id The WorkOS client ID for the environment - # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate. - # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate. - # @param [String] invitation_token The token of an Invitation, if required. - # @param [Hash] session An optional hash that determines whether the session should be sealed and - # the optional cookie password. - # - # @return WorkOS::AuthenticationResponse - # rubocop:disable Metrics/ParameterLists - def authenticate_with_password( - email:, - password:, - client_id:, - ip_address: nil, - user_agent: nil, - invitation_token: nil, - session: nil + # Authenticate with code. + # @param code [String] + # @param code_verifier [String, nil] + # @param invitation_token [String, nil] + # @param ip_address [String, nil] + # @param device_id [String, nil] + # @param user_agent [String, nil] + # @param request_options [Hash] Per-request overrides. + # @return [WorkOS::AuthenticateResponse] + def authenticate_with_code( + code:, + code_verifier: nil, + invitation_token: nil, + ip_address: nil, + device_id: nil, + user_agent: nil, + request_options: {} + ) + create_authenticate( + grant_type: "authorization_code", + client_id: @client.client_id, + client_secret: @client.api_key, + code: code, + code_verifier: code_verifier, + invitation_token: invitation_token, + ip_address: ip_address, + device_id: device_id, + user_agent: user_agent, + request_options: request_options ) - validate_session(session) - - response = execute_request( - request: post_request( - path: "/user_management/authenticate", - body: { - client_id: client_id, - client_secret: WorkOS.config.key!, - email: email, - password: password, - ip_address: ip_address, - user_agent: user_agent, - invitation_token: invitation_token, - grant_type: "password" - } - ) - ) - - WorkOS::AuthenticationResponse.new(response.body, session) - end - # rubocop:enable Metrics/ParameterLists + end - # Authenticate a user using OAuth or an organization's SSO connection. - # - # @param [String] code The authorization value which was passed back as a - # query parameter in the callback to the Redirect URI. - # @param [String] client_id The WorkOS client ID for the environment - # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate. - # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate. - # @param [String] invitation_token The token of an Invitation, if required. - # @param [Hash] session An optional hash that determines whether the session should be sealed and - # the optional cookie password. - # - # @return WorkOS::AuthenticationResponse - def authenticate_with_code( - code:, - client_id:, - ip_address: nil, - user_agent: nil, - invitation_token: nil, - session: nil + # Authenticate with refresh token. + # @param refresh_token [String] + # @param organization_id [String, nil] + # @param ip_address [String, nil] + # @param device_id [String, nil] + # @param user_agent [String, nil] + # @param request_options [Hash] Per-request overrides. + # @return [WorkOS::AuthenticateResponse] + def authenticate_with_refresh_token( + refresh_token:, + organization_id: nil, + ip_address: nil, + device_id: nil, + user_agent: nil, + request_options: {} + ) + create_authenticate( + grant_type: "refresh_token", + client_id: @client.client_id, + client_secret: @client.api_key, + refresh_token: refresh_token, + organization_id: organization_id, + ip_address: ip_address, + device_id: device_id, + user_agent: user_agent, + request_options: request_options ) - validate_session(session) - - response = execute_request( - request: post_request( - path: "/user_management/authenticate", - body: { - code: code, - client_id: client_id, - client_secret: WorkOS.config.key!, - ip_address: ip_address, - user_agent: user_agent, - invitation_token: invitation_token, - grant_type: "authorization_code" - } - ) - ) - - WorkOS::AuthenticationResponse.new(response.body, session) - end + end - # Authenticate a user using a refresh token. - # - # @param [String] refresh_token The refresh token previously obtained from a successful authentication call - # @param [String] client_id The WorkOS client ID for the environment - # @param [String] organization_id The organization to issue the new access token for. (Optional) - # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate. - # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate. - # @param [Hash] session An optional hash that determines whether the session should be sealed and - # the optional cookie password. - # - # @return WorkOS::RefreshAuthenticationResponse - def authenticate_with_refresh_token( - refresh_token:, - client_id:, - organization_id: nil, - ip_address: nil, - user_agent: nil, - session: nil + # Authenticate with magic auth. + # @param code [String] + # @param email [String] + # @param invitation_token [String, nil] + # @param ip_address [String, nil] + # @param device_id [String, nil] + # @param user_agent [String, nil] + # @param request_options [Hash] Per-request overrides. + # @return [WorkOS::AuthenticateResponse] + def authenticate_with_magic_auth( + code:, + email:, + invitation_token: nil, + ip_address: nil, + device_id: nil, + user_agent: nil, + request_options: {} + ) + create_authenticate( + grant_type: "urn:workos:oauth:grant-type:magic-auth:code", + client_id: @client.client_id, + client_secret: @client.api_key, + code: code, + email: email, + invitation_token: invitation_token, + ip_address: ip_address, + device_id: device_id, + user_agent: user_agent, + request_options: request_options ) - validate_session(session) - - response = execute_request( - request: post_request( - path: "/user_management/authenticate", - body: { - refresh_token: refresh_token, - client_id: client_id, - client_secret: WorkOS.config.key!, - ip_address: ip_address, - user_agent: user_agent, - grant_type: "refresh_token", - organization_id: organization_id - } - ) - ) - - WorkOS::RefreshAuthenticationResponse.new(response.body, session) - end + end - # Authenticate user by Magic Auth Code. - # - # @param [String] code The one-time code that was emailed to the user. - # @param [String] email The email address of the user. - # @param [String] client_id The WorkOS client ID for the environment. - # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate. - # @param [String] link_authorization_code Used to link an OAuth profile to an existing user, - # after having completed a Magic Code challenge. - # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate. - # @param [String] invitation_token The token of an Invitation, if required. - # @param [Hash] session An optional hash that determines whether the session should be sealed and - # the optional cookie password. - # - # @return WorkOS::AuthenticationResponse - # rubocop:disable Metrics/ParameterLists - def authenticate_with_magic_auth( - code:, - email:, - client_id:, - ip_address: nil, - user_agent: nil, - link_authorization_code: nil, - invitation_token: nil, - session: nil + # Authenticate with email verification. + # @param code [String] + # @param pending_authentication_token [String] + # @param ip_address [String, nil] + # @param device_id [String, nil] + # @param user_agent [String, nil] + # @param request_options [Hash] Per-request overrides. + # @return [WorkOS::AuthenticateResponse] + def authenticate_with_email_verification( + code:, + pending_authentication_token:, + ip_address: nil, + device_id: nil, + user_agent: nil, + request_options: {} + ) + create_authenticate( + grant_type: "urn:workos:oauth:grant-type:email-verification:code", + client_id: @client.client_id, + client_secret: @client.api_key, + code: code, + pending_authentication_token: pending_authentication_token, + ip_address: ip_address, + device_id: device_id, + user_agent: user_agent, + request_options: request_options ) - validate_session(session) - - response = execute_request( - request: post_request( - path: "/user_management/authenticate", - body: { - code: code, - email: email, - client_id: client_id, - client_secret: WorkOS.config.key!, - ip_address: ip_address, - user_agent: user_agent, - grant_type: "urn:workos:oauth:grant-type:magic-auth:code", - link_authorization_code: link_authorization_code, - invitation_token: invitation_token - } - ) - ) - - WorkOS::AuthenticationResponse.new(response.body, session) - end - # rubocop:enable Metrics/ParameterLists + end - # Authenticate a user into an organization they are a member of. - # - # @param [String] client_id The WorkOS client ID for the environment. - # @param [String] organization_id The organization ID the user selected to sign in to. - # @param [String] pending_authentication_token The pending authentication token - # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate. - # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate. - # @param [Hash] session An optional hash that determines whether the session should be sealed and - # the optional cookie password. - # - # @return WorkOS::AuthenticationResponse - def authenticate_with_organization_selection( - client_id:, - organization_id:, - pending_authentication_token:, - ip_address: nil, - user_agent: nil, - session: nil + # Authenticate with totp. + # @param code [String] + # @param pending_authentication_token [String] + # @param authentication_challenge_id [String] + # @param ip_address [String, nil] + # @param device_id [String, nil] + # @param user_agent [String, nil] + # @param request_options [Hash] Per-request overrides. + # @return [WorkOS::AuthenticateResponse] + def authenticate_with_totp( + code:, + pending_authentication_token:, + authentication_challenge_id:, + ip_address: nil, + device_id: nil, + user_agent: nil, + request_options: {} + ) + create_authenticate( + grant_type: "urn:workos:oauth:grant-type:mfa-totp", + client_id: @client.client_id, + client_secret: @client.api_key, + code: code, + pending_authentication_token: pending_authentication_token, + authentication_challenge_id: authentication_challenge_id, + ip_address: ip_address, + device_id: device_id, + user_agent: user_agent, + request_options: request_options ) - validate_session(session) - - response = execute_request( - request: post_request( - path: "/user_management/authenticate", - body: { - client_id: client_id, - client_secret: WorkOS.config.key!, - ip_address: ip_address, - user_agent: user_agent, - grant_type: "urn:workos:oauth:grant-type:organization-selection", - organization_id: organization_id, - pending_authentication_token: pending_authentication_token - } - ) - ) - - WorkOS::AuthenticationResponse.new(response.body, session) - end + end - # Authenticate a user using TOTP. - # - # @param [String] code The one-time code that was emailed to the user. - # @param [String] client_id The WorkOS client ID for the environment - # @param [String] pending_authentication_token The pending authentication token - # from the initial authentication request. - # @param [String] authentication_challenge_id The authentication challenge ID for the - # authentication request. - # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate. - # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate. - # @param [Hash] session An optional hash that determines whether the session should be sealed and - # the optional cookie password. - # - # @return WorkOS::AuthenticationResponse - # rubocop:disable Metrics/ParameterLists - def authenticate_with_totp( - code:, - client_id:, - pending_authentication_token:, - authentication_challenge_id:, - ip_address: nil, - user_agent: nil, - session: nil + # Authenticate with organization selection. + # @param pending_authentication_token [String] + # @param organization_id [String] + # @param ip_address [String, nil] + # @param device_id [String, nil] + # @param user_agent [String, nil] + # @param request_options [Hash] Per-request overrides. + # @return [WorkOS::AuthenticateResponse] + def authenticate_with_organization_selection( + pending_authentication_token:, + organization_id:, + ip_address: nil, + device_id: nil, + user_agent: nil, + request_options: {} + ) + create_authenticate( + grant_type: "urn:workos:oauth:grant-type:organization-selection", + client_id: @client.client_id, + client_secret: @client.api_key, + pending_authentication_token: pending_authentication_token, + organization_id: organization_id, + ip_address: ip_address, + device_id: device_id, + user_agent: user_agent, + request_options: request_options ) - validate_session(session) - - response = execute_request( - request: post_request( - path: "/user_management/authenticate", - body: { - code: code, - client_id: client_id, - client_secret: WorkOS.config.key!, - pending_authentication_token: pending_authentication_token, - grant_type: "urn:workos:oauth:grant-type:mfa-totp", - authentication_challenge_id: authentication_challenge_id, - ip_address: ip_address, - user_agent: user_agent - } - ) - ) - - WorkOS::AuthenticationResponse.new(response.body, session) - end - # rubocop:enable Metrics/ParameterLists + end - # Authenticate a user using Email Verification Code. - # - # @param [String] code The one-time code that was emailed to the user. - # @param [String] client_id The WorkOS client ID for the environment - # @param [String] pending_authentication_token The token returned from a failed email/password or OAuth - # authentication attempt due to an unverified email address. - # @param [String] ip_address The IP address of the request from the user who is attempting to authenticate. - # @param [String] user_agent The user agent of the request from the user who is attempting to authenticate. - # @param [Hash] session An optional hash that determines whether the session should be sealed and - # the optional cookie password. - # - # @return WorkOS::AuthenticationResponse - def authenticate_with_email_verification( - code:, - client_id:, - pending_authentication_token:, - ip_address: nil, - user_agent: nil, - session: nil + # Authenticate with device code. + # @param device_code [String] + # @param ip_address [String, nil] + # @param device_id [String, nil] + # @param user_agent [String, nil] + # @param request_options [Hash] Per-request overrides. + # @return [WorkOS::AuthenticateResponse] + def authenticate_with_device_code( + device_code:, + ip_address: nil, + device_id: nil, + user_agent: nil, + request_options: {} + ) + create_authenticate( + grant_type: "urn:ietf:params:oauth:grant-type:device_code", + client_id: @client.client_id, + device_code: device_code, + ip_address: ip_address, + device_id: device_id, + user_agent: user_agent, + request_options: request_options ) - validate_session(session) - - response = execute_request( - request: post_request( - path: "/user_management/authenticate", - body: { - code: code, - client_id: client_id, - pending_authentication_token: pending_authentication_token, - client_secret: WorkOS.config.key!, - grant_type: "urn:workos:oauth:grant-type:email-verification:code", - ip_address: ip_address, - user_agent: user_agent - } - ) - ) - - WorkOS::AuthenticationResponse.new(response.body, session) - end - - # Get the logout URL for a session - # - # The user's browser should be navigated to this URL - # - # @param [String] session_id The session ID can be found in the `sid` - # claim of the access token - # @param [String] return_to The URL to redirect the user to after logging out - # - # @return String - def get_logout_url(session_id:, return_to: nil) - params = {session_id: session_id} - params[:return_to] = return_to if return_to - - URI::HTTPS.build( - host: WorkOS.config.api_hostname, - path: "/user_management/sessions/logout", - query: URI.encode_www_form(params) - ).to_s - end - - # Revokes a session - # - # @param [String] session_id The session ID can be found in the `sid` - # claim of the access token - def revoke_session(session_id:) - response = execute_request( - request: post_request( - path: "/user_management/sessions/revoke", - body: { - session_id: session_id - }, - auth: true - ) - ) - - response.is_a? Net::HTTPSuccess - end - - # Get the JWKS URL - # - # The JWKS can be used to validate the access token returned upon successful authentication - # - # @param [String] client_id The WorkOS client ID for the environment - # - # @return String - def get_jwks_url(client_id) - URI::HTTPS.build( - host: WorkOS.config.api_hostname, - path: "/sso/jwks/#{client_id}" - ).to_s - end - - # Gets a Magic Auth object - # - # @param [String] id The unique ID of the MagicAuth object. - # - # @return WorkOS::MagicAuth - def get_magic_auth(id:) - response = execute_request( - request: get_request( - path: "/user_management/magic_auth/#{id}", - auth: true - ) - ) + end - WorkOS::MagicAuth.new(response.body) - end + # Get device authorization URL + # @param client_id [String] The WorkOS client ID for your application. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::DeviceAuthorizationResponse] + def create_device( + client_id:, + request_options: {} + ) + body = { + "client_id" => client_id + }.compact + response = @client.request(method: :post, path: "/user_management/authorize/device", auth: true, body: body, request_options: request_options) + WorkOS::DeviceAuthorizationResponse.new(response.body) + end - # Creates a MagicAuth code - # - # @param [String] email The email address of the recipient. - # @param [String] invitation_token The token of an Invitation, if required. - # - # @return WorkOS::MagicAuth - def create_magic_auth(email:, invitation_token: nil) - response = execute_request( - request: post_request( - path: "/user_management/magic_auth", - body: { - email: email, - invitation_token: invitation_token - }.compact, - auth: true - ) - ) + # Revoke Session + # @param session_id [String] The ID of the session to revoke. This can be extracted from the `sid` claim of the access token. + # @param return_to [String, nil] The URL to redirect the user to after session revocation. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def revoke_session( + session_id:, + return_to: nil, + request_options: {} + ) + body = { + "session_id" => session_id, + "return_to" => return_to + }.compact + @client.request(method: :post, path: "/user_management/sessions/revoke", auth: true, body: body, request_options: request_options) + nil + end - WorkOS::MagicAuth.new(response.body) - end + # Create a CORS origin + # @param origin [String] The origin URL to allow for CORS requests. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::CORSOriginResponse] + def create_cors_origin( + origin:, + request_options: {} + ) + body = { + "origin" => origin + }.compact + response = @client.request(method: :post, path: "/user_management/cors_origins", auth: true, body: body, request_options: request_options) + WorkOS::CORSOriginResponse.new(response.body) + end - # Create a one-time Magic Auth code and emails it to the user. - # - # @param [String] email The email address the one-time code will be sent to. - # - # @return Boolean - def send_magic_auth_code(email:) - warn_deprecation '`send_magic_auth_code` is deprecated. - Please use `create_magic_auth` instead. This method will be removed in a future major version.' + # Get an email verification code + # @param id [String] The ID of the email verification code. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::EmailVerification] + def get_email_verification( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/user_management/email_verification/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::EmailVerification.new(response.body) + end - response = execute_request( - request: post_request( - path: "/user_management/magic_auth/send", - body: { - email: email - }, - auth: true - ) - ) + # Create a password reset token + # @param email [String] The email address of the user requesting a password reset. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::PasswordReset] + def reset_password( + email:, + request_options: {} + ) + body = { + "email" => email + }.compact + response = @client.request(method: :post, path: "/user_management/password_reset", auth: true, body: body, request_options: request_options) + WorkOS::PasswordReset.new(response.body) + end - response.is_a? Net::HTTPSuccess - end + # Reset the password + # @param token [String] The password reset token. + # @param new_password [String] The new password to set for the user. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::ResetPasswordResponse] + def confirm_password_reset( + token:, + new_password:, + request_options: {} + ) + body = { + "token" => token, + "new_password" => new_password + }.compact + response = @client.request(method: :post, path: "/user_management/password_reset/confirm", auth: true, body: body, request_options: request_options) + WorkOS::ResetPasswordResponse.new(response.body) + end - # Enroll a user into an authentication factor. - # - # @param [String] user_id The id for the user. - # @param [String] type The type of the factor to enroll. Only option available is totp. - # @param [String] totp_issuer For totp factors. Typically your application - # or company name, this helps users distinguish between factors in authenticator apps. - # @param [String] totp_user For totp factors. Used as the account name in authenticator apps. - # @param [String] totp_secret For totp factors. The Base32 encdoded secret key for the - # factor. Generated if not provided. (Optional) - # - # @return WorkOS::AuthenticationFactorAndChallenge - def enroll_auth_factor(user_id:, type:, totp_issuer: nil, totp_user: nil, totp_secret: nil) - validate_auth_factor_type( - type: type - ) + # Get a password reset token + # @param id [String] The ID of the password reset token. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::PasswordReset] + def get_password_reset( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/user_management/password_reset/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::PasswordReset.new(response.body) + end - response = execute_request( - request: post_request( - path: "/user_management/users/#{user_id}/auth_factors", - body: { - type: type, - totp_issuer: totp_issuer, - totp_user: totp_user, - totp_secret: totp_secret - }.compact, - auth: true + # List users + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::UserManagementUsersOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param organization [String, nil] (deprecated) Filter users by the organization they are a member of. Deprecated in favor of `organization_id`. + # @param organization_id [String, nil] Filter users by the organization they are a member of. + # @param email [String, nil] Filter users by their email address. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_users( + before: nil, + after: nil, + limit: nil, + order: nil, + organization: nil, + organization_id: nil, + email: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "organization" => organization, + "organization_id" => organization_id, + "email" => email + }.compact + response = @client.request(method: :get, path: "/user_management/users", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::User, filters: {before: before, limit: limit, order: order, organization: organization, organization_id: organization_id, email: email}, + fetch_next: lambda do |cursor| + list_users( + before: before, + after: cursor, + limit: limit, + order: order, + organization: organization, + organization_id: organization_id, + email: email, + request_options: request_options ) - ) - - WorkOS::AuthenticationFactorAndChallenge.new(response.body) - end - - # Get all auth factors for a user - # - # @param [String] user_id The id for the user. - # - # @return WorkOS::ListStruct - def list_auth_factors(user_id:) - response = execute_request( - request: get_request( - path: "/user_management/users/#{user_id}/auth_factors", - auth: true + end, + fetch_previous: lambda do |cursor| + list_users( + before: cursor, + after: nil, + limit: limit, + order: order, + organization: organization, + organization_id: organization_id, + email: email, + request_options: request_options ) - ) - - parsed_response = JSON.parse(response.body) - - auth_factors = parsed_response["data"].map do |auth_factor| - ::WorkOS::Factor.new(auth_factor.to_json) end + ) + end - WorkOS::Types::ListStruct.new( - data: auth_factors, - list_metadata: parsed_response["list_metadata"] - ) + # Create a user + # @param email [String] The email address of the user. + # @param first_name [String, nil] The first name of the user. + # @param last_name [String, nil] The last name of the user. + # @param email_verified [Boolean, nil] Whether the user's email has been verified. + # @param metadata [Hash{String => String}, nil] Object containing metadata key/value pairs associated with the user. + # @param external_id [String, nil] The external ID of the user. + # @param password [String, nil] The password to set for the user. Mutually exclusive with `password_hash` and `password_hash_type`. + # @param password_hash [String, nil] The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`. + # @param password_hash_type [WorkOS::Types::CreateUserPasswordHashType, nil] The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::User] + def create_user( + email:, + first_name: nil, + last_name: nil, + email_verified: nil, + metadata: nil, + external_id: nil, + password: nil, + password_hash: nil, + password_hash_type: nil, + request_options: {} + ) + params = {} + if password + case password[:type] + when "plaintext" + params["password"] = password[:password] + when "hashed" + params["password_hash"] = password[:password_hash] + params["password_hash_type"] = password[:password_hash_type] + end end + body = { + "email" => email, + "first_name" => first_name, + "last_name" => last_name, + "email_verified" => email_verified, + "metadata" => metadata, + "external_id" => external_id, + "password" => password, + "password_hash" => password_hash, + "password_hash_type" => password_hash_type + }.compact + response = @client.request(method: :post, path: "/user_management/users", auth: true, params: params, body: body, request_options: request_options) + WorkOS::User.new(response.body) + end - # Get all sessions for a user - # - # @param [String] user_id The id for the user. - # @param [Hash] options - # @option options [String] limit Maximum number of records to return. - # @option options [String] order The order in which to paginate records - # @option options [String] before Pagination cursor to receive records - # before a provided Session ID. - # @option options [String] after Pagination cursor to receive records - # after a provided Session ID. - # - # @return [WorkOS::Types::ListStruct] - def list_sessions(user_id:, options: {}) - options[:order] ||= "desc" - response = execute_request( - request: get_request( - path: "/user_management/users/#{user_id}/sessions", - auth: true, - params: options - ) - ) + # Get a user by external ID + # @param external_id [String] The external ID of the user. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::User] + def get_user_by_external_id( + external_id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/user_management/users/external_id/#{WorkOS::Util.encode_path(external_id)}", auth: true, request_options: request_options) + WorkOS::User.new(response.body) + end - parsed_response = JSON.parse(response.body) + # Get a user + # @param id [String] The unique ID of the user. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::User] + def get_user( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::User.new(response.body) + end - sessions = parsed_response["data"].map do |session| - ::WorkOS::UserManagement::Session.new(session.to_json) + # Update a user + # @param id [String] The unique ID of the user. + # @param email [String, nil] The email address of the user. + # @param first_name [String, nil] The first name of the user. + # @param last_name [String, nil] The last name of the user. + # @param email_verified [Boolean, nil] Whether the user's email has been verified. + # @param metadata [Hash{String => String}, nil] Object containing metadata key/value pairs associated with the user. + # @param external_id [String, nil] The external ID of the user. + # @param locale [String, nil] The user's preferred locale. + # @param password [String, nil] The password to set for the user. Mutually exclusive with `password_hash` and `password_hash_type`. + # @param password_hash [String, nil] The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`. + # @param password_hash_type [WorkOS::Types::UpdateUserPasswordHashType, nil] The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::User] + def update_user( + id:, + email: nil, + first_name: nil, + last_name: nil, + email_verified: nil, + metadata: nil, + external_id: nil, + locale: nil, + password: nil, + password_hash: nil, + password_hash_type: nil, + request_options: {} + ) + params = {} + if password + case password[:type] + when "plaintext" + params["password"] = password[:password] + when "hashed" + params["password_hash"] = password[:password_hash] + params["password_hash_type"] = password[:password_hash_type] end - - WorkOS::Types::ListStruct.new( - data: sessions, - list_metadata: parsed_response["list_metadata"] - ) end + body = { + "email" => email, + "first_name" => first_name, + "last_name" => last_name, + "email_verified" => email_verified, + "metadata" => metadata, + "external_id" => external_id, + "locale" => locale, + "password" => password, + "password_hash" => password_hash, + "password_hash_type" => password_hash_type + }.compact + response = @client.request(method: :put, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}", auth: true, params: params, body: body, request_options: request_options) + WorkOS::User.new(response.body) + end - # Gets an email verification object - # - # @param [String] id The unique ID of the EmailVerification object. - # - # @return WorkOS::EmailVerification - def get_email_verification(id:) - response = execute_request( - request: get_request( - path: "/user_management/email_verification/#{id}", - auth: true - ) - ) + # Delete a user + # @param id [String] The unique ID of the user. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_user( + id:, + request_options: {} + ) + @client.request(method: :delete, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + nil + end - WorkOS::EmailVerification.new(response.body) - end + # Confirm email change + # @param id [String] The unique ID of the user. + # @param code [String] The one-time code used to confirm the email change. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::EmailChangeConfirmation] + def confirm_email_change( + id:, + code:, + request_options: {} + ) + body = { + "code" => code + }.compact + response = @client.request(method: :post, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/confirm", auth: true, body: body, request_options: request_options) + WorkOS::EmailChangeConfirmation.new(response.body) + end - # Sends a verification email to the provided user. - # - # @param [String] user_id The unique ID of the User whose email address will be verified. - # - # @return WorkOS::UserResponse - def send_verification_email(user_id:) - response = execute_request( - request: post_request( - path: "/user_management/users/#{user_id}/email_verification/send", - auth: true - ) - ) + # Send email change code + # @param id [String] The unique ID of the user. + # @param new_email [String] The new email address to change to. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::EmailChange] + def send_email_change( + id:, + new_email:, + request_options: {} + ) + body = { + "new_email" => new_email + }.compact + response = @client.request(method: :post, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/send", auth: true, body: body, request_options: request_options) + WorkOS::EmailChange.new(response.body) + end - WorkOS::UserResponse.new(response.body) - end + # Verify email + # @param id [String] The ID of the user. + # @param code [String] The one-time email verification code. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::VerifyEmailResponse] + def verify_email( + id:, + code:, + request_options: {} + ) + body = { + "code" => code + }.compact + response = @client.request(method: :post, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_verification/confirm", auth: true, body: body, request_options: request_options) + WorkOS::VerifyEmailResponse.new(response.body) + end - # Verifiy user email using one-time code that was sent to the user. - # - # @param [String] user_id The unique ID of the User whose email address will be verified. - # @param [String] code The one-time code emailed to the user. - # - # @return WorkOS::UserResponse - def verify_email(user_id:, code:) - response = execute_request( - request: post_request( - path: "/user_management/users/#{user_id}/email_verification/confirm", - body: { - code: code - }, - auth: true - ) - ) + # Send verification email + # @param id [String] The ID of the user. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::SendVerificationEmailResponse] + def send_verification_email( + id:, + request_options: {} + ) + response = @client.request(method: :post, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_verification/send", auth: true, request_options: request_options) + WorkOS::SendVerificationEmailResponse.new(response.body) + end - WorkOS::UserResponse.new(response.body) - end + # Get user identities + # @param id [String] The unique ID of the user. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [Array] + def get_user_identities( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/identities", auth: true, request_options: request_options) + parsed = JSON.parse(response.body) + (parsed || []).map { |item| WorkOS::UserIdentitiesGetItem.new(item) } + end - # Gets a password reset object - # - # @param [String] id The unique ID of the PasswordReset object. - # - # @return WorkOS::PasswordReset - def get_password_reset(id:) - response = execute_request( - request: get_request( - path: "/user_management/password_reset/#{id}", - auth: true + # List sessions + # @param id [String] The ID of the user. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::UserManagementUsersOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_sessions( + id:, + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/sessions", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::UserSessionsListItem, filters: {id: id, before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_sessions( + id: id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options ) - ) - - WorkOS::PasswordReset.new(response.body) - end - - # Creates a password reset token - # - # @param [String] email The email address of the user. - # - # @return WorkOS::PasswordReset - def create_password_reset(email:) - response = execute_request( - request: post_request( - path: "/user_management/password_reset", - body: { - email: email - }, - auth: true + end, + fetch_previous: lambda do |cursor| + list_sessions( + id: id, + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options ) - ) - - WorkOS::PasswordReset.new(response.body) - end - - # Create a password reset challenge and emails a password reset link to a user. - # - # @param [String] email The email of the user that wishes to reset their password. - # @param [String] password_reset_url The URL that will be linked to in the email. - # - # @return [Bool] - returns `true` if successful - def send_password_reset_email(email:, password_reset_url:) - warn_deprecation '`send_password_reset_email` is deprecated. - Please use `create_password_reset` instead. This method will be removed in a future major version.' + end + ) + end - request = post_request( - path: "/user_management/password_reset/send", - body: { + # List invitations + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::UserManagementInvitationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join. + # @param email [String, nil] The email address of the recipient. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_invitations( + before: nil, + after: nil, + limit: nil, + order: nil, + organization_id: nil, + email: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "organization_id" => organization_id, + "email" => email + }.compact + response = @client.request(method: :get, path: "/user_management/invitations", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::UserInvite, filters: {before: before, limit: limit, order: order, organization_id: organization_id, email: email}, + fetch_next: lambda do |cursor| + list_invitations( + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, email: email, - password_reset_url: password_reset_url - }, - auth: true - ) - - response = execute_request(request: request) - - response.is_a? Net::HTTPSuccess - end - - # Reset user password using token that was sent to the user. - # - # @param [String] token The token that was sent to the user. - # @param [String] new_password The new password to set for the user. - # - # @return WorkOS::User - def reset_password(token:, new_password:) - response = execute_request( - request: post_request( - path: "/user_management/password_reset/confirm", - body: { - token: token, - new_password: new_password - }, - auth: true + request_options: request_options ) - ) - - WorkOS::UserResponse.new(response.body).user - end - - # Get an Organization Membership - # - # @param [String] id The unique ID of the Organization Membership. - # - # @return WorkOS::OrganizationMembership - def get_organization_membership(id:) - response = execute_request( - request: get_request( - path: "/user_management/organization_memberships/#{id}", - auth: true - ) - ) - - WorkOS::OrganizationMembership.new(response.body) - end - - # Retrieve a list of Organization Memberships. - # - # @param [Hash] options - # @option options [String] user_id The ID of the User. - # @option options [String] organization_id Filter memberships by the organization they are members of. - # @option options [Array] statuses Filter memberships by status. - # @option options [String] limit Maximum number of records to return. - # @option options [String] order The order in which to paginate records - # @option options [String] before Pagination cursor to receive records - # before a provided User ID. - # @option options [String] after Pagination cursor to receive records - # before a provided User ID. - # - # @return [WorkOS::OrganizationMembership] - def list_organization_memberships(options = {}) - options[:order] ||= "desc" - response = execute_request( - request: get_request( - path: "/user_management/organization_memberships", - auth: true, - params: options + end, + fetch_previous: lambda do |cursor| + list_invitations( + before: cursor, + after: nil, + limit: limit, + order: order, + organization_id: organization_id, + email: email, + request_options: request_options ) - ) - - parsed_response = JSON.parse(response.body) - - organization_memberships = parsed_response["data"].map do |organization_membership| - ::WorkOS::OrganizationMembership.new(organization_membership.to_json) end + ) + end - WorkOS::Types::ListStruct.new( - data: organization_memberships, - list_metadata: parsed_response["list_metadata"] - ) - end - - # Create an Organization Membership - # - # @param [String] user_id The ID of the User. - # @param [String] organization_id The ID of the Organization to which the user belongs to. - # @param [String] role_slug The slug of the role to grant to this membership. (Optional) - # @param [Array] role_slugs Array of role slugs to assign to this membership. (Optional) - # - # @return [WorkOS::OrganizationMembership] - def create_organization_membership(user_id:, organization_id:, role_slug: nil, role_slugs: nil) - raise ArgumentError, "Cannot specify both role_slug and role_slugs" if role_slug && role_slugs - - body = { - user_id: user_id, - organization_id: organization_id - } - - body[:role_slugs] = role_slugs if role_slugs - body[:role_slug] = role_slug if role_slug - - request = post_request( - path: "/user_management/organization_memberships", - body: body.compact, - auth: true - ) + # Send an invitation + # @param email [String] The email address of the recipient. + # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join. + # @param role_slug [String, nil] The [role](https://workos.com/docs/authkit/roles) that the recipient will receive when they join the organization in the invitation. + # @param expires_in_days [Integer, nil] How many days the invitations will be valid for. Must be between 1 and 30 days. Defaults to 7 days if not specified. + # @param inviter_user_id [String, nil] The ID of the [user](https://workos.com/docs/reference/authkit/user) who invites the recipient. The invitation email will mention the name of this user. + # @param locale [WorkOS::Types::CreateUserInviteOptionsLocale, nil] The locale to use when rendering the invitation email. See [supported locales](https://workos.com/docs/authkit/hosted-ui/localization). + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::UserInvite] + def send_invitation( + email:, + organization_id: nil, + role_slug: nil, + expires_in_days: nil, + inviter_user_id: nil, + locale: nil, + request_options: {} + ) + body = { + "email" => email, + "organization_id" => organization_id, + "role_slug" => role_slug, + "expires_in_days" => expires_in_days, + "inviter_user_id" => inviter_user_id, + "locale" => locale + }.compact + response = @client.request(method: :post, path: "/user_management/invitations", auth: true, body: body, request_options: request_options) + WorkOS::UserInvite.new(response.body) + end - response = execute_request(request: request) + # Find an invitation by token + # @param token [String] The token used to accept the invitation. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::UserInvite] + def find_invitation_by_token( + token:, + request_options: {} + ) + response = @client.request(method: :get, path: "/user_management/invitations/by_token/#{WorkOS::Util.encode_path(token)}", auth: true, request_options: request_options) + WorkOS::UserInvite.new(response.body) + end - WorkOS::OrganizationMembership.new(response.body) - end + # Get an invitation + # @param id [String] The unique ID of the invitation. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::UserInvite] + def get_invitation( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::UserInvite.new(response.body) + end - # Update an Organization Membership - # - # @param [String] id The ID of the Organization Membership. - # @param [String] role_slug The slug of the role to grant to this membership. (Optional) - # @param [Array] role_slugs Array of role slugs to assign to this membership. (Optional) - # - # @return [WorkOS::OrganizationMembership] - def update_organization_membership(id:, role_slug: nil, role_slugs: nil) - raise ArgumentError, "Cannot specify both role_slug and role_slugs" if role_slug && role_slugs + # Accept an invitation + # @param id [String] The unique ID of the invitation. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Invitation] + def accept_invitation( + id:, + request_options: {} + ) + response = @client.request(method: :post, path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/accept", auth: true, request_options: request_options) + WorkOS::Invitation.new(response.body) + end - body = {id: id} + # Resend an invitation + # @param id [String] The unique ID of the invitation. + # @param locale [WorkOS::Types::ResendUserInviteOptionsLocale, nil] The locale to use when rendering the invitation email. See [supported locales](https://workos.com/docs/authkit/hosted-ui/localization). + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::UserInvite] + def resend_invitation( + id:, + locale: nil, + request_options: {} + ) + body = { + "locale" => locale + }.compact + response = @client.request(method: :post, path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/resend", auth: true, body: body, request_options: request_options) + WorkOS::UserInvite.new(response.body) + end - body[:role_slugs] = role_slugs if role_slugs - body[:role_slug] = role_slug if role_slug + # Revoke an invitation + # @param id [String] The unique ID of the invitation. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Invitation] + def revoke_invitation( + id:, + request_options: {} + ) + response = @client.request(method: :post, path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/revoke", auth: true, request_options: request_options) + WorkOS::Invitation.new(response.body) + end - request = put_request( - path: "/user_management/organization_memberships/#{id}", - body: body.compact, - auth: true - ) + # Update JWT template + # @param content [String] The JWT template content as a Liquid template string. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::JWTTemplateResponse] + def update_jwt_template( + content:, + request_options: {} + ) + body = { + "content" => content + }.compact + response = @client.request(method: :put, path: "/user_management/jwt_template", auth: true, body: body, request_options: request_options) + WorkOS::JWTTemplateResponse.new(response.body) + end - response = execute_request(request: request) + # Create a Magic Auth code + # @param email [String] The email address to send the magic code to. + # @param invitation_token [String, nil] The invitation token to associate with this magic code. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::MagicAuth] + def create_magic_auth( + email:, + invitation_token: nil, + request_options: {} + ) + body = { + "email" => email, + "invitation_token" => invitation_token + }.compact + response = @client.request(method: :post, path: "/user_management/magic_auth", auth: true, body: body, request_options: request_options) + WorkOS::MagicAuth.new(response.body) + end - WorkOS::OrganizationMembership.new(response.body) - end + # Get Magic Auth code details + # @param id [String] The unique ID of the Magic Auth code. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::MagicAuth] + def get_magic_auth( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/user_management/magic_auth/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::MagicAuth.new(response.body) + end - # Delete an Organization Membership - # - # @param [String] id The unique ID of the Organization Membership. - # - # @return [Bool] - returns `true` if successful - def delete_organization_membership(id:) - response = execute_request( - request: delete_request( - path: "/user_management/organization_memberships/#{id}", - auth: true + # List organization memberships + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::UserManagementOrganizationMembershipOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to. + # @param statuses [Array, nil] Filter by the status of the organization membership. Array including any of `active`, `inactive`, or `pending`. + # @param user_id [String, nil] The ID of the [user](https://workos.com/docs/reference/authkit/user). + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_organization_memberships( + before: nil, + after: nil, + limit: nil, + order: nil, + organization_id: nil, + statuses: nil, + user_id: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order, + "organization_id" => organization_id, + "statuses" => statuses, + "user_id" => user_id + }.compact + response = @client.request(method: :get, path: "/user_management/organization_memberships", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::UserOrganizationMembership, filters: {before: before, limit: limit, order: order, organization_id: organization_id, statuses: statuses, user_id: user_id}, + fetch_next: lambda do |cursor| + list_organization_memberships( + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + statuses: statuses, + user_id: user_id, + request_options: request_options ) - ) - - response.is_a? Net::HTTPSuccess - end - - # Deactivate an Organization Membership - # - # @param [String] id The unique ID of the Organization Membership. - # - # @return WorkOS::OrganizationMembership - def deactivate_organization_membership(id:) - response = execute_request( - request: put_request( - path: "/user_management/organization_memberships/#{id}/deactivate", - auth: true + end, + fetch_previous: lambda do |cursor| + list_organization_memberships( + before: cursor, + after: nil, + limit: limit, + order: order, + organization_id: organization_id, + statuses: statuses, + user_id: user_id, + request_options: request_options ) - ) + end + ) + end - WorkOS::OrganizationMembership.new(response.body) + # Create an organization membership + # @param user_id [String] The ID of the [user](https://workos.com/docs/reference/authkit/user). + # @param organization_id [String] The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to. + # @param role_slug [String, nil] A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`. + # @param role_slugs [Array, nil] An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::OrganizationMembership] + def create_organization_membership( + user_id:, + organization_id:, + role_slug: nil, + role_slugs: nil, + role: nil, + request_options: {} + ) + params = {} + if role + case role[:type] + when "single" + params["role_slug"] = role[:role_slug] + when "multiple" + params["role_slugs"] = role[:role_slugs] + end end + body = { + "user_id" => user_id, + "organization_id" => organization_id, + "role_slug" => role_slug, + "role_slugs" => role_slugs + }.compact + response = @client.request(method: :post, path: "/user_management/organization_memberships", auth: true, params: params, body: body, request_options: request_options) + WorkOS::OrganizationMembership.new(response.body) + end - # Reactivate an Organization Membership - # - # @param [String] id The unique ID of the Organization Membership. - # - # @return WorkOS::OrganizationMembership - def reactivate_organization_membership(id:) - response = execute_request( - request: put_request( - path: "/user_management/organization_memberships/#{id}/reactivate", - auth: true - ) - ) + # Get an organization membership + # @param id [String] The unique ID of the organization membership. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::UserOrganizationMembership] + def get_organization_membership( + id:, + request_options: {} + ) + response = @client.request(method: :get, path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + WorkOS::UserOrganizationMembership.new(response.body) + end - WorkOS::OrganizationMembership.new(response.body) + # Update an organization membership + # @param id [String] The unique ID of the organization membership. + # @param role_slug [String, nil] A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`. + # @param role_slugs [Array, nil] An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::UserOrganizationMembership] + def update_organization_membership( + id:, + role_slug: nil, + role_slugs: nil, + role: nil, + request_options: {} + ) + params = {} + if role + case role[:type] + when "single" + params["role_slug"] = role[:role_slug] + when "multiple" + params["role_slugs"] = role[:role_slugs] + end end + body = { + "role_slug" => role_slug, + "role_slugs" => role_slugs + }.compact + response = @client.request(method: :put, path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}", auth: true, params: params, body: body, request_options: request_options) + WorkOS::UserOrganizationMembership.new(response.body) + end - # Gets an Invitation - # - # @param [String] id The unique ID of the Invitation. - # - # @return WorkOS::Invitation - def get_invitation(id:) - response = execute_request( - request: get_request( - path: "/user_management/invitations/#{id}", - auth: true - ) - ) + # Delete an organization membership + # @param id [String] The unique ID of the organization membership. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_organization_membership( + id:, + request_options: {} + ) + @client.request(method: :delete, path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + nil + end - WorkOS::Invitation.new(response.body) - end + # Deactivate an organization membership + # @param id [String] The unique ID of the organization membership. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::OrganizationMembership] + def deactivate_organization_membership( + id:, + request_options: {} + ) + response = @client.request(method: :put, path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}/deactivate", auth: true, request_options: request_options) + WorkOS::OrganizationMembership.new(response.body) + end - # Finds an Invitation by Token - # - # @param [String] token The token of the Invitation. - # - # @return WorkOS::Invitation - def find_invitation_by_token(token:) - response = execute_request( - request: get_request( - path: "/user_management/invitations/by_token/#{token}", - auth: true - ) - ) + # Reactivate an organization membership + # @param id [String] The unique ID of the organization membership. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::UserOrganizationMembership] + def reactivate_organization_membership( + id:, + request_options: {} + ) + response = @client.request(method: :put, path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}/reactivate", auth: true, request_options: request_options) + WorkOS::UserOrganizationMembership.new(response.body) + end - WorkOS::Invitation.new(response.body) - end + # Create a redirect URI + # @param uri [String] The redirect URI to create. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::RedirectUri] + def create_redirect_uri( + uri:, + request_options: {} + ) + body = { + "uri" => uri + }.compact + response = @client.request(method: :post, path: "/user_management/redirect_uris", auth: true, body: body, request_options: request_options) + WorkOS::RedirectUri.new(response.body) + end - # Retrieve a list of invitations. - # - # @param [Hash] options - # @option options [String] email The email address of a recipient. - # @option options [String] organization_id The ID of the Organization that the recipient was invited to join. - # @option options [String] limit Maximum number of records to return. - # @option options [String] order The order in which to paginate records - # @option options [String] before Pagination cursor to receive records - # before a provided User ID. - # @option options [String] after Pagination cursor to receive records - # before a provided User ID. - # - # @return [WorkOS::Invitation] - def list_invitations(options = {}) - options[:order] ||= "desc" - response = execute_request( - request: get_request( - path: "/user_management/invitations", - auth: true, - params: options + # List authorized applications + # @param user_id [String] The ID of the user. + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::UserManagementUsersAuthorizedApplicationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_user_authorized_applications( + user_id:, + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/authorized_applications", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::AuthorizedConnectApplicationListData, filters: {user_id: user_id, before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_user_authorized_applications( + user_id: user_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options ) - ) - - parsed_response = JSON.parse(response.body) - - invitations = parsed_response["data"].map do |invitation| - ::WorkOS::Invitation.new(invitation.to_json) - end - - WorkOS::Types::ListStruct.new( - data: invitations, - list_metadata: parsed_response["list_metadata"] - ) - end - - # Sends an Invitation to a recipient. - # - # @param [String] email The email address of the recipient. - # @param [String] organization_id The ID of the Organization to which the recipient is being invited. - # @param [Integer] expires_in_days The number of days the invitations will be valid for. - # Must be between 1 and 30, defaults to 7 if not specified. - # @param [String] inviter_user_id The ID of the User sending the invitation. - # @param [String] role_slug The slug of the role to assign to the user upon invitation. - # - # @return WorkOS::Invitation - def send_invitation(email:, organization_id: nil, expires_in_days: nil, inviter_user_id: nil, role_slug: nil) - response = execute_request( - request: post_request( - path: "/user_management/invitations", - body: { - email: email, - organization_id: organization_id, - expires_in_days: expires_in_days, - inviter_user_id: inviter_user_id, - role_slug: role_slug - }.compact, - auth: true + end, + fetch_previous: lambda do |cursor| + list_user_authorized_applications( + user_id: user_id, + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options ) - ) - - WorkOS::Invitation.new(response.body) - end - - # Accepts an existing Invitation. - # - # @param [String] id The unique ID of the Invitation. - # - # @return WorkOS::Invitation - def accept_invitation(id:) - request = post_request( - path: "/user_management/invitations/#{id}/accept", - auth: true - ) - - response = execute_request(request: request) - - WorkOS::Invitation.new(response.body) - end - - # Revokes an existing Invitation. - # - # @param [String] id The unique ID of the Invitation. - # - # @return WorkOS::Invitation - def revoke_invitation(id:) - request = post_request( - path: "/user_management/invitations/#{id}/revoke", - auth: true - ) - - response = execute_request(request: request) - - WorkOS::Invitation.new(response.body) - end - - # Resends an existing Invitation. - # - # @param [String] id The unique ID of the Invitation. - # - # @return WorkOS::Invitation - def resend_invitation(id:) - request = post_request( - path: "/user_management/invitations/#{id}/resend", - auth: true - ) - - response = execute_request(request: request) - - WorkOS::Invitation.new(response.body) - end + end + ) + end - private + # Delete an authorized application + # @param application_id [String] The ID or client ID of the application. + # @param user_id [String] The ID of the user. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_user_authorized_application( + application_id:, + user_id:, + request_options: {} + ) + @client.request(method: :delete, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/authorized_applications/#{WorkOS::Util.encode_path(application_id)}", auth: true, request_options: request_options) + nil + end - def validate_session(session) - return unless session && (session[:seal_session] == true) && session[:cookie_password].nil? + # @oagen-ignore-start — non-spec helpers (hand-maintained) + # H13 — Build the JWKS URL for a given client_id (no HTTP call). + # Pair with #get_jwks (generated) to fetch the keyset. + def get_jwks_url(client_id: nil) + cid = client_id || @client.client_id + raise ArgumentError, "client_id is required" if cid.nil? || cid.empty? + base = @client.base_url || "https://api.workos.com" + URI.join(base, "/sso/jwks/#{WorkOS::Util.encode_path(cid)}").to_s + end - raise ArgumentError, "cookie_password is required when sealing session" - end + # H09 — Build an AuthKit authorization URL (client-side, no HTTP call). + # Overrides the generated get_authorization_url which hits the API. + def get_authorization_url(redirect_uri:, client_id: nil, provider: nil, connection_id: nil, + organization_id: nil, domain_hint: nil, login_hint: nil, + state: nil, screen_hint: nil, code_challenge: nil, + code_challenge_method: nil, prompt: nil, **) + cid = client_id || @client.client_id + raise ArgumentError, "client_id is required (set on Client or pass explicitly)" if cid.nil? || cid.empty? + raise ArgumentError, "provider, connection_id, or organization_id required" if provider.nil? && connection_id.nil? && organization_id.nil? + params = { + "client_id" => cid, + "redirect_uri" => redirect_uri, + "response_type" => "code", + "provider" => provider, + "connection_id" => connection_id, + "organization_id" => organization_id, + "domain_hint" => domain_hint, + "login_hint" => login_hint, + "state" => state, + "screen_hint" => screen_hint, + "code_challenge" => code_challenge, + "code_challenge_method" => code_challenge_method, + "prompt" => prompt + }.compact + build_url("/user_management/authorize", params) + end - def validate_authorization_url_arguments( - provider:, - connection_id:, - organization_id: + # H10 — AuthKit authorization URL with auto-generated PKCE + state. + # Returns [url, code_verifier, state]. + def get_authorization_url_with_pkce(redirect_uri:, client_id: nil, **opts) + pair = WorkOS::PKCE.generate_pair + state = opts.delete(:state) || WorkOS::PKCE.generate_code_verifier + url = get_authorization_url( + redirect_uri: redirect_uri, + client_id: client_id, + state: state, + code_challenge: pair[:code_challenge], + code_challenge_method: "S256", + **opts ) - if [provider, connection_id, organization_id].all?(&:nil?) - raise ArgumentError, "Either connection ID, organization ID," \ - " or provider is required." - end + [url, pair[:code_verifier], state] + end - return unless provider && !PROVIDERS.include?(provider) + # H11 — Exchange a code for tokens with PKCE support (public client; no secret). + # NOTE: Unlike the other authenticate_with_* helpers, this does NOT delegate to + # create_authenticate because PKCE is a public-client flow that requires + # auth: false (no Bearer token / API key in the Authorization header). + def authenticate_with_code_pkce(code:, code_verifier:, client_id: nil, ip_address: nil, user_agent: nil, request_options: {}) + cid = client_id || @client.client_id + raise ArgumentError, "client_id is required" if cid.nil? || cid.empty? + body = { + "grant_type" => "authorization_code", + "client_id" => cid, + "code" => code, + "code_verifier" => code_verifier, + "ip_address" => ip_address, + "user_agent" => user_agent + }.compact + response = @client.request(method: :post, path: "/user_management/authenticate", auth: false, body: body, request_options: request_options) + WorkOS::AuthenticateResponse.new(response.body) + end - raise ArgumentError, "#{provider} is not a valid value." \ - " `provider` must be in #{PROVIDERS}" - end + # H12 — Initiate the OAuth 2.0 device authorization flow. + # @return [WorkOS::DeviceAuthorizationResponse] + def authorize_device(client_id: nil, request_options: {}) + cid = client_id || @client.client_id + raise ArgumentError, "client_id is required" if cid.nil? || cid.empty? + body = {"client_id" => cid} + response = @client.request(method: :post, path: "/oauth2/device_authorization", auth: false, body: body, request_options: request_options) + WorkOS::DeviceAuthorizationResponse.new(response.body) + end - def validate_auth_factor_type( - type: - ) - return if AUTH_FACTOR_TYPES.include?(type) + # H12 device-code → token exchange is provided by the generated + # `authenticate_with_device_code` method (wraps /user_management/authenticate); + # no hand-maintained override is needed here. + + # Build the AuthKit logout redirect URL (client-side, no HTTP call). + # @param session_id [String] The session ID (from the `sid` claim of the access token). + # @param return_to [String, nil] URL to redirect the user to after session revocation. + # @return [String] + def get_logout_url(session_id:, return_to: nil) + params = {"session_id" => session_id} + params["return_to"] = return_to if return_to + build_url("/user_management/sessions/logout", params) + end - raise ArgumentError, "#{type} is not a valid value." \ - " `type` must be in #{AUTH_FACTOR_TYPES}" - end + private + + def build_url(path, params) + base = @client.base_url || "https://api.workos.com" + uri = URI.join(base, path) + uri.query = URI.encode_www_form(params) + uri.to_s end + # @oagen-ignore-end end - # rubocop:enable Metrics/ModuleLength end diff --git a/lib/workos/user_management/action_authentication_denied.rb b/lib/workos/user_management/action_authentication_denied.rb new file mode 100644 index 00000000..b8f654c1 --- /dev/null +++ b/lib/workos/user_management/action_authentication_denied.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ActionAuthenticationDenied + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + context: :context, + created_at: :created_at, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :context, + :created_at, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::ActionAuthenticationDeniedData.new(hash[:data]) : nil + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @created_at = hash[:created_at] + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/action_authentication_denied_data.rb b/lib/workos/user_management/action_authentication_denied_data.rb new file mode 100644 index 00000000..3b6d4a63 --- /dev/null +++ b/lib/workos/user_management/action_authentication_denied_data.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ActionAuthenticationDeniedData + include HashProvider + + HASH_ATTRS = { + action_endpoint_id: :action_endpoint_id, + action_execution_id: :action_execution_id, + type: :type, + verdict: :verdict, + user_id: :user_id, + organization_id: :organization_id, + email: :email, + ip_address: :ip_address, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :action_endpoint_id, + :action_execution_id, + :type, + :verdict, + :user_id, + :organization_id, + :email, + :ip_address, + :user_agent + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @action_endpoint_id = hash[:action_endpoint_id] + @action_execution_id = hash[:action_execution_id] + @type = hash[:type] + @verdict = hash[:verdict] + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + @email = hash[:email] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + end + end +end diff --git a/lib/workos/user_management/action_user_registration_denied.rb b/lib/workos/user_management/action_user_registration_denied.rb new file mode 100644 index 00000000..09a2528c --- /dev/null +++ b/lib/workos/user_management/action_user_registration_denied.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ActionUserRegistrationDenied + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + context: :context, + created_at: :created_at, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :context, + :created_at, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::ActionUserRegistrationDeniedData.new(hash[:data]) : nil + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @created_at = hash[:created_at] + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/action_user_registration_denied_data.rb b/lib/workos/user_management/action_user_registration_denied_data.rb new file mode 100644 index 00000000..90ebb8b4 --- /dev/null +++ b/lib/workos/user_management/action_user_registration_denied_data.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ActionUserRegistrationDeniedData + include HashProvider + + HASH_ATTRS = { + action_endpoint_id: :action_endpoint_id, + action_execution_id: :action_execution_id, + type: :type, + verdict: :verdict, + organization_id: :organization_id, + email: :email, + ip_address: :ip_address, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :action_endpoint_id, + :action_execution_id, + :type, + :verdict, + :organization_id, + :email, + :ip_address, + :user_agent + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @action_endpoint_id = hash[:action_endpoint_id] + @action_execution_id = hash[:action_execution_id] + @type = hash[:type] + @verdict = hash[:verdict] + @organization_id = hash[:organization_id] + @email = hash[:email] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + end + end +end diff --git a/lib/workos/user_management/authenticate_response.rb b/lib/workos/user_management/authenticate_response.rb new file mode 100644 index 00000000..36977e25 --- /dev/null +++ b/lib/workos/user_management/authenticate_response.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticateResponse + include HashProvider + + HASH_ATTRS = { + user: :user, + organization_id: :organization_id, + authkit_authorization_code: :authkit_authorization_code, + access_token: :access_token, + refresh_token: :refresh_token, + authentication_method: :authentication_method, + impersonator: :impersonator, + oauth_tokens: :oauth_tokens + }.freeze + + attr_accessor \ + :user, + :organization_id, + :authkit_authorization_code, + :access_token, + :refresh_token, + :authentication_method, + :impersonator, + :oauth_tokens + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil + @organization_id = hash[:organization_id] + @authkit_authorization_code = hash[:authkit_authorization_code] + @access_token = hash[:access_token] + @refresh_token = hash[:refresh_token] + @authentication_method = hash[:authentication_method] + @impersonator = hash[:impersonator] ? WorkOS::AuthenticateResponseImpersonator.new(hash[:impersonator]) : nil + @oauth_tokens = hash[:oauth_tokens] ? WorkOS::AuthenticateResponseOAuthToken.new(hash[:oauth_tokens]) : nil + end + end +end diff --git a/lib/workos/user_management/authenticate_response_impersonator.rb b/lib/workos/user_management/authenticate_response_impersonator.rb new file mode 100644 index 00000000..6496115e --- /dev/null +++ b/lib/workos/user_management/authenticate_response_impersonator.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticateResponseImpersonator + include HashProvider + + HASH_ATTRS = { + email: :email, + reason: :reason + }.freeze + + attr_accessor \ + :email, + :reason + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @email = hash[:email] + @reason = hash[:reason] + end + end +end diff --git a/lib/workos/user_management/authenticate_response_oauth_token.rb b/lib/workos/user_management/authenticate_response_oauth_token.rb new file mode 100644 index 00000000..c0fd0d6e --- /dev/null +++ b/lib/workos/user_management/authenticate_response_oauth_token.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticateResponseOAuthToken + include HashProvider + + HASH_ATTRS = { + provider: :provider, + refresh_token: :refresh_token, + access_token: :access_token, + expires_at: :expires_at, + scopes: :scopes + }.freeze + + attr_accessor \ + :provider, + :refresh_token, + :access_token, + :expires_at, + :scopes + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @provider = hash[:provider] + @refresh_token = hash[:refresh_token] + @access_token = hash[:access_token] + @expires_at = hash[:expires_at] + @scopes = hash[:scopes] || [] + end + end +end diff --git a/lib/workos/user_management/authentication_email_verification_failed.rb b/lib/workos/user_management/authentication_email_verification_failed.rb new file mode 100644 index 00000000..d87a458e --- /dev/null +++ b/lib/workos/user_management/authentication_email_verification_failed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationEmailVerificationFailed + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationEmailVerificationFailedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_email_verification_failed_data.rb b/lib/workos/user_management/authentication_email_verification_failed_data.rb new file mode 100644 index 00000000..34eaca52 --- /dev/null +++ b/lib/workos/user_management/authentication_email_verification_failed_data.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationEmailVerificationFailedData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email, + error: :error + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email, + :error + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + @error = hash[:error] ? WorkOS::AuthenticationEmailVerificationFailedDataError.new(hash[:error]) : nil + end + end +end diff --git a/lib/workos/user_management/authentication_email_verification_failed_data_error.rb b/lib/workos/user_management/authentication_email_verification_failed_data_error.rb new file mode 100644 index 00000000..00e4fd20 --- /dev/null +++ b/lib/workos/user_management/authentication_email_verification_failed_data_error.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationEmailVerificationFailedDataError + include HashProvider + + HASH_ATTRS = { + code: :code, + message: :message + }.freeze + + attr_accessor \ + :code, + :message + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @code = hash[:code] + @message = hash[:message] + end + end +end diff --git a/lib/workos/user_management/authentication_email_verification_succeeded.rb b/lib/workos/user_management/authentication_email_verification_succeeded.rb new file mode 100644 index 00000000..59abf4a8 --- /dev/null +++ b/lib/workos/user_management/authentication_email_verification_succeeded.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationEmailVerificationSucceeded + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationEmailVerificationSucceededData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_email_verification_succeeded_data.rb b/lib/workos/user_management/authentication_email_verification_succeeded_data.rb new file mode 100644 index 00000000..a7467129 --- /dev/null +++ b/lib/workos/user_management/authentication_email_verification_succeeded_data.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationEmailVerificationSucceededData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + end + end +end diff --git a/lib/workos/user_management/authentication_magic_auth_failed.rb b/lib/workos/user_management/authentication_magic_auth_failed.rb new file mode 100644 index 00000000..58dc7dec --- /dev/null +++ b/lib/workos/user_management/authentication_magic_auth_failed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationMagicAuthFailed + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationMagicAuthFailedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_magic_auth_failed_data.rb b/lib/workos/user_management/authentication_magic_auth_failed_data.rb new file mode 100644 index 00000000..e62b22c4 --- /dev/null +++ b/lib/workos/user_management/authentication_magic_auth_failed_data.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationMagicAuthFailedData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email, + error: :error + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email, + :error + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + @error = hash[:error] ? WorkOS::AuthenticationMagicAuthFailedDataError.new(hash[:error]) : nil + end + end +end diff --git a/lib/workos/user_management/authentication_magic_auth_failed_data_error.rb b/lib/workos/user_management/authentication_magic_auth_failed_data_error.rb new file mode 100644 index 00000000..d9743b46 --- /dev/null +++ b/lib/workos/user_management/authentication_magic_auth_failed_data_error.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuthenticationMagicAuthFailedDataError = AuthenticationEmailVerificationFailedDataError +end diff --git a/lib/workos/user_management/authentication_magic_auth_succeeded.rb b/lib/workos/user_management/authentication_magic_auth_succeeded.rb new file mode 100644 index 00000000..946b818f --- /dev/null +++ b/lib/workos/user_management/authentication_magic_auth_succeeded.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationMagicAuthSucceeded + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationMagicAuthSucceededData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_magic_auth_succeeded_data.rb b/lib/workos/user_management/authentication_magic_auth_succeeded_data.rb new file mode 100644 index 00000000..d8a07507 --- /dev/null +++ b/lib/workos/user_management/authentication_magic_auth_succeeded_data.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationMagicAuthSucceededData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + end + end +end diff --git a/lib/workos/user_management/authentication_mfa_failed.rb b/lib/workos/user_management/authentication_mfa_failed.rb new file mode 100644 index 00000000..a50235b1 --- /dev/null +++ b/lib/workos/user_management/authentication_mfa_failed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationMFAFailed + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationMFAFailedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_mfa_failed_data.rb b/lib/workos/user_management/authentication_mfa_failed_data.rb new file mode 100644 index 00000000..949d73a5 --- /dev/null +++ b/lib/workos/user_management/authentication_mfa_failed_data.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationMFAFailedData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email, + error: :error + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email, + :error + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + @error = hash[:error] ? WorkOS::AuthenticationMFAFailedDataError.new(hash[:error]) : nil + end + end +end diff --git a/lib/workos/user_management/authentication_mfa_failed_data_error.rb b/lib/workos/user_management/authentication_mfa_failed_data_error.rb new file mode 100644 index 00000000..5703be60 --- /dev/null +++ b/lib/workos/user_management/authentication_mfa_failed_data_error.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuthenticationMFAFailedDataError = AuthenticationEmailVerificationFailedDataError +end diff --git a/lib/workos/user_management/authentication_mfa_succeeded.rb b/lib/workos/user_management/authentication_mfa_succeeded.rb new file mode 100644 index 00000000..b6fd3986 --- /dev/null +++ b/lib/workos/user_management/authentication_mfa_succeeded.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationMFASucceeded + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationMFASucceededData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_mfa_succeeded_data.rb b/lib/workos/user_management/authentication_mfa_succeeded_data.rb new file mode 100644 index 00000000..d93a8d41 --- /dev/null +++ b/lib/workos/user_management/authentication_mfa_succeeded_data.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationMFASucceededData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + end + end +end diff --git a/lib/workos/user_management/authentication_oauth_failed.rb b/lib/workos/user_management/authentication_oauth_failed.rb new file mode 100644 index 00000000..1b90b0ec --- /dev/null +++ b/lib/workos/user_management/authentication_oauth_failed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationOAuthFailed + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationOAuthFailedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_oauth_failed_data.rb b/lib/workos/user_management/authentication_oauth_failed_data.rb new file mode 100644 index 00000000..41707014 --- /dev/null +++ b/lib/workos/user_management/authentication_oauth_failed_data.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationOAuthFailedData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email, + error: :error + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email, + :error + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + @error = hash[:error] ? WorkOS::AuthenticationOAuthFailedDataError.new(hash[:error]) : nil + end + end +end diff --git a/lib/workos/user_management/authentication_oauth_failed_data_error.rb b/lib/workos/user_management/authentication_oauth_failed_data_error.rb new file mode 100644 index 00000000..d2207355 --- /dev/null +++ b/lib/workos/user_management/authentication_oauth_failed_data_error.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuthenticationOAuthFailedDataError = AuthenticationEmailVerificationFailedDataError +end diff --git a/lib/workos/user_management/authentication_oauth_succeeded.rb b/lib/workos/user_management/authentication_oauth_succeeded.rb new file mode 100644 index 00000000..69c5c9ba --- /dev/null +++ b/lib/workos/user_management/authentication_oauth_succeeded.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationOAuthSucceeded + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationOAuthSucceededData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_oauth_succeeded_data.rb b/lib/workos/user_management/authentication_oauth_succeeded_data.rb new file mode 100644 index 00000000..cc424ede --- /dev/null +++ b/lib/workos/user_management/authentication_oauth_succeeded_data.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationOAuthSucceededData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + end + end +end diff --git a/lib/workos/user_management/authentication_passkey_failed.rb b/lib/workos/user_management/authentication_passkey_failed.rb new file mode 100644 index 00000000..84ab926f --- /dev/null +++ b/lib/workos/user_management/authentication_passkey_failed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationPasskeyFailed + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationPasskeyFailedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_passkey_failed_data.rb b/lib/workos/user_management/authentication_passkey_failed_data.rb new file mode 100644 index 00000000..43fac59c --- /dev/null +++ b/lib/workos/user_management/authentication_passkey_failed_data.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationPasskeyFailedData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email, + error: :error + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email, + :error + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + @error = hash[:error] ? WorkOS::AuthenticationPasskeyFailedDataError.new(hash[:error]) : nil + end + end +end diff --git a/lib/workos/user_management/authentication_passkey_failed_data_error.rb b/lib/workos/user_management/authentication_passkey_failed_data_error.rb new file mode 100644 index 00000000..ff5c38ab --- /dev/null +++ b/lib/workos/user_management/authentication_passkey_failed_data_error.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuthenticationPasskeyFailedDataError = AuthenticationEmailVerificationFailedDataError +end diff --git a/lib/workos/user_management/authentication_passkey_succeeded.rb b/lib/workos/user_management/authentication_passkey_succeeded.rb new file mode 100644 index 00000000..0b0ea943 --- /dev/null +++ b/lib/workos/user_management/authentication_passkey_succeeded.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationPasskeySucceeded + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationPasskeySucceededData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_passkey_succeeded_data.rb b/lib/workos/user_management/authentication_passkey_succeeded_data.rb new file mode 100644 index 00000000..87b0441f --- /dev/null +++ b/lib/workos/user_management/authentication_passkey_succeeded_data.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationPasskeySucceededData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + end + end +end diff --git a/lib/workos/user_management/authentication_password_failed.rb b/lib/workos/user_management/authentication_password_failed.rb new file mode 100644 index 00000000..e2a34559 --- /dev/null +++ b/lib/workos/user_management/authentication_password_failed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationPasswordFailed + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationPasswordFailedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_password_failed_data.rb b/lib/workos/user_management/authentication_password_failed_data.rb new file mode 100644 index 00000000..5ca45bdb --- /dev/null +++ b/lib/workos/user_management/authentication_password_failed_data.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationPasswordFailedData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email, + error: :error + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email, + :error + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + @error = hash[:error] ? WorkOS::AuthenticationPasswordFailedDataError.new(hash[:error]) : nil + end + end +end diff --git a/lib/workos/user_management/authentication_password_failed_data_error.rb b/lib/workos/user_management/authentication_password_failed_data_error.rb new file mode 100644 index 00000000..d2b41a39 --- /dev/null +++ b/lib/workos/user_management/authentication_password_failed_data_error.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuthenticationPasswordFailedDataError = AuthenticationEmailVerificationFailedDataError +end diff --git a/lib/workos/user_management/authentication_password_succeeded.rb b/lib/workos/user_management/authentication_password_succeeded.rb new file mode 100644 index 00000000..0900be3b --- /dev/null +++ b/lib/workos/user_management/authentication_password_succeeded.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationPasswordSucceeded + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationPasswordSucceededData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_password_succeeded_data.rb b/lib/workos/user_management/authentication_password_succeeded_data.rb new file mode 100644 index 00000000..4d60bfa8 --- /dev/null +++ b/lib/workos/user_management/authentication_password_succeeded_data.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationPasswordSucceededData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + end + end +end diff --git a/lib/workos/user_management/authentication_radar_risk_detected.rb b/lib/workos/user_management/authentication_radar_risk_detected.rb new file mode 100644 index 00000000..b179e369 --- /dev/null +++ b/lib/workos/user_management/authentication_radar_risk_detected.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationRadarRiskDetected + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationRadarRiskDetectedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_radar_risk_detected_data.rb b/lib/workos/user_management/authentication_radar_risk_detected_data.rb new file mode 100644 index 00000000..b499f58a --- /dev/null +++ b/lib/workos/user_management/authentication_radar_risk_detected_data.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationRadarRiskDetectedData + include HashProvider + + HASH_ATTRS = { + auth_method: :auth_method, + action: :action, + control: :control, + blocklist_type: :blocklist_type, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email + }.freeze + + attr_accessor \ + :auth_method, + :action, + :control, + :blocklist_type, + :ip_address, + :user_agent, + :user_id, + :email + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @auth_method = hash[:auth_method] + @action = hash[:action] + @control = hash[:control] + @blocklist_type = hash[:blocklist_type] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + end + end +end diff --git a/lib/workos/user_management/authentication_sso_failed.rb b/lib/workos/user_management/authentication_sso_failed.rb new file mode 100644 index 00000000..4c0ef67c --- /dev/null +++ b/lib/workos/user_management/authentication_sso_failed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationSSOFailed + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationSSOFailedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_sso_failed_data.rb b/lib/workos/user_management/authentication_sso_failed_data.rb new file mode 100644 index 00000000..ab96924d --- /dev/null +++ b/lib/workos/user_management/authentication_sso_failed_data.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationSSOFailedData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email, + sso: :sso, + error: :error + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email, + :sso, + :error + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + @sso = hash[:sso] ? WorkOS::AuthenticationSSOFailedDataSSO.new(hash[:sso]) : nil + @error = hash[:error] ? WorkOS::AuthenticationSSOFailedDataError.new(hash[:error]) : nil + end + end +end diff --git a/lib/workos/user_management/authentication_sso_failed_data_error.rb b/lib/workos/user_management/authentication_sso_failed_data_error.rb new file mode 100644 index 00000000..69dfecd2 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_failed_data_error.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuthenticationSSOFailedDataError = AuthenticationEmailVerificationFailedDataError +end diff --git a/lib/workos/user_management/authentication_sso_failed_data_sso.rb b/lib/workos/user_management/authentication_sso_failed_data_sso.rb new file mode 100644 index 00000000..c65d9b5a --- /dev/null +++ b/lib/workos/user_management/authentication_sso_failed_data_sso.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationSSOFailedDataSSO + include HashProvider + + HASH_ATTRS = { + organization_id: :organization_id, + connection_id: :connection_id, + session_id: :session_id + }.freeze + + attr_accessor \ + :organization_id, + :connection_id, + :session_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @organization_id = hash[:organization_id] + @connection_id = hash[:connection_id] + @session_id = hash[:session_id] + end + end +end diff --git a/lib/workos/user_management/authentication_sso_started.rb b/lib/workos/user_management/authentication_sso_started.rb new file mode 100644 index 00000000..e603099a --- /dev/null +++ b/lib/workos/user_management/authentication_sso_started.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationSSOStarted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationSSOStartedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_sso_started_data.rb b/lib/workos/user_management/authentication_sso_started_data.rb new file mode 100644 index 00000000..e57989ac --- /dev/null +++ b/lib/workos/user_management/authentication_sso_started_data.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationSSOStartedData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email, + sso: :sso + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email, + :sso + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + @sso = hash[:sso] ? WorkOS::AuthenticationSSOStartedDataSSO.new(hash[:sso]) : nil + end + end +end diff --git a/lib/workos/user_management/authentication_sso_started_data_sso.rb b/lib/workos/user_management/authentication_sso_started_data_sso.rb new file mode 100644 index 00000000..545a0c64 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_started_data_sso.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuthenticationSSOStartedDataSSO = AuthenticationSSOFailedDataSSO +end diff --git a/lib/workos/user_management/authentication_sso_succeeded.rb b/lib/workos/user_management/authentication_sso_succeeded.rb new file mode 100644 index 00000000..46f5b830 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_succeeded.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationSSOSucceeded + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationSSOSucceededData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_sso_succeeded_data.rb b/lib/workos/user_management/authentication_sso_succeeded_data.rb new file mode 100644 index 00000000..236d4c12 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_succeeded_data.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationSSOSucceededData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email, + sso: :sso + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email, + :sso + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + @sso = hash[:sso] ? WorkOS::AuthenticationSSOSucceededDataSSO.new(hash[:sso]) : nil + end + end +end diff --git a/lib/workos/user_management/authentication_sso_succeeded_data_sso.rb b/lib/workos/user_management/authentication_sso_succeeded_data_sso.rb new file mode 100644 index 00000000..3bb3ae1a --- /dev/null +++ b/lib/workos/user_management/authentication_sso_succeeded_data_sso.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuthenticationSSOSucceededDataSSO = AuthenticationSSOFailedDataSSO +end diff --git a/lib/workos/user_management/authentication_sso_timed_out.rb b/lib/workos/user_management/authentication_sso_timed_out.rb new file mode 100644 index 00000000..25b84a2c --- /dev/null +++ b/lib/workos/user_management/authentication_sso_timed_out.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationSSOTimedOut + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::AuthenticationSSOTimedOutData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/authentication_sso_timed_out_data.rb b/lib/workos/user_management/authentication_sso_timed_out_data.rb new file mode 100644 index 00000000..e1300d83 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_timed_out_data.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthenticationSSOTimedOutData + include HashProvider + + HASH_ATTRS = { + type: :type, + status: :status, + ip_address: :ip_address, + user_agent: :user_agent, + user_id: :user_id, + email: :email, + sso: :sso, + error: :error + }.freeze + + attr_accessor \ + :type, + :status, + :ip_address, + :user_agent, + :user_id, + :email, + :sso, + :error + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @status = hash[:status] + @ip_address = hash[:ip_address] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @email = hash[:email] + @sso = hash[:sso] ? WorkOS::AuthenticationSSOTimedOutDataSSO.new(hash[:sso]) : nil + @error = hash[:error] ? WorkOS::AuthenticationSSOTimedOutDataError.new(hash[:error]) : nil + end + end +end diff --git a/lib/workos/user_management/authentication_sso_timed_out_data_error.rb b/lib/workos/user_management/authentication_sso_timed_out_data_error.rb new file mode 100644 index 00000000..ef0123b5 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_timed_out_data_error.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuthenticationSSOTimedOutDataError = AuthenticationEmailVerificationFailedDataError +end diff --git a/lib/workos/user_management/authentication_sso_timed_out_data_sso.rb b/lib/workos/user_management/authentication_sso_timed_out_data_sso.rb new file mode 100644 index 00000000..888fbc25 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_timed_out_data_sso.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuthenticationSSOTimedOutDataSSO = AuthenticationSSOFailedDataSSO +end diff --git a/lib/workos/user_management/authorization_code_session_authenticate_request.rb b/lib/workos/user_management/authorization_code_session_authenticate_request.rb new file mode 100644 index 00000000..26f5da1f --- /dev/null +++ b/lib/workos/user_management/authorization_code_session_authenticate_request.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthorizationCodeSessionAuthenticateRequest + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + client_secret: :client_secret, + grant_type: :grant_type, + code: :code, + code_verifier: :code_verifier, + invitation_token: :invitation_token, + ip_address: :ip_address, + device_id: :device_id, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :client_id, + :client_secret, + :grant_type, + :code, + :code_verifier, + :invitation_token, + :ip_address, + :device_id, + :user_agent + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @client_secret = hash[:client_secret] + @grant_type = hash[:grant_type] + @code = hash[:code] + @code_verifier = hash[:code_verifier] + @invitation_token = hash[:invitation_token] + @ip_address = hash[:ip_address] + @device_id = hash[:device_id] + @user_agent = hash[:user_agent] + end + end +end diff --git a/lib/workos/user_management/authorized_connect_application_list_data.rb b/lib/workos/user_management/authorized_connect_application_list_data.rb new file mode 100644 index 00000000..f00c49e8 --- /dev/null +++ b/lib/workos/user_management/authorized_connect_application_list_data.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuthorizedConnectApplicationListData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + granted_scopes: :granted_scopes, + oauth_resource: :oauth_resource, + application: :application + }.freeze + + attr_accessor \ + :object, + :id, + :granted_scopes, + :oauth_resource, + :application + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @granted_scopes = hash[:granted_scopes] || [] + @oauth_resource = hash[:oauth_resource] + @application = hash[:application] ? WorkOS::ConnectApplication.new(hash[:application]) : nil + end + end +end diff --git a/lib/workos/user_management/confirm_email_change.rb b/lib/workos/user_management/confirm_email_change.rb new file mode 100644 index 00000000..b8a6504e --- /dev/null +++ b/lib/workos/user_management/confirm_email_change.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + ConfirmEmailChange = AuthenticationChallengesVerifyRequest +end diff --git a/lib/workos/user_management/cors_origin_response.rb b/lib/workos/user_management/cors_origin_response.rb new file mode 100644 index 00000000..83fd5a96 --- /dev/null +++ b/lib/workos/user_management/cors_origin_response.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CORSOriginResponse + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + origin: :origin, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :origin, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @origin = hash[:origin] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/create_cors_origin.rb b/lib/workos/user_management/create_cors_origin.rb new file mode 100644 index 00000000..c5c7e548 --- /dev/null +++ b/lib/workos/user_management/create_cors_origin.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateCORSOrigin + include HashProvider + + HASH_ATTRS = { + origin: :origin + }.freeze + + attr_accessor :origin + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @origin = hash[:origin] + end + end +end diff --git a/lib/workos/user_management/create_magic_code_and_return.rb b/lib/workos/user_management/create_magic_code_and_return.rb new file mode 100644 index 00000000..669e4f1e --- /dev/null +++ b/lib/workos/user_management/create_magic_code_and_return.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateMagicCodeAndReturn + include HashProvider + + HASH_ATTRS = { + email: :email, + invitation_token: :invitation_token + }.freeze + + attr_accessor \ + :email, + :invitation_token + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @email = hash[:email] + @invitation_token = hash[:invitation_token] + end + end +end diff --git a/lib/workos/user_management/create_password_reset.rb b/lib/workos/user_management/create_password_reset.rb new file mode 100644 index 00000000..ba9b9c0d --- /dev/null +++ b/lib/workos/user_management/create_password_reset.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreatePasswordReset + include HashProvider + + HASH_ATTRS = { + token: :token, + new_password: :new_password + }.freeze + + attr_accessor \ + :token, + :new_password + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @token = hash[:token] + @new_password = hash[:new_password] + end + end +end diff --git a/lib/workos/user_management/create_password_reset_token.rb b/lib/workos/user_management/create_password_reset_token.rb new file mode 100644 index 00000000..99e1ede5 --- /dev/null +++ b/lib/workos/user_management/create_password_reset_token.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreatePasswordResetToken + include HashProvider + + HASH_ATTRS = { + email: :email + }.freeze + + attr_accessor :email + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @email = hash[:email] + end + end +end diff --git a/lib/workos/user_management/create_redirect_uri.rb b/lib/workos/user_management/create_redirect_uri.rb new file mode 100644 index 00000000..6ceba1b6 --- /dev/null +++ b/lib/workos/user_management/create_redirect_uri.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateRedirectUri + include HashProvider + + HASH_ATTRS = { + uri: :uri + }.freeze + + attr_accessor :uri + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @uri = hash[:uri] + end + end +end diff --git a/lib/workos/user_management/create_user.rb b/lib/workos/user_management/create_user.rb new file mode 100644 index 00000000..79432672 --- /dev/null +++ b/lib/workos/user_management/create_user.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateUser + include HashProvider + + HASH_ATTRS = { + email: :email, + first_name: :first_name, + last_name: :last_name, + email_verified: :email_verified, + metadata: :metadata, + external_id: :external_id, + password: :password, + password_hash: :password_hash, + password_hash_type: :password_hash_type + }.freeze + + attr_accessor \ + :email, + :first_name, + :last_name, + :email_verified, + :metadata, + :external_id, + :password, + :password_hash, + :password_hash_type + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @email = hash[:email] + @first_name = hash[:first_name] + @last_name = hash[:last_name] + @email_verified = hash[:email_verified] + @metadata = hash[:metadata] || {} + @external_id = hash[:external_id] + @password = hash[:password] + @password_hash = hash[:password_hash] + @password_hash_type = hash[:password_hash_type] + end + end +end diff --git a/lib/workos/user_management/create_user_invite_options.rb b/lib/workos/user_management/create_user_invite_options.rb new file mode 100644 index 00000000..467d5926 --- /dev/null +++ b/lib/workos/user_management/create_user_invite_options.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateUserInviteOptions + include HashProvider + + HASH_ATTRS = { + email: :email, + organization_id: :organization_id, + role_slug: :role_slug, + expires_in_days: :expires_in_days, + inviter_user_id: :inviter_user_id, + locale: :locale + }.freeze + + attr_accessor \ + :email, + :organization_id, + :role_slug, + :expires_in_days, + :inviter_user_id, + :locale + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @email = hash[:email] + @organization_id = hash[:organization_id] + @role_slug = hash[:role_slug] + @expires_in_days = hash[:expires_in_days] + @inviter_user_id = hash[:inviter_user_id] + @locale = hash[:locale] + end + end +end diff --git a/lib/workos/user_management/create_user_organization_membership.rb b/lib/workos/user_management/create_user_organization_membership.rb new file mode 100644 index 00000000..88cc0e47 --- /dev/null +++ b/lib/workos/user_management/create_user_organization_membership.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateUserOrganizationMembership + include HashProvider + + HASH_ATTRS = { + user_id: :user_id, + organization_id: :organization_id, + role_slug: :role_slug, + role_slugs: :role_slugs + }.freeze + + attr_accessor \ + :user_id, + :organization_id, + :role_slug, + :role_slugs + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + @role_slug = hash[:role_slug] + @role_slugs = hash[:role_slugs] || [] + end + end +end diff --git a/lib/workos/user_management/device_authorization_response.rb b/lib/workos/user_management/device_authorization_response.rb new file mode 100644 index 00000000..52c3827a --- /dev/null +++ b/lib/workos/user_management/device_authorization_response.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DeviceAuthorizationResponse + include HashProvider + + HASH_ATTRS = { + device_code: :device_code, + user_code: :user_code, + verification_uri: :verification_uri, + verification_uri_complete: :verification_uri_complete, + expires_in: :expires_in, + interval: :interval + }.freeze + + attr_accessor \ + :device_code, + :user_code, + :verification_uri, + :verification_uri_complete, + :expires_in, + :interval + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @device_code = hash[:device_code] + @user_code = hash[:user_code] + @verification_uri = hash[:verification_uri] + @verification_uri_complete = hash[:verification_uri_complete] + @expires_in = hash[:expires_in] + @interval = hash[:interval] + end + end +end diff --git a/lib/workos/user_management/device_code_session_authenticate_request.rb b/lib/workos/user_management/device_code_session_authenticate_request.rb new file mode 100644 index 00000000..b4054061 --- /dev/null +++ b/lib/workos/user_management/device_code_session_authenticate_request.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class DeviceCodeSessionAuthenticateRequest + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + grant_type: :grant_type, + device_code: :device_code, + ip_address: :ip_address, + device_id: :device_id, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :client_id, + :grant_type, + :device_code, + :ip_address, + :device_id, + :user_agent + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @grant_type = hash[:grant_type] + @device_code = hash[:device_code] + @ip_address = hash[:ip_address] + @device_id = hash[:device_id] + @user_agent = hash[:user_agent] + end + end +end diff --git a/lib/workos/user_management/email_change.rb b/lib/workos/user_management/email_change.rb new file mode 100644 index 00000000..78380fee --- /dev/null +++ b/lib/workos/user_management/email_change.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EmailChange + include HashProvider + + HASH_ATTRS = { + object: :object, + user: :user, + new_email: :new_email, + expires_at: :expires_at, + created_at: :created_at + }.freeze + + attr_accessor \ + :object, + :user, + :new_email, + :expires_at, + :created_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil + @new_email = hash[:new_email] + @expires_at = hash[:expires_at] + @created_at = hash[:created_at] + end + end +end diff --git a/lib/workos/user_management/email_change_confirmation.rb b/lib/workos/user_management/email_change_confirmation.rb new file mode 100644 index 00000000..769b67de --- /dev/null +++ b/lib/workos/user_management/email_change_confirmation.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EmailChangeConfirmation + include HashProvider + + HASH_ATTRS = { + object: :object, + user: :user + }.freeze + + attr_accessor \ + :object, + :user + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @user = hash[:user] ? WorkOS::EmailChangeConfirmationUser.new(hash[:user]) : nil + end + end +end diff --git a/lib/workos/user_management/email_change_confirmation_user.rb b/lib/workos/user_management/email_change_confirmation_user.rb new file mode 100644 index 00000000..944287d5 --- /dev/null +++ b/lib/workos/user_management/email_change_confirmation_user.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EmailChangeConfirmationUser + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + first_name: :first_name, + last_name: :last_name, + profile_picture_url: :profile_picture_url, + email: :email, + email_verified: :email_verified, + external_id: :external_id, + metadata: :metadata, + last_sign_in_at: :last_sign_in_at, + locale: :locale, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :first_name, + :last_name, + :profile_picture_url, + :email, + :email_verified, + :external_id, + :metadata, + :last_sign_in_at, + :locale, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @first_name = hash[:first_name] + @last_name = hash[:last_name] + @profile_picture_url = hash[:profile_picture_url] + @email = hash[:email] + @email_verified = hash[:email_verified] + @external_id = hash[:external_id] + @metadata = hash[:metadata] || {} + @last_sign_in_at = hash[:last_sign_in_at] + @locale = hash[:locale] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/email_verification.rb b/lib/workos/user_management/email_verification.rb new file mode 100644 index 00000000..e652ca0e --- /dev/null +++ b/lib/workos/user_management/email_verification.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EmailVerification + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + email: :email, + expires_at: :expires_at, + created_at: :created_at, + updated_at: :updated_at, + code: :code + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :email, + :expires_at, + :created_at, + :updated_at, + :code + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @email = hash[:email] + @expires_at = hash[:expires_at] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @code = hash[:code] + end + end +end diff --git a/lib/workos/user_management/email_verification_code_session_authenticate_request.rb b/lib/workos/user_management/email_verification_code_session_authenticate_request.rb new file mode 100644 index 00000000..f9a5eb8f --- /dev/null +++ b/lib/workos/user_management/email_verification_code_session_authenticate_request.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EmailVerificationCodeSessionAuthenticateRequest + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + client_secret: :client_secret, + grant_type: :grant_type, + code: :code, + pending_authentication_token: :pending_authentication_token, + ip_address: :ip_address, + device_id: :device_id, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :client_id, + :client_secret, + :grant_type, + :code, + :pending_authentication_token, + :ip_address, + :device_id, + :user_agent + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @client_secret = hash[:client_secret] + @grant_type = hash[:grant_type] + @code = hash[:code] + @pending_authentication_token = hash[:pending_authentication_token] + @ip_address = hash[:ip_address] + @device_id = hash[:device_id] + @user_agent = hash[:user_agent] + end + end +end diff --git a/lib/workos/user_management/email_verification_created.rb b/lib/workos/user_management/email_verification_created.rb new file mode 100644 index 00000000..fe7dbef4 --- /dev/null +++ b/lib/workos/user_management/email_verification_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EmailVerificationCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::EmailVerificationCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/email_verification_created_data.rb b/lib/workos/user_management/email_verification_created_data.rb new file mode 100644 index 00000000..d16646bd --- /dev/null +++ b/lib/workos/user_management/email_verification_created_data.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class EmailVerificationCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + email: :email, + expires_at: :expires_at, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :email, + :expires_at, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @email = hash[:email] + @expires_at = hash[:expires_at] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/invitation.rb b/lib/workos/user_management/invitation.rb new file mode 100644 index 00000000..356f9b1a --- /dev/null +++ b/lib/workos/user_management/invitation.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Invitation + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + email: :email, + state: :state, + accepted_at: :accepted_at, + revoked_at: :revoked_at, + expires_at: :expires_at, + organization_id: :organization_id, + inviter_user_id: :inviter_user_id, + accepted_user_id: :accepted_user_id, + created_at: :created_at, + updated_at: :updated_at, + token: :token, + accept_invitation_url: :accept_invitation_url + }.freeze + + attr_accessor \ + :object, + :id, + :email, + :state, + :accepted_at, + :revoked_at, + :expires_at, + :organization_id, + :inviter_user_id, + :accepted_user_id, + :created_at, + :updated_at, + :token, + :accept_invitation_url + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @email = hash[:email] + @state = hash[:state] + @accepted_at = hash[:accepted_at] + @revoked_at = hash[:revoked_at] + @expires_at = hash[:expires_at] + @organization_id = hash[:organization_id] + @inviter_user_id = hash[:inviter_user_id] + @accepted_user_id = hash[:accepted_user_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @token = hash[:token] + @accept_invitation_url = hash[:accept_invitation_url] + end + end +end diff --git a/lib/workos/user_management/invitation_accepted.rb b/lib/workos/user_management/invitation_accepted.rb new file mode 100644 index 00000000..b8aae791 --- /dev/null +++ b/lib/workos/user_management/invitation_accepted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class InvitationAccepted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::InvitationAcceptedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/invitation_accepted_data.rb b/lib/workos/user_management/invitation_accepted_data.rb new file mode 100644 index 00000000..a008caf9 --- /dev/null +++ b/lib/workos/user_management/invitation_accepted_data.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class InvitationAcceptedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + email: :email, + state: :state, + accepted_at: :accepted_at, + revoked_at: :revoked_at, + expires_at: :expires_at, + organization_id: :organization_id, + inviter_user_id: :inviter_user_id, + accepted_user_id: :accepted_user_id, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :email, + :state, + :accepted_at, + :revoked_at, + :expires_at, + :organization_id, + :inviter_user_id, + :accepted_user_id, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @email = hash[:email] + @state = hash[:state] + @accepted_at = hash[:accepted_at] + @revoked_at = hash[:revoked_at] + @expires_at = hash[:expires_at] + @organization_id = hash[:organization_id] + @inviter_user_id = hash[:inviter_user_id] + @accepted_user_id = hash[:accepted_user_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/invitation_created.rb b/lib/workos/user_management/invitation_created.rb new file mode 100644 index 00000000..b6f5cfbd --- /dev/null +++ b/lib/workos/user_management/invitation_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class InvitationCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::InvitationCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/invitation_created_data.rb b/lib/workos/user_management/invitation_created_data.rb new file mode 100644 index 00000000..ba535c7a --- /dev/null +++ b/lib/workos/user_management/invitation_created_data.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class InvitationCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + email: :email, + state: :state, + accepted_at: :accepted_at, + revoked_at: :revoked_at, + expires_at: :expires_at, + organization_id: :organization_id, + inviter_user_id: :inviter_user_id, + accepted_user_id: :accepted_user_id, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :email, + :state, + :accepted_at, + :revoked_at, + :expires_at, + :organization_id, + :inviter_user_id, + :accepted_user_id, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @email = hash[:email] + @state = hash[:state] + @accepted_at = hash[:accepted_at] + @revoked_at = hash[:revoked_at] + @expires_at = hash[:expires_at] + @organization_id = hash[:organization_id] + @inviter_user_id = hash[:inviter_user_id] + @accepted_user_id = hash[:accepted_user_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/invitation_resent.rb b/lib/workos/user_management/invitation_resent.rb new file mode 100644 index 00000000..7b9b89d4 --- /dev/null +++ b/lib/workos/user_management/invitation_resent.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class InvitationResent + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::InvitationResentData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/invitation_resent_data.rb b/lib/workos/user_management/invitation_resent_data.rb new file mode 100644 index 00000000..cb3e00ef --- /dev/null +++ b/lib/workos/user_management/invitation_resent_data.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class InvitationResentData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + email: :email, + state: :state, + accepted_at: :accepted_at, + revoked_at: :revoked_at, + expires_at: :expires_at, + organization_id: :organization_id, + inviter_user_id: :inviter_user_id, + accepted_user_id: :accepted_user_id, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :email, + :state, + :accepted_at, + :revoked_at, + :expires_at, + :organization_id, + :inviter_user_id, + :accepted_user_id, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @email = hash[:email] + @state = hash[:state] + @accepted_at = hash[:accepted_at] + @revoked_at = hash[:revoked_at] + @expires_at = hash[:expires_at] + @organization_id = hash[:organization_id] + @inviter_user_id = hash[:inviter_user_id] + @accepted_user_id = hash[:accepted_user_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/invitation_revoked.rb b/lib/workos/user_management/invitation_revoked.rb new file mode 100644 index 00000000..b42b13f6 --- /dev/null +++ b/lib/workos/user_management/invitation_revoked.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class InvitationRevoked + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::InvitationRevokedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/invitation_revoked_data.rb b/lib/workos/user_management/invitation_revoked_data.rb new file mode 100644 index 00000000..86c09a91 --- /dev/null +++ b/lib/workos/user_management/invitation_revoked_data.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class InvitationRevokedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + email: :email, + state: :state, + accepted_at: :accepted_at, + revoked_at: :revoked_at, + expires_at: :expires_at, + organization_id: :organization_id, + inviter_user_id: :inviter_user_id, + accepted_user_id: :accepted_user_id, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :email, + :state, + :accepted_at, + :revoked_at, + :expires_at, + :organization_id, + :inviter_user_id, + :accepted_user_id, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @email = hash[:email] + @state = hash[:state] + @accepted_at = hash[:accepted_at] + @revoked_at = hash[:revoked_at] + @expires_at = hash[:expires_at] + @organization_id = hash[:organization_id] + @inviter_user_id = hash[:inviter_user_id] + @accepted_user_id = hash[:accepted_user_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/jwks_response.rb b/lib/workos/user_management/jwks_response.rb new file mode 100644 index 00000000..76f3f0a4 --- /dev/null +++ b/lib/workos/user_management/jwks_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class JwksResponse + include HashProvider + + HASH_ATTRS = { + keys: :keys + }.freeze + + attr_accessor :keys + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @keys = (hash[:keys] || []).map { |item| item ? WorkOS::JwksResponseKeys.new(item) : nil } + end + end +end diff --git a/lib/workos/user_management/jwks_response_keys.rb b/lib/workos/user_management/jwks_response_keys.rb new file mode 100644 index 00000000..9a4c72f7 --- /dev/null +++ b/lib/workos/user_management/jwks_response_keys.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class JwksResponseKeys + include HashProvider + + HASH_ATTRS = { + :alg => :alg, + :kty => :kty, + :use => :use, + :x5c => :x_5_c, + :n => :n, + :e => :e, + :kid => :kid, + "x5t#S256" => :x_5_t_s_256 + }.freeze + + attr_accessor \ + :alg, + :kty, + :use, + :x_5_c, + :n, + :e, + :kid, + :x_5_t_s_256 + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @alg = hash[:alg] + @kty = hash[:kty] + @use = hash[:use] + @x_5_c = hash[:x5c] || [] + @n = hash[:n] + @e = hash[:e] + @kid = hash[:kid] + @x_5_t_s_256 = hash[:"x5t#S256"] + end + end +end diff --git a/lib/workos/user_management/jwt_template_response.rb b/lib/workos/user_management/jwt_template_response.rb new file mode 100644 index 00000000..1fcd1812 --- /dev/null +++ b/lib/workos/user_management/jwt_template_response.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class JWTTemplateResponse + include HashProvider + + HASH_ATTRS = { + object: :object, + content: :content, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :content, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @content = hash[:content] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/magic_auth.rb b/lib/workos/user_management/magic_auth.rb new file mode 100644 index 00000000..adda9f7b --- /dev/null +++ b/lib/workos/user_management/magic_auth.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class MagicAuth + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + email: :email, + expires_at: :expires_at, + created_at: :created_at, + updated_at: :updated_at, + code: :code + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :email, + :expires_at, + :created_at, + :updated_at, + :code + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @email = hash[:email] + @expires_at = hash[:expires_at] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @code = hash[:code] + end + end +end diff --git a/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb b/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb new file mode 100644 index 00000000..73362824 --- /dev/null +++ b/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class MagicAuthCodeSessionAuthenticateRequest + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + client_secret: :client_secret, + grant_type: :grant_type, + code: :code, + email: :email, + invitation_token: :invitation_token, + ip_address: :ip_address, + device_id: :device_id, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :client_id, + :client_secret, + :grant_type, + :code, + :email, + :invitation_token, + :ip_address, + :device_id, + :user_agent + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @client_secret = hash[:client_secret] + @grant_type = hash[:grant_type] + @code = hash[:code] + @email = hash[:email] + @invitation_token = hash[:invitation_token] + @ip_address = hash[:ip_address] + @device_id = hash[:device_id] + @user_agent = hash[:user_agent] + end + end +end diff --git a/lib/workos/user_management/magic_auth_created.rb b/lib/workos/user_management/magic_auth_created.rb new file mode 100644 index 00000000..f3acec39 --- /dev/null +++ b/lib/workos/user_management/magic_auth_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class MagicAuthCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::MagicAuthCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/magic_auth_created_data.rb b/lib/workos/user_management/magic_auth_created_data.rb new file mode 100644 index 00000000..6f03430e --- /dev/null +++ b/lib/workos/user_management/magic_auth_created_data.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class MagicAuthCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + email: :email, + expires_at: :expires_at, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :email, + :expires_at, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @email = hash[:email] + @expires_at = hash[:expires_at] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/mfa_totp_session_authenticate_request.rb b/lib/workos/user_management/mfa_totp_session_authenticate_request.rb new file mode 100644 index 00000000..10825b30 --- /dev/null +++ b/lib/workos/user_management/mfa_totp_session_authenticate_request.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class MFATotpSessionAuthenticateRequest + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + client_secret: :client_secret, + grant_type: :grant_type, + code: :code, + pending_authentication_token: :pending_authentication_token, + authentication_challenge_id: :authentication_challenge_id, + ip_address: :ip_address, + device_id: :device_id, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :client_id, + :client_secret, + :grant_type, + :code, + :pending_authentication_token, + :authentication_challenge_id, + :ip_address, + :device_id, + :user_agent + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @client_secret = hash[:client_secret] + @grant_type = hash[:grant_type] + @code = hash[:code] + @pending_authentication_token = hash[:pending_authentication_token] + @authentication_challenge_id = hash[:authentication_challenge_id] + @ip_address = hash[:ip_address] + @device_id = hash[:device_id] + @user_agent = hash[:user_agent] + end + end +end diff --git a/lib/workos/user_management/organization_membership.rb b/lib/workos/user_management/organization_membership.rb new file mode 100644 index 00000000..880f44cf --- /dev/null +++ b/lib/workos/user_management/organization_membership.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationMembership + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + organization_id: :organization_id, + status: :status, + directory_managed: :directory_managed, + organization_name: :organization_name, + custom_attributes: :custom_attributes, + created_at: :created_at, + updated_at: :updated_at, + role: :role + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :organization_id, + :status, + :directory_managed, + :organization_name, + :custom_attributes, + :created_at, + :updated_at, + :role + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + @status = hash[:status] + @directory_managed = hash[:directory_managed] + @organization_name = hash[:organization_name] + @custom_attributes = hash[:custom_attributes] || {} + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + end + end +end diff --git a/lib/workos/user_management/organization_selection_session_authenticate_request.rb b/lib/workos/user_management/organization_selection_session_authenticate_request.rb new file mode 100644 index 00000000..809c54ac --- /dev/null +++ b/lib/workos/user_management/organization_selection_session_authenticate_request.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class OrganizationSelectionSessionAuthenticateRequest + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + client_secret: :client_secret, + grant_type: :grant_type, + pending_authentication_token: :pending_authentication_token, + organization_id: :organization_id, + ip_address: :ip_address, + device_id: :device_id, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :client_id, + :client_secret, + :grant_type, + :pending_authentication_token, + :organization_id, + :ip_address, + :device_id, + :user_agent + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @client_secret = hash[:client_secret] + @grant_type = hash[:grant_type] + @pending_authentication_token = hash[:pending_authentication_token] + @organization_id = hash[:organization_id] + @ip_address = hash[:ip_address] + @device_id = hash[:device_id] + @user_agent = hash[:user_agent] + end + end +end diff --git a/lib/workos/user_management/password_reset.rb b/lib/workos/user_management/password_reset.rb new file mode 100644 index 00000000..d64d7da1 --- /dev/null +++ b/lib/workos/user_management/password_reset.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class PasswordReset + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + email: :email, + expires_at: :expires_at, + created_at: :created_at, + password_reset_token: :password_reset_token, + password_reset_url: :password_reset_url + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :email, + :expires_at, + :created_at, + :password_reset_token, + :password_reset_url + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @email = hash[:email] + @expires_at = hash[:expires_at] + @created_at = hash[:created_at] + @password_reset_token = hash[:password_reset_token] + @password_reset_url = hash[:password_reset_url] + end + end +end diff --git a/lib/workos/user_management/password_reset_created.rb b/lib/workos/user_management/password_reset_created.rb new file mode 100644 index 00000000..3f79e06a --- /dev/null +++ b/lib/workos/user_management/password_reset_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class PasswordResetCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::PasswordResetCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/password_reset_created_data.rb b/lib/workos/user_management/password_reset_created_data.rb new file mode 100644 index 00000000..70886022 --- /dev/null +++ b/lib/workos/user_management/password_reset_created_data.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class PasswordResetCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + email: :email, + expires_at: :expires_at, + created_at: :created_at + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :email, + :expires_at, + :created_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @email = hash[:email] + @expires_at = hash[:expires_at] + @created_at = hash[:created_at] + end + end +end diff --git a/lib/workos/user_management/password_reset_succeeded.rb b/lib/workos/user_management/password_reset_succeeded.rb new file mode 100644 index 00000000..b37d5f84 --- /dev/null +++ b/lib/workos/user_management/password_reset_succeeded.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class PasswordResetSucceeded + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::PasswordResetSucceededData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/password_reset_succeeded_data.rb b/lib/workos/user_management/password_reset_succeeded_data.rb new file mode 100644 index 00000000..076bc8b3 --- /dev/null +++ b/lib/workos/user_management/password_reset_succeeded_data.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + PasswordResetSucceededData = PasswordResetCreatedData +end diff --git a/lib/workos/user_management/password_session_authenticate_request.rb b/lib/workos/user_management/password_session_authenticate_request.rb new file mode 100644 index 00000000..ef55c9e6 --- /dev/null +++ b/lib/workos/user_management/password_session_authenticate_request.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class PasswordSessionAuthenticateRequest + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + client_secret: :client_secret, + grant_type: :grant_type, + email: :email, + password: :password, + invitation_token: :invitation_token, + ip_address: :ip_address, + device_id: :device_id, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :client_id, + :client_secret, + :grant_type, + :email, + :password, + :invitation_token, + :ip_address, + :device_id, + :user_agent + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @client_secret = hash[:client_secret] + @grant_type = hash[:grant_type] + @email = hash[:email] + @password = hash[:password] + @invitation_token = hash[:invitation_token] + @ip_address = hash[:ip_address] + @device_id = hash[:device_id] + @user_agent = hash[:user_agent] + end + end +end diff --git a/lib/workos/user_management/redirect_uri.rb b/lib/workos/user_management/redirect_uri.rb new file mode 100644 index 00000000..aa241eb3 --- /dev/null +++ b/lib/workos/user_management/redirect_uri.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RedirectUri + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + uri: :uri, + default: :default, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :uri, + :default, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @uri = hash[:uri] + @default = hash[:default] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/refresh_token_session_authenticate_request.rb b/lib/workos/user_management/refresh_token_session_authenticate_request.rb new file mode 100644 index 00000000..be6d901d --- /dev/null +++ b/lib/workos/user_management/refresh_token_session_authenticate_request.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RefreshTokenSessionAuthenticateRequest + include HashProvider + + HASH_ATTRS = { + client_id: :client_id, + client_secret: :client_secret, + grant_type: :grant_type, + refresh_token: :refresh_token, + organization_id: :organization_id, + ip_address: :ip_address, + device_id: :device_id, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :client_id, + :client_secret, + :grant_type, + :refresh_token, + :organization_id, + :ip_address, + :device_id, + :user_agent + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + @client_secret = hash[:client_secret] + @grant_type = hash[:grant_type] + @refresh_token = hash[:refresh_token] + @organization_id = hash[:organization_id] + @ip_address = hash[:ip_address] + @device_id = hash[:device_id] + @user_agent = hash[:user_agent] + end + end +end diff --git a/lib/workos/user_management/resend_user_invite_options.rb b/lib/workos/user_management/resend_user_invite_options.rb new file mode 100644 index 00000000..8ef3ebdd --- /dev/null +++ b/lib/workos/user_management/resend_user_invite_options.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ResendUserInviteOptions + include HashProvider + + HASH_ATTRS = { + locale: :locale + }.freeze + + attr_accessor :locale + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @locale = hash[:locale] + end + end +end diff --git a/lib/workos/user_management/reset_password_response.rb b/lib/workos/user_management/reset_password_response.rb new file mode 100644 index 00000000..9209165e --- /dev/null +++ b/lib/workos/user_management/reset_password_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class ResetPasswordResponse + include HashProvider + + HASH_ATTRS = { + user: :user + }.freeze + + attr_accessor :user + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil + end + end +end diff --git a/lib/workos/user_management/revoke_session.rb b/lib/workos/user_management/revoke_session.rb new file mode 100644 index 00000000..142475fe --- /dev/null +++ b/lib/workos/user_management/revoke_session.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class RevokeSession + include HashProvider + + HASH_ATTRS = { + session_id: :session_id, + return_to: :return_to + }.freeze + + attr_accessor \ + :session_id, + :return_to + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @session_id = hash[:session_id] + @return_to = hash[:return_to] + end + end +end diff --git a/lib/workos/user_management/send_email_change.rb b/lib/workos/user_management/send_email_change.rb new file mode 100644 index 00000000..f5f5667c --- /dev/null +++ b/lib/workos/user_management/send_email_change.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SendEmailChange + include HashProvider + + HASH_ATTRS = { + new_email: :new_email + }.freeze + + attr_accessor :new_email + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @new_email = hash[:new_email] + end + end +end diff --git a/lib/workos/user_management/send_verification_email_response.rb b/lib/workos/user_management/send_verification_email_response.rb new file mode 100644 index 00000000..677a2cc6 --- /dev/null +++ b/lib/workos/user_management/send_verification_email_response.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + SendVerificationEmailResponse = ResetPasswordResponse +end diff --git a/lib/workos/user_management/session.rb b/lib/workos/user_management/session.rb deleted file mode 100644 index def2023b..00000000 --- a/lib/workos/user_management/session.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - module UserManagement - # The Session class provides a lightweight wrapper around - # a WorkOS Session resource. This class is not meant to be instantiated - # in user space, and is instantiated internally but exposed. - class Session - include HashProvider - - attr_accessor :id, :object, :user_id, :organization_id, :status, :auth_method, - :ip_address, :user_agent, :expires_at, :ended_at, :created_at, :updated_at - - # rubocop:disable Metrics/AbcSize - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @object = hash[:object] - @user_id = hash[:user_id] - @organization_id = hash[:organization_id] - @status = hash[:status] - @auth_method = hash[:auth_method] - @ip_address = hash[:ip_address] - @user_agent = hash[:user_agent] - @expires_at = hash[:expires_at] - @ended_at = hash[:ended_at] - @created_at = hash[:created_at] - @updated_at = hash[:updated_at] - end - # rubocop:enable Metrics/AbcSize - - def to_json(*) - { - id: id, - object: object, - user_id: user_id, - organization_id: organization_id, - status: status, - auth_method: auth_method, - ip_address: ip_address, - user_agent: user_agent, - expires_at: expires_at, - ended_at: ended_at, - created_at: created_at, - updated_at: updated_at - } - end - - # Revoke this session - # - # @return [Bool] - returns `true` if successful - def revoke - WorkOS::UserManagement.revoke_session(session_id: id) - end - end - end -end diff --git a/lib/workos/user_management/session_created.rb b/lib/workos/user_management/session_created.rb new file mode 100644 index 00000000..d530f115 --- /dev/null +++ b/lib/workos/user_management/session_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SessionCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::SessionCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/session_created_data.rb b/lib/workos/user_management/session_created_data.rb new file mode 100644 index 00000000..535bdf58 --- /dev/null +++ b/lib/workos/user_management/session_created_data.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SessionCreatedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + impersonator: :impersonator, + ip_address: :ip_address, + organization_id: :organization_id, + user_agent: :user_agent, + user_id: :user_id, + auth_method: :auth_method, + status: :status, + expires_at: :expires_at, + ended_at: :ended_at, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :impersonator, + :ip_address, + :organization_id, + :user_agent, + :user_id, + :auth_method, + :status, + :expires_at, + :ended_at, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @impersonator = hash[:impersonator] ? WorkOS::SessionCreatedDataImpersonator.new(hash[:impersonator]) : nil + @ip_address = hash[:ip_address] + @organization_id = hash[:organization_id] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @auth_method = hash[:auth_method] + @status = hash[:status] + @expires_at = hash[:expires_at] + @ended_at = hash[:ended_at] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/session_created_data_impersonator.rb b/lib/workos/user_management/session_created_data_impersonator.rb new file mode 100644 index 00000000..5db89677 --- /dev/null +++ b/lib/workos/user_management/session_created_data_impersonator.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + SessionCreatedDataImpersonator = AuthenticateResponseImpersonator +end diff --git a/lib/workos/user_management/session_revoked.rb b/lib/workos/user_management/session_revoked.rb new file mode 100644 index 00000000..0e93c54f --- /dev/null +++ b/lib/workos/user_management/session_revoked.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SessionRevoked + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::SessionRevokedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/session_revoked_data.rb b/lib/workos/user_management/session_revoked_data.rb new file mode 100644 index 00000000..be778d5e --- /dev/null +++ b/lib/workos/user_management/session_revoked_data.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SessionRevokedData + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + impersonator: :impersonator, + ip_address: :ip_address, + organization_id: :organization_id, + user_agent: :user_agent, + user_id: :user_id, + auth_method: :auth_method, + status: :status, + expires_at: :expires_at, + ended_at: :ended_at, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :impersonator, + :ip_address, + :organization_id, + :user_agent, + :user_id, + :auth_method, + :status, + :expires_at, + :ended_at, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @impersonator = hash[:impersonator] ? WorkOS::SessionRevokedDataImpersonator.new(hash[:impersonator]) : nil + @ip_address = hash[:ip_address] + @organization_id = hash[:organization_id] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @auth_method = hash[:auth_method] + @status = hash[:status] + @expires_at = hash[:expires_at] + @ended_at = hash[:ended_at] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/session_revoked_data_impersonator.rb b/lib/workos/user_management/session_revoked_data_impersonator.rb new file mode 100644 index 00000000..31c0d83d --- /dev/null +++ b/lib/workos/user_management/session_revoked_data_impersonator.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + SessionRevokedDataImpersonator = AuthenticateResponseImpersonator +end diff --git a/lib/workos/user_management/sso_device_authorization_request.rb b/lib/workos/user_management/sso_device_authorization_request.rb new file mode 100644 index 00000000..b7e10f2a --- /dev/null +++ b/lib/workos/user_management/sso_device_authorization_request.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class SSODeviceAuthorizationRequest + include HashProvider + + HASH_ATTRS = { + client_id: :client_id + }.freeze + + attr_accessor :client_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @client_id = hash[:client_id] + end + end +end diff --git a/lib/workos/user_management/update_jwt_template.rb b/lib/workos/user_management/update_jwt_template.rb new file mode 100644 index 00000000..850bd646 --- /dev/null +++ b/lib/workos/user_management/update_jwt_template.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UpdateJWTTemplate + include HashProvider + + HASH_ATTRS = { + content: :content + }.freeze + + attr_accessor :content + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @content = hash[:content] + end + end +end diff --git a/lib/workos/user_management/update_user.rb b/lib/workos/user_management/update_user.rb new file mode 100644 index 00000000..863cfb5c --- /dev/null +++ b/lib/workos/user_management/update_user.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UpdateUser + include HashProvider + + HASH_ATTRS = { + email: :email, + first_name: :first_name, + last_name: :last_name, + email_verified: :email_verified, + metadata: :metadata, + external_id: :external_id, + locale: :locale, + password: :password, + password_hash: :password_hash, + password_hash_type: :password_hash_type + }.freeze + + attr_accessor \ + :email, + :first_name, + :last_name, + :email_verified, + :metadata, + :external_id, + :locale, + :password, + :password_hash, + :password_hash_type + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @email = hash[:email] + @first_name = hash[:first_name] + @last_name = hash[:last_name] + @email_verified = hash[:email_verified] + @metadata = hash[:metadata] || {} + @external_id = hash[:external_id] + @locale = hash[:locale] + @password = hash[:password] + @password_hash = hash[:password_hash] + @password_hash_type = hash[:password_hash_type] + end + end +end diff --git a/lib/workos/user_management/update_user_organization_membership.rb b/lib/workos/user_management/update_user_organization_membership.rb new file mode 100644 index 00000000..0464b378 --- /dev/null +++ b/lib/workos/user_management/update_user_organization_membership.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UpdateUserOrganizationMembership + include HashProvider + + HASH_ATTRS = { + role_slug: :role_slug, + role_slugs: :role_slugs + }.freeze + + attr_accessor \ + :role_slug, + :role_slugs + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @role_slug = hash[:role_slug] + @role_slugs = hash[:role_slugs] || [] + end + end +end diff --git a/lib/workos/user_management/urn_ietf_params_oauth_grant_type_device_code_session_authenticate_request.rb b/lib/workos/user_management/urn_ietf_params_oauth_grant_type_device_code_session_authenticate_request.rb new file mode 100644 index 00000000..e6acd7a4 --- /dev/null +++ b/lib/workos/user_management/urn_ietf_params_oauth_grant_type_device_code_session_authenticate_request.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + # @deprecated Use WorkOS::DeviceCodeSessionAuthenticateRequest instead. + UrnIetfParamsOAuthGrantTypeDeviceCodeSessionAuthenticateRequest = DeviceCodeSessionAuthenticateRequest +end diff --git a/lib/workos/user_management/urn_workos_oauth_grant_type_email_verification_code_session_authenticate_request.rb b/lib/workos/user_management/urn_workos_oauth_grant_type_email_verification_code_session_authenticate_request.rb new file mode 100644 index 00000000..edce56f1 --- /dev/null +++ b/lib/workos/user_management/urn_workos_oauth_grant_type_email_verification_code_session_authenticate_request.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + # @deprecated Use WorkOS::EmailVerificationCodeSessionAuthenticateRequest instead. + UrnWorkosOAuthGrantTypeEmailVerificationCodeSessionAuthenticateRequest = EmailVerificationCodeSessionAuthenticateRequest +end diff --git a/lib/workos/user_management/urn_workos_oauth_grant_type_magic_auth_code_session_authenticate_request.rb b/lib/workos/user_management/urn_workos_oauth_grant_type_magic_auth_code_session_authenticate_request.rb new file mode 100644 index 00000000..ea199f7c --- /dev/null +++ b/lib/workos/user_management/urn_workos_oauth_grant_type_magic_auth_code_session_authenticate_request.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + # @deprecated Use WorkOS::MagicAuthCodeSessionAuthenticateRequest instead. + UrnWorkosOAuthGrantTypeMagicAuthCodeSessionAuthenticateRequest = MagicAuthCodeSessionAuthenticateRequest +end diff --git a/lib/workos/user_management/urn_workos_oauth_grant_type_mfa_totp_session_authenticate_request.rb b/lib/workos/user_management/urn_workos_oauth_grant_type_mfa_totp_session_authenticate_request.rb new file mode 100644 index 00000000..8a5d4ef4 --- /dev/null +++ b/lib/workos/user_management/urn_workos_oauth_grant_type_mfa_totp_session_authenticate_request.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + # @deprecated Use WorkOS::MFATotpSessionAuthenticateRequest instead. + UrnWorkosOAuthGrantTypeMfaTotpSessionAuthenticateRequest = MFATotpSessionAuthenticateRequest +end diff --git a/lib/workos/user_management/urn_workos_oauth_grant_type_organization_selection_session_authenticate_request.rb b/lib/workos/user_management/urn_workos_oauth_grant_type_organization_selection_session_authenticate_request.rb new file mode 100644 index 00000000..10651e79 --- /dev/null +++ b/lib/workos/user_management/urn_workos_oauth_grant_type_organization_selection_session_authenticate_request.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + # @deprecated Use WorkOS::OrganizationSelectionSessionAuthenticateRequest instead. + UrnWorkosOAuthGrantTypeOrganizationSelectionSessionAuthenticateRequest = OrganizationSelectionSessionAuthenticateRequest +end diff --git a/lib/workos/user_management/user.rb b/lib/workos/user_management/user.rb new file mode 100644 index 00000000..e48e0b4b --- /dev/null +++ b/lib/workos/user_management/user.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + User = EmailChangeConfirmationUser +end diff --git a/lib/workos/user_management/user_created.rb b/lib/workos/user_management/user_created.rb new file mode 100644 index 00000000..7506146a --- /dev/null +++ b/lib/workos/user_management/user_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::User.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/user_deleted.rb b/lib/workos/user_management/user_deleted.rb new file mode 100644 index 00000000..9ece3feb --- /dev/null +++ b/lib/workos/user_management/user_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::User.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/user_identities_get_item.rb b/lib/workos/user_management/user_identities_get_item.rb new file mode 100644 index 00000000..99950b07 --- /dev/null +++ b/lib/workos/user_management/user_identities_get_item.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserIdentitiesGetItem + include HashProvider + + HASH_ATTRS = { + idp_id: :idp_id, + type: :type, + provider: :provider + }.freeze + + attr_accessor \ + :idp_id, + :type, + :provider + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @idp_id = hash[:idp_id] + @type = hash[:type] + @provider = hash[:provider] + end + end +end diff --git a/lib/workos/user_management/user_invite.rb b/lib/workos/user_management/user_invite.rb new file mode 100644 index 00000000..0a811021 --- /dev/null +++ b/lib/workos/user_management/user_invite.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserInvite + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + email: :email, + state: :state, + accepted_at: :accepted_at, + revoked_at: :revoked_at, + expires_at: :expires_at, + organization_id: :organization_id, + inviter_user_id: :inviter_user_id, + accepted_user_id: :accepted_user_id, + created_at: :created_at, + updated_at: :updated_at, + token: :token, + accept_invitation_url: :accept_invitation_url + }.freeze + + attr_accessor \ + :object, + :id, + :email, + :state, + :accepted_at, + :revoked_at, + :expires_at, + :organization_id, + :inviter_user_id, + :accepted_user_id, + :created_at, + :updated_at, + :token, + :accept_invitation_url + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @email = hash[:email] + @state = hash[:state] + @accepted_at = hash[:accepted_at] + @revoked_at = hash[:revoked_at] + @expires_at = hash[:expires_at] + @organization_id = hash[:organization_id] + @inviter_user_id = hash[:inviter_user_id] + @accepted_user_id = hash[:accepted_user_id] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @token = hash[:token] + @accept_invitation_url = hash[:accept_invitation_url] + end + end +end diff --git a/lib/workos/user_management/user_organization_membership.rb b/lib/workos/user_management/user_organization_membership.rb new file mode 100644 index 00000000..9d646956 --- /dev/null +++ b/lib/workos/user_management/user_organization_membership.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserOrganizationMembership + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + user_id: :user_id, + organization_id: :organization_id, + status: :status, + directory_managed: :directory_managed, + organization_name: :organization_name, + custom_attributes: :custom_attributes, + created_at: :created_at, + updated_at: :updated_at, + role: :role + }.freeze + + attr_accessor \ + :object, + :id, + :user_id, + :organization_id, + :status, + :directory_managed, + :organization_name, + :custom_attributes, + :created_at, + :updated_at, + :role + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @user_id = hash[:user_id] + @organization_id = hash[:organization_id] + @status = hash[:status] + @directory_managed = hash[:directory_managed] + @organization_name = hash[:organization_name] + @custom_attributes = hash[:custom_attributes] || {} + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + end + end +end diff --git a/lib/workos/user_management/user_sessions_impersonator.rb b/lib/workos/user_management/user_sessions_impersonator.rb new file mode 100644 index 00000000..85f414e0 --- /dev/null +++ b/lib/workos/user_management/user_sessions_impersonator.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + UserSessionsImpersonator = AuthenticateResponseImpersonator +end diff --git a/lib/workos/user_management/user_sessions_list_item.rb b/lib/workos/user_management/user_sessions_list_item.rb new file mode 100644 index 00000000..f62a4053 --- /dev/null +++ b/lib/workos/user_management/user_sessions_list_item.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserSessionsListItem + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + impersonator: :impersonator, + ip_address: :ip_address, + organization_id: :organization_id, + user_agent: :user_agent, + user_id: :user_id, + auth_method: :auth_method, + status: :status, + expires_at: :expires_at, + ended_at: :ended_at, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :impersonator, + :ip_address, + :organization_id, + :user_agent, + :user_id, + :auth_method, + :status, + :expires_at, + :ended_at, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @impersonator = hash[:impersonator] ? WorkOS::UserSessionsImpersonator.new(hash[:impersonator]) : nil + @ip_address = hash[:ip_address] + @organization_id = hash[:organization_id] + @user_agent = hash[:user_agent] + @user_id = hash[:user_id] + @auth_method = hash[:auth_method] + @status = hash[:status] + @expires_at = hash[:expires_at] + @ended_at = hash[:ended_at] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/user_management/user_updated.rb b/lib/workos/user_management/user_updated.rb new file mode 100644 index 00000000..145916b9 --- /dev/null +++ b/lib/workos/user_management/user_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::User.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/user_management/verify_email_address.rb b/lib/workos/user_management/verify_email_address.rb new file mode 100644 index 00000000..e3864e40 --- /dev/null +++ b/lib/workos/user_management/verify_email_address.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + VerifyEmailAddress = AuthenticationChallengesVerifyRequest +end diff --git a/lib/workos/user_management/verify_email_response.rb b/lib/workos/user_management/verify_email_response.rb new file mode 100644 index 00000000..00004e69 --- /dev/null +++ b/lib/workos/user_management/verify_email_response.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + VerifyEmailResponse = ResetPasswordResponse +end diff --git a/lib/workos/user_response.rb b/lib/workos/user_response.rb deleted file mode 100644 index 495948f1..00000000 --- a/lib/workos/user_response.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The UserResponse class represents a User as well as an corresponding - # response data that can later be appended on. - class UserResponse - include HashProvider - - attr_accessor :user - - def initialize(user_response_json) - json = JSON.parse(user_response_json, symbolize_names: true) - @user = WorkOS::User.new(json[:user].to_json) - end - - def to_json(*) - { - user: user.to_json - } - end - end -end diff --git a/lib/workos/util.rb b/lib/workos/util.rb new file mode 100644 index 00000000..258e5b69 --- /dev/null +++ b/lib/workos/util.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# @oagen-ignore-file — hand-maintained runtime +require "cgi" + +module WorkOS + module Util + # Percent-encode a value for use in a URL path segment (RFC 3986). + # Unlike CGI.escape, spaces become %20 instead of +. + def self.encode_path(value) + str = value.to_s + raise ArgumentError, "path segment cannot be nil or empty" if str.empty? + CGI.escape(str).gsub("+", "%20") + end + end +end diff --git a/lib/workos/util/signature.rb b/lib/workos/util/signature.rb new file mode 100644 index 00000000..a2b18a9a --- /dev/null +++ b/lib/workos/util/signature.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +require "openssl" + +module WorkOS + module Util + module Signature + module_function + + # Computes the expected signature hash for a webhook or action payload. + # + # @param payload [String] Raw request body. + # @param timestamp [String] Timestamp extracted from the signature header. + # @param secret [String] Webhook or action signing secret. + # @return [String] + def compute(payload:, timestamp:, secret:) + OpenSSL::HMAC.hexdigest("SHA256", secret, "#{timestamp}.#{payload}") + end + + # Parses the WorkOS signature header. + # + # @param sig_header [String] Header value in `t=..., v1=...` format. + # @return [Array(String, String)] + # @raise [ArgumentError] If the header is missing or malformed. + def parse_header(sig_header) + raise ArgumentError, "Signature header missing" if sig_header.nil? || sig_header.empty? + + parts = sig_header.split(",").map(&:strip) + timestamp = parts.find { |part| part.start_with?("t=") }&.sub(/\At=/, "") + signature = parts.find { |part| part.start_with?("v1=") }&.sub(/\Av1=/, "") + raise ArgumentError, "Unable to extract timestamp and signature hash from header" if timestamp.nil? || signature.nil? + + [timestamp, signature] + end + + # Compares two signature hashes in constant time. + # + # @param a [String] + # @param b [String] + # @return [Boolean] + def secure_compare(a, b) + return false if a.bytesize != b.bytesize + + OpenSSL.fixed_length_secure_compare(a, b) + rescue NoMethodError + left = a.unpack("C*") + result = 0 + index = -1 + b.each_byte { |byte| result |= byte ^ left[index += 1] } + result.zero? + end + end + end +end diff --git a/lib/workos/vault.rb b/lib/workos/vault.rb new file mode 100644 index 00000000..9f906248 --- /dev/null +++ b/lib/workos/vault.rb @@ -0,0 +1,238 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +# Hand-maintained Vault service: 8 KV endpoints + 2 key endpoints + client-side +# AES-GCM encrypt/decrypt (H18). The Vault HTTP API is not in the OpenAPI spec +# and the AES-GCM helpers are inherently client-side, so this stays +# hand-maintained regardless of spec coverage. +require "base64" +require "json" +require "openssl" +require "securerandom" + +module WorkOS + # WorkOS Vault: KV secret storage, server-managed key wrapping, and + # client-side AES-GCM encrypt/decrypt. + # + # client.vault.create_object(name: "api-key", value: "sk_...", key_context: { "tenant" => "t1" }) + # client.vault.encrypt(data: "plaintext", key_context: { "tenant" => "t1" }) + class Vault + DEFAULT_RESPONSE_LIMIT = 10 + + DataKey = Struct.new(:id, :key, keyword_init: true) do + def self.from_response(hash) + new(id: hash["id"], key: hash["data_key"]) + end + end + + DataKeyPair = Struct.new(:context, :data_key, :encrypted_keys, keyword_init: true) do + def self.from_response(hash) + new( + context: hash["context"], + data_key: DataKey.new(id: hash["id"], key: hash["data_key"]), + encrypted_keys: hash["encrypted_keys"] + ) + end + end + + ObjectUpdateBy = Struct.new(:id, :name, keyword_init: true) do + def self.from_hash(hash) + return nil if hash.nil? + new(id: hash["id"], name: hash["name"]) + end + end + + ObjectMetadata = Struct.new( + :context, :environment_id, :id, :key_id, :updated_at, :updated_by, :version_id, + keyword_init: true + ) do + def self.from_hash(hash) + new( + context: hash["context"], + environment_id: hash["environment_id"], + id: hash["id"], + key_id: hash["key_id"], + updated_at: hash["updated_at"], + updated_by: ObjectUpdateBy.from_hash(hash["updated_by"]), + version_id: hash["version_id"] + ) + end + end + + VaultObject = Struct.new(:id, :name, :value, :metadata, keyword_init: true) do + def self.from_hash(hash) + new( + id: hash["id"], + name: hash["name"], + value: hash["value"], + metadata: hash["metadata"] ? ObjectMetadata.from_hash(hash["metadata"]) : nil + ) + end + end + + ObjectDigest = Struct.new(:id, :name, :updated_at, keyword_init: true) do + def self.from_hash(hash) + new(id: hash["id"], name: hash["name"], updated_at: hash["updated_at"]) + end + end + + ObjectVersion = Struct.new(:id, :created_at, :current_version, keyword_init: true) do + def self.from_hash(hash) + new(id: hash["id"], created_at: hash["created_at"], current_version: hash["current_version"]) + end + end + + def initialize(client) + @client = client + end + + # -- KV operations -------------------------------------------------------- + + # Get a Vault object with the value decrypted. + def read_object(object_id:, request_options: {}) + response = @client.request(method: :get, path: "/vault/v1/kv/#{WorkOS::Util.encode_path(object_id)}", auth: true, request_options: request_options) + VaultObject.from_hash(JSON.parse(response.body)) + end + + # Get a Vault object by name with the value decrypted. + def read_object_by_name(name:, request_options: {}) + response = @client.request(method: :get, path: "/vault/v1/kv/name/#{WorkOS::Util.encode_path(name)}", auth: true, request_options: request_options) + VaultObject.from_hash(JSON.parse(response.body)) + end + + # Get a Vault object's metadata without decrypting the value. + def get_object_metadata(object_id:, request_options: {}) + response = @client.request(method: :get, path: "/vault/v1/kv/#{WorkOS::Util.encode_path(object_id)}/metadata", auth: true, request_options: request_options) + VaultObject.from_hash(JSON.parse(response.body)) + end + + # List encrypted Vault objects. + # @return [Array] + def list_objects(limit: DEFAULT_RESPONSE_LIMIT, before: nil, after: nil, request_options: {}) + params = {"limit" => limit, "before" => before, "after" => after}.compact + response = @client.request(method: :get, path: "/vault/v1/kv", auth: true, params: params, request_options: request_options) + parsed = JSON.parse(response.body) + (parsed["data"] || []).map { |item| ObjectDigest.from_hash(item) } + end + + # List versions for a specific Vault object. + # @return [Array] + def list_object_versions(object_id:, request_options: {}) + response = @client.request(method: :get, path: "/vault/v1/kv/#{WorkOS::Util.encode_path(object_id)}/versions", auth: true, request_options: request_options) + parsed = JSON.parse(response.body) + (parsed["data"] || []).map { |item| ObjectVersion.from_hash(item) } + end + + # Create a new Vault encrypted object. + def create_object(name:, value:, key_context:, request_options: {}) + body = {"name" => name, "value" => value, "key_context" => key_context} + response = @client.request(method: :post, path: "/vault/v1/kv", auth: true, body: body, request_options: request_options) + ObjectMetadata.from_hash(JSON.parse(response.body)) + end + + # Update an existing Vault object. + def update_object(object_id:, value:, version_check: nil, request_options: {}) + body = {"value" => value, "version_check" => version_check}.compact + response = @client.request(method: :put, path: "/vault/v1/kv/#{WorkOS::Util.encode_path(object_id)}", auth: true, body: body, request_options: request_options) + VaultObject.from_hash(JSON.parse(response.body)) + end + + # Permanently delete a Vault encrypted object. + def delete_object(object_id:, request_options: {}) + @client.request(method: :delete, path: "/vault/v1/kv/#{WorkOS::Util.encode_path(object_id)}", auth: true, request_options: request_options) + nil + end + + # -- Key operations ------------------------------------------------------- + + # Generate a data key for local encryption. + # @return [DataKeyPair] + def create_data_key(key_context:, request_options: {}) + body = {"context" => key_context} + response = @client.request(method: :post, path: "/vault/v1/keys/data-key", auth: true, body: body, request_options: request_options) + DataKeyPair.from_response(JSON.parse(response.body)) + end + + # Decrypt encrypted data keys previously generated by create_data_key. + # @return [DataKey] + def decrypt_data_key(keys:, request_options: {}) + body = {"keys" => keys} + response = @client.request(method: :post, path: "/vault/v1/keys/decrypt", auth: true, body: body, request_options: request_options) + DataKey.from_response(JSON.parse(response.body)) + end + + # -- Client-side AES-GCM encrypt/decrypt (H18) --------------------------- + + # Encrypt data locally using AES-GCM with a data key derived from the context. + # Returns base64(IV || TAG || LEB128(len(keyBlob)) || keyBlob || ciphertext). + def encrypt(data:, key_context:, associated_data: nil) + pair = create_data_key(key_context: key_context) + key = Base64.decode64(pair.data_key.key) + key_blob = Base64.decode64(pair.encrypted_keys) + prefix = encode_u32_leb128(key_blob.bytesize) + iv, ciphertext, tag = aes_gcm_encrypt(data.b, key, associated_data&.b) + Base64.strict_encode64(iv + tag + prefix + key_blob + ciphertext) + end + + # Decrypt data previously encrypted by `encrypt`. + def decrypt(encrypted_data:, associated_data: nil) + payload = Base64.decode64(encrypted_data) + iv = payload.byteslice(0, 12) + tag = payload.byteslice(12, 16) + key_len, leb_len = decode_u32_leb128(payload.byteslice(28, payload.bytesize - 28)) + keys_index = 28 + leb_len + key_blob = payload.byteslice(keys_index, key_len) + ciphertext = payload.byteslice(keys_index + key_len, payload.bytesize - (keys_index + key_len)) + data_key = decrypt_data_key(keys: Base64.strict_encode64(key_blob)) + key = Base64.decode64(data_key.key) + aes_gcm_decrypt(ciphertext, key, iv, tag, associated_data&.b) + end + + private + + def aes_gcm_encrypt(plaintext, key, aad) + cipher = OpenSSL::Cipher.new("aes-256-gcm").encrypt + cipher.key = key + iv = SecureRandom.random_bytes(12) + cipher.iv = iv + cipher.auth_data = aad if aad + ciphertext = cipher.update(plaintext) + cipher.final + [iv, ciphertext, cipher.auth_tag] + end + + def aes_gcm_decrypt(ciphertext, key, iv, tag, aad) + cipher = OpenSSL::Cipher.new("aes-256-gcm").decrypt + cipher.key = key + cipher.iv = iv + cipher.auth_tag = tag + cipher.auth_data = aad if aad + result = cipher.update(ciphertext) + cipher.final + result.force_encoding(Encoding::UTF_8) + end + + def encode_u32_leb128(value) + raise ArgumentError, "value must fit in u32" if value.negative? || value > 0xFFFFFFFF + bytes = +"" + loop do + byte = value & 0x7F + value >>= 7 + byte |= 0x80 if value != 0 + bytes << byte.chr + break if value.zero? + end + bytes + end + + def decode_u32_leb128(buf) + result = 0 + shift = 0 + buf.each_byte.with_index do |b, i| + raise ArgumentError, "LEB128 overflow" if i > 4 + result |= (b & 0x7F) << shift + return [result, i + 1] if (b & 0x80).zero? + shift += 7 + end + raise ArgumentError, "LEB128 not terminated" + end + end +end diff --git a/lib/workos/vault/vault_byok_key_verification_completed.rb b/lib/workos/vault/vault_byok_key_verification_completed.rb new file mode 100644 index 00000000..eaf61311 --- /dev/null +++ b/lib/workos/vault/vault_byok_key_verification_completed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultByokKeyVerificationCompleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultByokKeyVerificationCompletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/vault/vault_byok_key_verification_completed_data.rb b/lib/workos/vault/vault_byok_key_verification_completed_data.rb new file mode 100644 index 00000000..2a01f0b5 --- /dev/null +++ b/lib/workos/vault/vault_byok_key_verification_completed_data.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultByokKeyVerificationCompletedData + include HashProvider + + HASH_ATTRS = { + organization_id: :organization_id, + key_provider: :key_provider, + verified: :verified + }.freeze + + attr_accessor \ + :organization_id, + :key_provider, + :verified + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @organization_id = hash[:organization_id] + @key_provider = hash[:key_provider] + @verified = hash[:verified] + end + end +end diff --git a/lib/workos/vault/vault_data_created.rb b/lib/workos/vault/vault_data_created.rb new file mode 100644 index 00000000..81df95aa --- /dev/null +++ b/lib/workos/vault/vault_data_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDataCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultDataCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/vault/vault_data_created_data.rb b/lib/workos/vault/vault_data_created_data.rb new file mode 100644 index 00000000..f84e271d --- /dev/null +++ b/lib/workos/vault/vault_data_created_data.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDataCreatedData + include HashProvider + + HASH_ATTRS = { + actor_id: :actor_id, + actor_source: :actor_source, + actor_name: :actor_name, + kv_name: :kv_name, + key_id: :key_id, + key_context: :key_context + }.freeze + + attr_accessor \ + :actor_id, + :actor_source, + :actor_name, + :kv_name, + :key_id, + :key_context + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @actor_id = hash[:actor_id] + @actor_source = hash[:actor_source] + @actor_name = hash[:actor_name] + @kv_name = hash[:kv_name] + @key_id = hash[:key_id] + @key_context = hash[:key_context] || {} + end + end +end diff --git a/lib/workos/vault/vault_data_deleted.rb b/lib/workos/vault/vault_data_deleted.rb new file mode 100644 index 00000000..456feb32 --- /dev/null +++ b/lib/workos/vault/vault_data_deleted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDataDeleted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultDataDeletedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/vault/vault_data_deleted_data.rb b/lib/workos/vault/vault_data_deleted_data.rb new file mode 100644 index 00000000..83a27c81 --- /dev/null +++ b/lib/workos/vault/vault_data_deleted_data.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDataDeletedData + include HashProvider + + HASH_ATTRS = { + actor_id: :actor_id, + actor_source: :actor_source, + actor_name: :actor_name, + kv_name: :kv_name + }.freeze + + attr_accessor \ + :actor_id, + :actor_source, + :actor_name, + :kv_name + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @actor_id = hash[:actor_id] + @actor_source = hash[:actor_source] + @actor_name = hash[:actor_name] + @kv_name = hash[:kv_name] + end + end +end diff --git a/lib/workos/vault/vault_data_read.rb b/lib/workos/vault/vault_data_read.rb new file mode 100644 index 00000000..6ea0b822 --- /dev/null +++ b/lib/workos/vault/vault_data_read.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDataRead + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultDataReadData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/vault/vault_data_read_data.rb b/lib/workos/vault/vault_data_read_data.rb new file mode 100644 index 00000000..c25afbc7 --- /dev/null +++ b/lib/workos/vault/vault_data_read_data.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDataReadData + include HashProvider + + HASH_ATTRS = { + actor_id: :actor_id, + actor_source: :actor_source, + actor_name: :actor_name, + kv_name: :kv_name, + key_id: :key_id + }.freeze + + attr_accessor \ + :actor_id, + :actor_source, + :actor_name, + :kv_name, + :key_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @actor_id = hash[:actor_id] + @actor_source = hash[:actor_source] + @actor_name = hash[:actor_name] + @kv_name = hash[:kv_name] + @key_id = hash[:key_id] + end + end +end diff --git a/lib/workos/vault/vault_data_updated.rb b/lib/workos/vault/vault_data_updated.rb new file mode 100644 index 00000000..c25771ac --- /dev/null +++ b/lib/workos/vault/vault_data_updated.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDataUpdated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultDataUpdatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/vault/vault_data_updated_data.rb b/lib/workos/vault/vault_data_updated_data.rb new file mode 100644 index 00000000..caa00245 --- /dev/null +++ b/lib/workos/vault/vault_data_updated_data.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDataUpdatedData + include HashProvider + + HASH_ATTRS = { + actor_id: :actor_id, + actor_source: :actor_source, + actor_name: :actor_name, + kv_name: :kv_name, + key_id: :key_id, + key_context: :key_context + }.freeze + + attr_accessor \ + :actor_id, + :actor_source, + :actor_name, + :kv_name, + :key_id, + :key_context + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @actor_id = hash[:actor_id] + @actor_source = hash[:actor_source] + @actor_name = hash[:actor_name] + @kv_name = hash[:kv_name] + @key_id = hash[:key_id] + @key_context = hash[:key_context] || {} + end + end +end diff --git a/lib/workos/vault/vault_dek_decrypted.rb b/lib/workos/vault/vault_dek_decrypted.rb new file mode 100644 index 00000000..93eaca53 --- /dev/null +++ b/lib/workos/vault/vault_dek_decrypted.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDekDecrypted + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultDekDecryptedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/vault/vault_dek_decrypted_data.rb b/lib/workos/vault/vault_dek_decrypted_data.rb new file mode 100644 index 00000000..70e4dcba --- /dev/null +++ b/lib/workos/vault/vault_dek_decrypted_data.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDekDecryptedData + include HashProvider + + HASH_ATTRS = { + actor_id: :actor_id, + actor_source: :actor_source, + actor_name: :actor_name, + key_id: :key_id + }.freeze + + attr_accessor \ + :actor_id, + :actor_source, + :actor_name, + :key_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @actor_id = hash[:actor_id] + @actor_source = hash[:actor_source] + @actor_name = hash[:actor_name] + @key_id = hash[:key_id] + end + end +end diff --git a/lib/workos/vault/vault_dek_read.rb b/lib/workos/vault/vault_dek_read.rb new file mode 100644 index 00000000..2a66ac16 --- /dev/null +++ b/lib/workos/vault/vault_dek_read.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDekRead + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultDekReadData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/vault/vault_dek_read_data.rb b/lib/workos/vault/vault_dek_read_data.rb new file mode 100644 index 00000000..5c0e7c6f --- /dev/null +++ b/lib/workos/vault/vault_dek_read_data.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultDekReadData + include HashProvider + + HASH_ATTRS = { + actor_id: :actor_id, + actor_source: :actor_source, + actor_name: :actor_name, + key_ids: :key_ids, + key_context: :key_context + }.freeze + + attr_accessor \ + :actor_id, + :actor_source, + :actor_name, + :key_ids, + :key_context + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @actor_id = hash[:actor_id] + @actor_source = hash[:actor_source] + @actor_name = hash[:actor_name] + @key_ids = hash[:key_ids] || [] + @key_context = hash[:key_context] || {} + end + end +end diff --git a/lib/workos/vault/vault_kek_created.rb b/lib/workos/vault/vault_kek_created.rb new file mode 100644 index 00000000..5308ac55 --- /dev/null +++ b/lib/workos/vault/vault_kek_created.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultKekCreated + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultKekCreatedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/vault/vault_kek_created_data.rb b/lib/workos/vault/vault_kek_created_data.rb new file mode 100644 index 00000000..ff39afce --- /dev/null +++ b/lib/workos/vault/vault_kek_created_data.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultKekCreatedData + include HashProvider + + HASH_ATTRS = { + actor_id: :actor_id, + actor_source: :actor_source, + actor_name: :actor_name, + key_name: :key_name, + key_id: :key_id + }.freeze + + attr_accessor \ + :actor_id, + :actor_source, + :actor_name, + :key_name, + :key_id + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @actor_id = hash[:actor_id] + @actor_source = hash[:actor_source] + @actor_name = hash[:actor_name] + @key_name = hash[:key_name] + @key_id = hash[:key_id] + end + end +end diff --git a/lib/workos/vault/vault_metadata_read.rb b/lib/workos/vault/vault_metadata_read.rb new file mode 100644 index 00000000..8fee58e0 --- /dev/null +++ b/lib/workos/vault/vault_metadata_read.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultMetadataRead + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultMetadataReadData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/vault/vault_metadata_read_data.rb b/lib/workos/vault/vault_metadata_read_data.rb new file mode 100644 index 00000000..8c7a96b8 --- /dev/null +++ b/lib/workos/vault/vault_metadata_read_data.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultMetadataReadData + include HashProvider + + HASH_ATTRS = { + actor_id: :actor_id, + actor_source: :actor_source, + actor_name: :actor_name, + kv_name: :kv_name + }.freeze + + attr_accessor \ + :actor_id, + :actor_source, + :actor_name, + :kv_name + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @actor_id = hash[:actor_id] + @actor_source = hash[:actor_source] + @actor_name = hash[:actor_name] + @kv_name = hash[:kv_name] + end + end +end diff --git a/lib/workos/vault/vault_names_listed.rb b/lib/workos/vault/vault_names_listed.rb new file mode 100644 index 00000000..3f6ed43e --- /dev/null +++ b/lib/workos/vault/vault_names_listed.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultNamesListed + include HashProvider + + HASH_ATTRS = { + id: :id, + event: :event, + data: :data, + created_at: :created_at, + context: :context, + object: :object + }.freeze + + attr_accessor \ + :id, + :event, + :data, + :created_at, + :context, + :object + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultNamesListedData.new(hash[:data]) : nil + @created_at = hash[:created_at] + @context = hash[:context] ? WorkOS::EventContext.new(hash[:context]) : nil + @object = hash[:object] + end + end +end diff --git a/lib/workos/vault/vault_names_listed_data.rb b/lib/workos/vault/vault_names_listed_data.rb new file mode 100644 index 00000000..c6af3593 --- /dev/null +++ b/lib/workos/vault/vault_names_listed_data.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class VaultNamesListedData + include HashProvider + + HASH_ATTRS = { + actor_id: :actor_id, + actor_source: :actor_source, + actor_name: :actor_name + }.freeze + + attr_accessor \ + :actor_id, + :actor_source, + :actor_name + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @actor_id = hash[:actor_id] + @actor_source = hash[:actor_source] + @actor_name = hash[:actor_name] + end + end +end diff --git a/lib/workos/verify_challenge.rb b/lib/workos/verify_challenge.rb deleted file mode 100644 index 8cef355f..00000000 --- a/lib/workos/verify_challenge.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The VerifyChallenge class provides a lightweight wrapper around - # a WorkOS Authentication Challenge resource. - class VerifyChallenge - include HashProvider - - attr_accessor :challenge, :valid - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @challenge = hash[:challenge] - @valid = hash[:valid] - end - - def to_json(*) - { - challenge: challenge, - valid: valid - } - end - end -end diff --git a/lib/workos/version.rb b/lib/workos/version.rb index f038c0fa..fff66459 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# @oagen-ignore-file module WorkOS VERSION = "6.2.0" end diff --git a/lib/workos/webhook.rb b/lib/workos/webhook.rb deleted file mode 100644 index bdf92be0..00000000 --- a/lib/workos/webhook.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -module WorkOS - # The Webhook class provides a lightweight wrapper around - # a WorkOS Webhook resource. This class is not meant to be instantiated - # in user space, and is instantiated internally but exposed. - class Webhook - include HashProvider - - attr_accessor :id, :event, :data, :created_at - - def initialize(json) - hash = JSON.parse(json, symbolize_names: true) - - @id = hash[:id] - @event = hash[:event] - @data = hash[:data] - @created_at = hash[:created_at] - end - - def to_json(*) - { - id: id, - event: event, - data: data, - created_at: created_at - } - end - end -end diff --git a/lib/workos/webhook_event.rb b/lib/workos/webhook_event.rb new file mode 100644 index 00000000..165d749d --- /dev/null +++ b/lib/workos/webhook_event.rb @@ -0,0 +1,120 @@ +# frozen_string_literal: true + +# @oagen-ignore-file — hand-maintained runtime +require "json" + +module WorkOS + # Typed wrapper around a parsed webhook event payload. + # + # event = client.webhooks.construct_event( + # payload: body, sig_header: sig, secret: ENV["WORKOS_WEBHOOK_SECRET"] + # ) + # event.event # => "connection.activated" + # event.id # => "evt_01..." + # event.data # => WorkOS::ConnectionActivatedData (typed) or Hash (unknown event) + # event.created_at # => "2026-04-16T..." + # event.raw # => original Hash for escape hatch + class WebhookEvent + attr_reader :id, :event, :data, :created_at, :raw + + # Map of event type string -> data model class name. + # Entries with nil mean "no typed model yet" and will return the raw hash. + EVENT_DATA_MODELS = { + "authentication.email_verification_succeeded" => "WorkOS::AuthenticationEmailVerificationSucceededData", + "authentication.magic_auth_failed" => "WorkOS::AuthenticationMagicAuthFailedData", + "authentication.magic_auth_succeeded" => "WorkOS::AuthenticationMagicAuthSucceededData", + "authentication.mfa_succeeded" => "WorkOS::AuthenticationMFASucceededData", + "authentication.oauth_failed" => "WorkOS::AuthenticationOAuthFailedData", + "authentication.oauth_succeeded" => "WorkOS::AuthenticationOAuthSucceededData", + "authentication.password_failed" => "WorkOS::AuthenticationPasswordFailedData", + "authentication.password_succeeded" => "WorkOS::AuthenticationPasswordSucceededData", + "authentication.passkey_failed" => "WorkOS::AuthenticationPasskeyFailedData", + "authentication.passkey_succeeded" => "WorkOS::AuthenticationPasskeySucceededData", + "authentication.sso_failed" => "WorkOS::AuthenticationSSOFailedData", + "authentication.sso_started" => "WorkOS::AuthenticationSSOStartedData", + "authentication.sso_succeeded" => "WorkOS::AuthenticationSSOSucceededData", + "authentication.sso_timed_out" => "WorkOS::AuthenticationSSOTimedOutData", + "authentication.radar_risk_detected" => "WorkOS::AuthenticationRadarRiskDetectedData", + "api_key.created" => "WorkOS::ApiKeyCreatedData", + "api_key.revoked" => "WorkOS::ApiKeyRevokedData", + "connection.activated" => "WorkOS::ConnectionActivatedData", + "connection.deactivated" => "WorkOS::ConnectionDeactivatedData", + "connection.deleted" => "WorkOS::ConnectionDeletedData", + "connection.saml_certificate_renewal_required" => "WorkOS::ConnectionSAMLCertificateRenewalRequiredData", + "connection.saml_certificate_renewed" => "WorkOS::ConnectionSAMLCertificateRenewedData", + "dsync.activated" => "WorkOS::DsyncActivatedData", + "dsync.deleted" => "WorkOS::DsyncDeletedData", + "dsync.group.created" => nil, + "dsync.group.deleted" => nil, + "dsync.group.updated" => "WorkOS::DsyncGroupUpdatedData", + "dsync.group.user_added" => "WorkOS::DsyncGroupUserAddedData", + "dsync.group.user_removed" => "WorkOS::DsyncGroupUserRemovedData", + "dsync.user.created" => nil, + "dsync.user.deleted" => nil, + "dsync.user.updated" => "WorkOS::DsyncUserUpdatedData", + "email_verification.created" => "WorkOS::EmailVerificationCreatedData", + "group.created" => nil, + "group.deleted" => nil, + "group.updated" => nil, + "group.member_added" => "WorkOS::GroupMemberAddedData", + "group.member_removed" => "WorkOS::GroupMemberRemovedData", + "flag.created" => "WorkOS::FlagCreatedData", + "flag.deleted" => "WorkOS::FlagDeletedData", + "flag.updated" => "WorkOS::FlagUpdatedData", + "flag.rule_updated" => "WorkOS::FlagRuleUpdatedData", + "invitation.accepted" => "WorkOS::InvitationAcceptedData", + "invitation.created" => "WorkOS::InvitationCreatedData", + "invitation.resent" => "WorkOS::InvitationResentData", + "invitation.revoked" => "WorkOS::InvitationRevokedData", + "magic_auth.created" => "WorkOS::MagicAuthCreatedData", + "organization.created" => "WorkOS::OrganizationCreatedData", + "organization.deleted" => "WorkOS::OrganizationDeletedData", + "organization.updated" => "WorkOS::OrganizationUpdatedData", + "organization_domain.created" => "WorkOS::OrganizationDomainCreatedData", + "organization_domain.deleted" => "WorkOS::OrganizationDomainDeletedData", + "organization_domain.updated" => "WorkOS::OrganizationDomainUpdatedData", + "organization_domain.verified" => "WorkOS::OrganizationDomainVerifiedData", + "organization_domain.verification_failed" => "WorkOS::OrganizationDomainVerificationFailedData", + "password_reset.created" => "WorkOS::PasswordResetCreatedData", + "password_reset.succeeded" => "WorkOS::PasswordResetSucceededData", + "user.created" => nil, + "user.updated" => nil, + "user.deleted" => nil, + "organization_membership.created" => "WorkOS::OrganizationMembershipCreatedData", + "organization_membership.deleted" => "WorkOS::OrganizationMembershipDeletedData", + "organization_membership.updated" => "WorkOS::OrganizationMembershipUpdatedData", + "role.created" => "WorkOS::RoleCreatedData", + "role.deleted" => "WorkOS::RoleDeletedData", + "role.updated" => "WorkOS::RoleUpdatedData", + "organization_role.created" => "WorkOS::OrganizationRoleCreatedData", + "organization_role.deleted" => "WorkOS::OrganizationRoleDeletedData", + "organization_role.updated" => "WorkOS::OrganizationRoleUpdatedData", + "permission.created" => "WorkOS::PermissionCreatedData", + "permission.deleted" => "WorkOS::PermissionDeletedData", + "permission.updated" => "WorkOS::PermissionUpdatedData", + "session.created" => "WorkOS::SessionCreatedData", + "session.revoked" => "WorkOS::SessionRevokedData" + }.freeze + + def initialize(raw_hash) + @raw = raw_hash + @id = raw_hash["id"] + @event = raw_hash["event"] + @created_at = raw_hash["created_at"] + @data = coerce_data(raw_hash["data"]) + end + + private + + def coerce_data(data_hash) + return data_hash unless data_hash.is_a?(Hash) && @event + model_name = EVENT_DATA_MODELS[@event] + return data_hash unless model_name + + klass = Object.const_get(model_name) + klass.new(data_hash) + rescue NameError, JSON::ParserError + data_hash + end + end +end diff --git a/lib/workos/webhooks.rb b/lib/workos/webhooks.rb index fc071503..ad6562a4 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -1,180 +1,185 @@ # frozen_string_literal: true -require "openssl" +# This file is auto-generated by oagen. Do not edit. + +require "json" module WorkOS - # The Webhooks module provides convenience methods for working with the WorkOS webhooks. - # You'll need to extract the signature header and payload from the webhook request - # sig_header = request.headers['WorkOS-Signature'] - # payload = request.body.read - # - # The secret is the Webhook Secret from your WorkOS Dashboard - # The tolerance is for the timestamp validation - # - module Webhooks - class << self - DEFAULT_TOLERANCE = 180 - - # Initializes an Event object from a JSON payload - # rubocop:disable Layout/LineLength - # - # @param [String] payload The payload from the webhook sent by WorkOS. This is the RAW_POST_DATA of the request. - # @param [String] sig_header The signature from the webhook sent by WorkOS. - # @param [String] secret The webhook secret from the WorkOS dashboard. - # @param [Integer] tolerance The time tolerance in seconds for the webhook. - # - # @example - # WorkOS::Webhooks.construct_event( - # payload: "{"id": "wh_123","data":{"id":"directory_user_01FAEAJCR3ZBZ30D8BD1924TVG","state":"active","emails":[{"type":"work","value":"blair@foo-corp.com","primary":true}],"idp_id":"00u1e8mutl6wlH3lL4x7","object":"directory_user","username":"blair@foo-corp.com","last_name":"Lunceford","first_name":"Blair","directory_id":"directory_01F9M7F68PZP8QXP8G7X5QRHS7","raw_attributes":{"name":{"givenName":"Blair","familyName":"Lunceford","middleName":"Elizabeth","honorificPrefix":"Ms."},"title":"Developer Success Engineer","active":true,"emails":[{"type":"work","value":"blair@foo-corp.com","primary":true}],"groups":[],"locale":"en-US","schemas":["urn:ietf:params:scim:schemas:core:2.0:User","urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"],"userName":"blair@foo-corp.com","addresses":[{"region":"CO","primary":true,"locality":"Steamboat Springs","postalCode":"80487"}],"externalId":"00u1e8mutl6wlH3lL4x7","displayName":"Blair Lunceford","urn:ietf:params:scim:schemas:extension:enterprise:2.0:User":{"manager":{"value":"2","displayName":"Kathleen Chung"},"division":"Engineering","department":"Customer Success"}}},"event":"dsync.user.created"}", - # sig_header: 't=1626125972272, v1=80f7ab7efadc306eb5797c588cee9410da9be4416782b497bf1e1bf4175fb928', - # secret: 'LJlTiC19GmCKWs8AE0IaOQcos', - # ) - # - # => #"directory_user_01FAEAJCR3ZBZ30D8BD1924TVG", :state=>"active", :emails=>[{:type=>"work", :value=>"blair@foo-corp.com", :primary=>true}], :idp_id=>"00u1e8mutl6wlH3lL4x7", :object=>"directory_user", :username=>"blair@foo-corp.com", :last_name=>"Lunceford", :first_name=>"Blair", :directory_id=>"directory_01F9M7F68PZP8QXP8G7X5QRHS7", :raw_attributes=>{:name=>{:givenName=>"Blair", :familyName=>"Lunceford", :middleName=>"Elizabeth", :honorificPrefix=>"Ms."}, :title=>"Developer Success Engineer", :active=>true, :emails=>[{:type=>"work", :value=>"blair@foo-corp.com", :primary=>true}], :groups=>[], :locale=>"en-US", :schemas=>["urn:ietf:params:scim:schemas:core:2.0:User", "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"], :userName=>"blair@foo-corp.com", :addresses=>[{:region=>"CO", :primary=>true, :locality=>"Steamboat Springs", :postalCode=>"80487"}], :externalId=>"00u1e8mutl6wlH3lL4x7", :displayName=>"Blair Lunceford", :"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"=>{:manager=>{:value=>"2", :displayName=>"Kathleen Chung"}, :division=>"Engineering", :department=>"Customer Success"}}}> - # - # @return [WorkOS::Webhook] - # rubocop:enable Layout/LineLength - def construct_event( - payload:, - sig_header:, - secret:, - tolerance: DEFAULT_TOLERANCE - ) - verify_header(payload: payload, sig_header: sig_header, secret: secret, tolerance: tolerance) - WorkOS::Webhook.new(payload) - end + class Webhooks + def initialize(client) + @client = client + end - # Verifies WorkOS-Signature header from request - # rubocop:disable Layout/LineLength - # - # @param [String] payload The payload from the webhook sent by WorkOS. This is the RAW_POST_DATA of the request. - # @param [String] sig_header The signature from the webhook sent by WorkOS. - # @param [String] secret The webhook secret from the WorkOS dashboard. - # @param [Integer] tolerance The time tolerance in seconds for the webhook. - # - # @example - # WorkOS::Webhooks.verify_header( - # payload: "{"id": "wh_123","data":{"id":"directory_user_01FAEAJCR3ZBZ30D8BD1924TVG","state":"active","emails":[{"type":"work","value":"blair@foo-corp.com","primary":true}],"idp_id":"00u1e8mutl6wlH3lL4x7","object":"directory_user","username":"blair@foo-corp.com","last_name":"Lunchford","first_name":"Blair","directory_id":"directory_01F9M7F68PZP8QXP8G7X5QRHS7","raw_attributes":{"name":{"givenName":"Blair","familyName":"Lunchford","middleName":"Elizabeth","honorificPrefix":"Ms."},"title":"Developer Success Engineer","active":true,"emails":[{"type":"work","value":"blair@foo-corp.com","primary":true}],"groups":[],"locale":"en-US","schemas":["urn:ietf:params:scim:schemas:core:2.0:User","urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"],"userName":"blair@foo-corp.com","addresses":[{"region":"CA","primary":true,"locality":"San Francisco","postalCode":"94016"}],"externalId":"00u1e8mutl6wlH3lL4x7","displayName":"Blair Lunchford","urn:ietf:params:scim:schemas:extension:enterprise:2.0:User":{"manager":{"value":"2","displayName":"Kate Chapman"},"division":"Engineering","department":"Customer Success"}}},"event":"dsync.user.created"}", - # sig_header: 't=1626125972272, v1=80f7ab7efadc306eb5797c588cee9410da9be4416782b497bf1e1bf4175fb928', - # secret: 'LJlTiC19GmCKWs8AE0IaOQcos', - # ) - # - # => true - # - # @return Boolean - # rubocop:enable Layout/LineLength - # rubocop:disable Metrics/AbcSize - def verify_header( - payload:, - sig_header:, - secret:, - tolerance: DEFAULT_TOLERANCE - ) - begin - timestamp, signature_hash = get_timestamp_and_signature_hash(sig_header: sig_header) - rescue - raise WorkOS::SignatureVerificationError.new( - message: "Unable to extract timestamp and signature hash from header" + # List Webhook Endpoints + # @param before [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `before="obj_123"` to fetch a new batch of objects before `"obj_123"`. + # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. + # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. + # @param order [WorkOS::Types::WebhooksOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::Types::ListStruct] + def list_webhook_endpoints( + before: nil, + after: nil, + limit: nil, + order: nil, + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request(method: :get, path: "/webhook_endpoints", auth: true, params: params, request_options: request_options) + WorkOS::Types::ListStruct.from_response( + response, model: WorkOS::WebhookEndpoint, filters: {before: before, limit: limit, order: order}, + fetch_next: lambda do |cursor| + list_webhook_endpoints( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options ) - end - - if signature_hash.empty? - raise WorkOS::SignatureVerificationError.new( - message: "No signature hash found with expected scheme v1" + end, + fetch_previous: lambda do |cursor| + list_webhook_endpoints( + before: cursor, + after: nil, + limit: limit, + order: order, + request_options: request_options ) end + ) + end - timestamp_to_time = Time.at(timestamp.to_i / 1000) - - if timestamp_to_time < Time.now - tolerance - raise WorkOS::SignatureVerificationError.new( - message: "Timestamp outside the tolerance zone" - ) - end + # Create a Webhook Endpoint + # @param endpoint_url [String] The HTTPS URL where webhooks will be sent. + # @param events [Array] The events that the Webhook Endpoint is subscribed to. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::WebhookEndpoint] + def create_webhook_endpoint( + endpoint_url:, + events:, + request_options: {} + ) + body = { + "endpoint_url" => endpoint_url, + "events" => events + }.compact + response = @client.request(method: :post, path: "/webhook_endpoints", auth: true, body: body, request_options: request_options) + WorkOS::WebhookEndpoint.new(response.body) + end - expected_sig = compute_signature(timestamp: timestamp, payload: payload, secret: secret) - unless secure_compare(str_a: expected_sig, str_b: signature_hash) - raise WorkOS::SignatureVerificationError.new( - message: "Signature hash does not match the expected signature hash for payload" - ) - end + # Update a Webhook Endpoint + # @param id [String] Unique identifier of the Webhook Endpoint. + # @param endpoint_url [String, nil] The HTTPS URL where webhooks will be sent. + # @param status [WorkOS::Types::UpdateWebhookEndpointStatus, nil] Whether the Webhook Endpoint is enabled or disabled. + # @param events [Array, nil] The events that the Webhook Endpoint is subscribed to. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::WebhookEndpoint] + def update_webhook_endpoint( + id:, + endpoint_url: nil, + status: nil, + events: nil, + request_options: {} + ) + body = { + "endpoint_url" => endpoint_url, + "status" => status, + "events" => events + }.compact + response = @client.request(method: :patch, path: "/webhook_endpoints/#{WorkOS::Util.encode_path(id)}", auth: true, body: body, request_options: request_options) + WorkOS::WebhookEndpoint.new(response.body) + end - true - end - # rubocop:enable Metrics/AbcSize - - # Extracts timestamp and signature hash from WorkOS-Signature header - # - # @param [String] sig_header The signature from the webhook sent by WorkOS. - # - # @example - # WorkOS::Webhooks.get_timestamp_and_signature_hash( - # sig_header: 't=1626125972272, v1=80f7ab7efadc306eb5797c588cee9410da9be4416782b497bf1e1bf4175fb928', - # ) - # - # => ['1626125972272', '80f7ab7efadc306eb5797c588cee9410da9be4416782b497bf1e1bf4175fb928'] - # - # @return Array - def get_timestamp_and_signature_hash( - sig_header: - ) - timestamp, signature_hash = sig_header.split(", ") + # Delete a Webhook Endpoint + # @param id [String] Unique identifier of the Webhook Endpoint. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [void] + def delete_webhook_endpoint( + id:, + request_options: {} + ) + @client.request(method: :delete, path: "/webhook_endpoints/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + nil + end - if timestamp.nil? || signature_hash.nil? - raise WorkOS::SignatureVerificationError.new( - message: "Unable to extract timestamp and signature hash from header" - ) - end + # @oagen-ignore-start — non-spec helpers (hand-maintained) + require "openssl" + + DEFAULT_TOLERANCE_SECONDS = 180 + + # Verify a webhook signature and return a typed event struct. + # + # @param payload [String] Raw webhook request body. + # @param sig_header [String] Value of the WorkOS-Signature header. + # @param secret [String] Webhook endpoint secret. + # @param tolerance [Integer] Maximum event age in seconds. + # @return [WorkOS::WebhookEvent] Typed event with .event, .data, .id, .created_at. + # @raise [WorkOS::SignatureVerificationError] if verification fails. + def construct_event(payload:, sig_header:, secret:, tolerance: DEFAULT_TOLERANCE_SECONDS) + raw = verify_event(payload: payload, sig_header: sig_header, secret: secret, tolerance: tolerance) + WebhookEvent.new(raw) + end - timestamp = timestamp.sub("t=", "") - signature_hash = signature_hash.sub("v1=", "") + # Verify a webhook signature and return the deserialized event payload. + # + # @param payload [String] Raw webhook request body. + # @param sig_header [String] Value of the WorkOS-Signature header + # (format: "t=, v1="). + # @param secret [String] Webhook endpoint secret from the dashboard. + # @param tolerance [Integer] Maximum age of the event in seconds. + # @return [Hash] Parsed JSON payload. + # @raise [WorkOS::SignatureVerificationError] if signature or timestamp invalid. + def verify_event(payload:, sig_header:, secret:, tolerance: DEFAULT_TOLERANCE_SECONDS) + verify_header(payload: payload, sig_header: sig_header, secret: secret, tolerance: tolerance) + JSON.parse(payload) + end - [timestamp, signature_hash] + # Verify the signature without deserializing. Raises on failure. + def verify_header(payload:, sig_header:, secret:, tolerance: DEFAULT_TOLERANCE_SECONDS) + timestamp_ms, signature_hash = parse_signature_header(sig_header) + max_age = tolerance.to_i + issued_at = timestamp_ms.to_i / 1000.0 + if (Time.now.to_f - issued_at) > max_age + raise WorkOS::SignatureVerificationError.new( + message: "Timestamp outside the tolerance zone", + http_status: nil + ) end - # Computes expected signature - # rubocop:disable Layout/LineLength - # - # @param [String] timestamp The timestamp from the webhook signature. - # @param [String] payload The payload from the webhook sent by WorkOS. This is the RAW_POST_DATA of the request. - # @param [String] secret The webhook secret from the WorkOS dashboard. - # - # @example - # WorkOS::Webhooks.compute_signature( - # timestamp: '1626125972272', - # payload: "{"id": "wh_123","data":{"id":"directory_user_01FAEAJCR3ZBZ30D8BD1924TVG","state":"active","emails":[{"type":"work","value":"blair@foo-corp.com","primary":true}],"idp_id":"00u1e8mutl6wlH3lL4x7","object":"directory_user","username":"blair@foo-corp.com","last_name":"Lunchford","first_name":"Blair","directory_id":"directory_01F9M7F68PZP8QXP8G7X5QRHS7","raw_attributes":{"name":{"givenName":"Blair","familyName":"Lunchford","middleName":"Elizabeth","honorificPrefix":"Ms."},"title":"Developer Success Engineer","active":true,"emails":[{"type":"work","value":"blair@foo-corp.com","primary":true}],"groups":[],"locale":"en-US","schemas":["urn:ietf:params:scim:schemas:core:2.0:User","urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"],"userName":"blair@foo-corp.com","addresses":[{"region":"CA","primary":true,"locality":"San Francisco","postalCode":"94016"}],"externalId":"00u1e8mutl6wlH3lL4x7","displayName":"Blair Lunchford","urn:ietf:params:scim:schemas:extension:enterprise:2.0:User":{"manager":{"value":"2","displayName":"Kate Chapman"},"division":"Engineering","department":"Customer Success"}}},"event":"dsync.user.created"}", - # secret: 'LJlTiC19GmCKWs8AE0IaOQcos', - # ) - # - # => '80f7ab7efadc306eb5797c588cee9410da9be4416782b497bf1e1bf4175fb928' - # - # @return String - # rubocop:enable Layout/LineLength - def compute_signature( - timestamp:, - payload:, - secret: - ) - unhashed_string = "#{timestamp}.#{payload}" - digest = OpenSSL::Digest.new("sha256") - OpenSSL::HMAC.hexdigest(digest, secret, unhashed_string) + expected = compute_signature(payload: payload, timestamp: timestamp_ms, secret: secret) + unless secure_compare(signature_hash, expected) + raise WorkOS::SignatureVerificationError.new( + message: "Signature hash does not match the expected signature hash for payload", + http_status: nil + ) end + true + end - # Constant time string comparison to prevent timing attacks - # Code borrowed from ActiveSupport - def secure_compare( - str_a:, - str_b: - ) - return false unless str_a.bytesize == str_b.bytesize + # Compute the HMAC-SHA256 hex signature for a (timestamp, payload) pair. + # Exposed publicly so users can build their own verification flow. + def compute_signature(payload:, timestamp:, secret:) + WorkOS::Util::Signature.compute(payload: payload, timestamp: timestamp, secret: secret) + end - l = str_a.unpack("C#{str_a.bytesize}") + # Parse a "t=, v1=" header into [timestamp, signature]. + # Exposed publicly for advanced use. + def parse_signature_header(sig_header) + WorkOS::Util::Signature.parse_header(sig_header) + rescue ArgumentError => e + raise WorkOS::SignatureVerificationError.new(message: e.message, http_status: nil) + end - res = 0 - str_b.each_byte { |byte| res |= byte ^ l.shift } + private - res.zero? - end + def secure_compare(a, b) + WorkOS::Util::Signature.secure_compare(a, b) end + # @oagen-ignore-end end end diff --git a/lib/workos/webhooks/create_webhook_endpoint.rb b/lib/workos/webhooks/create_webhook_endpoint.rb new file mode 100644 index 00000000..655e5526 --- /dev/null +++ b/lib/workos/webhooks/create_webhook_endpoint.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class CreateWebhookEndpoint + include HashProvider + + HASH_ATTRS = { + endpoint_url: :endpoint_url, + events: :events + }.freeze + + attr_accessor \ + :endpoint_url, + :events + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @endpoint_url = hash[:endpoint_url] + @events = hash[:events] || [] + end + end +end diff --git a/lib/workos/webhooks/update_webhook_endpoint.rb b/lib/workos/webhooks/update_webhook_endpoint.rb new file mode 100644 index 00000000..988f5d8e --- /dev/null +++ b/lib/workos/webhooks/update_webhook_endpoint.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UpdateWebhookEndpoint + include HashProvider + + HASH_ATTRS = { + endpoint_url: :endpoint_url, + status: :status, + events: :events + }.freeze + + attr_accessor \ + :endpoint_url, + :status, + :events + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @endpoint_url = hash[:endpoint_url] + @status = hash[:status] + @events = hash[:events] || [] + end + end +end diff --git a/lib/workos/webhooks/webhook_endpoint.rb b/lib/workos/webhooks/webhook_endpoint.rb new file mode 100644 index 00000000..e3b9abb0 --- /dev/null +++ b/lib/workos/webhooks/webhook_endpoint.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class WebhookEndpoint + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + endpoint_url: :endpoint_url, + secret: :secret, + status: :status, + events: :events, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :endpoint_url, + :secret, + :status, + :events, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @endpoint_url = hash[:endpoint_url] + @secret = hash[:secret] + @status = hash[:status] + @events = hash[:events] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/widgets.rb b/lib/workos/widgets.rb index 39ed5d38..e77f1ed3 100644 --- a/lib/workos/widgets.rb +++ b/lib/workos/widgets.rb @@ -1,46 +1,34 @@ # frozen_string_literal: true -require "net/http" +# This file is auto-generated by oagen. Do not edit. -module WorkOS - # The Widgets module provides resource methods for working with the Widgets APIs - module Widgets - class << self - include Client - - WIDGET_SCOPES = WorkOS::Types::WidgetScope::ALL - - # Generate a widget token. - # - # @param [String] organization_id The ID of the organization to generate the token for. - # @param [String] user_id The ID of the user to generate the token for. - # @param [WidgetScope[]] The scopes to generate the token for. - def get_token(organization_id:, user_id:, scopes:) - validate_scopes(scopes) - - request = post_request( - auth: true, - body: { - organization_id: organization_id, - user_id: user_id, - scopes: scopes - }, - path: "/widgets/token" - ) - - response = execute_request(request: request) +require "json" - JSON.parse(response.body)["token"] - end - - private - - def validate_scopes(scopes) - return if scopes.all? { |scope| WIDGET_SCOPES.include?(scope) } +module WorkOS + class Widgets + def initialize(client) + @client = client + end - raise ArgumentError, "scopes contains an invalid value." \ - " Every item in `scopes` must be in #{WIDGET_SCOPES}" - end + # Generate a widget token + # @param organization_id [String] The ID of the organization to scope the widget session to. + # @param user_id [String, nil] The ID of the user to issue the widget session token for. + # @param scopes [Array, nil] The scopes to grant the widget session. + # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @return [WorkOS::WidgetSessionTokenResponse] + def create_token( + organization_id:, + user_id: nil, + scopes: nil, + request_options: {} + ) + body = { + "organization_id" => organization_id, + "user_id" => user_id, + "scopes" => scopes + }.compact + response = @client.request(method: :post, path: "/widgets/token", auth: true, body: body, request_options: request_options) + WorkOS::WidgetSessionTokenResponse.new(response.body) end end end diff --git a/lib/workos/widgets/widget_session_token.rb b/lib/workos/widgets/widget_session_token.rb new file mode 100644 index 00000000..9143a58b --- /dev/null +++ b/lib/workos/widgets/widget_session_token.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class WidgetSessionToken + include HashProvider + + HASH_ATTRS = { + organization_id: :organization_id, + user_id: :user_id, + scopes: :scopes + }.freeze + + attr_accessor \ + :organization_id, + :user_id, + :scopes + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @organization_id = hash[:organization_id] + @user_id = hash[:user_id] + @scopes = hash[:scopes] || [] + end + end +end diff --git a/lib/workos/widgets/widget_session_token_response.rb b/lib/workos/widgets/widget_session_token_response.rb new file mode 100644 index 00000000..e3044aa4 --- /dev/null +++ b/lib/workos/widgets/widget_session_token_response.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class WidgetSessionTokenResponse + include HashProvider + + HASH_ATTRS = { + token: :token + }.freeze + + attr_accessor :token + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @token = hash[:token] + end + end +end diff --git a/rbi/workos/action_authentication_denied.rbi b/rbi/workos/action_authentication_denied.rbi new file mode 100644 index 00000000..11a58664 --- /dev/null +++ b/rbi/workos/action_authentication_denied.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ActionAuthenticationDenied + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::ActionAuthenticationDeniedData) } + def data; end + + sig { params(value: WorkOS::ActionAuthenticationDeniedData).returns(WorkOS::ActionAuthenticationDeniedData) } + def data=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/action_authentication_denied_data.rbi b/rbi/workos/action_authentication_denied_data.rbi new file mode 100644 index 00000000..c380af71 --- /dev/null +++ b/rbi/workos/action_authentication_denied_data.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ActionAuthenticationDeniedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def action_endpoint_id; end + + sig { params(value: String).returns(String) } + def action_endpoint_id=(value); end + + sig { returns(String) } + def action_execution_id; end + + sig { params(value: String).returns(String) } + def action_execution_id=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def verdict; end + + sig { params(value: String).returns(String) } + def verdict=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/action_user_registration_denied.rbi b/rbi/workos/action_user_registration_denied.rbi new file mode 100644 index 00000000..8274ff27 --- /dev/null +++ b/rbi/workos/action_user_registration_denied.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ActionUserRegistrationDenied + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::ActionUserRegistrationDeniedData) } + def data; end + + sig { params(value: WorkOS::ActionUserRegistrationDeniedData).returns(WorkOS::ActionUserRegistrationDeniedData) } + def data=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/action_user_registration_denied_data.rbi b/rbi/workos/action_user_registration_denied_data.rbi new file mode 100644 index 00000000..b9bd4a1d --- /dev/null +++ b/rbi/workos/action_user_registration_denied_data.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ActionUserRegistrationDeniedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def action_endpoint_id; end + + sig { params(value: String).returns(String) } + def action_endpoint_id=(value); end + + sig { returns(String) } + def action_execution_id; end + + sig { params(value: String).returns(String) } + def action_execution_id=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def verdict; end + + sig { params(value: String).returns(String) } + def verdict=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/add_role_permission.rbi b/rbi/workos/add_role_permission.rbi new file mode 100644 index 00000000..e037cf6e --- /dev/null +++ b/rbi/workos/add_role_permission.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AddRolePermission + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/admin_portal.rbi b/rbi/workos/admin_portal.rbi new file mode 100644 index 00000000..cc294dcd --- /dev/null +++ b/rbi/workos/admin_portal.rbi @@ -0,0 +1,25 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AdminPortal + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + organization: String, + return_url: T.nilable(String), + success_url: T.nilable(String), + intent: T.nilable(String), + intent_options: T.nilable(WorkOS::IntentOptions), + admin_emails: T.nilable(T::Array[String]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::PortalLinkResponse) + end + def generate_link(organization:, return_url:, success_url:, intent:, intent_options:, admin_emails:, request_options:); end + + end +end diff --git a/rbi/workos/api_key.rbi b/rbi/workos/api_key.rbi new file mode 100644 index 00000000..12202b66 --- /dev/null +++ b/rbi/workos/api_key.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKey + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(WorkOS::ApiKeyOwner) } + def owner; end + + sig { params(value: WorkOS::ApiKeyOwner).returns(WorkOS::ApiKeyOwner) } + def owner=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def obfuscated_value; end + + sig { params(value: String).returns(String) } + def obfuscated_value=(value); end + + sig { returns(T.nilable(String)) } + def last_used_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_used_at=(value); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_created.rbi b/rbi/workos/api_key_created.rbi new file mode 100644 index 00000000..e90fabbd --- /dev/null +++ b/rbi/workos/api_key_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKeyCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::ApiKeyCreatedData) } + def data; end + + sig { params(value: WorkOS::ApiKeyCreatedData).returns(WorkOS::ApiKeyCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_created_data.rbi b/rbi/workos/api_key_created_data.rbi new file mode 100644 index 00000000..9a0c701c --- /dev/null +++ b/rbi/workos/api_key_created_data.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKeyCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(WorkOS::ApiKeyCreatedDataOwner) } + def owner; end + + sig { params(value: WorkOS::ApiKeyCreatedDataOwner).returns(WorkOS::ApiKeyCreatedDataOwner) } + def owner=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def obfuscated_value; end + + sig { params(value: String).returns(String) } + def obfuscated_value=(value); end + + sig { returns(T.nilable(String)) } + def last_used_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_used_at=(value); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_created_data_owner.rbi b/rbi/workos/api_key_created_data_owner.rbi new file mode 100644 index 00000000..8110aa78 --- /dev/null +++ b/rbi/workos/api_key_created_data_owner.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKeyCreatedDataOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_owner.rbi b/rbi/workos/api_key_owner.rbi new file mode 100644 index 00000000..147dd489 --- /dev/null +++ b/rbi/workos/api_key_owner.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKeyOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_revoked.rbi b/rbi/workos/api_key_revoked.rbi new file mode 100644 index 00000000..f40850a6 --- /dev/null +++ b/rbi/workos/api_key_revoked.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKeyRevoked + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::ApiKeyRevokedData) } + def data; end + + sig { params(value: WorkOS::ApiKeyRevokedData).returns(WorkOS::ApiKeyRevokedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_revoked_data.rbi b/rbi/workos/api_key_revoked_data.rbi new file mode 100644 index 00000000..9d1f6a01 --- /dev/null +++ b/rbi/workos/api_key_revoked_data.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKeyRevokedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(WorkOS::ApiKeyRevokedDataOwner) } + def owner; end + + sig { params(value: WorkOS::ApiKeyRevokedDataOwner).returns(WorkOS::ApiKeyRevokedDataOwner) } + def owner=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def obfuscated_value; end + + sig { params(value: String).returns(String) } + def obfuscated_value=(value); end + + sig { returns(T.nilable(String)) } + def last_used_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_used_at=(value); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_revoked_data_owner.rbi b/rbi/workos/api_key_revoked_data_owner.rbi new file mode 100644 index 00000000..61f89b84 --- /dev/null +++ b/rbi/workos/api_key_revoked_data_owner.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKeyRevokedDataOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_validation_response.rbi b/rbi/workos/api_key_validation_response.rbi new file mode 100644 index 00000000..7421cf14 --- /dev/null +++ b/rbi/workos/api_key_validation_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKeyValidationResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(WorkOS::ApiKey)) } + def api_key; end + + sig { params(value: T.nilable(WorkOS::ApiKey)).returns(T.nilable(WorkOS::ApiKey)) } + def api_key=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_with_value.rbi b/rbi/workos/api_key_with_value.rbi new file mode 100644 index 00000000..472345e9 --- /dev/null +++ b/rbi/workos/api_key_with_value.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKeyWithValue + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(WorkOS::ApiKeyWithValueOwner) } + def owner; end + + sig { params(value: WorkOS::ApiKeyWithValueOwner).returns(WorkOS::ApiKeyWithValueOwner) } + def owner=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def obfuscated_value; end + + sig { params(value: String).returns(String) } + def obfuscated_value=(value); end + + sig { returns(T.nilable(String)) } + def last_used_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_used_at=(value); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(String) } + def value; end + + sig { params(value: String).returns(String) } + def value=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_key_with_value_owner.rbi b/rbi/workos/api_key_with_value_owner.rbi new file mode 100644 index 00000000..7f9cb4ff --- /dev/null +++ b/rbi/workos/api_key_with_value_owner.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKeyWithValueOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/api_keys.rbi b/rbi/workos/api_keys.rbi new file mode 100644 index 00000000..14c27a4a --- /dev/null +++ b/rbi/workos/api_keys.rbi @@ -0,0 +1,50 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApiKeys + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + value: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ApiKeyValidationResponse) + end + def create_validation(value:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_api_key(id:, request_options:); end + + sig do + params( + organization_id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_organization_api_keys(organization_id:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + organization_id: String, + name: String, + permissions: T.nilable(T::Array[String]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ApiKeyWithValue) + end + def create_organization_api_key(organization_id:, name:, permissions:, request_options:); end + + end +end diff --git a/rbi/workos/application_credentials_list_item.rbi b/rbi/workos/application_credentials_list_item.rbi new file mode 100644 index 00000000..3930956e --- /dev/null +++ b/rbi/workos/application_credentials_list_item.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ApplicationCredentialsListItem + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def secret_hint; end + + sig { params(value: String).returns(String) } + def secret_hint=(value); end + + sig { returns(T.nilable(String)) } + def last_used_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_used_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/assign_role.rbi b/rbi/workos/assign_role.rbi new file mode 100644 index 00000000..7c2648b3 --- /dev/null +++ b/rbi/workos/assign_role.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AssignRole + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def role_slug; end + + sig { params(value: String).returns(String) } + def role_slug=(value); end + + sig { returns(T.nilable(String)) } + def resource_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_id=(value); end + + sig { returns(T.nilable(String)) } + def resource_external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_external_id=(value); end + + sig { returns(T.nilable(String)) } + def resource_type_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_type_slug=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_action.rbi b/rbi/workos/audit_log_action.rbi new file mode 100644 index 00000000..4185bd10 --- /dev/null +++ b/rbi/workos/audit_log_action.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogAction + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(WorkOS::AuditLogSchema) } + def schema; end + + sig { params(value: WorkOS::AuditLogSchema).returns(WorkOS::AuditLogSchema) } + def schema=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_configuration.rbi b/rbi/workos/audit_log_configuration.rbi new file mode 100644 index 00000000..70e61485 --- /dev/null +++ b/rbi/workos/audit_log_configuration.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogConfiguration + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(Integer) } + def retention_period_in_days; end + + sig { params(value: Integer).returns(Integer) } + def retention_period_in_days=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T.nilable(WorkOS::AuditLogConfigurationLogStream)) } + def log_stream; end + + sig { params(value: T.nilable(WorkOS::AuditLogConfigurationLogStream)).returns(T.nilable(WorkOS::AuditLogConfigurationLogStream)) } + def log_stream=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_configuration_log_stream.rbi b/rbi/workos/audit_log_configuration_log_stream.rbi new file mode 100644 index 00000000..71bab227 --- /dev/null +++ b/rbi/workos/audit_log_configuration_log_stream.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogConfigurationLogStream + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def last_synced_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_synced_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_event.rbi b/rbi/workos/audit_log_event.rbi new file mode 100644 index 00000000..9a18b996 --- /dev/null +++ b/rbi/workos/audit_log_event.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogEvent + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def action; end + + sig { params(value: String).returns(String) } + def action=(value); end + + sig { returns(String) } + def occurred_at; end + + sig { params(value: String).returns(String) } + def occurred_at=(value); end + + sig { returns(WorkOS::AuditLogEventActor) } + def actor; end + + sig { params(value: WorkOS::AuditLogEventActor).returns(WorkOS::AuditLogEventActor) } + def actor=(value); end + + sig { returns(T::Array[WorkOS::AuditLogEventTarget]) } + def targets; end + + sig { params(value: T::Array[WorkOS::AuditLogEventTarget]).returns(T::Array[WorkOS::AuditLogEventTarget]) } + def targets=(value); end + + sig { returns(WorkOS::AuditLogEventContext) } + def context; end + + sig { params(value: WorkOS::AuditLogEventContext).returns(WorkOS::AuditLogEventContext) } + def context=(value); end + + sig { returns(T.nilable(T::Hash[String, T.any(String, Float, T::Boolean)])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, T.any(String, Float, T::Boolean)])).returns(T.nilable(T::Hash[String, T.any(String, Float, T::Boolean)])) } + def metadata=(value); end + + sig { returns(T.nilable(Integer)) } + def version; end + + sig { params(value: T.nilable(Integer)).returns(T.nilable(Integer)) } + def version=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_event_actor.rbi b/rbi/workos/audit_log_event_actor.rbi new file mode 100644 index 00000000..30675d97 --- /dev/null +++ b/rbi/workos/audit_log_event_actor.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogEventActor + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T.nilable(T::Hash[String, T.any(String, Float, T::Boolean)])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, T.any(String, Float, T::Boolean)])).returns(T.nilable(T::Hash[String, T.any(String, Float, T::Boolean)])) } + def metadata=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_event_context.rbi b/rbi/workos/audit_log_event_context.rbi new file mode 100644 index 00000000..007594a2 --- /dev/null +++ b/rbi/workos/audit_log_event_context.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogEventContext + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def location; end + + sig { params(value: String).returns(String) } + def location=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_event_create_response.rbi b/rbi/workos/audit_log_event_create_response.rbi new file mode 100644 index 00000000..261ffc2e --- /dev/null +++ b/rbi/workos/audit_log_event_create_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogEventCreateResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T::Boolean) } + def success; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def success=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_event_ingestion.rbi b/rbi/workos/audit_log_event_ingestion.rbi new file mode 100644 index 00000000..3170177d --- /dev/null +++ b/rbi/workos/audit_log_event_ingestion.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogEventIngestion + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(WorkOS::AuditLogEvent) } + def event; end + + sig { params(value: WorkOS::AuditLogEvent).returns(WorkOS::AuditLogEvent) } + def event=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_event_target.rbi b/rbi/workos/audit_log_event_target.rbi new file mode 100644 index 00000000..0c798df1 --- /dev/null +++ b/rbi/workos/audit_log_event_target.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogEventTarget + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T.nilable(T::Hash[String, T.any(String, Float, T::Boolean)])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, T.any(String, Float, T::Boolean)])).returns(T.nilable(T::Hash[String, T.any(String, Float, T::Boolean)])) } + def metadata=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_export.rbi b/rbi/workos/audit_log_export.rbi new file mode 100644 index 00000000..f2cbe49a --- /dev/null +++ b/rbi/workos/audit_log_export.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogExport + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def url=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_export_creation.rbi b/rbi/workos/audit_log_export_creation.rbi new file mode 100644 index 00000000..bb88cbbd --- /dev/null +++ b/rbi/workos/audit_log_export_creation.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogExportCreation + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def range_start; end + + sig { params(value: String).returns(String) } + def range_start=(value); end + + sig { returns(String) } + def range_end; end + + sig { params(value: String).returns(String) } + def range_end=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def actions; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def actions=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def actors; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def actors=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def actor_names; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def actor_names=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def actor_ids; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def actor_ids=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def targets; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def targets=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_schema.rbi b/rbi/workos/audit_log_schema.rbi new file mode 100644 index 00000000..6cc95782 --- /dev/null +++ b/rbi/workos/audit_log_schema.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogSchema + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(Integer) } + def version; end + + sig { params(value: Integer).returns(Integer) } + def version=(value); end + + sig { returns(T.nilable(WorkOS::AuditLogSchemaActor)) } + def actor; end + + sig { params(value: T.nilable(WorkOS::AuditLogSchemaActor)).returns(T.nilable(WorkOS::AuditLogSchemaActor)) } + def actor=(value); end + + sig { returns(T::Array[WorkOS::AuditLogSchemaTarget]) } + def targets; end + + sig { params(value: T::Array[WorkOS::AuditLogSchemaTarget]).returns(T::Array[WorkOS::AuditLogSchemaTarget]) } + def targets=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def metadata=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_schema_actor.rbi b/rbi/workos/audit_log_schema_actor.rbi new file mode 100644 index 00000000..ba1b0c92 --- /dev/null +++ b/rbi/workos/audit_log_schema_actor.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogSchemaActor + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T::Hash[String, T.untyped]) } + def metadata; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def metadata=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_schema_target.rbi b/rbi/workos/audit_log_schema_target.rbi new file mode 100644 index 00000000..2a929733 --- /dev/null +++ b/rbi/workos/audit_log_schema_target.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogSchemaTarget + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def metadata=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_logs.rbi b/rbi/workos/audit_logs.rbi new file mode 100644 index 00000000..5d309ca8 --- /dev/null +++ b/rbi/workos/audit_logs.rbi @@ -0,0 +1,95 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogs + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuditLogsRetention) + end + def get_organization_audit_logs_retention(id:, request_options:); end + + sig do + params( + id: String, + retention_period_in_days: Integer, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuditLogsRetention) + end + def update_organization_audit_logs_retention(id:, retention_period_in_days:, request_options:); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(T::Array[WorkOS::AuditLogAction]) + end + def list_actions(before:, after:, limit:, order:, request_options:); end + + sig do + params( + action_name: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(T::Array[WorkOS::AuditLogSchema]) + end + def list_action_schemas(action_name:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + action_name: String, + targets: T::Array[WorkOS::AuditLogSchemaTarget], + actor: T.nilable(WorkOS::AuditLogSchemaActor), + metadata: T.nilable(T::Hash[String, T.untyped]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuditLogSchema) + end + def create_schema(action_name:, targets:, actor:, metadata:, request_options:); end + + sig do + params( + organization_id: String, + event: WorkOS::AuditLogEvent, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuditLogEventCreateResponse) + end + def create_event(organization_id:, event:, request_options:); end + + sig do + params( + organization_id: String, + range_start: String, + range_end: String, + actions: T.nilable(T::Array[String]), + actors: T.nilable(T::Array[String]), + actor_names: T.nilable(T::Array[String]), + actor_ids: T.nilable(T::Array[String]), + targets: T.nilable(T::Array[String]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuditLogExport) + end + def create_export(organization_id:, range_start:, range_end:, actions:, actors:, actor_names:, actor_ids:, targets:, request_options:); end + + sig do + params( + audit_log_export_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuditLogExport) + end + def get_export(audit_log_export_id:, request_options:); end + + end +end diff --git a/rbi/workos/audit_logs_retention.rbi b/rbi/workos/audit_logs_retention.rbi new file mode 100644 index 00000000..4ca26347 --- /dev/null +++ b/rbi/workos/audit_logs_retention.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogsRetention + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(Integer)) } + def retention_period_in_days; end + + sig { params(value: T.nilable(Integer)).returns(T.nilable(Integer)) } + def retention_period_in_days=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authenticate_response.rbi b/rbi/workos/authenticate_response.rbi new file mode 100644 index 00000000..c9623130 --- /dev/null +++ b/rbi/workos/authenticate_response.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticateResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(WorkOS::User) } + def user; end + + sig { params(value: WorkOS::User).returns(WorkOS::User) } + def user=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def authkit_authorization_code; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def authkit_authorization_code=(value); end + + sig { returns(String) } + def access_token; end + + sig { params(value: String).returns(String) } + def access_token=(value); end + + sig { returns(String) } + def refresh_token; end + + sig { params(value: String).returns(String) } + def refresh_token=(value); end + + sig { returns(T.nilable(String)) } + def authentication_method; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def authentication_method=(value); end + + sig { returns(T.nilable(WorkOS::AuthenticateResponseImpersonator)) } + def impersonator; end + + sig { params(value: T.nilable(WorkOS::AuthenticateResponseImpersonator)).returns(T.nilable(WorkOS::AuthenticateResponseImpersonator)) } + def impersonator=(value); end + + sig { returns(T.nilable(WorkOS::AuthenticateResponseOAuthToken)) } + def oauth_tokens; end + + sig { params(value: T.nilable(WorkOS::AuthenticateResponseOAuthToken)).returns(T.nilable(WorkOS::AuthenticateResponseOAuthToken)) } + def oauth_tokens=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authenticate_response_impersonator.rbi b/rbi/workos/authenticate_response_impersonator.rbi new file mode 100644 index 00000000..cf4bfb47 --- /dev/null +++ b/rbi/workos/authenticate_response_impersonator.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticateResponseImpersonator + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def reason; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def reason=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authenticate_response_oauth_token.rbi b/rbi/workos/authenticate_response_oauth_token.rbi new file mode 100644 index 00000000..e4069f46 --- /dev/null +++ b/rbi/workos/authenticate_response_oauth_token.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticateResponseOAuthToken + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def provider; end + + sig { params(value: String).returns(String) } + def provider=(value); end + + sig { returns(String) } + def refresh_token; end + + sig { params(value: String).returns(String) } + def refresh_token=(value); end + + sig { returns(String) } + def access_token; end + + sig { params(value: String).returns(String) } + def access_token=(value); end + + sig { returns(Integer) } + def expires_at; end + + sig { params(value: Integer).returns(Integer) } + def expires_at=(value); end + + sig { returns(T::Array[String]) } + def scopes; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def scopes=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_challenge.rbi b/rbi/workos/authentication_challenge.rbi new file mode 100644 index 00000000..ebfa4cd3 --- /dev/null +++ b/rbi/workos/authentication_challenge.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationChallenge + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def expires_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def expires_at=(value); end + + sig { returns(T.nilable(String)) } + def code; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def code=(value); end + + sig { returns(String) } + def authentication_factor_id; end + + sig { params(value: String).returns(String) } + def authentication_factor_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_challenge_verify_response.rbi b/rbi/workos/authentication_challenge_verify_response.rbi new file mode 100644 index 00000000..86ecbf42 --- /dev/null +++ b/rbi/workos/authentication_challenge_verify_response.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationChallengeVerifyResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(WorkOS::AuthenticationChallenge) } + def challenge; end + + sig { params(value: WorkOS::AuthenticationChallenge).returns(WorkOS::AuthenticationChallenge) } + def challenge=(value); end + + sig { returns(T::Boolean) } + def valid; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def valid=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_challenges_verify_request.rbi b/rbi/workos/authentication_challenges_verify_request.rbi new file mode 100644 index 00000000..3db4ce32 --- /dev/null +++ b/rbi/workos/authentication_challenges_verify_request.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationChallengesVerifyRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_email_verification_failed.rbi b/rbi/workos/authentication_email_verification_failed.rbi new file mode 100644 index 00000000..643dfd0f --- /dev/null +++ b/rbi/workos/authentication_email_verification_failed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationEmailVerificationFailed + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationEmailVerificationFailedData) } + def data; end + + sig { params(value: WorkOS::AuthenticationEmailVerificationFailedData).returns(WorkOS::AuthenticationEmailVerificationFailedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_email_verification_failed_data.rbi b/rbi/workos/authentication_email_verification_failed_data.rbi new file mode 100644 index 00000000..dd4b2563 --- /dev/null +++ b/rbi/workos/authentication_email_verification_failed_data.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationEmailVerificationFailedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(WorkOS::AuthenticationEmailVerificationFailedDataError) } + def error; end + + sig { params(value: WorkOS::AuthenticationEmailVerificationFailedDataError).returns(WorkOS::AuthenticationEmailVerificationFailedDataError) } + def error=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_email_verification_failed_data_error.rbi b/rbi/workos/authentication_email_verification_failed_data_error.rbi new file mode 100644 index 00000000..fd77664e --- /dev/null +++ b/rbi/workos/authentication_email_verification_failed_data_error.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationEmailVerificationFailedDataError + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def message; end + + sig { params(value: String).returns(String) } + def message=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_email_verification_succeeded.rbi b/rbi/workos/authentication_email_verification_succeeded.rbi new file mode 100644 index 00000000..6e482077 --- /dev/null +++ b/rbi/workos/authentication_email_verification_succeeded.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationEmailVerificationSucceeded + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationEmailVerificationSucceededData) } + def data; end + + sig { params(value: WorkOS::AuthenticationEmailVerificationSucceededData).returns(WorkOS::AuthenticationEmailVerificationSucceededData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_email_verification_succeeded_data.rbi b/rbi/workos/authentication_email_verification_succeeded_data.rbi new file mode 100644 index 00000000..b3cb404d --- /dev/null +++ b/rbi/workos/authentication_email_verification_succeeded_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationEmailVerificationSucceededData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_factor.rbi b/rbi/workos/authentication_factor.rbi new file mode 100644 index 00000000..019bc202 --- /dev/null +++ b/rbi/workos/authentication_factor.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationFactor + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(WorkOS::AuthenticationFactorSms)) } + def sms; end + + sig { params(value: T.nilable(WorkOS::AuthenticationFactorSms)).returns(T.nilable(WorkOS::AuthenticationFactorSms)) } + def sms=(value); end + + sig { returns(T.nilable(WorkOS::AuthenticationFactorTotp)) } + def totp; end + + sig { params(value: T.nilable(WorkOS::AuthenticationFactorTotp)).returns(T.nilable(WorkOS::AuthenticationFactorTotp)) } + def totp=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_factor_enrolled.rbi b/rbi/workos/authentication_factor_enrolled.rbi new file mode 100644 index 00000000..ef0b10dd --- /dev/null +++ b/rbi/workos/authentication_factor_enrolled.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationFactorEnrolled + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(WorkOS::AuthenticationFactorEnrolledSms)) } + def sms; end + + sig { params(value: T.nilable(WorkOS::AuthenticationFactorEnrolledSms)).returns(T.nilable(WorkOS::AuthenticationFactorEnrolledSms)) } + def sms=(value); end + + sig { returns(T.nilable(WorkOS::AuthenticationFactorEnrolledTotp)) } + def totp; end + + sig { params(value: T.nilable(WorkOS::AuthenticationFactorEnrolledTotp)).returns(T.nilable(WorkOS::AuthenticationFactorEnrolledTotp)) } + def totp=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_factor_enrolled_sms.rbi b/rbi/workos/authentication_factor_enrolled_sms.rbi new file mode 100644 index 00000000..3d0b0b34 --- /dev/null +++ b/rbi/workos/authentication_factor_enrolled_sms.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationFactorEnrolledSms + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def phone_number; end + + sig { params(value: String).returns(String) } + def phone_number=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_factor_enrolled_totp.rbi b/rbi/workos/authentication_factor_enrolled_totp.rbi new file mode 100644 index 00000000..b5f29de1 --- /dev/null +++ b/rbi/workos/authentication_factor_enrolled_totp.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationFactorEnrolledTotp + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def issuer; end + + sig { params(value: String).returns(String) } + def issuer=(value); end + + sig { returns(String) } + def user; end + + sig { params(value: String).returns(String) } + def user=(value); end + + sig { returns(String) } + def secret; end + + sig { params(value: String).returns(String) } + def secret=(value); end + + sig { returns(String) } + def qr_code; end + + sig { params(value: String).returns(String) } + def qr_code=(value); end + + sig { returns(String) } + def uri; end + + sig { params(value: String).returns(String) } + def uri=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_factor_sms.rbi b/rbi/workos/authentication_factor_sms.rbi new file mode 100644 index 00000000..6c7fcdfe --- /dev/null +++ b/rbi/workos/authentication_factor_sms.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationFactorSms + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def phone_number; end + + sig { params(value: String).returns(String) } + def phone_number=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_factor_totp.rbi b/rbi/workos/authentication_factor_totp.rbi new file mode 100644 index 00000000..c1215a3e --- /dev/null +++ b/rbi/workos/authentication_factor_totp.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationFactorTotp + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def issuer; end + + sig { params(value: String).returns(String) } + def issuer=(value); end + + sig { returns(String) } + def user; end + + sig { params(value: String).returns(String) } + def user=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_factors_create_request.rbi b/rbi/workos/authentication_factors_create_request.rbi new file mode 100644 index 00000000..7fe1d564 --- /dev/null +++ b/rbi/workos/authentication_factors_create_request.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationFactorsCreateRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(T.nilable(String)) } + def phone_number; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def phone_number=(value); end + + sig { returns(T.nilable(String)) } + def totp_issuer; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def totp_issuer=(value); end + + sig { returns(T.nilable(String)) } + def totp_user; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def totp_user=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_magic_auth_failed.rbi b/rbi/workos/authentication_magic_auth_failed.rbi new file mode 100644 index 00000000..4daba7c0 --- /dev/null +++ b/rbi/workos/authentication_magic_auth_failed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationMagicAuthFailed + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationMagicAuthFailedData) } + def data; end + + sig { params(value: WorkOS::AuthenticationMagicAuthFailedData).returns(WorkOS::AuthenticationMagicAuthFailedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_magic_auth_failed_data.rbi b/rbi/workos/authentication_magic_auth_failed_data.rbi new file mode 100644 index 00000000..abdbc5ce --- /dev/null +++ b/rbi/workos/authentication_magic_auth_failed_data.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationMagicAuthFailedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(WorkOS::AuthenticationMagicAuthFailedDataError) } + def error; end + + sig { params(value: WorkOS::AuthenticationMagicAuthFailedDataError).returns(WorkOS::AuthenticationMagicAuthFailedDataError) } + def error=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_magic_auth_failed_data_error.rbi b/rbi/workos/authentication_magic_auth_failed_data_error.rbi new file mode 100644 index 00000000..bffc8836 --- /dev/null +++ b/rbi/workos/authentication_magic_auth_failed_data_error.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationMagicAuthFailedDataError + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def message; end + + sig { params(value: String).returns(String) } + def message=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_magic_auth_succeeded.rbi b/rbi/workos/authentication_magic_auth_succeeded.rbi new file mode 100644 index 00000000..26fefe57 --- /dev/null +++ b/rbi/workos/authentication_magic_auth_succeeded.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationMagicAuthSucceeded + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationMagicAuthSucceededData) } + def data; end + + sig { params(value: WorkOS::AuthenticationMagicAuthSucceededData).returns(WorkOS::AuthenticationMagicAuthSucceededData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_magic_auth_succeeded_data.rbi b/rbi/workos/authentication_magic_auth_succeeded_data.rbi new file mode 100644 index 00000000..01328059 --- /dev/null +++ b/rbi/workos/authentication_magic_auth_succeeded_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationMagicAuthSucceededData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_mfa_failed.rbi b/rbi/workos/authentication_mfa_failed.rbi new file mode 100644 index 00000000..00f5dad2 --- /dev/null +++ b/rbi/workos/authentication_mfa_failed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationMFAFailed + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationMFAFailedData) } + def data; end + + sig { params(value: WorkOS::AuthenticationMFAFailedData).returns(WorkOS::AuthenticationMFAFailedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_mfa_failed_data.rbi b/rbi/workos/authentication_mfa_failed_data.rbi new file mode 100644 index 00000000..1d665a9a --- /dev/null +++ b/rbi/workos/authentication_mfa_failed_data.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationMFAFailedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(WorkOS::AuthenticationMFAFailedDataError) } + def error; end + + sig { params(value: WorkOS::AuthenticationMFAFailedDataError).returns(WorkOS::AuthenticationMFAFailedDataError) } + def error=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_mfa_failed_data_error.rbi b/rbi/workos/authentication_mfa_failed_data_error.rbi new file mode 100644 index 00000000..98d12cf1 --- /dev/null +++ b/rbi/workos/authentication_mfa_failed_data_error.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationMFAFailedDataError + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def message; end + + sig { params(value: String).returns(String) } + def message=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_mfa_succeeded.rbi b/rbi/workos/authentication_mfa_succeeded.rbi new file mode 100644 index 00000000..cf7a20e3 --- /dev/null +++ b/rbi/workos/authentication_mfa_succeeded.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationMFASucceeded + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationMFASucceededData) } + def data; end + + sig { params(value: WorkOS::AuthenticationMFASucceededData).returns(WorkOS::AuthenticationMFASucceededData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_mfa_succeeded_data.rbi b/rbi/workos/authentication_mfa_succeeded_data.rbi new file mode 100644 index 00000000..7cd8fb90 --- /dev/null +++ b/rbi/workos/authentication_mfa_succeeded_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationMFASucceededData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_oauth_failed.rbi b/rbi/workos/authentication_oauth_failed.rbi new file mode 100644 index 00000000..3eb102fb --- /dev/null +++ b/rbi/workos/authentication_oauth_failed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationOAuthFailed + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationOAuthFailedData) } + def data; end + + sig { params(value: WorkOS::AuthenticationOAuthFailedData).returns(WorkOS::AuthenticationOAuthFailedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_oauth_failed_data.rbi b/rbi/workos/authentication_oauth_failed_data.rbi new file mode 100644 index 00000000..d22145c2 --- /dev/null +++ b/rbi/workos/authentication_oauth_failed_data.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationOAuthFailedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(WorkOS::AuthenticationOAuthFailedDataError) } + def error; end + + sig { params(value: WorkOS::AuthenticationOAuthFailedDataError).returns(WorkOS::AuthenticationOAuthFailedDataError) } + def error=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_oauth_failed_data_error.rbi b/rbi/workos/authentication_oauth_failed_data_error.rbi new file mode 100644 index 00000000..3ace7754 --- /dev/null +++ b/rbi/workos/authentication_oauth_failed_data_error.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationOAuthFailedDataError + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def message; end + + sig { params(value: String).returns(String) } + def message=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_oauth_succeeded.rbi b/rbi/workos/authentication_oauth_succeeded.rbi new file mode 100644 index 00000000..f6a5b2a5 --- /dev/null +++ b/rbi/workos/authentication_oauth_succeeded.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationOAuthSucceeded + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationOAuthSucceededData) } + def data; end + + sig { params(value: WorkOS::AuthenticationOAuthSucceededData).returns(WorkOS::AuthenticationOAuthSucceededData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_oauth_succeeded_data.rbi b/rbi/workos/authentication_oauth_succeeded_data.rbi new file mode 100644 index 00000000..7805c006 --- /dev/null +++ b/rbi/workos/authentication_oauth_succeeded_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationOAuthSucceededData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_passkey_failed.rbi b/rbi/workos/authentication_passkey_failed.rbi new file mode 100644 index 00000000..a08a9562 --- /dev/null +++ b/rbi/workos/authentication_passkey_failed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationPasskeyFailed + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationPasskeyFailedData) } + def data; end + + sig { params(value: WorkOS::AuthenticationPasskeyFailedData).returns(WorkOS::AuthenticationPasskeyFailedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_passkey_failed_data.rbi b/rbi/workos/authentication_passkey_failed_data.rbi new file mode 100644 index 00000000..b4327ebd --- /dev/null +++ b/rbi/workos/authentication_passkey_failed_data.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationPasskeyFailedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(WorkOS::AuthenticationPasskeyFailedDataError) } + def error; end + + sig { params(value: WorkOS::AuthenticationPasskeyFailedDataError).returns(WorkOS::AuthenticationPasskeyFailedDataError) } + def error=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_passkey_failed_data_error.rbi b/rbi/workos/authentication_passkey_failed_data_error.rbi new file mode 100644 index 00000000..8ed94323 --- /dev/null +++ b/rbi/workos/authentication_passkey_failed_data_error.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationPasskeyFailedDataError + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def message; end + + sig { params(value: String).returns(String) } + def message=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_passkey_succeeded.rbi b/rbi/workos/authentication_passkey_succeeded.rbi new file mode 100644 index 00000000..6f479663 --- /dev/null +++ b/rbi/workos/authentication_passkey_succeeded.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationPasskeySucceeded + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationPasskeySucceededData) } + def data; end + + sig { params(value: WorkOS::AuthenticationPasskeySucceededData).returns(WorkOS::AuthenticationPasskeySucceededData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_passkey_succeeded_data.rbi b/rbi/workos/authentication_passkey_succeeded_data.rbi new file mode 100644 index 00000000..1f1e3d16 --- /dev/null +++ b/rbi/workos/authentication_passkey_succeeded_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationPasskeySucceededData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_password_failed.rbi b/rbi/workos/authentication_password_failed.rbi new file mode 100644 index 00000000..2fdc910b --- /dev/null +++ b/rbi/workos/authentication_password_failed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationPasswordFailed + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationPasswordFailedData) } + def data; end + + sig { params(value: WorkOS::AuthenticationPasswordFailedData).returns(WorkOS::AuthenticationPasswordFailedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_password_failed_data.rbi b/rbi/workos/authentication_password_failed_data.rbi new file mode 100644 index 00000000..242c4f1a --- /dev/null +++ b/rbi/workos/authentication_password_failed_data.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationPasswordFailedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(WorkOS::AuthenticationPasswordFailedDataError) } + def error; end + + sig { params(value: WorkOS::AuthenticationPasswordFailedDataError).returns(WorkOS::AuthenticationPasswordFailedDataError) } + def error=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_password_failed_data_error.rbi b/rbi/workos/authentication_password_failed_data_error.rbi new file mode 100644 index 00000000..f4048725 --- /dev/null +++ b/rbi/workos/authentication_password_failed_data_error.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationPasswordFailedDataError + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def message; end + + sig { params(value: String).returns(String) } + def message=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_password_succeeded.rbi b/rbi/workos/authentication_password_succeeded.rbi new file mode 100644 index 00000000..3274e7fd --- /dev/null +++ b/rbi/workos/authentication_password_succeeded.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationPasswordSucceeded + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationPasswordSucceededData) } + def data; end + + sig { params(value: WorkOS::AuthenticationPasswordSucceededData).returns(WorkOS::AuthenticationPasswordSucceededData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_password_succeeded_data.rbi b/rbi/workos/authentication_password_succeeded_data.rbi new file mode 100644 index 00000000..aa9c6c7e --- /dev/null +++ b/rbi/workos/authentication_password_succeeded_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationPasswordSucceededData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_radar_risk_detected.rbi b/rbi/workos/authentication_radar_risk_detected.rbi new file mode 100644 index 00000000..d49c0656 --- /dev/null +++ b/rbi/workos/authentication_radar_risk_detected.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationRadarRiskDetected + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationRadarRiskDetectedData) } + def data; end + + sig { params(value: WorkOS::AuthenticationRadarRiskDetectedData).returns(WorkOS::AuthenticationRadarRiskDetectedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_radar_risk_detected_data.rbi b/rbi/workos/authentication_radar_risk_detected_data.rbi new file mode 100644 index 00000000..d610f7fe --- /dev/null +++ b/rbi/workos/authentication_radar_risk_detected_data.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationRadarRiskDetectedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def auth_method; end + + sig { params(value: String).returns(String) } + def auth_method=(value); end + + sig { returns(String) } + def action; end + + sig { params(value: String).returns(String) } + def action=(value); end + + sig { returns(T.nilable(String)) } + def control; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def control=(value); end + + sig { returns(T.nilable(String)) } + def blocklist_type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def blocklist_type=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_failed.rbi b/rbi/workos/authentication_sso_failed.rbi new file mode 100644 index 00000000..1fcc5e48 --- /dev/null +++ b/rbi/workos/authentication_sso_failed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOFailed + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationSSOFailedData) } + def data; end + + sig { params(value: WorkOS::AuthenticationSSOFailedData).returns(WorkOS::AuthenticationSSOFailedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_failed_data.rbi b/rbi/workos/authentication_sso_failed_data.rbi new file mode 100644 index 00000000..2526e8e6 --- /dev/null +++ b/rbi/workos/authentication_sso_failed_data.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOFailedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(WorkOS::AuthenticationSSOFailedDataSSO) } + def sso; end + + sig { params(value: WorkOS::AuthenticationSSOFailedDataSSO).returns(WorkOS::AuthenticationSSOFailedDataSSO) } + def sso=(value); end + + sig { returns(WorkOS::AuthenticationSSOFailedDataError) } + def error; end + + sig { params(value: WorkOS::AuthenticationSSOFailedDataError).returns(WorkOS::AuthenticationSSOFailedDataError) } + def error=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_failed_data_error.rbi b/rbi/workos/authentication_sso_failed_data_error.rbi new file mode 100644 index 00000000..d727e446 --- /dev/null +++ b/rbi/workos/authentication_sso_failed_data_error.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOFailedDataError + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def message; end + + sig { params(value: String).returns(String) } + def message=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_failed_data_sso.rbi b/rbi/workos/authentication_sso_failed_data_sso.rbi new file mode 100644 index 00000000..ce8a2cd1 --- /dev/null +++ b/rbi/workos/authentication_sso_failed_data_sso.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOFailedDataSSO + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def connection_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def connection_id=(value); end + + sig { returns(T.nilable(String)) } + def session_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def session_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_started.rbi b/rbi/workos/authentication_sso_started.rbi new file mode 100644 index 00000000..ca7a4cb3 --- /dev/null +++ b/rbi/workos/authentication_sso_started.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOStarted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationSSOStartedData) } + def data; end + + sig { params(value: WorkOS::AuthenticationSSOStartedData).returns(WorkOS::AuthenticationSSOStartedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_started_data.rbi b/rbi/workos/authentication_sso_started_data.rbi new file mode 100644 index 00000000..8cc05ea7 --- /dev/null +++ b/rbi/workos/authentication_sso_started_data.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOStartedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(WorkOS::AuthenticationSSOStartedDataSSO) } + def sso; end + + sig { params(value: WorkOS::AuthenticationSSOStartedDataSSO).returns(WorkOS::AuthenticationSSOStartedDataSSO) } + def sso=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_started_data_sso.rbi b/rbi/workos/authentication_sso_started_data_sso.rbi new file mode 100644 index 00000000..32dee512 --- /dev/null +++ b/rbi/workos/authentication_sso_started_data_sso.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOStartedDataSSO + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def connection_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def connection_id=(value); end + + sig { returns(T.nilable(String)) } + def session_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def session_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_succeeded.rbi b/rbi/workos/authentication_sso_succeeded.rbi new file mode 100644 index 00000000..315da666 --- /dev/null +++ b/rbi/workos/authentication_sso_succeeded.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOSucceeded + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationSSOSucceededData) } + def data; end + + sig { params(value: WorkOS::AuthenticationSSOSucceededData).returns(WorkOS::AuthenticationSSOSucceededData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_succeeded_data.rbi b/rbi/workos/authentication_sso_succeeded_data.rbi new file mode 100644 index 00000000..a5ed670d --- /dev/null +++ b/rbi/workos/authentication_sso_succeeded_data.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOSucceededData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(WorkOS::AuthenticationSSOSucceededDataSSO) } + def sso; end + + sig { params(value: WorkOS::AuthenticationSSOSucceededDataSSO).returns(WorkOS::AuthenticationSSOSucceededDataSSO) } + def sso=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_succeeded_data_sso.rbi b/rbi/workos/authentication_sso_succeeded_data_sso.rbi new file mode 100644 index 00000000..bbaa446e --- /dev/null +++ b/rbi/workos/authentication_sso_succeeded_data_sso.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOSucceededDataSSO + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def connection_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def connection_id=(value); end + + sig { returns(T.nilable(String)) } + def session_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def session_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_timed_out.rbi b/rbi/workos/authentication_sso_timed_out.rbi new file mode 100644 index 00000000..efe6702b --- /dev/null +++ b/rbi/workos/authentication_sso_timed_out.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOTimedOut + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::AuthenticationSSOTimedOutData) } + def data; end + + sig { params(value: WorkOS::AuthenticationSSOTimedOutData).returns(WorkOS::AuthenticationSSOTimedOutData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_timed_out_data.rbi b/rbi/workos/authentication_sso_timed_out_data.rbi new file mode 100644 index 00000000..7c5d6507 --- /dev/null +++ b/rbi/workos/authentication_sso_timed_out_data.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOTimedOutData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(WorkOS::AuthenticationSSOTimedOutDataSSO) } + def sso; end + + sig { params(value: WorkOS::AuthenticationSSOTimedOutDataSSO).returns(WorkOS::AuthenticationSSOTimedOutDataSSO) } + def sso=(value); end + + sig { returns(WorkOS::AuthenticationSSOTimedOutDataError) } + def error; end + + sig { params(value: WorkOS::AuthenticationSSOTimedOutDataError).returns(WorkOS::AuthenticationSSOTimedOutDataError) } + def error=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_timed_out_data_error.rbi b/rbi/workos/authentication_sso_timed_out_data_error.rbi new file mode 100644 index 00000000..71475788 --- /dev/null +++ b/rbi/workos/authentication_sso_timed_out_data_error.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOTimedOutDataError + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def message; end + + sig { params(value: String).returns(String) } + def message=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authentication_sso_timed_out_data_sso.rbi b/rbi/workos/authentication_sso_timed_out_data_sso.rbi new file mode 100644 index 00000000..3d36cf76 --- /dev/null +++ b/rbi/workos/authentication_sso_timed_out_data_sso.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthenticationSSOTimedOutDataSSO + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def connection_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def connection_id=(value); end + + sig { returns(T.nilable(String)) } + def session_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def session_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authorization.rbi b/rbi/workos/authorization.rbi new file mode 100644 index 00000000..f8f5a119 --- /dev/null +++ b/rbi/workos/authorization.rbi @@ -0,0 +1,413 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Authorization + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + organization_membership_id: String, + permission_slug: String, + resource_id: T.nilable(String), + resource_external_id: T.nilable(String), + resource_type_slug: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthorizationCheck) + end + def check(organization_membership_id:, permission_slug:, resource_id:, resource_external_id:, resource_type_slug:, request_options:); end + + sig do + params( + organization_membership_id: String, + permission_slug: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_organization_membership_resources(organization_membership_id:, permission_slug:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + organization_membership_id: String, + resource_id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_resource_permissions(organization_membership_id:, resource_id:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + organization_membership_id: String, + resource_type_slug: String, + external_id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_effective_permissions_by_external_id(organization_membership_id:, resource_type_slug:, external_id:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + organization_membership_id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_organization_membership_role_assignments(organization_membership_id:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + organization_membership_id: String, + role_slug: String, + resource_id: T.nilable(String), + resource_external_id: T.nilable(String), + resource_type_slug: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::RoleAssignment) + end + def assign_role(organization_membership_id:, role_slug:, resource_id:, resource_external_id:, resource_type_slug:, request_options:); end + + sig do + params( + organization_membership_id: String, + role_slug: String, + resource_id: T.nilable(String), + resource_external_id: T.nilable(String), + resource_type_slug: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def remove_role(organization_membership_id:, role_slug:, resource_id:, resource_external_id:, resource_type_slug:, request_options:); end + + sig do + params( + organization_membership_id: String, + role_assignment_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_organization_membership_role_assignment(organization_membership_id:, role_assignment_id:, request_options:); end + + sig do + params( + organization_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::RoleList) + end + def list_organization_roles(organization_id:, request_options:); end + + sig do + params( + organization_id: String, + name: String, + slug: T.nilable(String), + description: T.nilable(String), + resource_type_slug: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Role) + end + def create_organization_role(organization_id:, name:, slug:, description:, resource_type_slug:, request_options:); end + + sig do + params( + organization_id: String, + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Role) + end + def get_organization_role(organization_id:, slug:, request_options:); end + + sig do + params( + organization_id: String, + slug: String, + name: T.nilable(String), + description: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Role) + end + def update_organization_role(organization_id:, slug:, name:, description:, request_options:); end + + sig do + params( + organization_id: String, + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_organization_role(organization_id:, slug:, request_options:); end + + sig do + params( + organization_id: String, + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Role) + end + def create_role_permission(organization_id:, slug:, request_options:); end + + sig do + params( + organization_id: String, + slug: String, + permissions: T::Array[String], + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Role) + end + def update_role_permissions(organization_id:, slug:, permissions:, request_options:); end + + sig do + params( + organization_id: String, + slug: String, + permission_slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Role) + end + def delete_role_permission(organization_id:, slug:, permission_slug:, request_options:); end + + sig do + params( + organization_id: String, + resource_type_slug: String, + external_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthorizationResource) + end + def get_organization_resource(organization_id:, resource_type_slug:, external_id:, request_options:); end + + sig do + params( + organization_id: String, + resource_type_slug: String, + external_id: String, + name: T.nilable(String), + description: T.nilable(String), + parent_resource_id: T.nilable(String), + parent_resource_external_id: T.nilable(String), + parent_resource_type_slug: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthorizationResource) + end + def update_organization_resource(organization_id:, resource_type_slug:, external_id:, name:, description:, parent_resource_id:, parent_resource_external_id:, parent_resource_type_slug:, request_options:); end + + sig do + params( + organization_id: String, + resource_type_slug: String, + external_id: String, + cascade_delete: T.nilable(T::Boolean), + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_organization_resource(organization_id:, resource_type_slug:, external_id:, cascade_delete:, request_options:); end + + sig do + params( + organization_id: String, + resource_type_slug: String, + external_id: String, + permission_slug: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + assignment: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_resource_organization_memberships(organization_id:, resource_type_slug:, external_id:, permission_slug:, before:, after:, limit:, order:, assignment:, request_options:); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + organization_id: T.nilable(String), + resource_type_slug: T.nilable(String), + search: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_resources(before:, after:, limit:, order:, organization_id:, resource_type_slug:, search:, request_options:); end + + sig do + params( + external_id: String, + name: String, + resource_type_slug: String, + organization_id: String, + description: T.nilable(String), + parent_resource_id: T.nilable(String), + parent_resource_external_id: T.nilable(String), + parent_resource_type_slug: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthorizationResource) + end + def create_resource(external_id:, name:, resource_type_slug:, organization_id:, description:, parent_resource_id:, parent_resource_external_id:, parent_resource_type_slug:, request_options:); end + + sig do + params( + resource_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthorizationResource) + end + def get_resource(resource_id:, request_options:); end + + sig do + params( + resource_id: String, + name: T.nilable(String), + description: T.nilable(String), + parent_resource_id: T.nilable(String), + parent_resource_external_id: T.nilable(String), + parent_resource_type_slug: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthorizationResource) + end + def update_resource(resource_id:, name:, description:, parent_resource_id:, parent_resource_external_id:, parent_resource_type_slug:, request_options:); end + + sig do + params( + resource_id: String, + cascade_delete: T.nilable(T::Boolean), + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_resource(resource_id:, cascade_delete:, request_options:); end + + sig do + params( + resource_id: String, + permission_slug: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + assignment: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_memberships_for_resource(resource_id:, permission_slug:, before:, after:, limit:, order:, assignment:, request_options:); end + + sig do + params( + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::RoleList) + end + def list_environment_roles(request_options:); end + + sig do + params( + slug: String, + name: String, + description: T.nilable(String), + resource_type_slug: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Role) + end + def create_environment_role(slug:, name:, description:, resource_type_slug:, request_options:); end + + sig do + params( + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Role) + end + def get_environment_role(slug:, request_options:); end + + sig do + params( + slug: String, + name: T.nilable(String), + description: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Role) + end + def update_environment_role(slug:, name:, description:, request_options:); end + + sig do + params( + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Role) + end + def add_environment_role_permission(slug:, request_options:); end + + sig do + params( + slug: String, + permissions: T::Array[String], + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Role) + end + def set_environment_role_permissions(slug:, permissions:, request_options:); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_permissions(before:, after:, limit:, order:, request_options:); end + + sig do + params( + slug: String, + name: String, + description: T.nilable(String), + resource_type_slug: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Permission) + end + def create_permission(slug:, name:, description:, resource_type_slug:, request_options:); end + + sig do + params( + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthorizationPermission) + end + def get_permission(slug:, request_options:); end + + sig do + params( + slug: String, + name: T.nilable(String), + description: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthorizationPermission) + end + def update_permission(slug:, name:, description:, request_options:); end + + sig do + params( + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_permission(slug:, request_options:); end + + end +end diff --git a/rbi/workos/authorization_check.rbi b/rbi/workos/authorization_check.rbi new file mode 100644 index 00000000..989e3a8f --- /dev/null +++ b/rbi/workos/authorization_check.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthorizationCheck + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T::Boolean) } + def authorized; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def authorized=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authorization_code_session_authenticate_request.rbi b/rbi/workos/authorization_code_session_authenticate_request.rbi new file mode 100644 index 00000000..cc8a1326 --- /dev/null +++ b/rbi/workos/authorization_code_session_authenticate_request.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthorizationCodeSessionAuthenticateRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(String) } + def client_secret; end + + sig { params(value: String).returns(String) } + def client_secret=(value); end + + sig { returns(String) } + def grant_type; end + + sig { params(value: String).returns(String) } + def grant_type=(value); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(T.nilable(String)) } + def code_verifier; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def code_verifier=(value); end + + sig { returns(T.nilable(String)) } + def invitation_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def invitation_token=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def device_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def device_id=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authorization_permission.rbi b/rbi/workos/authorization_permission.rbi new file mode 100644 index 00000000..1954ea06 --- /dev/null +++ b/rbi/workos/authorization_permission.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthorizationPermission + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T::Boolean) } + def system; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def system=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authorization_resource.rbi b/rbi/workos/authorization_resource.rbi new file mode 100644 index 00000000..c53c03d5 --- /dev/null +++ b/rbi/workos/authorization_resource.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthorizationResource + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def parent_resource_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def parent_resource_id=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def external_id; end + + sig { params(value: String).returns(String) } + def external_id=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authorized_connect_application_list_data.rbi b/rbi/workos/authorized_connect_application_list_data.rbi new file mode 100644 index 00000000..c99cbb17 --- /dev/null +++ b/rbi/workos/authorized_connect_application_list_data.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuthorizedConnectApplicationListData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T::Array[String]) } + def granted_scopes; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def granted_scopes=(value); end + + sig { returns(T.nilable(String)) } + def oauth_resource; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def oauth_resource=(value); end + + sig { returns(WorkOS::ConnectApplication) } + def application; end + + sig { params(value: WorkOS::ConnectApplication).returns(WorkOS::ConnectApplication) } + def application=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/challenge_authentication_factor.rbi b/rbi/workos/challenge_authentication_factor.rbi new file mode 100644 index 00000000..3d7595ad --- /dev/null +++ b/rbi/workos/challenge_authentication_factor.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ChallengeAuthenticationFactor + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def sms_template; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def sms_template=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/check_authorization.rbi b/rbi/workos/check_authorization.rbi new file mode 100644 index 00000000..3902713d --- /dev/null +++ b/rbi/workos/check_authorization.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CheckAuthorization + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def permission_slug; end + + sig { params(value: String).returns(String) } + def permission_slug=(value); end + + sig { returns(T.nilable(String)) } + def resource_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_id=(value); end + + sig { returns(T.nilable(String)) } + def resource_external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_external_id=(value); end + + sig { returns(T.nilable(String)) } + def resource_type_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_type_slug=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/client.rbi b/rbi/workos/client.rbi new file mode 100644 index 00000000..e5a54610 --- /dev/null +++ b/rbi/workos/client.rbi @@ -0,0 +1,60 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Client < BaseClient + sig { returns(WorkOS::ApiKeys) } + def api_keys; end + + sig { returns(WorkOS::MultiFactorAuth) } + def multi_factor_auth; end + + sig { returns(WorkOS::Connect) } + def connect; end + + sig { returns(WorkOS::Authorization) } + def authorization; end + + sig { returns(WorkOS::SSO) } + def s_s_o; end + + sig { returns(WorkOS::Pipes) } + def pipes; end + + sig { returns(WorkOS::DirectorySync) } + def directory_sync; end + + sig { returns(WorkOS::Events) } + def events; end + + sig { returns(WorkOS::FeatureFlags) } + def feature_flags; end + + sig { returns(WorkOS::OrganizationDomains) } + def organization_domains; end + + sig { returns(WorkOS::Organizations) } + def organizations; end + + sig { returns(WorkOS::AuditLogs) } + def audit_logs; end + + sig { returns(WorkOS::AdminPortal) } + def admin_portal; end + + sig { returns(WorkOS::Radar) } + def radar; end + + sig { returns(WorkOS::UserManagement) } + def user_management; end + + sig { returns(WorkOS::Webhooks) } + def webhooks; end + + sig { returns(WorkOS::Widgets) } + def widgets; end + + end +end diff --git a/rbi/workos/confirm_email_change.rbi b/rbi/workos/confirm_email_change.rbi new file mode 100644 index 00000000..2448e07f --- /dev/null +++ b/rbi/workos/confirm_email_change.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConfirmEmailChange + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connect.rbi b/rbi/workos/connect.rbi new file mode 100644 index 00000000..5d2a6179 --- /dev/null +++ b/rbi/workos/connect.rbi @@ -0,0 +1,101 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Connect + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + external_auth_id: String, + user: WorkOS::UserObject, + user_consent_options: T.nilable(T::Array[WorkOS::UserConsentOption]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ExternalAuthCompleteResponse) + end + def complete_oauth2(external_auth_id:, user:, user_consent_options:, request_options:); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + organization_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_applications(before:, after:, limit:, order:, organization_id:, request_options:); end + + sig do + params( + name: String, + application_type: String, + is_first_party: T::Boolean, + description: T.nilable(String), + scopes: T.nilable(T::Array[String]), + redirect_uris: T.nilable(T::Array[WorkOS::RedirectUriInput]), + uses_pkce: T.nilable(T::Boolean), + organization_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ConnectApplication) + end + def create_application(name:, application_type:, is_first_party:, description:, scopes:, redirect_uris:, uses_pkce:, organization_id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ConnectApplication) + end + def get_application(id:, request_options:); end + + sig do + params( + id: String, + name: T.nilable(String), + description: T.nilable(String), + scopes: T.nilable(T::Array[String]), + redirect_uris: T.nilable(T::Array[WorkOS::RedirectUriInput]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ConnectApplication) + end + def update_application(id:, name:, description:, scopes:, redirect_uris:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_application(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(T::Array[WorkOS::ApplicationCredentialsListItem]) + end + def list_application_client_secrets(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::NewConnectApplicationSecret) + end + def create_application_client_secret(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_client_secret(id:, request_options:); end + + end +end diff --git a/rbi/workos/connect_application.rbi b/rbi/workos/connect_application.rbi new file mode 100644 index 00000000..d5b46a8f --- /dev/null +++ b/rbi/workos/connect_application.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectApplication + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T::Array[String]) } + def scopes; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def scopes=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T.nilable(String)) } + def application_type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def application_type=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connected_account.rbi b/rbi/workos/connected_account.rbi new file mode 100644 index 00000000..15239b2a --- /dev/null +++ b/rbi/workos/connected_account.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectedAccount + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T::Array[String]) } + def scopes; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def scopes=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection.rbi b/rbi/workos/connection.rbi new file mode 100644 index 00000000..2d97b96c --- /dev/null +++ b/rbi/workos/connection.rbi @@ -0,0 +1,83 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Connection + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(String) } + def connection_type; end + + sig { params(value: String).returns(String) } + def connection_type=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T::Array[WorkOS::ConnectionDomain]) } + def domains; end + + sig { params(value: T::Array[WorkOS::ConnectionDomain]).returns(T::Array[WorkOS::ConnectionDomain]) } + def domains=(value); end + + sig { returns(T.nilable(WorkOS::ConnectionOption)) } + def options; end + + sig { params(value: T.nilable(WorkOS::ConnectionOption)).returns(T.nilable(WorkOS::ConnectionOption)) } + def options=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_activated.rbi b/rbi/workos/connection_activated.rbi new file mode 100644 index 00000000..3e5a8a95 --- /dev/null +++ b/rbi/workos/connection_activated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionActivated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::ConnectionActivatedData) } + def data; end + + sig { params(value: WorkOS::ConnectionActivatedData).returns(WorkOS::ConnectionActivatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_activated_data.rbi b/rbi/workos/connection_activated_data.rbi new file mode 100644 index 00000000..bb626753 --- /dev/null +++ b/rbi/workos/connection_activated_data.rbi @@ -0,0 +1,83 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionActivatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def connection_type; end + + sig { params(value: String).returns(String) } + def connection_type=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(String) } + def external_key; end + + sig { params(value: String).returns(String) } + def external_key=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T::Array[WorkOS::ConnectionActivatedDataDomain]) } + def domains; end + + sig { params(value: T::Array[WorkOS::ConnectionActivatedDataDomain]).returns(T::Array[WorkOS::ConnectionActivatedDataDomain]) } + def domains=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_activated_data_domain.rbi b/rbi/workos/connection_activated_data_domain.rbi new file mode 100644 index 00000000..49fa32a0 --- /dev/null +++ b/rbi/workos/connection_activated_data_domain.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionActivatedDataDomain + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_deactivated.rbi b/rbi/workos/connection_deactivated.rbi new file mode 100644 index 00000000..5b7e7f34 --- /dev/null +++ b/rbi/workos/connection_deactivated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionDeactivated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::ConnectionDeactivatedData) } + def data; end + + sig { params(value: WorkOS::ConnectionDeactivatedData).returns(WorkOS::ConnectionDeactivatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_deactivated_data.rbi b/rbi/workos/connection_deactivated_data.rbi new file mode 100644 index 00000000..545a3f48 --- /dev/null +++ b/rbi/workos/connection_deactivated_data.rbi @@ -0,0 +1,83 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionDeactivatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def connection_type; end + + sig { params(value: String).returns(String) } + def connection_type=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(String) } + def external_key; end + + sig { params(value: String).returns(String) } + def external_key=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T::Array[WorkOS::ConnectionDeactivatedDataDomain]) } + def domains; end + + sig { params(value: T::Array[WorkOS::ConnectionDeactivatedDataDomain]).returns(T::Array[WorkOS::ConnectionDeactivatedDataDomain]) } + def domains=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_deactivated_data_domain.rbi b/rbi/workos/connection_deactivated_data_domain.rbi new file mode 100644 index 00000000..02d0e3a6 --- /dev/null +++ b/rbi/workos/connection_deactivated_data_domain.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionDeactivatedDataDomain + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_deleted.rbi b/rbi/workos/connection_deleted.rbi new file mode 100644 index 00000000..7a2cc41e --- /dev/null +++ b/rbi/workos/connection_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::ConnectionDeletedData) } + def data; end + + sig { params(value: WorkOS::ConnectionDeletedData).returns(WorkOS::ConnectionDeletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_deleted_data.rbi b/rbi/workos/connection_deleted_data.rbi new file mode 100644 index 00000000..3aa13364 --- /dev/null +++ b/rbi/workos/connection_deleted_data.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionDeletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def connection_type; end + + sig { params(value: String).returns(String) } + def connection_type=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_domain.rbi b/rbi/workos/connection_domain.rbi new file mode 100644 index 00000000..26e89240 --- /dev/null +++ b/rbi/workos/connection_domain.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionDomain + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_option.rbi b/rbi/workos/connection_option.rbi new file mode 100644 index 00000000..164bd40a --- /dev/null +++ b/rbi/workos/connection_option.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionOption + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def signing_cert; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def signing_cert=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_saml_certificate_renewal_required.rbi b/rbi/workos/connection_saml_certificate_renewal_required.rbi new file mode 100644 index 00000000..9f8dd2a2 --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewal_required.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionSAMLCertificateRenewalRequired + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::ConnectionSAMLCertificateRenewalRequiredData) } + def data; end + + sig { params(value: WorkOS::ConnectionSAMLCertificateRenewalRequiredData).returns(WorkOS::ConnectionSAMLCertificateRenewalRequiredData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_saml_certificate_renewal_required_data.rbi b/rbi/workos/connection_saml_certificate_renewal_required_data.rbi new file mode 100644 index 00000000..2cb1383c --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewal_required_data.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionSAMLCertificateRenewalRequiredData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(WorkOS::ConnectionSAMLCertificateRenewalRequiredDataConnection) } + def connection; end + + sig { params(value: WorkOS::ConnectionSAMLCertificateRenewalRequiredDataConnection).returns(WorkOS::ConnectionSAMLCertificateRenewalRequiredDataConnection) } + def connection=(value); end + + sig { returns(WorkOS::ConnectionSAMLCertificateRenewalRequiredDataCertificate) } + def certificate; end + + sig { params(value: WorkOS::ConnectionSAMLCertificateRenewalRequiredDataCertificate).returns(WorkOS::ConnectionSAMLCertificateRenewalRequiredDataCertificate) } + def certificate=(value); end + + sig { returns(Integer) } + def days_until_expiry; end + + sig { params(value: Integer).returns(Integer) } + def days_until_expiry=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_saml_certificate_renewal_required_data_certificate.rbi b/rbi/workos/connection_saml_certificate_renewal_required_data_certificate.rbi new file mode 100644 index 00000000..13f57f11 --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewal_required_data_certificate.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionSAMLCertificateRenewalRequiredDataCertificate + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def certificate_type; end + + sig { params(value: String).returns(String) } + def certificate_type=(value); end + + sig { returns(String) } + def expiry_date; end + + sig { params(value: String).returns(String) } + def expiry_date=(value); end + + sig { returns(T::Boolean) } + def is_expired; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def is_expired=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_saml_certificate_renewal_required_data_connection.rbi b/rbi/workos/connection_saml_certificate_renewal_required_data_connection.rbi new file mode 100644 index 00000000..2c85d855 --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewal_required_data_connection.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionSAMLCertificateRenewalRequiredDataConnection + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_saml_certificate_renewed.rbi b/rbi/workos/connection_saml_certificate_renewed.rbi new file mode 100644 index 00000000..2d7374ca --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionSAMLCertificateRenewed + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::ConnectionSAMLCertificateRenewedData) } + def data; end + + sig { params(value: WorkOS::ConnectionSAMLCertificateRenewedData).returns(WorkOS::ConnectionSAMLCertificateRenewedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_saml_certificate_renewed_data.rbi b/rbi/workos/connection_saml_certificate_renewed_data.rbi new file mode 100644 index 00000000..96a90258 --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewed_data.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionSAMLCertificateRenewedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(WorkOS::ConnectionSAMLCertificateRenewedDataConnection) } + def connection; end + + sig { params(value: WorkOS::ConnectionSAMLCertificateRenewedDataConnection).returns(WorkOS::ConnectionSAMLCertificateRenewedDataConnection) } + def connection=(value); end + + sig { returns(WorkOS::ConnectionSAMLCertificateRenewedDataCertificate) } + def certificate; end + + sig { params(value: WorkOS::ConnectionSAMLCertificateRenewedDataCertificate).returns(WorkOS::ConnectionSAMLCertificateRenewedDataCertificate) } + def certificate=(value); end + + sig { returns(String) } + def renewed_at; end + + sig { params(value: String).returns(String) } + def renewed_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_saml_certificate_renewed_data_certificate.rbi b/rbi/workos/connection_saml_certificate_renewed_data_certificate.rbi new file mode 100644 index 00000000..b69df2fc --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewed_data_certificate.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionSAMLCertificateRenewedDataCertificate + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def certificate_type; end + + sig { params(value: String).returns(String) } + def certificate_type=(value); end + + sig { returns(String) } + def expiry_date; end + + sig { params(value: String).returns(String) } + def expiry_date=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/connection_saml_certificate_renewed_data_connection.rbi b/rbi/workos/connection_saml_certificate_renewed_data_connection.rbi new file mode 100644 index 00000000..8d8b97bc --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewed_data_connection.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ConnectionSAMLCertificateRenewedDataConnection + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/cors_origin_response.rbi b/rbi/workos/cors_origin_response.rbi new file mode 100644 index 00000000..e5cfbea5 --- /dev/null +++ b/rbi/workos/cors_origin_response.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CORSOriginResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def origin; end + + sig { params(value: String).returns(String) } + def origin=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_application_secret.rbi b/rbi/workos/create_application_secret.rbi new file mode 100644 index 00000000..456ce8a6 --- /dev/null +++ b/rbi/workos/create_application_secret.rbi @@ -0,0 +1,17 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateApplicationSecret + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_authorization_permission.rbi b/rbi/workos/create_authorization_permission.rbi new file mode 100644 index 00000000..3e5ef533 --- /dev/null +++ b/rbi/workos/create_authorization_permission.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateAuthorizationPermission + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(String)) } + def resource_type_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_type_slug=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_authorization_resource.rbi b/rbi/workos/create_authorization_resource.rbi new file mode 100644 index 00000000..c70d8fd9 --- /dev/null +++ b/rbi/workos/create_authorization_resource.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateAuthorizationResource + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def external_id; end + + sig { params(value: String).returns(String) } + def external_id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def parent_resource_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def parent_resource_id=(value); end + + sig { returns(T.nilable(String)) } + def parent_resource_external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def parent_resource_external_id=(value); end + + sig { returns(T.nilable(String)) } + def parent_resource_type_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def parent_resource_type_slug=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_cors_origin.rbi b/rbi/workos/create_cors_origin.rbi new file mode 100644 index 00000000..2bbd58e2 --- /dev/null +++ b/rbi/workos/create_cors_origin.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateCORSOrigin + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def origin; end + + sig { params(value: String).returns(String) } + def origin=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_m2m_application.rbi b/rbi/workos/create_m2m_application.rbi new file mode 100644 index 00000000..dc3d703e --- /dev/null +++ b/rbi/workos/create_m2m_application.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateM2MApplication + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def application_type; end + + sig { params(value: String).returns(String) } + def application_type=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def scopes; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def scopes=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_magic_code_and_return.rbi b/rbi/workos/create_magic_code_and_return.rbi new file mode 100644 index 00000000..f7cc1098 --- /dev/null +++ b/rbi/workos/create_magic_code_and_return.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateMagicCodeAndReturn + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def invitation_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def invitation_token=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_oauth_application.rbi b/rbi/workos/create_oauth_application.rbi new file mode 100644 index 00000000..e397e54c --- /dev/null +++ b/rbi/workos/create_oauth_application.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateOAuthApplication + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def application_type; end + + sig { params(value: String).returns(String) } + def application_type=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def scopes; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def scopes=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::RedirectUriInput])) } + def redirect_uris; end + + sig { params(value: T.nilable(T::Array[WorkOS::RedirectUriInput])).returns(T.nilable(T::Array[WorkOS::RedirectUriInput])) } + def redirect_uris=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def uses_pkce; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def uses_pkce=(value); end + + sig { returns(T::Boolean) } + def is_first_party; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def is_first_party=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_organization_api_key.rbi b/rbi/workos/create_organization_api_key.rbi new file mode 100644 index 00000000..5103d741 --- /dev/null +++ b/rbi/workos/create_organization_api_key.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateOrganizationApiKey + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def permissions; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def permissions=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_organization_domain.rbi b/rbi/workos/create_organization_domain.rbi new file mode 100644 index 00000000..17aef8c5 --- /dev/null +++ b/rbi/workos/create_organization_domain.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateOrganizationDomain + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_organization_role.rbi b/rbi/workos/create_organization_role.rbi new file mode 100644 index 00000000..32909063 --- /dev/null +++ b/rbi/workos/create_organization_role.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateOrganizationRole + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(String)) } + def resource_type_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_type_slug=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_password_reset.rbi b/rbi/workos/create_password_reset.rbi new file mode 100644 index 00000000..33491654 --- /dev/null +++ b/rbi/workos/create_password_reset.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreatePasswordReset + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def token; end + + sig { params(value: String).returns(String) } + def token=(value); end + + sig { returns(String) } + def new_password; end + + sig { params(value: String).returns(String) } + def new_password=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_password_reset_token.rbi b/rbi/workos/create_password_reset_token.rbi new file mode 100644 index 00000000..eca9fb79 --- /dev/null +++ b/rbi/workos/create_password_reset_token.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreatePasswordResetToken + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_redirect_uri.rbi b/rbi/workos/create_redirect_uri.rbi new file mode 100644 index 00000000..9acf0b91 --- /dev/null +++ b/rbi/workos/create_redirect_uri.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateRedirectUri + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def uri; end + + sig { params(value: String).returns(String) } + def uri=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_role.rbi b/rbi/workos/create_role.rbi new file mode 100644 index 00000000..66140b7d --- /dev/null +++ b/rbi/workos/create_role.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateRole + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(String)) } + def resource_type_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_type_slug=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_user.rbi b/rbi/workos/create_user.rbi new file mode 100644 index 00000000..7a12b788 --- /dev/null +++ b/rbi/workos/create_user.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateUser + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def email_verified; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def email_verified=(value); end + + sig { returns(T.nilable(T::Hash[String, String])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) } + def metadata=(value); end + + sig { returns(T.nilable(String)) } + def external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def external_id=(value); end + + sig { returns(T.nilable(String)) } + def password; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def password=(value); end + + sig { returns(T.nilable(String)) } + def password_hash; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def password_hash=(value); end + + sig { returns(T.nilable(String)) } + def password_hash_type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def password_hash_type=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_user_invite_options.rbi b/rbi/workos/create_user_invite_options.rbi new file mode 100644 index 00000000..4f8774b4 --- /dev/null +++ b/rbi/workos/create_user_invite_options.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateUserInviteOptions + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def role_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def role_slug=(value); end + + sig { returns(T.nilable(Integer)) } + def expires_in_days; end + + sig { params(value: T.nilable(Integer)).returns(T.nilable(Integer)) } + def expires_in_days=(value); end + + sig { returns(T.nilable(String)) } + def inviter_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def inviter_user_id=(value); end + + sig { returns(T.nilable(String)) } + def locale; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def locale=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_user_organization_membership.rbi b/rbi/workos/create_user_organization_membership.rbi new file mode 100644 index 00000000..cc76b974 --- /dev/null +++ b/rbi/workos/create_user_organization_membership.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateUserOrganizationMembership + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def role_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def role_slug=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def role_slugs; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def role_slugs=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/create_webhook_endpoint.rbi b/rbi/workos/create_webhook_endpoint.rbi new file mode 100644 index 00000000..dea4847d --- /dev/null +++ b/rbi/workos/create_webhook_endpoint.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateWebhookEndpoint + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def endpoint_url; end + + sig { params(value: String).returns(String) } + def endpoint_url=(value); end + + sig { returns(T::Array[String]) } + def events; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def events=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integration_access_token_response.rbi b/rbi/workos/data_integration_access_token_response.rbi new file mode 100644 index 00000000..7df918be --- /dev/null +++ b/rbi/workos/data_integration_access_token_response.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegrationAccessTokenResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(T::Boolean)) } + def active; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def active=(value); end + + sig { returns(T.nilable(WorkOS::DataIntegrationAccessTokenResponseAccessToken)) } + def access_token; end + + sig { params(value: T.nilable(WorkOS::DataIntegrationAccessTokenResponseAccessToken)).returns(T.nilable(WorkOS::DataIntegrationAccessTokenResponseAccessToken)) } + def access_token=(value); end + + sig { returns(T.nilable(String)) } + def error; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def error=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integration_access_token_response_access_token.rbi b/rbi/workos/data_integration_access_token_response_access_token.rbi new file mode 100644 index 00000000..54a7a3a3 --- /dev/null +++ b/rbi/workos/data_integration_access_token_response_access_token.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegrationAccessTokenResponseAccessToken + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def access_token; end + + sig { params(value: String).returns(String) } + def access_token=(value); end + + sig { returns(T.nilable(String)) } + def expires_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def expires_at=(value); end + + sig { returns(T::Array[String]) } + def scopes; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def scopes=(value); end + + sig { returns(T::Array[String]) } + def missing_scopes; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def missing_scopes=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integration_authorize_url_response.rbi b/rbi/workos/data_integration_authorize_url_response.rbi new file mode 100644 index 00000000..62e515fb --- /dev/null +++ b/rbi/workos/data_integration_authorize_url_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegrationAuthorizeUrlResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def url; end + + sig { params(value: String).returns(String) } + def url=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi b/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi new file mode 100644 index 00000000..803a4006 --- /dev/null +++ b/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegrationsGetDataIntegrationAuthorizeUrlRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def return_to; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def return_to=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integrations_get_user_token_request.rbi b/rbi/workos/data_integrations_get_user_token_request.rbi new file mode 100644 index 00000000..eb8a0021 --- /dev/null +++ b/rbi/workos/data_integrations_get_user_token_request.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegrationsGetUserTokenRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integrations_list_response.rbi b/rbi/workos/data_integrations_list_response.rbi new file mode 100644 index 00000000..ddd641ba --- /dev/null +++ b/rbi/workos/data_integrations_list_response.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegrationsListResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Array[WorkOS::DataIntegrationsListResponseData]) } + def data; end + + sig { params(value: T::Array[WorkOS::DataIntegrationsListResponseData]).returns(T::Array[WorkOS::DataIntegrationsListResponseData]) } + def data=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integrations_list_response_data.rbi b/rbi/workos/data_integrations_list_response_data.rbi new file mode 100644 index 00000000..c732d527 --- /dev/null +++ b/rbi/workos/data_integrations_list_response_data.rbi @@ -0,0 +1,89 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegrationsListResponseData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def integration_type; end + + sig { params(value: String).returns(String) } + def integration_type=(value); end + + sig { returns(String) } + def credentials_type; end + + sig { params(value: String).returns(String) } + def credentials_type=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def scopes; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def scopes=(value); end + + sig { returns(String) } + def ownership; end + + sig { params(value: String).returns(String) } + def ownership=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T.nilable(WorkOS::DataIntegrationsListResponseDataConnectedAccount)) } + def connected_account; end + + sig { params(value: T.nilable(WorkOS::DataIntegrationsListResponseDataConnectedAccount)).returns(T.nilable(WorkOS::DataIntegrationsListResponseDataConnectedAccount)) } + def connected_account=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/data_integrations_list_response_data_connected_account.rbi b/rbi/workos/data_integrations_list_response_data_connected_account.rbi new file mode 100644 index 00000000..7266a9a7 --- /dev/null +++ b/rbi/workos/data_integrations_list_response_data_connected_account.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DataIntegrationsListResponseDataConnectedAccount + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T::Array[String]) } + def scopes; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def scopes=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T.nilable(String)) } + def userland_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def userland_user_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/device_authorization_response.rbi b/rbi/workos/device_authorization_response.rbi new file mode 100644 index 00000000..fbe536bb --- /dev/null +++ b/rbi/workos/device_authorization_response.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DeviceAuthorizationResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def device_code; end + + sig { params(value: String).returns(String) } + def device_code=(value); end + + sig { returns(String) } + def user_code; end + + sig { params(value: String).returns(String) } + def user_code=(value); end + + sig { returns(String) } + def verification_uri; end + + sig { params(value: String).returns(String) } + def verification_uri=(value); end + + sig { returns(T.nilable(String)) } + def verification_uri_complete; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_uri_complete=(value); end + + sig { returns(Float) } + def expires_in; end + + sig { params(value: Float).returns(Float) } + def expires_in=(value); end + + sig { returns(T.nilable(Float)) } + def interval; end + + sig { params(value: T.nilable(Float)).returns(T.nilable(Float)) } + def interval=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/device_code_session_authenticate_request.rbi b/rbi/workos/device_code_session_authenticate_request.rbi new file mode 100644 index 00000000..53641b01 --- /dev/null +++ b/rbi/workos/device_code_session_authenticate_request.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DeviceCodeSessionAuthenticateRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(String) } + def grant_type; end + + sig { params(value: String).returns(String) } + def grant_type=(value); end + + sig { returns(String) } + def device_code; end + + sig { params(value: String).returns(String) } + def device_code=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def device_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def device_id=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/directory.rbi b/rbi/workos/directory.rbi new file mode 100644 index 00000000..9643760a --- /dev/null +++ b/rbi/workos/directory.rbi @@ -0,0 +1,83 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Directory + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def external_key; end + + sig { params(value: String).returns(String) } + def external_key=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def domain; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def domain=(value); end + + sig { returns(T.nilable(WorkOS::DirectoryMetadata)) } + def metadata; end + + sig { params(value: T.nilable(WorkOS::DirectoryMetadata)).returns(T.nilable(WorkOS::DirectoryMetadata)) } + def metadata=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/directory_group.rbi b/rbi/workos/directory_group.rbi new file mode 100644 index 00000000..46805244 --- /dev/null +++ b/rbi/workos/directory_group.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DirectoryGroup + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def idp_id; end + + sig { params(value: String).returns(String) } + def idp_id=(value); end + + sig { returns(String) } + def directory_id; end + + sig { params(value: String).returns(String) } + def directory_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def raw_attributes; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def raw_attributes=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/directory_metadata.rbi b/rbi/workos/directory_metadata.rbi new file mode 100644 index 00000000..b8ed8de9 --- /dev/null +++ b/rbi/workos/directory_metadata.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DirectoryMetadata + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(WorkOS::DirectoryMetadataUser) } + def users; end + + sig { params(value: WorkOS::DirectoryMetadataUser).returns(WorkOS::DirectoryMetadataUser) } + def users=(value); end + + sig { returns(Integer) } + def groups; end + + sig { params(value: Integer).returns(Integer) } + def groups=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/directory_metadata_user.rbi b/rbi/workos/directory_metadata_user.rbi new file mode 100644 index 00000000..9f7c8da2 --- /dev/null +++ b/rbi/workos/directory_metadata_user.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DirectoryMetadataUser + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(Integer) } + def active; end + + sig { params(value: Integer).returns(Integer) } + def active=(value); end + + sig { returns(Integer) } + def inactive; end + + sig { params(value: Integer).returns(Integer) } + def inactive=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/directory_sync.rbi b/rbi/workos/directory_sync.rbi new file mode 100644 index 00000000..43161514 --- /dev/null +++ b/rbi/workos/directory_sync.rbi @@ -0,0 +1,84 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DirectorySync + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + organization_id: T.nilable(String), + search: T.nilable(String), + domain: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_directories(before:, after:, limit:, order:, organization_id:, search:, domain:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Directory) + end + def get_directory(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_directory(id:, request_options:); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + directory: T.nilable(String), + user: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_groups(before:, after:, limit:, order:, directory:, user:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::DirectoryGroup) + end + def get_group(id:, request_options:); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + directory: T.nilable(String), + group: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_users(before:, after:, limit:, order:, directory:, group:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::DirectoryUserWithGroups) + end + def get_user(id:, request_options:); end + + end +end diff --git a/rbi/workos/directory_user.rbi b/rbi/workos/directory_user.rbi new file mode 100644 index 00000000..68182618 --- /dev/null +++ b/rbi/workos/directory_user.rbi @@ -0,0 +1,125 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DirectoryUser + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def directory_id; end + + sig { params(value: String).returns(String) } + def directory_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def idp_id; end + + sig { params(value: String).returns(String) } + def idp_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::DirectoryUserEmail])) } + def emails; end + + sig { params(value: T.nilable(T::Array[WorkOS::DirectoryUserEmail])).returns(T.nilable(T::Array[WorkOS::DirectoryUserEmail])) } + def emails=(value); end + + sig { returns(T.nilable(String)) } + def job_title; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def job_title=(value); end + + sig { returns(T.nilable(String)) } + def username; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def username=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def raw_attributes; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def raw_attributes=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def custom_attributes; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def custom_attributes=(value); end + + sig { returns(T.nilable(WorkOS::SlimRole)) } + def role; end + + sig { params(value: T.nilable(WorkOS::SlimRole)).returns(T.nilable(WorkOS::SlimRole)) } + def role=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles; end + + sig { params(value: T.nilable(T::Array[WorkOS::SlimRole])).returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/directory_user_email.rbi b/rbi/workos/directory_user_email.rbi new file mode 100644 index 00000000..bf1e5a10 --- /dev/null +++ b/rbi/workos/directory_user_email.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DirectoryUserEmail + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(T::Boolean)) } + def primary; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def primary=(value); end + + sig { returns(T.nilable(String)) } + def type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def type=(value); end + + sig { returns(T.nilable(String)) } + def value; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def value=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/directory_user_with_groups.rbi b/rbi/workos/directory_user_with_groups.rbi new file mode 100644 index 00000000..708bfcd8 --- /dev/null +++ b/rbi/workos/directory_user_with_groups.rbi @@ -0,0 +1,131 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DirectoryUserWithGroups + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def directory_id; end + + sig { params(value: String).returns(String) } + def directory_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def idp_id; end + + sig { params(value: String).returns(String) } + def idp_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::DirectoryUserWithGroupsEmail])) } + def emails; end + + sig { params(value: T.nilable(T::Array[WorkOS::DirectoryUserWithGroupsEmail])).returns(T.nilable(T::Array[WorkOS::DirectoryUserWithGroupsEmail])) } + def emails=(value); end + + sig { returns(T.nilable(String)) } + def job_title; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def job_title=(value); end + + sig { returns(T.nilable(String)) } + def username; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def username=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def raw_attributes; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def raw_attributes=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def custom_attributes; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def custom_attributes=(value); end + + sig { returns(T.nilable(WorkOS::SlimRole)) } + def role; end + + sig { params(value: T.nilable(WorkOS::SlimRole)).returns(T.nilable(WorkOS::SlimRole)) } + def role=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles; end + + sig { params(value: T.nilable(T::Array[WorkOS::SlimRole])).returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Array[WorkOS::DirectoryGroup]) } + def groups; end + + sig { params(value: T::Array[WorkOS::DirectoryGroup]).returns(T::Array[WorkOS::DirectoryGroup]) } + def groups=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/directory_user_with_groups_email.rbi b/rbi/workos/directory_user_with_groups_email.rbi new file mode 100644 index 00000000..dc8d4482 --- /dev/null +++ b/rbi/workos/directory_user_with_groups_email.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DirectoryUserWithGroupsEmail + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(T::Boolean)) } + def primary; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def primary=(value); end + + sig { returns(T.nilable(String)) } + def type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def type=(value); end + + sig { returns(T.nilable(String)) } + def value; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def value=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_activated.rbi b/rbi/workos/dsync_activated.rbi new file mode 100644 index 00000000..a4496855 --- /dev/null +++ b/rbi/workos/dsync_activated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncActivated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::DsyncActivatedData) } + def data; end + + sig { params(value: WorkOS::DsyncActivatedData).returns(WorkOS::DsyncActivatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_activated_data.rbi b/rbi/workos/dsync_activated_data.rbi new file mode 100644 index 00000000..2db20eb4 --- /dev/null +++ b/rbi/workos/dsync_activated_data.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncActivatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(String) } + def external_key; end + + sig { params(value: String).returns(String) } + def external_key=(value); end + + sig { returns(T::Array[WorkOS::DsyncActivatedDataDomain]) } + def domains; end + + sig { params(value: T::Array[WorkOS::DsyncActivatedDataDomain]).returns(T::Array[WorkOS::DsyncActivatedDataDomain]) } + def domains=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_activated_data_domain.rbi b/rbi/workos/dsync_activated_data_domain.rbi new file mode 100644 index 00000000..82e5818f --- /dev/null +++ b/rbi/workos/dsync_activated_data_domain.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncActivatedDataDomain + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_deactivated.rbi b/rbi/workos/dsync_deactivated.rbi new file mode 100644 index 00000000..b9f2ad27 --- /dev/null +++ b/rbi/workos/dsync_deactivated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncDeactivated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::DsyncDeactivatedData) } + def data; end + + sig { params(value: WorkOS::DsyncDeactivatedData).returns(WorkOS::DsyncDeactivatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_deactivated_data.rbi b/rbi/workos/dsync_deactivated_data.rbi new file mode 100644 index 00000000..4ff0cdc4 --- /dev/null +++ b/rbi/workos/dsync_deactivated_data.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncDeactivatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(String) } + def external_key; end + + sig { params(value: String).returns(String) } + def external_key=(value); end + + sig { returns(T::Array[WorkOS::DsyncDeactivatedDataDomain]) } + def domains; end + + sig { params(value: T::Array[WorkOS::DsyncDeactivatedDataDomain]).returns(T::Array[WorkOS::DsyncDeactivatedDataDomain]) } + def domains=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_deactivated_data_domain.rbi b/rbi/workos/dsync_deactivated_data_domain.rbi new file mode 100644 index 00000000..f0564698 --- /dev/null +++ b/rbi/workos/dsync_deactivated_data_domain.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncDeactivatedDataDomain + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_deleted.rbi b/rbi/workos/dsync_deleted.rbi new file mode 100644 index 00000000..6aba9243 --- /dev/null +++ b/rbi/workos/dsync_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::DsyncDeletedData) } + def data; end + + sig { params(value: WorkOS::DsyncDeletedData).returns(WorkOS::DsyncDeletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_deleted_data.rbi b/rbi/workos/dsync_deleted_data.rbi new file mode 100644 index 00000000..ab87c0fa --- /dev/null +++ b/rbi/workos/dsync_deleted_data.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncDeletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_group_created.rbi b/rbi/workos/dsync_group_created.rbi new file mode 100644 index 00000000..fe9321df --- /dev/null +++ b/rbi/workos/dsync_group_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncGroupCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::DirectoryGroup) } + def data; end + + sig { params(value: WorkOS::DirectoryGroup).returns(WorkOS::DirectoryGroup) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_group_deleted.rbi b/rbi/workos/dsync_group_deleted.rbi new file mode 100644 index 00000000..992b7cc6 --- /dev/null +++ b/rbi/workos/dsync_group_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncGroupDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::DirectoryGroup) } + def data; end + + sig { params(value: WorkOS::DirectoryGroup).returns(WorkOS::DirectoryGroup) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_group_updated.rbi b/rbi/workos/dsync_group_updated.rbi new file mode 100644 index 00000000..6551b219 --- /dev/null +++ b/rbi/workos/dsync_group_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncGroupUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::DsyncGroupUpdatedData) } + def data; end + + sig { params(value: WorkOS::DsyncGroupUpdatedData).returns(WorkOS::DsyncGroupUpdatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_group_updated_data.rbi b/rbi/workos/dsync_group_updated_data.rbi new file mode 100644 index 00000000..647a479f --- /dev/null +++ b/rbi/workos/dsync_group_updated_data.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncGroupUpdatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def idp_id; end + + sig { params(value: String).returns(String) } + def idp_id=(value); end + + sig { returns(String) } + def directory_id; end + + sig { params(value: String).returns(String) } + def directory_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def raw_attributes; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def raw_attributes=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def previous_attributes; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def previous_attributes=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_group_user_added.rbi b/rbi/workos/dsync_group_user_added.rbi new file mode 100644 index 00000000..628fae19 --- /dev/null +++ b/rbi/workos/dsync_group_user_added.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncGroupUserAdded + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::DsyncGroupUserAddedData) } + def data; end + + sig { params(value: WorkOS::DsyncGroupUserAddedData).returns(WorkOS::DsyncGroupUserAddedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_group_user_added_data.rbi b/rbi/workos/dsync_group_user_added_data.rbi new file mode 100644 index 00000000..a82881ff --- /dev/null +++ b/rbi/workos/dsync_group_user_added_data.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncGroupUserAddedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def directory_id; end + + sig { params(value: String).returns(String) } + def directory_id=(value); end + + sig { returns(WorkOS::DirectoryUser) } + def user; end + + sig { params(value: WorkOS::DirectoryUser).returns(WorkOS::DirectoryUser) } + def user=(value); end + + sig { returns(WorkOS::DirectoryGroup) } + def group; end + + sig { params(value: WorkOS::DirectoryGroup).returns(WorkOS::DirectoryGroup) } + def group=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_group_user_removed.rbi b/rbi/workos/dsync_group_user_removed.rbi new file mode 100644 index 00000000..648084a6 --- /dev/null +++ b/rbi/workos/dsync_group_user_removed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncGroupUserRemoved + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::DsyncGroupUserRemovedData) } + def data; end + + sig { params(value: WorkOS::DsyncGroupUserRemovedData).returns(WorkOS::DsyncGroupUserRemovedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_group_user_removed_data.rbi b/rbi/workos/dsync_group_user_removed_data.rbi new file mode 100644 index 00000000..7257ba1c --- /dev/null +++ b/rbi/workos/dsync_group_user_removed_data.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncGroupUserRemovedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def directory_id; end + + sig { params(value: String).returns(String) } + def directory_id=(value); end + + sig { returns(WorkOS::DirectoryUser) } + def user; end + + sig { params(value: WorkOS::DirectoryUser).returns(WorkOS::DirectoryUser) } + def user=(value); end + + sig { returns(WorkOS::DirectoryGroup) } + def group; end + + sig { params(value: WorkOS::DirectoryGroup).returns(WorkOS::DirectoryGroup) } + def group=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_user_created.rbi b/rbi/workos/dsync_user_created.rbi new file mode 100644 index 00000000..bb8462a7 --- /dev/null +++ b/rbi/workos/dsync_user_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncUserCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::DirectoryUser) } + def data; end + + sig { params(value: WorkOS::DirectoryUser).returns(WorkOS::DirectoryUser) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_user_deleted.rbi b/rbi/workos/dsync_user_deleted.rbi new file mode 100644 index 00000000..14cc036a --- /dev/null +++ b/rbi/workos/dsync_user_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncUserDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::DirectoryUser) } + def data; end + + sig { params(value: WorkOS::DirectoryUser).returns(WorkOS::DirectoryUser) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_user_updated.rbi b/rbi/workos/dsync_user_updated.rbi new file mode 100644 index 00000000..ffe17df3 --- /dev/null +++ b/rbi/workos/dsync_user_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncUserUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::DsyncUserUpdatedData) } + def data; end + + sig { params(value: WorkOS::DsyncUserUpdatedData).returns(WorkOS::DsyncUserUpdatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_user_updated_data.rbi b/rbi/workos/dsync_user_updated_data.rbi new file mode 100644 index 00000000..ed11b411 --- /dev/null +++ b/rbi/workos/dsync_user_updated_data.rbi @@ -0,0 +1,131 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncUserUpdatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def directory_id; end + + sig { params(value: String).returns(String) } + def directory_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def idp_id; end + + sig { params(value: String).returns(String) } + def idp_id=(value); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::DsyncUserUpdatedDataEmail])) } + def emails; end + + sig { params(value: T.nilable(T::Array[WorkOS::DsyncUserUpdatedDataEmail])).returns(T.nilable(T::Array[WorkOS::DsyncUserUpdatedDataEmail])) } + def emails=(value); end + + sig { returns(T.nilable(String)) } + def job_title; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def job_title=(value); end + + sig { returns(T.nilable(String)) } + def username; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def username=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def raw_attributes; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def raw_attributes=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def custom_attributes; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def custom_attributes=(value); end + + sig { returns(T.nilable(WorkOS::SlimRole)) } + def role; end + + sig { params(value: T.nilable(WorkOS::SlimRole)).returns(T.nilable(WorkOS::SlimRole)) } + def role=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles; end + + sig { params(value: T.nilable(T::Array[WorkOS::SlimRole])).returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def previous_attributes; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def previous_attributes=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/dsync_user_updated_data_email.rbi b/rbi/workos/dsync_user_updated_data_email.rbi new file mode 100644 index 00000000..be555785 --- /dev/null +++ b/rbi/workos/dsync_user_updated_data_email.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DsyncUserUpdatedDataEmail + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(T::Boolean)) } + def primary; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def primary=(value); end + + sig { returns(T.nilable(String)) } + def type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def type=(value); end + + sig { returns(T.nilable(String)) } + def value; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def value=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/email_change.rbi b/rbi/workos/email_change.rbi new file mode 100644 index 00000000..f0d73d5f --- /dev/null +++ b/rbi/workos/email_change.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EmailChange + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(WorkOS::User) } + def user; end + + sig { params(value: WorkOS::User).returns(WorkOS::User) } + def user=(value); end + + sig { returns(String) } + def new_email; end + + sig { params(value: String).returns(String) } + def new_email=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/email_change_confirmation.rbi b/rbi/workos/email_change_confirmation.rbi new file mode 100644 index 00000000..aad0ef58 --- /dev/null +++ b/rbi/workos/email_change_confirmation.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EmailChangeConfirmation + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(WorkOS::EmailChangeConfirmationUser) } + def user; end + + sig { params(value: WorkOS::EmailChangeConfirmationUser).returns(WorkOS::EmailChangeConfirmationUser) } + def user=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/email_change_confirmation_user.rbi b/rbi/workos/email_change_confirmation_user.rbi new file mode 100644 index 00000000..74cc8f10 --- /dev/null +++ b/rbi/workos/email_change_confirmation_user.rbi @@ -0,0 +1,95 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EmailChangeConfirmationUser + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T.nilable(String)) } + def profile_picture_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def profile_picture_url=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Boolean) } + def email_verified; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def email_verified=(value); end + + sig { returns(T.nilable(String)) } + def external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def external_id=(value); end + + sig { returns(T.nilable(T::Hash[String, String])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) } + def metadata=(value); end + + sig { returns(T.nilable(String)) } + def last_sign_in_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_sign_in_at=(value); end + + sig { returns(T.nilable(String)) } + def locale; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def locale=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/email_verification.rbi b/rbi/workos/email_verification.rbi new file mode 100644 index 00000000..b709939a --- /dev/null +++ b/rbi/workos/email_verification.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EmailVerification + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/email_verification_code_session_authenticate_request.rbi b/rbi/workos/email_verification_code_session_authenticate_request.rbi new file mode 100644 index 00000000..cba5dde9 --- /dev/null +++ b/rbi/workos/email_verification_code_session_authenticate_request.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EmailVerificationCodeSessionAuthenticateRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(String) } + def client_secret; end + + sig { params(value: String).returns(String) } + def client_secret=(value); end + + sig { returns(String) } + def grant_type; end + + sig { params(value: String).returns(String) } + def grant_type=(value); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def pending_authentication_token; end + + sig { params(value: String).returns(String) } + def pending_authentication_token=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def device_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def device_id=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/email_verification_created.rbi b/rbi/workos/email_verification_created.rbi new file mode 100644 index 00000000..85582e95 --- /dev/null +++ b/rbi/workos/email_verification_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EmailVerificationCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::EmailVerificationCreatedData) } + def data; end + + sig { params(value: WorkOS::EmailVerificationCreatedData).returns(WorkOS::EmailVerificationCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/email_verification_created_data.rbi b/rbi/workos/email_verification_created_data.rbi new file mode 100644 index 00000000..fed19236 --- /dev/null +++ b/rbi/workos/email_verification_created_data.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EmailVerificationCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/enroll_user_authentication_factor.rbi b/rbi/workos/enroll_user_authentication_factor.rbi new file mode 100644 index 00000000..0b24512d --- /dev/null +++ b/rbi/workos/enroll_user_authentication_factor.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EnrollUserAuthenticationFactor + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(T.nilable(String)) } + def totp_issuer; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def totp_issuer=(value); end + + sig { returns(T.nilable(String)) } + def totp_user; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def totp_user=(value); end + + sig { returns(T.nilable(String)) } + def totp_secret; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def totp_secret=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/event_context.rbi b/rbi/workos/event_context.rbi new file mode 100644 index 00000000..fa51ebd6 --- /dev/null +++ b/rbi/workos/event_context.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EventContext + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def google_analytics_client_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def google_analytics_client_id=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::EventContextGoogleAnalyticsSession])) } + def google_analytics_sessions; end + + sig { params(value: T.nilable(T::Array[WorkOS::EventContextGoogleAnalyticsSession])).returns(T.nilable(T::Array[WorkOS::EventContextGoogleAnalyticsSession])) } + def google_analytics_sessions=(value); end + + sig { returns(T.nilable(String)) } + def ajs_anonymous_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ajs_anonymous_id=(value); end + + sig { returns(T.nilable(String)) } + def client_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def client_id=(value); end + + sig { returns(T.nilable(WorkOS::EventContextActor)) } + def actor; end + + sig { params(value: T.nilable(WorkOS::EventContextActor)).returns(T.nilable(WorkOS::EventContextActor)) } + def actor=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def previous_attributes; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def previous_attributes=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/event_context_actor.rbi b/rbi/workos/event_context_actor.rbi new file mode 100644 index 00000000..a004a019 --- /dev/null +++ b/rbi/workos/event_context_actor.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EventContextActor + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def source; end + + sig { params(value: String).returns(String) } + def source=(value); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/event_context_google_analytics_session.rbi b/rbi/workos/event_context_google_analytics_session.rbi new file mode 100644 index 00000000..7cb1048c --- /dev/null +++ b/rbi/workos/event_context_google_analytics_session.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EventContextGoogleAnalyticsSession + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def container_id; end + + sig { params(value: String).returns(String) } + def container_id=(value); end + + sig { returns(T.nilable(String)) } + def session_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def session_id=(value); end + + sig { returns(T.nilable(String)) } + def session_number; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def session_number=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/event_list_list_metadata.rbi b/rbi/workos/event_list_list_metadata.rbi new file mode 100644 index 00000000..4d427e29 --- /dev/null +++ b/rbi/workos/event_list_list_metadata.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EventListListMetadata + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def after; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def after=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/event_schema.rbi b/rbi/workos/event_schema.rbi new file mode 100644 index 00000000..3528f55c --- /dev/null +++ b/rbi/workos/event_schema.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class EventSchema + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def data; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def context; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def context=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/events.rbi b/rbi/workos/events.rbi new file mode 100644 index 00000000..06c03bcb --- /dev/null +++ b/rbi/workos/events.rbi @@ -0,0 +1,27 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Events + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + events: T.nilable(T::Array[String]), + range_start: T.nilable(String), + range_end: T.nilable(String), + organization_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_events(before:, after:, limit:, order:, events:, range_start:, range_end:, organization_id:, request_options:); end + + end +end diff --git a/rbi/workos/external_auth_complete_response.rbi b/rbi/workos/external_auth_complete_response.rbi new file mode 100644 index 00000000..bc50335b --- /dev/null +++ b/rbi/workos/external_auth_complete_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ExternalAuthCompleteResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def redirect_uri; end + + sig { params(value: String).returns(String) } + def redirect_uri=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/feature_flag.rbi b/rbi/workos/feature_flag.rbi new file mode 100644 index 00000000..2f6f9ccc --- /dev/null +++ b/rbi/workos/feature_flag.rbi @@ -0,0 +1,83 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FeatureFlag + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(WorkOS::FeatureFlagOwner)) } + def owner; end + + sig { params(value: T.nilable(WorkOS::FeatureFlagOwner)).returns(T.nilable(WorkOS::FeatureFlagOwner)) } + def owner=(value); end + + sig { returns(T::Array[String]) } + def tags; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def tags=(value); end + + sig { returns(T::Boolean) } + def enabled; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def enabled=(value); end + + sig { returns(T::Boolean) } + def default_value; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def default_value=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/feature_flag_owner.rbi b/rbi/workos/feature_flag_owner.rbi new file mode 100644 index 00000000..01e0966e --- /dev/null +++ b/rbi/workos/feature_flag_owner.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FeatureFlagOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/feature_flags.rbi b/rbi/workos/feature_flags.rbi new file mode 100644 index 00000000..0697e13a --- /dev/null +++ b/rbi/workos/feature_flags.rbi @@ -0,0 +1,89 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FeatureFlags + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_feature_flags(before:, after:, limit:, order:, request_options:); end + + sig do + params( + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Flag) + end + def get_feature_flag(slug:, request_options:); end + + sig do + params( + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::FeatureFlag) + end + def disable_feature_flag(slug:, request_options:); end + + sig do + params( + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::FeatureFlag) + end + def enable_feature_flag(slug:, request_options:); end + + sig do + params( + resource_id: String, + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def add_flag_target(resource_id:, slug:, request_options:); end + + sig do + params( + resource_id: String, + slug: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def remove_flag_target(resource_id:, slug:, request_options:); end + + sig do + params( + organization_id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_organization_feature_flags(organization_id:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + user_id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_user_feature_flags(user_id:, before:, after:, limit:, order:, request_options:); end + + end +end diff --git a/rbi/workos/flag.rbi b/rbi/workos/flag.rbi new file mode 100644 index 00000000..d78ffaef --- /dev/null +++ b/rbi/workos/flag.rbi @@ -0,0 +1,83 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Flag + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(WorkOS::FlagOwner)) } + def owner; end + + sig { params(value: T.nilable(WorkOS::FlagOwner)).returns(T.nilable(WorkOS::FlagOwner)) } + def owner=(value); end + + sig { returns(T::Array[String]) } + def tags; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def tags=(value); end + + sig { returns(T::Boolean) } + def enabled; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def enabled=(value); end + + sig { returns(T::Boolean) } + def default_value; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def default_value=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_created.rbi b/rbi/workos/flag_created.rbi new file mode 100644 index 00000000..1347f936 --- /dev/null +++ b/rbi/workos/flag_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::FlagCreatedData) } + def data; end + + sig { params(value: WorkOS::FlagCreatedData).returns(WorkOS::FlagCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(WorkOS::FlagCreatedContext) } + def context; end + + sig { params(value: WorkOS::FlagCreatedContext).returns(WorkOS::FlagCreatedContext) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_created_context.rbi b/rbi/workos/flag_created_context.rbi new file mode 100644 index 00000000..f15e2d00 --- /dev/null +++ b/rbi/workos/flag_created_context.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagCreatedContext + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(WorkOS::FlagCreatedContextActor) } + def actor; end + + sig { params(value: WorkOS::FlagCreatedContextActor).returns(WorkOS::FlagCreatedContextActor) } + def actor=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_created_context_actor.rbi b/rbi/workos/flag_created_context_actor.rbi new file mode 100644 index 00000000..dfbb7b3b --- /dev/null +++ b/rbi/workos/flag_created_context_actor.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagCreatedContextActor + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def source; end + + sig { params(value: String).returns(String) } + def source=(value); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_created_data.rbi b/rbi/workos/flag_created_data.rbi new file mode 100644 index 00000000..b137797c --- /dev/null +++ b/rbi/workos/flag_created_data.rbi @@ -0,0 +1,89 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def environment_id; end + + sig { params(value: String).returns(String) } + def environment_id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(WorkOS::FlagCreatedDataOwner)) } + def owner; end + + sig { params(value: T.nilable(WorkOS::FlagCreatedDataOwner)).returns(T.nilable(WorkOS::FlagCreatedDataOwner)) } + def owner=(value); end + + sig { returns(T::Array[String]) } + def tags; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def tags=(value); end + + sig { returns(T::Boolean) } + def enabled; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def enabled=(value); end + + sig { returns(T::Boolean) } + def default_value; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def default_value=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_created_data_owner.rbi b/rbi/workos/flag_created_data_owner.rbi new file mode 100644 index 00000000..bcd69499 --- /dev/null +++ b/rbi/workos/flag_created_data_owner.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagCreatedDataOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_deleted.rbi b/rbi/workos/flag_deleted.rbi new file mode 100644 index 00000000..c288e0e4 --- /dev/null +++ b/rbi/workos/flag_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::FlagDeletedData) } + def data; end + + sig { params(value: WorkOS::FlagDeletedData).returns(WorkOS::FlagDeletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(WorkOS::FlagDeletedContext) } + def context; end + + sig { params(value: WorkOS::FlagDeletedContext).returns(WorkOS::FlagDeletedContext) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_deleted_context.rbi b/rbi/workos/flag_deleted_context.rbi new file mode 100644 index 00000000..22a4cef8 --- /dev/null +++ b/rbi/workos/flag_deleted_context.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagDeletedContext + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(WorkOS::FlagDeletedContextActor) } + def actor; end + + sig { params(value: WorkOS::FlagDeletedContextActor).returns(WorkOS::FlagDeletedContextActor) } + def actor=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_deleted_context_actor.rbi b/rbi/workos/flag_deleted_context_actor.rbi new file mode 100644 index 00000000..8c8657d3 --- /dev/null +++ b/rbi/workos/flag_deleted_context_actor.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagDeletedContextActor + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def source; end + + sig { params(value: String).returns(String) } + def source=(value); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_deleted_data.rbi b/rbi/workos/flag_deleted_data.rbi new file mode 100644 index 00000000..3702853a --- /dev/null +++ b/rbi/workos/flag_deleted_data.rbi @@ -0,0 +1,89 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagDeletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def environment_id; end + + sig { params(value: String).returns(String) } + def environment_id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(WorkOS::FlagDeletedDataOwner)) } + def owner; end + + sig { params(value: T.nilable(WorkOS::FlagDeletedDataOwner)).returns(T.nilable(WorkOS::FlagDeletedDataOwner)) } + def owner=(value); end + + sig { returns(T::Array[String]) } + def tags; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def tags=(value); end + + sig { returns(T::Boolean) } + def enabled; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def enabled=(value); end + + sig { returns(T::Boolean) } + def default_value; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def default_value=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_deleted_data_owner.rbi b/rbi/workos/flag_deleted_data_owner.rbi new file mode 100644 index 00000000..15c42591 --- /dev/null +++ b/rbi/workos/flag_deleted_data_owner.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagDeletedDataOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_owner.rbi b/rbi/workos/flag_owner.rbi new file mode 100644 index 00000000..d37e4d94 --- /dev/null +++ b/rbi/workos/flag_owner.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated.rbi b/rbi/workos/flag_rule_updated.rbi new file mode 100644 index 00000000..fed6bf00 --- /dev/null +++ b/rbi/workos/flag_rule_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::FlagRuleUpdatedData) } + def data; end + + sig { params(value: WorkOS::FlagRuleUpdatedData).returns(WorkOS::FlagRuleUpdatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(WorkOS::FlagRuleUpdatedContext) } + def context; end + + sig { params(value: WorkOS::FlagRuleUpdatedContext).returns(WorkOS::FlagRuleUpdatedContext) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_context.rbi b/rbi/workos/flag_rule_updated_context.rbi new file mode 100644 index 00000000..fda7617c --- /dev/null +++ b/rbi/workos/flag_rule_updated_context.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedContext + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(WorkOS::FlagRuleUpdatedContextActor) } + def actor; end + + sig { params(value: WorkOS::FlagRuleUpdatedContextActor).returns(WorkOS::FlagRuleUpdatedContextActor) } + def actor=(value); end + + sig { returns(String) } + def access_type; end + + sig { params(value: String).returns(String) } + def access_type=(value); end + + sig { returns(WorkOS::FlagRuleUpdatedContextConfiguredTarget) } + def configured_targets; end + + sig { params(value: WorkOS::FlagRuleUpdatedContextConfiguredTarget).returns(WorkOS::FlagRuleUpdatedContextConfiguredTarget) } + def configured_targets=(value); end + + sig { returns(WorkOS::FlagRuleUpdatedContextPreviousAttribute) } + def previous_attributes; end + + sig { params(value: WorkOS::FlagRuleUpdatedContextPreviousAttribute).returns(WorkOS::FlagRuleUpdatedContextPreviousAttribute) } + def previous_attributes=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_context_actor.rbi b/rbi/workos/flag_rule_updated_context_actor.rbi new file mode 100644 index 00000000..0aedc7e2 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_actor.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedContextActor + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def source; end + + sig { params(value: String).returns(String) } + def source=(value); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_context_configured_target.rbi b/rbi/workos/flag_rule_updated_context_configured_target.rbi new file mode 100644 index 00000000..a18fa0f9 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_configured_target.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedContextConfiguredTarget + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T::Array[WorkOS::FlagRuleUpdatedContextConfiguredTargetOrganization]) } + def organizations; end + + sig { params(value: T::Array[WorkOS::FlagRuleUpdatedContextConfiguredTargetOrganization]).returns(T::Array[WorkOS::FlagRuleUpdatedContextConfiguredTargetOrganization]) } + def organizations=(value); end + + sig { returns(T::Array[WorkOS::FlagRuleUpdatedContextConfiguredTargetUser]) } + def users; end + + sig { params(value: T::Array[WorkOS::FlagRuleUpdatedContextConfiguredTargetUser]).returns(T::Array[WorkOS::FlagRuleUpdatedContextConfiguredTargetUser]) } + def users=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_context_configured_target_organization.rbi b/rbi/workos/flag_rule_updated_context_configured_target_organization.rbi new file mode 100644 index 00000000..b7b8c664 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_configured_target_organization.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedContextConfiguredTargetOrganization + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_context_configured_target_user.rbi b/rbi/workos/flag_rule_updated_context_configured_target_user.rbi new file mode 100644 index 00000000..e96d1356 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_configured_target_user.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedContextConfiguredTargetUser + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute.rbi new file mode 100644 index 00000000..ff1739c8 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedContextPreviousAttribute + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(WorkOS::FlagRuleUpdatedContextPreviousAttributeData)) } + def data; end + + sig { params(value: T.nilable(WorkOS::FlagRuleUpdatedContextPreviousAttributeData)).returns(T.nilable(WorkOS::FlagRuleUpdatedContextPreviousAttributeData)) } + def data=(value); end + + sig { returns(T.nilable(WorkOS::FlagRuleUpdatedContextPreviousAttributeContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::FlagRuleUpdatedContextPreviousAttributeContext)).returns(T.nilable(WorkOS::FlagRuleUpdatedContextPreviousAttributeContext)) } + def context=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute_context.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute_context.rbi new file mode 100644 index 00000000..5a2072f8 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedContextPreviousAttributeContext + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def access_type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def access_type=(value); end + + sig { returns(T.nilable(WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget)) } + def configured_targets; end + + sig { params(value: T.nilable(WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget)).returns(T.nilable(WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget)) } + def configured_targets=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target.rbi new file mode 100644 index 00000000..eee60924 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T::Array[WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization]) } + def organizations; end + + sig { params(value: T::Array[WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization]).returns(T::Array[WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization]) } + def organizations=(value); end + + sig { returns(T::Array[WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser]) } + def users; end + + sig { params(value: T::Array[WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser]).returns(T::Array[WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser]) } + def users=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rbi new file mode 100644 index 00000000..34faff98 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_user.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_user.rbi new file mode 100644 index 00000000..2061b4e6 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_user.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute_data.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute_data.rbi new file mode 100644 index 00000000..46afa87f --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_data.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedContextPreviousAttributeData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(T::Boolean)) } + def enabled; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def enabled=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def default_value; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def default_value=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_data.rbi b/rbi/workos/flag_rule_updated_data.rbi new file mode 100644 index 00000000..4153b1f0 --- /dev/null +++ b/rbi/workos/flag_rule_updated_data.rbi @@ -0,0 +1,89 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def environment_id; end + + sig { params(value: String).returns(String) } + def environment_id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(WorkOS::FlagRuleUpdatedDataOwner)) } + def owner; end + + sig { params(value: T.nilable(WorkOS::FlagRuleUpdatedDataOwner)).returns(T.nilable(WorkOS::FlagRuleUpdatedDataOwner)) } + def owner=(value); end + + sig { returns(T::Array[String]) } + def tags; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def tags=(value); end + + sig { returns(T::Boolean) } + def enabled; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def enabled=(value); end + + sig { returns(T::Boolean) } + def default_value; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def default_value=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_rule_updated_data_owner.rbi b/rbi/workos/flag_rule_updated_data_owner.rbi new file mode 100644 index 00000000..ffd44107 --- /dev/null +++ b/rbi/workos/flag_rule_updated_data_owner.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagRuleUpdatedDataOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_updated.rbi b/rbi/workos/flag_updated.rbi new file mode 100644 index 00000000..49c1645f --- /dev/null +++ b/rbi/workos/flag_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::FlagUpdatedData) } + def data; end + + sig { params(value: WorkOS::FlagUpdatedData).returns(WorkOS::FlagUpdatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(WorkOS::FlagUpdatedContext) } + def context; end + + sig { params(value: WorkOS::FlagUpdatedContext).returns(WorkOS::FlagUpdatedContext) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_updated_context.rbi b/rbi/workos/flag_updated_context.rbi new file mode 100644 index 00000000..dda52bb1 --- /dev/null +++ b/rbi/workos/flag_updated_context.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagUpdatedContext + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(WorkOS::FlagUpdatedContextActor) } + def actor; end + + sig { params(value: WorkOS::FlagUpdatedContextActor).returns(WorkOS::FlagUpdatedContextActor) } + def actor=(value); end + + sig { returns(T.nilable(WorkOS::FlagUpdatedContextPreviousAttribute)) } + def previous_attributes; end + + sig { params(value: T.nilable(WorkOS::FlagUpdatedContextPreviousAttribute)).returns(T.nilable(WorkOS::FlagUpdatedContextPreviousAttribute)) } + def previous_attributes=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_updated_context_actor.rbi b/rbi/workos/flag_updated_context_actor.rbi new file mode 100644 index 00000000..9207b59c --- /dev/null +++ b/rbi/workos/flag_updated_context_actor.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagUpdatedContextActor + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def source; end + + sig { params(value: String).returns(String) } + def source=(value); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_updated_context_previous_attribute.rbi b/rbi/workos/flag_updated_context_previous_attribute.rbi new file mode 100644 index 00000000..2c38186e --- /dev/null +++ b/rbi/workos/flag_updated_context_previous_attribute.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagUpdatedContextPreviousAttribute + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(WorkOS::FlagUpdatedContextPreviousAttributeData)) } + def data; end + + sig { params(value: T.nilable(WorkOS::FlagUpdatedContextPreviousAttributeData)).returns(T.nilable(WorkOS::FlagUpdatedContextPreviousAttributeData)) } + def data=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_updated_context_previous_attribute_data.rbi b/rbi/workos/flag_updated_context_previous_attribute_data.rbi new file mode 100644 index 00000000..3a5d6980 --- /dev/null +++ b/rbi/workos/flag_updated_context_previous_attribute_data.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagUpdatedContextPreviousAttributeData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def tags; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def tags=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def enabled; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def enabled=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def default_value; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def default_value=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_updated_data.rbi b/rbi/workos/flag_updated_data.rbi new file mode 100644 index 00000000..84603121 --- /dev/null +++ b/rbi/workos/flag_updated_data.rbi @@ -0,0 +1,89 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagUpdatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def environment_id; end + + sig { params(value: String).returns(String) } + def environment_id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(WorkOS::FlagUpdatedDataOwner)) } + def owner; end + + sig { params(value: T.nilable(WorkOS::FlagUpdatedDataOwner)).returns(T.nilable(WorkOS::FlagUpdatedDataOwner)) } + def owner=(value); end + + sig { returns(T::Array[String]) } + def tags; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def tags=(value); end + + sig { returns(T::Boolean) } + def enabled; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def enabled=(value); end + + sig { returns(T::Boolean) } + def default_value; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def default_value=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/flag_updated_data_owner.rbi b/rbi/workos/flag_updated_data_owner.rbi new file mode 100644 index 00000000..7f0c8cb2 --- /dev/null +++ b/rbi/workos/flag_updated_data_owner.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class FlagUpdatedDataOwner + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/generate_link.rbi b/rbi/workos/generate_link.rbi new file mode 100644 index 00000000..279e2699 --- /dev/null +++ b/rbi/workos/generate_link.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class GenerateLink + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def return_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def return_url=(value); end + + sig { returns(T.nilable(String)) } + def success_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def success_url=(value); end + + sig { returns(String) } + def organization; end + + sig { params(value: String).returns(String) } + def organization=(value); end + + sig { returns(T.nilable(String)) } + def intent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def intent=(value); end + + sig { returns(T.nilable(WorkOS::IntentOptions)) } + def intent_options; end + + sig { params(value: T.nilable(WorkOS::IntentOptions)).returns(T.nilable(WorkOS::IntentOptions)) } + def intent_options=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def admin_emails; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def admin_emails=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/group.rbi b/rbi/workos/group.rbi new file mode 100644 index 00000000..3b2df923 --- /dev/null +++ b/rbi/workos/group.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Group + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/group_created.rbi b/rbi/workos/group_created.rbi new file mode 100644 index 00000000..67fbe903 --- /dev/null +++ b/rbi/workos/group_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class GroupCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::Group) } + def data; end + + sig { params(value: WorkOS::Group).returns(WorkOS::Group) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/group_deleted.rbi b/rbi/workos/group_deleted.rbi new file mode 100644 index 00000000..7a301d76 --- /dev/null +++ b/rbi/workos/group_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class GroupDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::Group) } + def data; end + + sig { params(value: WorkOS::Group).returns(WorkOS::Group) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/group_member_added.rbi b/rbi/workos/group_member_added.rbi new file mode 100644 index 00000000..eaf82143 --- /dev/null +++ b/rbi/workos/group_member_added.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class GroupMemberAdded + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::GroupMemberAddedData) } + def data; end + + sig { params(value: WorkOS::GroupMemberAddedData).returns(WorkOS::GroupMemberAddedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/group_member_added_data.rbi b/rbi/workos/group_member_added_data.rbi new file mode 100644 index 00000000..9f4ba621 --- /dev/null +++ b/rbi/workos/group_member_added_data.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class GroupMemberAddedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def group_id; end + + sig { params(value: String).returns(String) } + def group_id=(value); end + + sig { returns(String) } + def organization_membership_id; end + + sig { params(value: String).returns(String) } + def organization_membership_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/group_member_removed.rbi b/rbi/workos/group_member_removed.rbi new file mode 100644 index 00000000..b783ec2e --- /dev/null +++ b/rbi/workos/group_member_removed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class GroupMemberRemoved + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::GroupMemberRemovedData) } + def data; end + + sig { params(value: WorkOS::GroupMemberRemovedData).returns(WorkOS::GroupMemberRemovedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/group_member_removed_data.rbi b/rbi/workos/group_member_removed_data.rbi new file mode 100644 index 00000000..79eb768c --- /dev/null +++ b/rbi/workos/group_member_removed_data.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class GroupMemberRemovedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def group_id; end + + sig { params(value: String).returns(String) } + def group_id=(value); end + + sig { returns(String) } + def organization_membership_id; end + + sig { params(value: String).returns(String) } + def organization_membership_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/group_updated.rbi b/rbi/workos/group_updated.rbi new file mode 100644 index 00000000..7a905c86 --- /dev/null +++ b/rbi/workos/group_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class GroupUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::Group) } + def data; end + + sig { params(value: WorkOS::Group).returns(WorkOS::Group) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/intent_options.rbi b/rbi/workos/intent_options.rbi new file mode 100644 index 00000000..dc55f9db --- /dev/null +++ b/rbi/workos/intent_options.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class IntentOptions + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(WorkOS::SSOIntentOptions) } + def sso; end + + sig { params(value: WorkOS::SSOIntentOptions).returns(WorkOS::SSOIntentOptions) } + def sso=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/invitation.rbi b/rbi/workos/invitation.rbi new file mode 100644 index 00000000..26694f42 --- /dev/null +++ b/rbi/workos/invitation.rbi @@ -0,0 +1,101 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Invitation + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def accepted_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_at=(value); end + + sig { returns(T.nilable(String)) } + def revoked_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def revoked_at=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def inviter_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def inviter_user_id=(value); end + + sig { returns(T.nilable(String)) } + def accepted_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_user_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(String) } + def token; end + + sig { params(value: String).returns(String) } + def token=(value); end + + sig { returns(String) } + def accept_invitation_url; end + + sig { params(value: String).returns(String) } + def accept_invitation_url=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/invitation_accepted.rbi b/rbi/workos/invitation_accepted.rbi new file mode 100644 index 00000000..ee8264e6 --- /dev/null +++ b/rbi/workos/invitation_accepted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class InvitationAccepted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::InvitationAcceptedData) } + def data; end + + sig { params(value: WorkOS::InvitationAcceptedData).returns(WorkOS::InvitationAcceptedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/invitation_accepted_data.rbi b/rbi/workos/invitation_accepted_data.rbi new file mode 100644 index 00000000..92cb681e --- /dev/null +++ b/rbi/workos/invitation_accepted_data.rbi @@ -0,0 +1,89 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class InvitationAcceptedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def accepted_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_at=(value); end + + sig { returns(T.nilable(String)) } + def revoked_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def revoked_at=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def inviter_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def inviter_user_id=(value); end + + sig { returns(T.nilable(String)) } + def accepted_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_user_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/invitation_created.rbi b/rbi/workos/invitation_created.rbi new file mode 100644 index 00000000..502919a4 --- /dev/null +++ b/rbi/workos/invitation_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class InvitationCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::InvitationCreatedData) } + def data; end + + sig { params(value: WorkOS::InvitationCreatedData).returns(WorkOS::InvitationCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/invitation_created_data.rbi b/rbi/workos/invitation_created_data.rbi new file mode 100644 index 00000000..0b239477 --- /dev/null +++ b/rbi/workos/invitation_created_data.rbi @@ -0,0 +1,89 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class InvitationCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def accepted_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_at=(value); end + + sig { returns(T.nilable(String)) } + def revoked_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def revoked_at=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def inviter_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def inviter_user_id=(value); end + + sig { returns(T.nilable(String)) } + def accepted_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_user_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/invitation_resent.rbi b/rbi/workos/invitation_resent.rbi new file mode 100644 index 00000000..cdb11ecb --- /dev/null +++ b/rbi/workos/invitation_resent.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class InvitationResent + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::InvitationResentData) } + def data; end + + sig { params(value: WorkOS::InvitationResentData).returns(WorkOS::InvitationResentData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/invitation_resent_data.rbi b/rbi/workos/invitation_resent_data.rbi new file mode 100644 index 00000000..e1a5acdb --- /dev/null +++ b/rbi/workos/invitation_resent_data.rbi @@ -0,0 +1,89 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class InvitationResentData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def accepted_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_at=(value); end + + sig { returns(T.nilable(String)) } + def revoked_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def revoked_at=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def inviter_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def inviter_user_id=(value); end + + sig { returns(T.nilable(String)) } + def accepted_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_user_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/invitation_revoked.rbi b/rbi/workos/invitation_revoked.rbi new file mode 100644 index 00000000..a2a784d0 --- /dev/null +++ b/rbi/workos/invitation_revoked.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class InvitationRevoked + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::InvitationRevokedData) } + def data; end + + sig { params(value: WorkOS::InvitationRevokedData).returns(WorkOS::InvitationRevokedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/invitation_revoked_data.rbi b/rbi/workos/invitation_revoked_data.rbi new file mode 100644 index 00000000..ea40a229 --- /dev/null +++ b/rbi/workos/invitation_revoked_data.rbi @@ -0,0 +1,89 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class InvitationRevokedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def accepted_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_at=(value); end + + sig { returns(T.nilable(String)) } + def revoked_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def revoked_at=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def inviter_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def inviter_user_id=(value); end + + sig { returns(T.nilable(String)) } + def accepted_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_user_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/jwks_response.rbi b/rbi/workos/jwks_response.rbi new file mode 100644 index 00000000..6c98b7be --- /dev/null +++ b/rbi/workos/jwks_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class JwksResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T::Array[WorkOS::JwksResponseKeys]) } + def keys; end + + sig { params(value: T::Array[WorkOS::JwksResponseKeys]).returns(T::Array[WorkOS::JwksResponseKeys]) } + def keys=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/jwks_response_keys.rbi b/rbi/workos/jwks_response_keys.rbi new file mode 100644 index 00000000..349e7c48 --- /dev/null +++ b/rbi/workos/jwks_response_keys.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class JwksResponseKeys + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def alg; end + + sig { params(value: String).returns(String) } + def alg=(value); end + + sig { returns(String) } + def kty; end + + sig { params(value: String).returns(String) } + def kty=(value); end + + sig { returns(String) } + def use; end + + sig { params(value: String).returns(String) } + def use=(value); end + + sig { returns(T::Array[String]) } + def x_5_c; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def x_5_c=(value); end + + sig { returns(String) } + def n; end + + sig { params(value: String).returns(String) } + def n=(value); end + + sig { returns(String) } + def e; end + + sig { params(value: String).returns(String) } + def e=(value); end + + sig { returns(String) } + def kid; end + + sig { params(value: String).returns(String) } + def kid=(value); end + + sig { returns(String) } + def x_5_t_s_256; end + + sig { params(value: String).returns(String) } + def x_5_t_s_256=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/jwt_template_response.rbi b/rbi/workos/jwt_template_response.rbi new file mode 100644 index 00000000..f992a7e0 --- /dev/null +++ b/rbi/workos/jwt_template_response.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class JWTTemplateResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def content; end + + sig { params(value: String).returns(String) } + def content=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/magic_auth.rbi b/rbi/workos/magic_auth.rbi new file mode 100644 index 00000000..7391ab80 --- /dev/null +++ b/rbi/workos/magic_auth.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class MagicAuth + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/magic_auth_code_session_authenticate_request.rbi b/rbi/workos/magic_auth_code_session_authenticate_request.rbi new file mode 100644 index 00000000..d3272bff --- /dev/null +++ b/rbi/workos/magic_auth_code_session_authenticate_request.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class MagicAuthCodeSessionAuthenticateRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(String) } + def client_secret; end + + sig { params(value: String).returns(String) } + def client_secret=(value); end + + sig { returns(String) } + def grant_type; end + + sig { params(value: String).returns(String) } + def grant_type=(value); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def invitation_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def invitation_token=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def device_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def device_id=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/magic_auth_created.rbi b/rbi/workos/magic_auth_created.rbi new file mode 100644 index 00000000..811b2db3 --- /dev/null +++ b/rbi/workos/magic_auth_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class MagicAuthCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::MagicAuthCreatedData) } + def data; end + + sig { params(value: WorkOS::MagicAuthCreatedData).returns(WorkOS::MagicAuthCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/magic_auth_created_data.rbi b/rbi/workos/magic_auth_created_data.rbi new file mode 100644 index 00000000..d5028ce9 --- /dev/null +++ b/rbi/workos/magic_auth_created_data.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class MagicAuthCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/mfa_totp_session_authenticate_request.rbi b/rbi/workos/mfa_totp_session_authenticate_request.rbi new file mode 100644 index 00000000..c27d73d5 --- /dev/null +++ b/rbi/workos/mfa_totp_session_authenticate_request.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class MFATotpSessionAuthenticateRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(String) } + def client_secret; end + + sig { params(value: String).returns(String) } + def client_secret=(value); end + + sig { returns(String) } + def grant_type; end + + sig { params(value: String).returns(String) } + def grant_type=(value); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def pending_authentication_token; end + + sig { params(value: String).returns(String) } + def pending_authentication_token=(value); end + + sig { returns(String) } + def authentication_challenge_id; end + + sig { params(value: String).returns(String) } + def authentication_challenge_id=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def device_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def device_id=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/multi_factor_auth.rbi b/rbi/workos/multi_factor_auth.rbi new file mode 100644 index 00000000..4d501310 --- /dev/null +++ b/rbi/workos/multi_factor_auth.rbi @@ -0,0 +1,82 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class MultiFactorAuth + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + id: String, + code: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthenticationChallengeVerifyResponse) + end + def verify_challenge(id:, code:, request_options:); end + + sig do + params( + type: String, + phone_number: T.nilable(String), + totp_issuer: T.nilable(String), + totp_user: T.nilable(String), + user_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthenticationFactorEnrolled) + end + def enroll_factor(type:, phone_number:, totp_issuer:, totp_user:, user_id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthenticationFactor) + end + def get_factor(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_factor(id:, request_options:); end + + sig do + params( + id: String, + sms_template: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthenticationChallenge) + end + def challenge_factor(id:, sms_template:, request_options:); end + + sig do + params( + userland_user_id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_user_auth_factors(userland_user_id:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + userland_user_id: String, + type: String, + totp_issuer: T.nilable(String), + totp_user: T.nilable(String), + totp_secret: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::UserAuthenticationFactorEnrollResponse) + end + def create_user_auth_factor(userland_user_id:, type:, totp_issuer:, totp_user:, totp_secret:, request_options:); end + + end +end diff --git a/rbi/workos/new_connect_application_secret.rbi b/rbi/workos/new_connect_application_secret.rbi new file mode 100644 index 00000000..e5df458b --- /dev/null +++ b/rbi/workos/new_connect_application_secret.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class NewConnectApplicationSecret + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def secret_hint; end + + sig { params(value: String).returns(String) } + def secret_hint=(value); end + + sig { returns(T.nilable(String)) } + def last_used_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_used_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(String) } + def secret; end + + sig { params(value: String).returns(String) } + def secret=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization.rbi b/rbi/workos/organization.rbi new file mode 100644 index 00000000..12b14bcd --- /dev/null +++ b/rbi/workos/organization.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Organization + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T::Array[WorkOS::OrganizationDomain]) } + def domains; end + + sig { params(value: T::Array[WorkOS::OrganizationDomain]).returns(T::Array[WorkOS::OrganizationDomain]) } + def domains=(value); end + + sig { returns(T::Hash[String, String]) } + def metadata; end + + sig { params(value: T::Hash[String, String]).returns(T::Hash[String, String]) } + def metadata=(value); end + + sig { returns(T.nilable(String)) } + def external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def external_id=(value); end + + sig { returns(T.nilable(String)) } + def stripe_customer_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def stripe_customer_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def allow_profiles_outside_organization; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def allow_profiles_outside_organization=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_created.rbi b/rbi/workos/organization_created.rbi new file mode 100644 index 00000000..79b6f27e --- /dev/null +++ b/rbi/workos/organization_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationCreatedData) } + def data; end + + sig { params(value: WorkOS::OrganizationCreatedData).returns(WorkOS::OrganizationCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_created_data.rbi b/rbi/workos/organization_created_data.rbi new file mode 100644 index 00000000..fe881206 --- /dev/null +++ b/rbi/workos/organization_created_data.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T::Array[WorkOS::OrganizationCreatedDataDomain]) } + def domains; end + + sig { params(value: T::Array[WorkOS::OrganizationCreatedDataDomain]).returns(T::Array[WorkOS::OrganizationCreatedDataDomain]) } + def domains=(value); end + + sig { returns(T::Hash[String, String]) } + def metadata; end + + sig { params(value: T::Hash[String, String]).returns(T::Hash[String, String]) } + def metadata=(value); end + + sig { returns(T.nilable(String)) } + def external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def external_id=(value); end + + sig { returns(T.nilable(String)) } + def stripe_customer_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def stripe_customer_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_created_data_domain.rbi b/rbi/workos/organization_created_data_domain.rbi new file mode 100644 index 00000000..1a2d0337 --- /dev/null +++ b/rbi/workos/organization_created_data_domain.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationCreatedDataDomain + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T.nilable(String)) } + def state; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def verification_prefix; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_prefix=(value); end + + sig { returns(T.nilable(String)) } + def verification_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_token=(value); end + + sig { returns(T.nilable(String)) } + def verification_strategy; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_strategy=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_deleted.rbi b/rbi/workos/organization_deleted.rbi new file mode 100644 index 00000000..8a013c1f --- /dev/null +++ b/rbi/workos/organization_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationDeletedData) } + def data; end + + sig { params(value: WorkOS::OrganizationDeletedData).returns(WorkOS::OrganizationDeletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_deleted_data.rbi b/rbi/workos/organization_deleted_data.rbi new file mode 100644 index 00000000..33583bc4 --- /dev/null +++ b/rbi/workos/organization_deleted_data.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDeletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T::Array[WorkOS::OrganizationDeletedDataDomain]) } + def domains; end + + sig { params(value: T::Array[WorkOS::OrganizationDeletedDataDomain]).returns(T::Array[WorkOS::OrganizationDeletedDataDomain]) } + def domains=(value); end + + sig { returns(T::Hash[String, String]) } + def metadata; end + + sig { params(value: T::Hash[String, String]).returns(T::Hash[String, String]) } + def metadata=(value); end + + sig { returns(T.nilable(String)) } + def external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def external_id=(value); end + + sig { returns(T.nilable(String)) } + def stripe_customer_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def stripe_customer_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_deleted_data_domain.rbi b/rbi/workos/organization_deleted_data_domain.rbi new file mode 100644 index 00000000..69aba9c6 --- /dev/null +++ b/rbi/workos/organization_deleted_data_domain.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDeletedDataDomain + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T.nilable(String)) } + def state; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def verification_prefix; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_prefix=(value); end + + sig { returns(T.nilable(String)) } + def verification_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_token=(value); end + + sig { returns(T.nilable(String)) } + def verification_strategy; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_strategy=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain.rbi b/rbi/workos/organization_domain.rbi new file mode 100644 index 00000000..6e8081bb --- /dev/null +++ b/rbi/workos/organization_domain.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomain + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T.nilable(String)) } + def state; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def verification_prefix; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_prefix=(value); end + + sig { returns(T.nilable(String)) } + def verification_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_token=(value); end + + sig { returns(T.nilable(String)) } + def verification_strategy; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_strategy=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_created.rbi b/rbi/workos/organization_domain_created.rbi new file mode 100644 index 00000000..ec340da6 --- /dev/null +++ b/rbi/workos/organization_domain_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationDomainCreatedData) } + def data; end + + sig { params(value: WorkOS::OrganizationDomainCreatedData).returns(WorkOS::OrganizationDomainCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_created_data.rbi b/rbi/workos/organization_domain_created_data.rbi new file mode 100644 index 00000000..48114ebc --- /dev/null +++ b/rbi/workos/organization_domain_created_data.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T.nilable(String)) } + def state; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def verification_prefix; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_prefix=(value); end + + sig { returns(T.nilable(String)) } + def verification_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_token=(value); end + + sig { returns(T.nilable(String)) } + def verification_strategy; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_strategy=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_data.rbi b/rbi/workos/organization_domain_data.rbi new file mode 100644 index 00000000..241878e5 --- /dev/null +++ b/rbi/workos/organization_domain_data.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_deleted.rbi b/rbi/workos/organization_domain_deleted.rbi new file mode 100644 index 00000000..bfa1fd13 --- /dev/null +++ b/rbi/workos/organization_domain_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationDomainDeletedData) } + def data; end + + sig { params(value: WorkOS::OrganizationDomainDeletedData).returns(WorkOS::OrganizationDomainDeletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_deleted_data.rbi b/rbi/workos/organization_domain_deleted_data.rbi new file mode 100644 index 00000000..8e8ebc09 --- /dev/null +++ b/rbi/workos/organization_domain_deleted_data.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainDeletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T.nilable(String)) } + def state; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def verification_prefix; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_prefix=(value); end + + sig { returns(T.nilable(String)) } + def verification_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_token=(value); end + + sig { returns(T.nilable(String)) } + def verification_strategy; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_strategy=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_stand_alone.rbi b/rbi/workos/organization_domain_stand_alone.rbi new file mode 100644 index 00000000..354d6f1b --- /dev/null +++ b/rbi/workos/organization_domain_stand_alone.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainStandAlone + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T.nilable(String)) } + def state; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def verification_prefix; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_prefix=(value); end + + sig { returns(T.nilable(String)) } + def verification_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_token=(value); end + + sig { returns(T.nilable(String)) } + def verification_strategy; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_strategy=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_updated.rbi b/rbi/workos/organization_domain_updated.rbi new file mode 100644 index 00000000..7f34c771 --- /dev/null +++ b/rbi/workos/organization_domain_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationDomainUpdatedData) } + def data; end + + sig { params(value: WorkOS::OrganizationDomainUpdatedData).returns(WorkOS::OrganizationDomainUpdatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_updated_data.rbi b/rbi/workos/organization_domain_updated_data.rbi new file mode 100644 index 00000000..0befd2f4 --- /dev/null +++ b/rbi/workos/organization_domain_updated_data.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainUpdatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T.nilable(String)) } + def state; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def verification_prefix; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_prefix=(value); end + + sig { returns(T.nilable(String)) } + def verification_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_token=(value); end + + sig { returns(T.nilable(String)) } + def verification_strategy; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_strategy=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_verification_failed.rbi b/rbi/workos/organization_domain_verification_failed.rbi new file mode 100644 index 00000000..fc6b8bf1 --- /dev/null +++ b/rbi/workos/organization_domain_verification_failed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainVerificationFailed + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationDomainVerificationFailedData) } + def data; end + + sig { params(value: WorkOS::OrganizationDomainVerificationFailedData).returns(WorkOS::OrganizationDomainVerificationFailedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_verification_failed_data.rbi b/rbi/workos/organization_domain_verification_failed_data.rbi new file mode 100644 index 00000000..6021beb6 --- /dev/null +++ b/rbi/workos/organization_domain_verification_failed_data.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainVerificationFailedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def reason; end + + sig { params(value: String).returns(String) } + def reason=(value); end + + sig { returns(WorkOS::OrganizationDomainVerificationFailedDataOrganizationDomain) } + def organization_domain; end + + sig { params(value: WorkOS::OrganizationDomainVerificationFailedDataOrganizationDomain).returns(WorkOS::OrganizationDomainVerificationFailedDataOrganizationDomain) } + def organization_domain=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_verification_failed_data_organization_domain.rbi b/rbi/workos/organization_domain_verification_failed_data_organization_domain.rbi new file mode 100644 index 00000000..5fcac7cc --- /dev/null +++ b/rbi/workos/organization_domain_verification_failed_data_organization_domain.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainVerificationFailedDataOrganizationDomain + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T.nilable(String)) } + def state; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def verification_prefix; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_prefix=(value); end + + sig { returns(T.nilable(String)) } + def verification_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_token=(value); end + + sig { returns(T.nilable(String)) } + def verification_strategy; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_strategy=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_verified.rbi b/rbi/workos/organization_domain_verified.rbi new file mode 100644 index 00000000..c2ee1474 --- /dev/null +++ b/rbi/workos/organization_domain_verified.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainVerified + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationDomainVerifiedData) } + def data; end + + sig { params(value: WorkOS::OrganizationDomainVerifiedData).returns(WorkOS::OrganizationDomainVerifiedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domain_verified_data.rbi b/rbi/workos/organization_domain_verified_data.rbi new file mode 100644 index 00000000..bf99774b --- /dev/null +++ b/rbi/workos/organization_domain_verified_data.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomainVerifiedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T.nilable(String)) } + def state; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def verification_prefix; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_prefix=(value); end + + sig { returns(T.nilable(String)) } + def verification_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_token=(value); end + + sig { returns(T.nilable(String)) } + def verification_strategy; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_strategy=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_domains.rbi b/rbi/workos/organization_domains.rbi new file mode 100644 index 00000000..259fd4ec --- /dev/null +++ b/rbi/workos/organization_domains.rbi @@ -0,0 +1,45 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationDomains + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + domain: String, + organization_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::OrganizationDomain) + end + def create_organization_domain(domain:, organization_id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::OrganizationDomainStandAlone) + end + def get_organization_domain(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_organization_domain(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::OrganizationDomainStandAlone) + end + def verify_organization_domain(id:, request_options:); end + + end +end diff --git a/rbi/workos/organization_input.rbi b/rbi/workos/organization_input.rbi new file mode 100644 index 00000000..b7a61c12 --- /dev/null +++ b/rbi/workos/organization_input.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationInput + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def allow_profiles_outside_organization; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def allow_profiles_outside_organization=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def domains; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def domains=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::OrganizationDomainData])) } + def domain_data; end + + sig { params(value: T.nilable(T::Array[WorkOS::OrganizationDomainData])).returns(T.nilable(T::Array[WorkOS::OrganizationDomainData])) } + def domain_data=(value); end + + sig { returns(T.nilable(T::Hash[String, String])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) } + def metadata=(value); end + + sig { returns(T.nilable(String)) } + def external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def external_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_membership.rbi b/rbi/workos/organization_membership.rbi new file mode 100644 index 00000000..153149d5 --- /dev/null +++ b/rbi/workos/organization_membership.rbi @@ -0,0 +1,83 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationMembership + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T::Boolean) } + def directory_managed; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def directory_managed=(value); end + + sig { returns(T.nilable(String)) } + def organization_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_name=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def custom_attributes; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def custom_attributes=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(WorkOS::SlimRole) } + def role; end + + sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } + def role=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_membership_created.rbi b/rbi/workos/organization_membership_created.rbi new file mode 100644 index 00000000..a112996c --- /dev/null +++ b/rbi/workos/organization_membership_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationMembershipCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationMembershipCreatedData) } + def data; end + + sig { params(value: WorkOS::OrganizationMembershipCreatedData).returns(WorkOS::OrganizationMembershipCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_membership_created_data.rbi b/rbi/workos/organization_membership_created_data.rbi new file mode 100644 index 00000000..4a59aa07 --- /dev/null +++ b/rbi/workos/organization_membership_created_data.rbi @@ -0,0 +1,83 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationMembershipCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(WorkOS::SlimRole) } + def role; end + + sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } + def role=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles; end + + sig { params(value: T.nilable(T::Array[WorkOS::SlimRole])).returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def custom_attributes; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def custom_attributes=(value); end + + sig { returns(T::Boolean) } + def directory_managed; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def directory_managed=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_membership_deleted.rbi b/rbi/workos/organization_membership_deleted.rbi new file mode 100644 index 00000000..adc0012a --- /dev/null +++ b/rbi/workos/organization_membership_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationMembershipDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationMembershipDeletedData) } + def data; end + + sig { params(value: WorkOS::OrganizationMembershipDeletedData).returns(WorkOS::OrganizationMembershipDeletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_membership_deleted_data.rbi b/rbi/workos/organization_membership_deleted_data.rbi new file mode 100644 index 00000000..8b1ba8b1 --- /dev/null +++ b/rbi/workos/organization_membership_deleted_data.rbi @@ -0,0 +1,83 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationMembershipDeletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(WorkOS::SlimRole) } + def role; end + + sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } + def role=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles; end + + sig { params(value: T.nilable(T::Array[WorkOS::SlimRole])).returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def custom_attributes; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def custom_attributes=(value); end + + sig { returns(T::Boolean) } + def directory_managed; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def directory_managed=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_membership_updated.rbi b/rbi/workos/organization_membership_updated.rbi new file mode 100644 index 00000000..8b8636f4 --- /dev/null +++ b/rbi/workos/organization_membership_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationMembershipUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationMembershipUpdatedData) } + def data; end + + sig { params(value: WorkOS::OrganizationMembershipUpdatedData).returns(WorkOS::OrganizationMembershipUpdatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_membership_updated_data.rbi b/rbi/workos/organization_membership_updated_data.rbi new file mode 100644 index 00000000..24621054 --- /dev/null +++ b/rbi/workos/organization_membership_updated_data.rbi @@ -0,0 +1,83 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationMembershipUpdatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(WorkOS::SlimRole) } + def role; end + + sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } + def role=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles; end + + sig { params(value: T.nilable(T::Array[WorkOS::SlimRole])).returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def custom_attributes; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def custom_attributes=(value); end + + sig { returns(T::Boolean) } + def directory_managed; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def directory_managed=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_role_created.rbi b/rbi/workos/organization_role_created.rbi new file mode 100644 index 00000000..9100100b --- /dev/null +++ b/rbi/workos/organization_role_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationRoleCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationRoleCreatedData) } + def data; end + + sig { params(value: WorkOS::OrganizationRoleCreatedData).returns(WorkOS::OrganizationRoleCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_role_created_data.rbi b/rbi/workos/organization_role_created_data.rbi new file mode 100644 index 00000000..5285a4d9 --- /dev/null +++ b/rbi/workos/organization_role_created_data.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationRoleCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_role_deleted.rbi b/rbi/workos/organization_role_deleted.rbi new file mode 100644 index 00000000..0e6c0924 --- /dev/null +++ b/rbi/workos/organization_role_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationRoleDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationRoleDeletedData) } + def data; end + + sig { params(value: WorkOS::OrganizationRoleDeletedData).returns(WorkOS::OrganizationRoleDeletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_role_deleted_data.rbi b/rbi/workos/organization_role_deleted_data.rbi new file mode 100644 index 00000000..5abecf4c --- /dev/null +++ b/rbi/workos/organization_role_deleted_data.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationRoleDeletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_role_updated.rbi b/rbi/workos/organization_role_updated.rbi new file mode 100644 index 00000000..f802ee76 --- /dev/null +++ b/rbi/workos/organization_role_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationRoleUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationRoleUpdatedData) } + def data; end + + sig { params(value: WorkOS::OrganizationRoleUpdatedData).returns(WorkOS::OrganizationRoleUpdatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_role_updated_data.rbi b/rbi/workos/organization_role_updated_data.rbi new file mode 100644 index 00000000..6098d93e --- /dev/null +++ b/rbi/workos/organization_role_updated_data.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationRoleUpdatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_selection_session_authenticate_request.rbi b/rbi/workos/organization_selection_session_authenticate_request.rbi new file mode 100644 index 00000000..f114052b --- /dev/null +++ b/rbi/workos/organization_selection_session_authenticate_request.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationSelectionSessionAuthenticateRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(String) } + def client_secret; end + + sig { params(value: String).returns(String) } + def client_secret=(value); end + + sig { returns(String) } + def grant_type; end + + sig { params(value: String).returns(String) } + def grant_type=(value); end + + sig { returns(String) } + def pending_authentication_token; end + + sig { params(value: String).returns(String) } + def pending_authentication_token=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def device_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def device_id=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_updated.rbi b/rbi/workos/organization_updated.rbi new file mode 100644 index 00000000..7c2e2dc9 --- /dev/null +++ b/rbi/workos/organization_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::OrganizationUpdatedData) } + def data; end + + sig { params(value: WorkOS::OrganizationUpdatedData).returns(WorkOS::OrganizationUpdatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_updated_data.rbi b/rbi/workos/organization_updated_data.rbi new file mode 100644 index 00000000..213f23f0 --- /dev/null +++ b/rbi/workos/organization_updated_data.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationUpdatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T::Array[WorkOS::OrganizationUpdatedDataDomain]) } + def domains; end + + sig { params(value: T::Array[WorkOS::OrganizationUpdatedDataDomain]).returns(T::Array[WorkOS::OrganizationUpdatedDataDomain]) } + def domains=(value); end + + sig { returns(T::Hash[String, String]) } + def metadata; end + + sig { params(value: T::Hash[String, String]).returns(T::Hash[String, String]) } + def metadata=(value); end + + sig { returns(T.nilable(String)) } + def external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def external_id=(value); end + + sig { returns(T.nilable(String)) } + def stripe_customer_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def stripe_customer_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organization_updated_data_domain.rbi b/rbi/workos/organization_updated_data_domain.rbi new file mode 100644 index 00000000..2f07c889 --- /dev/null +++ b/rbi/workos/organization_updated_data_domain.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationUpdatedDataDomain + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def domain; end + + sig { params(value: String).returns(String) } + def domain=(value); end + + sig { returns(T.nilable(String)) } + def state; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def verification_prefix; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_prefix=(value); end + + sig { returns(T.nilable(String)) } + def verification_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_token=(value); end + + sig { returns(T.nilable(String)) } + def verification_strategy; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def verification_strategy=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/organizations.rbi b/rbi/workos/organizations.rbi new file mode 100644 index 00000000..4d01afec --- /dev/null +++ b/rbi/workos/organizations.rbi @@ -0,0 +1,85 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Organizations + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + domains: T.nilable(T::Array[String]), + search: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_organizations(before:, after:, limit:, order:, domains:, search:, request_options:); end + + sig do + params( + name: String, + allow_profiles_outside_organization: T.nilable(T::Boolean), + domains: T.nilable(T::Array[String]), + domain_data: T.nilable(T::Array[WorkOS::OrganizationDomainData]), + metadata: T.nilable(T::Hash[String, String]), + external_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Organization) + end + def create_organization(name:, allow_profiles_outside_organization:, domains:, domain_data:, metadata:, external_id:, request_options:); end + + sig do + params( + external_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Organization) + end + def get_organization_by_external_id(external_id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Organization) + end + def get_organization(id:, request_options:); end + + sig do + params( + id: String, + name: T.nilable(String), + allow_profiles_outside_organization: T.nilable(T::Boolean), + domains: T.nilable(T::Array[String]), + domain_data: T.nilable(T::Array[WorkOS::OrganizationDomainData]), + stripe_customer_id: T.nilable(String), + metadata: T.nilable(T::Hash[String, String]), + external_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Organization) + end + def update_organization(id:, name:, allow_profiles_outside_organization:, domains:, domain_data:, stripe_customer_id:, metadata:, external_id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_organization(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuditLogConfiguration) + end + def get_audit_log_configuration(id:, request_options:); end + + end +end diff --git a/rbi/workos/password_reset.rbi b/rbi/workos/password_reset.rbi new file mode 100644 index 00000000..eba5f1de --- /dev/null +++ b/rbi/workos/password_reset.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PasswordReset + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def password_reset_token; end + + sig { params(value: String).returns(String) } + def password_reset_token=(value); end + + sig { returns(String) } + def password_reset_url; end + + sig { params(value: String).returns(String) } + def password_reset_url=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/password_reset_created.rbi b/rbi/workos/password_reset_created.rbi new file mode 100644 index 00000000..cb290d0f --- /dev/null +++ b/rbi/workos/password_reset_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PasswordResetCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::PasswordResetCreatedData) } + def data; end + + sig { params(value: WorkOS::PasswordResetCreatedData).returns(WorkOS::PasswordResetCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/password_reset_created_data.rbi b/rbi/workos/password_reset_created_data.rbi new file mode 100644 index 00000000..9a31c826 --- /dev/null +++ b/rbi/workos/password_reset_created_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PasswordResetCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/password_reset_succeeded.rbi b/rbi/workos/password_reset_succeeded.rbi new file mode 100644 index 00000000..e881dee0 --- /dev/null +++ b/rbi/workos/password_reset_succeeded.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PasswordResetSucceeded + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::PasswordResetSucceededData) } + def data; end + + sig { params(value: WorkOS::PasswordResetSucceededData).returns(WorkOS::PasswordResetSucceededData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/password_reset_succeeded_data.rbi b/rbi/workos/password_reset_succeeded_data.rbi new file mode 100644 index 00000000..38b63605 --- /dev/null +++ b/rbi/workos/password_reset_succeeded_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PasswordResetSucceededData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/password_session_authenticate_request.rbi b/rbi/workos/password_session_authenticate_request.rbi new file mode 100644 index 00000000..09104979 --- /dev/null +++ b/rbi/workos/password_session_authenticate_request.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PasswordSessionAuthenticateRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(String) } + def client_secret; end + + sig { params(value: String).returns(String) } + def client_secret=(value); end + + sig { returns(String) } + def grant_type; end + + sig { params(value: String).returns(String) } + def grant_type=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def password; end + + sig { params(value: String).returns(String) } + def password=(value); end + + sig { returns(T.nilable(String)) } + def invitation_token; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def invitation_token=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def device_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def device_id=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/permission.rbi b/rbi/workos/permission.rbi new file mode 100644 index 00000000..892ad82b --- /dev/null +++ b/rbi/workos/permission.rbi @@ -0,0 +1,71 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Permission + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T::Boolean) } + def system; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def system=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/permission_created.rbi b/rbi/workos/permission_created.rbi new file mode 100644 index 00000000..da4e5b44 --- /dev/null +++ b/rbi/workos/permission_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PermissionCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::PermissionCreatedData) } + def data; end + + sig { params(value: WorkOS::PermissionCreatedData).returns(WorkOS::PermissionCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/permission_created_data.rbi b/rbi/workos/permission_created_data.rbi new file mode 100644 index 00000000..ed47462a --- /dev/null +++ b/rbi/workos/permission_created_data.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PermissionCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T::Boolean) } + def system; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def system=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/permission_deleted.rbi b/rbi/workos/permission_deleted.rbi new file mode 100644 index 00000000..5ec17265 --- /dev/null +++ b/rbi/workos/permission_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PermissionDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::PermissionDeletedData) } + def data; end + + sig { params(value: WorkOS::PermissionDeletedData).returns(WorkOS::PermissionDeletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/permission_deleted_data.rbi b/rbi/workos/permission_deleted_data.rbi new file mode 100644 index 00000000..108c3952 --- /dev/null +++ b/rbi/workos/permission_deleted_data.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PermissionDeletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T::Boolean) } + def system; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def system=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/permission_updated.rbi b/rbi/workos/permission_updated.rbi new file mode 100644 index 00000000..67504cb1 --- /dev/null +++ b/rbi/workos/permission_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PermissionUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::PermissionUpdatedData) } + def data; end + + sig { params(value: WorkOS::PermissionUpdatedData).returns(WorkOS::PermissionUpdatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/permission_updated_data.rbi b/rbi/workos/permission_updated_data.rbi new file mode 100644 index 00000000..9ccb1d0c --- /dev/null +++ b/rbi/workos/permission_updated_data.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PermissionUpdatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T::Boolean) } + def system; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def system=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/pipes.rbi b/rbi/workos/pipes.rbi new file mode 100644 index 00000000..dcce8343 --- /dev/null +++ b/rbi/workos/pipes.rbi @@ -0,0 +1,62 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Pipes + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + slug: String, + user_id: String, + organization_id: T.nilable(String), + return_to: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::DataIntegrationAuthorizeUrlResponse) + end + def authorize_data_integration(slug:, user_id:, organization_id:, return_to:, request_options:); end + + sig do + params( + slug: String, + user_id: String, + organization_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::DataIntegrationAccessTokenResponse) + end + def create_data_integration_token(slug:, user_id:, organization_id:, request_options:); end + + sig do + params( + user_id: String, + slug: String, + organization_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ConnectedAccount) + end + def get_user_connected_account(user_id:, slug:, organization_id:, request_options:); end + + sig do + params( + user_id: String, + slug: String, + organization_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_user_connected_account(user_id:, slug:, organization_id:, request_options:); end + + sig do + params( + user_id: String, + organization_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::DataIntegrationsListResponse) + end + def list_user_data_providers(user_id:, organization_id:, request_options:); end + + end +end diff --git a/rbi/workos/portal_link_response.rbi b/rbi/workos/portal_link_response.rbi new file mode 100644 index 00000000..64ab80ee --- /dev/null +++ b/rbi/workos/portal_link_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class PortalLinkResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def link; end + + sig { params(value: String).returns(String) } + def link=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/profile.rbi b/rbi/workos/profile.rbi new file mode 100644 index 00000000..44646dbf --- /dev/null +++ b/rbi/workos/profile.rbi @@ -0,0 +1,101 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Profile + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(String) } + def connection_id; end + + sig { params(value: String).returns(String) } + def connection_id=(value); end + + sig { returns(String) } + def connection_type; end + + sig { params(value: String).returns(String) } + def connection_type=(value); end + + sig { returns(String) } + def idp_id; end + + sig { params(value: String).returns(String) } + def idp_id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T.nilable(WorkOS::SlimRole)) } + def role; end + + sig { params(value: T.nilable(WorkOS::SlimRole)).returns(T.nilable(WorkOS::SlimRole)) } + def role=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles; end + + sig { params(value: T.nilable(T::Array[WorkOS::SlimRole])).returns(T.nilable(T::Array[WorkOS::SlimRole])) } + def roles=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def groups; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def groups=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def custom_attributes; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def custom_attributes=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def raw_attributes; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def raw_attributes=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/radar.rbi b/rbi/workos/radar.rbi new file mode 100644 index 00000000..d5acceb0 --- /dev/null +++ b/rbi/workos/radar.rbi @@ -0,0 +1,56 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Radar + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + ip_address: String, + user_agent: String, + email: String, + auth_method: String, + action: String, + device_fingerprint: T.nilable(String), + bot_score: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::RadarStandaloneResponse) + end + def create_attempt(ip_address:, user_agent:, email:, auth_method:, action:, device_fingerprint:, bot_score:, request_options:); end + + sig do + params( + id: String, + challenge_status: T.nilable(String), + attempt_status: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def update_attempt(id:, challenge_status:, attempt_status:, request_options:); end + + sig do + params( + type: String, + action: String, + entry: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::RadarListEntryAlreadyPresentResponse) + end + def add_list_entry(type:, action:, entry:, request_options:); end + + sig do + params( + type: String, + action: String, + entry: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def remove_list_entry(type:, action:, entry:, request_options:); end + + end +end diff --git a/rbi/workos/radar_list_entry_already_present_response.rbi b/rbi/workos/radar_list_entry_already_present_response.rbi new file mode 100644 index 00000000..375b2b0f --- /dev/null +++ b/rbi/workos/radar_list_entry_already_present_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RadarListEntryAlreadyPresentResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def message; end + + sig { params(value: String).returns(String) } + def message=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/radar_standalone_assess_request.rbi b/rbi/workos/radar_standalone_assess_request.rbi new file mode 100644 index 00000000..854dc0c4 --- /dev/null +++ b/rbi/workos/radar_standalone_assess_request.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RadarStandaloneAssessRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def ip_address; end + + sig { params(value: String).returns(String) } + def ip_address=(value); end + + sig { returns(String) } + def user_agent; end + + sig { params(value: String).returns(String) } + def user_agent=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def auth_method; end + + sig { params(value: String).returns(String) } + def auth_method=(value); end + + sig { returns(String) } + def action; end + + sig { params(value: String).returns(String) } + def action=(value); end + + sig { returns(T.nilable(String)) } + def device_fingerprint; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def device_fingerprint=(value); end + + sig { returns(T.nilable(String)) } + def bot_score; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def bot_score=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/radar_standalone_delete_radar_list_entry_request.rbi b/rbi/workos/radar_standalone_delete_radar_list_entry_request.rbi new file mode 100644 index 00000000..56adfe09 --- /dev/null +++ b/rbi/workos/radar_standalone_delete_radar_list_entry_request.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RadarStandaloneDeleteRadarListEntryRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def entry; end + + sig { params(value: String).returns(String) } + def entry=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/radar_standalone_response.rbi b/rbi/workos/radar_standalone_response.rbi new file mode 100644 index 00000000..360685d4 --- /dev/null +++ b/rbi/workos/radar_standalone_response.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RadarStandaloneResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def verdict; end + + sig { params(value: String).returns(String) } + def verdict=(value); end + + sig { returns(String) } + def reason; end + + sig { params(value: String).returns(String) } + def reason=(value); end + + sig { returns(String) } + def attempt_id; end + + sig { params(value: String).returns(String) } + def attempt_id=(value); end + + sig { returns(T.nilable(String)) } + def control; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def control=(value); end + + sig { returns(T.nilable(String)) } + def blocklist_type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def blocklist_type=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/radar_standalone_update_radar_attempt_request.rbi b/rbi/workos/radar_standalone_update_radar_attempt_request.rbi new file mode 100644 index 00000000..703cbce3 --- /dev/null +++ b/rbi/workos/radar_standalone_update_radar_attempt_request.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RadarStandaloneUpdateRadarAttemptRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def challenge_status; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def challenge_status=(value); end + + sig { returns(T.nilable(String)) } + def attempt_status; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def attempt_status=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/radar_standalone_update_radar_list_request.rbi b/rbi/workos/radar_standalone_update_radar_list_request.rbi new file mode 100644 index 00000000..0ffe8913 --- /dev/null +++ b/rbi/workos/radar_standalone_update_radar_list_request.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RadarStandaloneUpdateRadarListRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def entry; end + + sig { params(value: String).returns(String) } + def entry=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/redirect_uri.rbi b/rbi/workos/redirect_uri.rbi new file mode 100644 index 00000000..7d038b8a --- /dev/null +++ b/rbi/workos/redirect_uri.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RedirectUri + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def uri; end + + sig { params(value: String).returns(String) } + def uri=(value); end + + sig { returns(T::Boolean) } + def default; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def default=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/redirect_uri_input.rbi b/rbi/workos/redirect_uri_input.rbi new file mode 100644 index 00000000..052d97f2 --- /dev/null +++ b/rbi/workos/redirect_uri_input.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RedirectUriInput + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def uri; end + + sig { params(value: String).returns(String) } + def uri=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def default; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def default=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/refresh_token_session_authenticate_request.rbi b/rbi/workos/refresh_token_session_authenticate_request.rbi new file mode 100644 index 00000000..7bef4420 --- /dev/null +++ b/rbi/workos/refresh_token_session_authenticate_request.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RefreshTokenSessionAuthenticateRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(String) } + def client_secret; end + + sig { params(value: String).returns(String) } + def client_secret=(value); end + + sig { returns(String) } + def grant_type; end + + sig { params(value: String).returns(String) } + def grant_type=(value); end + + sig { returns(String) } + def refresh_token; end + + sig { params(value: String).returns(String) } + def refresh_token=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def device_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def device_id=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/remove_role.rbi b/rbi/workos/remove_role.rbi new file mode 100644 index 00000000..4db68dd3 --- /dev/null +++ b/rbi/workos/remove_role.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RemoveRole + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def role_slug; end + + sig { params(value: String).returns(String) } + def role_slug=(value); end + + sig { returns(T.nilable(String)) } + def resource_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_id=(value); end + + sig { returns(T.nilable(String)) } + def resource_external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_external_id=(value); end + + sig { returns(T.nilable(String)) } + def resource_type_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def resource_type_slug=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/resend_user_invite_options.rbi b/rbi/workos/resend_user_invite_options.rbi new file mode 100644 index 00000000..19306772 --- /dev/null +++ b/rbi/workos/resend_user_invite_options.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ResendUserInviteOptions + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def locale; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def locale=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/reset_password_response.rbi b/rbi/workos/reset_password_response.rbi new file mode 100644 index 00000000..1e45f991 --- /dev/null +++ b/rbi/workos/reset_password_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ResetPasswordResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(WorkOS::User) } + def user; end + + sig { params(value: WorkOS::User).returns(WorkOS::User) } + def user=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/revoke_session.rbi b/rbi/workos/revoke_session.rbi new file mode 100644 index 00000000..416ded9c --- /dev/null +++ b/rbi/workos/revoke_session.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RevokeSession + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def session_id; end + + sig { params(value: String).returns(String) } + def session_id=(value); end + + sig { returns(T.nilable(String)) } + def return_to; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def return_to=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/role.rbi b/rbi/workos/role.rbi new file mode 100644 index 00000000..cb7d5ade --- /dev/null +++ b/rbi/workos/role.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Role + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/role_assignment.rbi b/rbi/workos/role_assignment.rbi new file mode 100644 index 00000000..b1879a09 --- /dev/null +++ b/rbi/workos/role_assignment.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RoleAssignment + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(WorkOS::SlimRole) } + def role; end + + sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } + def role=(value); end + + sig { returns(WorkOS::RoleAssignmentResource) } + def resource; end + + sig { params(value: WorkOS::RoleAssignmentResource).returns(WorkOS::RoleAssignmentResource) } + def resource=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/role_assignment_resource.rbi b/rbi/workos/role_assignment_resource.rbi new file mode 100644 index 00000000..ffc48903 --- /dev/null +++ b/rbi/workos/role_assignment_resource.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RoleAssignmentResource + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def external_id; end + + sig { params(value: String).returns(String) } + def external_id=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/role_created.rbi b/rbi/workos/role_created.rbi new file mode 100644 index 00000000..c3854531 --- /dev/null +++ b/rbi/workos/role_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RoleCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::RoleCreatedData) } + def data; end + + sig { params(value: WorkOS::RoleCreatedData).returns(WorkOS::RoleCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/role_created_data.rbi b/rbi/workos/role_created_data.rbi new file mode 100644 index 00000000..b8de5ae6 --- /dev/null +++ b/rbi/workos/role_created_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RoleCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def permissions; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/role_deleted.rbi b/rbi/workos/role_deleted.rbi new file mode 100644 index 00000000..81e2ea3e --- /dev/null +++ b/rbi/workos/role_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RoleDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::RoleDeletedData) } + def data; end + + sig { params(value: WorkOS::RoleDeletedData).returns(WorkOS::RoleDeletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/role_deleted_data.rbi b/rbi/workos/role_deleted_data.rbi new file mode 100644 index 00000000..814556ea --- /dev/null +++ b/rbi/workos/role_deleted_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RoleDeletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def permissions; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/role_list.rbi b/rbi/workos/role_list.rbi new file mode 100644 index 00000000..1c364c4d --- /dev/null +++ b/rbi/workos/role_list.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RoleList + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Array[WorkOS::Role]) } + def data; end + + sig { params(value: T::Array[WorkOS::Role]).returns(T::Array[WorkOS::Role]) } + def data=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/role_updated.rbi b/rbi/workos/role_updated.rbi new file mode 100644 index 00000000..ecb1bd52 --- /dev/null +++ b/rbi/workos/role_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RoleUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::RoleUpdatedData) } + def data; end + + sig { params(value: WorkOS::RoleUpdatedData).returns(WorkOS::RoleUpdatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/role_updated_data.rbi b/rbi/workos/role_updated_data.rbi new file mode 100644 index 00000000..0c7109f4 --- /dev/null +++ b/rbi/workos/role_updated_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class RoleUpdatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(String) } + def resource_type_slug; end + + sig { params(value: String).returns(String) } + def resource_type_slug=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def permissions; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def permissions=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/send_email_change.rbi b/rbi/workos/send_email_change.rbi new file mode 100644 index 00000000..1bc4030a --- /dev/null +++ b/rbi/workos/send_email_change.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SendEmailChange + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def new_email; end + + sig { params(value: String).returns(String) } + def new_email=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/send_verification_email_response.rbi b/rbi/workos/send_verification_email_response.rbi new file mode 100644 index 00000000..08624991 --- /dev/null +++ b/rbi/workos/send_verification_email_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SendVerificationEmailResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(WorkOS::User) } + def user; end + + sig { params(value: WorkOS::User).returns(WorkOS::User) } + def user=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/session_created.rbi b/rbi/workos/session_created.rbi new file mode 100644 index 00000000..f939178e --- /dev/null +++ b/rbi/workos/session_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SessionCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::SessionCreatedData) } + def data; end + + sig { params(value: WorkOS::SessionCreatedData).returns(WorkOS::SessionCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/session_created_data.rbi b/rbi/workos/session_created_data.rbi new file mode 100644 index 00000000..2b7a52af --- /dev/null +++ b/rbi/workos/session_created_data.rbi @@ -0,0 +1,95 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SessionCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(WorkOS::SessionCreatedDataImpersonator)) } + def impersonator; end + + sig { params(value: T.nilable(WorkOS::SessionCreatedDataImpersonator)).returns(T.nilable(WorkOS::SessionCreatedDataImpersonator)) } + def impersonator=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def auth_method; end + + sig { params(value: String).returns(String) } + def auth_method=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(T.nilable(String)) } + def ended_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ended_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/session_created_data_impersonator.rbi b/rbi/workos/session_created_data_impersonator.rbi new file mode 100644 index 00000000..4a3a3190 --- /dev/null +++ b/rbi/workos/session_created_data_impersonator.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SessionCreatedDataImpersonator + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def reason; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def reason=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/session_revoked.rbi b/rbi/workos/session_revoked.rbi new file mode 100644 index 00000000..747eb09b --- /dev/null +++ b/rbi/workos/session_revoked.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SessionRevoked + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::SessionRevokedData) } + def data; end + + sig { params(value: WorkOS::SessionRevokedData).returns(WorkOS::SessionRevokedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/session_revoked_data.rbi b/rbi/workos/session_revoked_data.rbi new file mode 100644 index 00000000..1f7e1816 --- /dev/null +++ b/rbi/workos/session_revoked_data.rbi @@ -0,0 +1,95 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SessionRevokedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(WorkOS::SessionRevokedDataImpersonator)) } + def impersonator; end + + sig { params(value: T.nilable(WorkOS::SessionRevokedDataImpersonator)).returns(T.nilable(WorkOS::SessionRevokedDataImpersonator)) } + def impersonator=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def auth_method; end + + sig { params(value: String).returns(String) } + def auth_method=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(T.nilable(String)) } + def ended_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ended_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/session_revoked_data_impersonator.rbi b/rbi/workos/session_revoked_data_impersonator.rbi new file mode 100644 index 00000000..c7d0b44a --- /dev/null +++ b/rbi/workos/session_revoked_data_impersonator.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SessionRevokedDataImpersonator + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def reason; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def reason=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/set_role_permissions.rbi b/rbi/workos/set_role_permissions.rbi new file mode 100644 index 00000000..33cdacfe --- /dev/null +++ b/rbi/workos/set_role_permissions.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SetRolePermissions + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T::Array[String]) } + def permissions; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def permissions=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/slim_role.rbi b/rbi/workos/slim_role.rbi new file mode 100644 index 00000000..7c5c9744 --- /dev/null +++ b/rbi/workos/slim_role.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SlimRole + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def slug; end + + sig { params(value: String).returns(String) } + def slug=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/sso.rbi b/rbi/workos/sso.rbi new file mode 100644 index 00000000..2e29bf44 --- /dev/null +++ b/rbi/workos/sso.rbi @@ -0,0 +1,66 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SSO + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + connection_type: T.nilable(String), + domain: T.nilable(String), + organization_id: T.nilable(String), + search: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_connections(before:, after:, limit:, order:, connection_type:, domain:, organization_id:, search:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Connection) + end + def get_connection(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_connection(id:, request_options:); end + + sig do + params( + profile_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::SSOLogoutAuthorizeResponse) + end + def authorize_logout(profile_id:, request_options:); end + + sig do + params( + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Profile) + end + def get_profile(request_options:); end + + sig do + params( + code: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::SSOTokenResponse) + end + def get_profile_and_token(code:, request_options:); end + + end +end diff --git a/rbi/workos/sso_authorize_url_response.rbi b/rbi/workos/sso_authorize_url_response.rbi new file mode 100644 index 00000000..5af9c74f --- /dev/null +++ b/rbi/workos/sso_authorize_url_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SSOAuthorizeUrlResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def url; end + + sig { params(value: String).returns(String) } + def url=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/sso_device_authorization_request.rbi b/rbi/workos/sso_device_authorization_request.rbi new file mode 100644 index 00000000..3d45f349 --- /dev/null +++ b/rbi/workos/sso_device_authorization_request.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SSODeviceAuthorizationRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/sso_intent_options.rbi b/rbi/workos/sso_intent_options.rbi new file mode 100644 index 00000000..9d16da29 --- /dev/null +++ b/rbi/workos/sso_intent_options.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SSOIntentOptions + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def bookmark_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def bookmark_slug=(value); end + + sig { returns(T.nilable(String)) } + def provider_type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def provider_type=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/sso_logout_authorize_request.rbi b/rbi/workos/sso_logout_authorize_request.rbi new file mode 100644 index 00000000..ec19231d --- /dev/null +++ b/rbi/workos/sso_logout_authorize_request.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SSOLogoutAuthorizeRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def profile_id; end + + sig { params(value: String).returns(String) } + def profile_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/sso_logout_authorize_response.rbi b/rbi/workos/sso_logout_authorize_response.rbi new file mode 100644 index 00000000..685a34f5 --- /dev/null +++ b/rbi/workos/sso_logout_authorize_response.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SSOLogoutAuthorizeResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def logout_url; end + + sig { params(value: String).returns(String) } + def logout_url=(value); end + + sig { returns(String) } + def logout_token; end + + sig { params(value: String).returns(String) } + def logout_token=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/sso_token_response.rbi b/rbi/workos/sso_token_response.rbi new file mode 100644 index 00000000..d9a0b741 --- /dev/null +++ b/rbi/workos/sso_token_response.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SSOTokenResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def token_type; end + + sig { params(value: String).returns(String) } + def token_type=(value); end + + sig { returns(String) } + def access_token; end + + sig { params(value: String).returns(String) } + def access_token=(value); end + + sig { returns(Integer) } + def expires_in; end + + sig { params(value: Integer).returns(Integer) } + def expires_in=(value); end + + sig { returns(WorkOS::Profile) } + def profile; end + + sig { params(value: WorkOS::Profile).returns(WorkOS::Profile) } + def profile=(value); end + + sig { returns(T.nilable(WorkOS::SSOTokenResponseOAuthToken)) } + def oauth_tokens; end + + sig { params(value: T.nilable(WorkOS::SSOTokenResponseOAuthToken)).returns(T.nilable(WorkOS::SSOTokenResponseOAuthToken)) } + def oauth_tokens=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/sso_token_response_oauth_token.rbi b/rbi/workos/sso_token_response_oauth_token.rbi new file mode 100644 index 00000000..5d183140 --- /dev/null +++ b/rbi/workos/sso_token_response_oauth_token.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SSOTokenResponseOAuthToken + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def provider; end + + sig { params(value: String).returns(String) } + def provider=(value); end + + sig { returns(String) } + def refresh_token; end + + sig { params(value: String).returns(String) } + def refresh_token=(value); end + + sig { returns(String) } + def access_token; end + + sig { params(value: String).returns(String) } + def access_token=(value); end + + sig { returns(Integer) } + def expires_at; end + + sig { params(value: Integer).returns(Integer) } + def expires_at=(value); end + + sig { returns(T::Array[String]) } + def scopes; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def scopes=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/token_query.rbi b/rbi/workos/token_query.rbi new file mode 100644 index 00000000..1cfcb519 --- /dev/null +++ b/rbi/workos/token_query.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class TokenQuery + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def client_id; end + + sig { params(value: String).returns(String) } + def client_id=(value); end + + sig { returns(String) } + def client_secret; end + + sig { params(value: String).returns(String) } + def client_secret=(value); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(String) } + def grant_type; end + + sig { params(value: String).returns(String) } + def grant_type=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_audit_logs_retention.rbi b/rbi/workos/update_audit_logs_retention.rbi new file mode 100644 index 00000000..a8f29819 --- /dev/null +++ b/rbi/workos/update_audit_logs_retention.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateAuditLogsRetention + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(Integer) } + def retention_period_in_days; end + + sig { params(value: Integer).returns(Integer) } + def retention_period_in_days=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_authorization_permission.rbi b/rbi/workos/update_authorization_permission.rbi new file mode 100644 index 00000000..496b8b10 --- /dev/null +++ b/rbi/workos/update_authorization_permission.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateAuthorizationPermission + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_authorization_resource.rbi b/rbi/workos/update_authorization_resource.rbi new file mode 100644 index 00000000..0ad00d8e --- /dev/null +++ b/rbi/workos/update_authorization_resource.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateAuthorizationResource + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(String)) } + def parent_resource_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def parent_resource_id=(value); end + + sig { returns(T.nilable(String)) } + def parent_resource_external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def parent_resource_external_id=(value); end + + sig { returns(T.nilable(String)) } + def parent_resource_type_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def parent_resource_type_slug=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_jwt_template.rbi b/rbi/workos/update_jwt_template.rbi new file mode 100644 index 00000000..ba8fec98 --- /dev/null +++ b/rbi/workos/update_jwt_template.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateJWTTemplate + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def content; end + + sig { params(value: String).returns(String) } + def content=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_oauth_application.rbi b/rbi/workos/update_oauth_application.rbi new file mode 100644 index 00000000..30951111 --- /dev/null +++ b/rbi/workos/update_oauth_application.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateOAuthApplication + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def scopes; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def scopes=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::RedirectUriInput])) } + def redirect_uris; end + + sig { params(value: T.nilable(T::Array[WorkOS::RedirectUriInput])).returns(T.nilable(T::Array[WorkOS::RedirectUriInput])) } + def redirect_uris=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_organization.rbi b/rbi/workos/update_organization.rbi new file mode 100644 index 00000000..f0548dcb --- /dev/null +++ b/rbi/workos/update_organization.rbi @@ -0,0 +1,59 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateOrganization + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def allow_profiles_outside_organization; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def allow_profiles_outside_organization=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def domains; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def domains=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::OrganizationDomainData])) } + def domain_data; end + + sig { params(value: T.nilable(T::Array[WorkOS::OrganizationDomainData])).returns(T.nilable(T::Array[WorkOS::OrganizationDomainData])) } + def domain_data=(value); end + + sig { returns(T.nilable(String)) } + def stripe_customer_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def stripe_customer_id=(value); end + + sig { returns(T.nilable(T::Hash[String, String])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) } + def metadata=(value); end + + sig { returns(T.nilable(String)) } + def external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def external_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_organization_role.rbi b/rbi/workos/update_organization_role.rbi new file mode 100644 index 00000000..39b9cefe --- /dev/null +++ b/rbi/workos/update_organization_role.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateOrganizationRole + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_role.rbi b/rbi/workos/update_role.rbi new file mode 100644 index 00000000..9f47e73b --- /dev/null +++ b/rbi/workos/update_role.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateRole + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def name=(value); end + + sig { returns(T.nilable(String)) } + def description; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def description=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_user.rbi b/rbi/workos/update_user.rbi new file mode 100644 index 00000000..3dc63dec --- /dev/null +++ b/rbi/workos/update_user.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateUser + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def email; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T.nilable(T::Boolean)) } + def email_verified; end + + sig { params(value: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def email_verified=(value); end + + sig { returns(T.nilable(T::Hash[String, String])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) } + def metadata=(value); end + + sig { returns(T.nilable(String)) } + def external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def external_id=(value); end + + sig { returns(T.nilable(String)) } + def locale; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def locale=(value); end + + sig { returns(T.nilable(String)) } + def password; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def password=(value); end + + sig { returns(T.nilable(String)) } + def password_hash; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def password_hash=(value); end + + sig { returns(T.nilable(String)) } + def password_hash_type; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def password_hash_type=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_user_organization_membership.rbi b/rbi/workos/update_user_organization_membership.rbi new file mode 100644 index 00000000..4a598263 --- /dev/null +++ b/rbi/workos/update_user_organization_membership.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateUserOrganizationMembership + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def role_slug; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def role_slug=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def role_slugs; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def role_slugs=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/update_webhook_endpoint.rbi b/rbi/workos/update_webhook_endpoint.rbi new file mode 100644 index 00000000..5ae55011 --- /dev/null +++ b/rbi/workos/update_webhook_endpoint.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateWebhookEndpoint + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def endpoint_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def endpoint_url=(value); end + + sig { returns(T.nilable(String)) } + def status; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def status=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def events; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def events=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user.rbi b/rbi/workos/user.rbi new file mode 100644 index 00000000..82e2f536 --- /dev/null +++ b/rbi/workos/user.rbi @@ -0,0 +1,95 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class User + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T.nilable(String)) } + def profile_picture_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def profile_picture_url=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T::Boolean) } + def email_verified; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def email_verified=(value); end + + sig { returns(T.nilable(String)) } + def external_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def external_id=(value); end + + sig { returns(T.nilable(T::Hash[String, String])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) } + def metadata=(value); end + + sig { returns(T.nilable(String)) } + def last_sign_in_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_sign_in_at=(value); end + + sig { returns(T.nilable(String)) } + def locale; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def locale=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_authentication_factor_enroll_response.rbi b/rbi/workos/user_authentication_factor_enroll_response.rbi new file mode 100644 index 00000000..3268a62a --- /dev/null +++ b/rbi/workos/user_authentication_factor_enroll_response.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserAuthenticationFactorEnrollResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(WorkOS::AuthenticationFactorEnrolled) } + def authentication_factor; end + + sig { params(value: WorkOS::AuthenticationFactorEnrolled).returns(WorkOS::AuthenticationFactorEnrolled) } + def authentication_factor=(value); end + + sig { returns(WorkOS::AuthenticationChallenge) } + def authentication_challenge; end + + sig { params(value: WorkOS::AuthenticationChallenge).returns(WorkOS::AuthenticationChallenge) } + def authentication_challenge=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_consent_option.rbi b/rbi/workos/user_consent_option.rbi new file mode 100644 index 00000000..00addadd --- /dev/null +++ b/rbi/workos/user_consent_option.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserConsentOption + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def claim; end + + sig { params(value: String).returns(String) } + def claim=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def label; end + + sig { params(value: String).returns(String) } + def label=(value); end + + sig { returns(T::Array[WorkOS::UserConsentOptionChoice]) } + def choices; end + + sig { params(value: T::Array[WorkOS::UserConsentOptionChoice]).returns(T::Array[WorkOS::UserConsentOptionChoice]) } + def choices=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_consent_option_choice.rbi b/rbi/workos/user_consent_option_choice.rbi new file mode 100644 index 00000000..6dd91fd1 --- /dev/null +++ b/rbi/workos/user_consent_option_choice.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserConsentOptionChoice + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def value; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def value=(value); end + + sig { returns(T.nilable(String)) } + def label; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def label=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_created.rbi b/rbi/workos/user_created.rbi new file mode 100644 index 00000000..06a3b548 --- /dev/null +++ b/rbi/workos/user_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::User) } + def data; end + + sig { params(value: WorkOS::User).returns(WorkOS::User) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_deleted.rbi b/rbi/workos/user_deleted.rbi new file mode 100644 index 00000000..57ece069 --- /dev/null +++ b/rbi/workos/user_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::User) } + def data; end + + sig { params(value: WorkOS::User).returns(WorkOS::User) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_identities_get_item.rbi b/rbi/workos/user_identities_get_item.rbi new file mode 100644 index 00000000..8ccd0baa --- /dev/null +++ b/rbi/workos/user_identities_get_item.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserIdentitiesGetItem + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def idp_id; end + + sig { params(value: String).returns(String) } + def idp_id=(value); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(String) } + def provider; end + + sig { params(value: String).returns(String) } + def provider=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_invite.rbi b/rbi/workos/user_invite.rbi new file mode 100644 index 00000000..b2141229 --- /dev/null +++ b/rbi/workos/user_invite.rbi @@ -0,0 +1,101 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserInvite + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def accepted_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_at=(value); end + + sig { returns(T.nilable(String)) } + def revoked_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def revoked_at=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def inviter_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def inviter_user_id=(value); end + + sig { returns(T.nilable(String)) } + def accepted_user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def accepted_user_id=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(String) } + def token; end + + sig { params(value: String).returns(String) } + def token=(value); end + + sig { returns(String) } + def accept_invitation_url; end + + sig { params(value: String).returns(String) } + def accept_invitation_url=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_management.rbi b/rbi/workos/user_management.rbi new file mode 100644 index 00000000..3950a824 --- /dev/null +++ b/rbi/workos/user_management.rbi @@ -0,0 +1,409 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserManagement + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + client_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::JwksResponse) + end + def get_jwks(client_id:, request_options:); end + + sig do + params( + client_id: String, + client_secret: String, + grant_type: String, + code: String, + code_verifier: T.nilable(String), + invitation_token: T.nilable(String), + ip_address: T.nilable(String), + device_id: T.nilable(String), + user_agent: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::AuthenticateResponse) + end + def create_authenticate(client_id:, client_secret:, grant_type:, code:, code_verifier:, invitation_token:, ip_address:, device_id:, user_agent:, request_options:); end + + sig do + params( + client_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::DeviceAuthorizationResponse) + end + def create_device(client_id:, request_options:); end + + sig do + params( + session_id: String, + return_to: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def revoke_session(session_id:, return_to:, request_options:); end + + sig do + params( + origin: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::CORSOriginResponse) + end + def create_cors_origin(origin:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::EmailVerification) + end + def get_email_verification(id:, request_options:); end + + sig do + params( + email: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::PasswordReset) + end + def reset_password(email:, request_options:); end + + sig do + params( + token: String, + new_password: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::ResetPasswordResponse) + end + def confirm_password_reset(token:, new_password:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::PasswordReset) + end + def get_password_reset(id:, request_options:); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + organization: T.nilable(String), + organization_id: T.nilable(String), + email: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_users(before:, after:, limit:, order:, organization:, organization_id:, email:, request_options:); end + + sig do + params( + email: String, + first_name: T.nilable(String), + last_name: T.nilable(String), + email_verified: T.nilable(T::Boolean), + metadata: T.nilable(T::Hash[String, String]), + external_id: T.nilable(String), + password: T.nilable(String), + password_hash: T.nilable(String), + password_hash_type: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::User) + end + def create_user(email:, first_name:, last_name:, email_verified:, metadata:, external_id:, password:, password_hash:, password_hash_type:, request_options:); end + + sig do + params( + external_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::User) + end + def get_user_by_external_id(external_id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::User) + end + def get_user(id:, request_options:); end + + sig do + params( + id: String, + email: T.nilable(String), + first_name: T.nilable(String), + last_name: T.nilable(String), + email_verified: T.nilable(T::Boolean), + metadata: T.nilable(T::Hash[String, String]), + external_id: T.nilable(String), + locale: T.nilable(String), + password: T.nilable(String), + password_hash: T.nilable(String), + password_hash_type: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::User) + end + def update_user(id:, email:, first_name:, last_name:, email_verified:, metadata:, external_id:, locale:, password:, password_hash:, password_hash_type:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_user(id:, request_options:); end + + sig do + params( + id: String, + code: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::EmailChangeConfirmation) + end + def confirm_email_change(id:, code:, request_options:); end + + sig do + params( + id: String, + new_email: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::EmailChange) + end + def send_email_change(id:, new_email:, request_options:); end + + sig do + params( + id: String, + code: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::VerifyEmailResponse) + end + def verify_email(id:, code:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::SendVerificationEmailResponse) + end + def send_verification_email(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(T::Array[WorkOS::UserIdentitiesGetItem]) + end + def get_user_identities(id:, request_options:); end + + sig do + params( + id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(T::Array[WorkOS::UserSessionsListItem]) + end + def list_sessions(id:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + organization_id: T.nilable(String), + email: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(T::Array[WorkOS::UserInvite]) + end + def list_invitations(before:, after:, limit:, order:, organization_id:, email:, request_options:); end + + sig do + params( + email: String, + organization_id: T.nilable(String), + role_slug: T.nilable(String), + expires_in_days: T.nilable(Integer), + inviter_user_id: T.nilable(String), + locale: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::UserInvite) + end + def send_invitation(email:, organization_id:, role_slug:, expires_in_days:, inviter_user_id:, locale:, request_options:); end + + sig do + params( + token: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::UserInvite) + end + def find_invitation_by_token(token:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::UserInvite) + end + def get_invitation(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Invitation) + end + def accept_invitation(id:, request_options:); end + + sig do + params( + id: String, + locale: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::UserInvite) + end + def resend_invitation(id:, locale:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Invitation) + end + def revoke_invitation(id:, request_options:); end + + sig do + params( + content: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::JWTTemplateResponse) + end + def update_jwt_template(content:, request_options:); end + + sig do + params( + email: String, + invitation_token: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::MagicAuth) + end + def create_magic_auth(email:, invitation_token:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::MagicAuth) + end + def get_magic_auth(id:, request_options:); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + organization_id: T.nilable(String), + statuses: T.nilable(T::Array[String]), + user_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(T::Array[WorkOS::UserOrganizationMembership]) + end + def list_organization_memberships(before:, after:, limit:, order:, organization_id:, statuses:, user_id:, request_options:); end + + sig do + params( + user_id: String, + organization_id: String, + role_slug: T.nilable(String), + role_slugs: T.nilable(T::Array[String]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::OrganizationMembership) + end + def create_organization_membership(user_id:, organization_id:, role_slug:, role_slugs:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::UserOrganizationMembership) + end + def get_organization_membership(id:, request_options:); end + + sig do + params( + id: String, + role_slug: T.nilable(String), + role_slugs: T.nilable(T::Array[String]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::UserOrganizationMembership) + end + def update_organization_membership(id:, role_slug:, role_slugs:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_organization_membership(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::OrganizationMembership) + end + def deactivate_organization_membership(id:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::UserOrganizationMembership) + end + def reactivate_organization_membership(id:, request_options:); end + + sig do + params( + uri: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::RedirectUri) + end + def create_redirect_uri(uri:, request_options:); end + + sig do + params( + user_id: String, + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_user_authorized_applications(user_id:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + application_id: String, + user_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_user_authorized_application(application_id:, user_id:, request_options:); end + + end +end diff --git a/rbi/workos/user_management_login_request.rbi b/rbi/workos/user_management_login_request.rbi new file mode 100644 index 00000000..2e20cf9c --- /dev/null +++ b/rbi/workos/user_management_login_request.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserManagementLoginRequest + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def external_auth_id; end + + sig { params(value: String).returns(String) } + def external_auth_id=(value); end + + sig { returns(WorkOS::UserObject) } + def user; end + + sig { params(value: WorkOS::UserObject).returns(WorkOS::UserObject) } + def user=(value); end + + sig { returns(T.nilable(T::Array[WorkOS::UserConsentOption])) } + def user_consent_options; end + + sig { params(value: T.nilable(T::Array[WorkOS::UserConsentOption])).returns(T.nilable(T::Array[WorkOS::UserConsentOption])) } + def user_consent_options=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_object.rbi b/rbi/workos/user_object.rbi new file mode 100644 index 00000000..b34fdedc --- /dev/null +++ b/rbi/workos/user_object.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserObject + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def first_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def first_name=(value); end + + sig { returns(T.nilable(String)) } + def last_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def last_name=(value); end + + sig { returns(T.nilable(T::Hash[String, String])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, String])).returns(T.nilable(T::Hash[String, String])) } + def metadata=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_organization_membership.rbi b/rbi/workos/user_organization_membership.rbi new file mode 100644 index 00000000..61403395 --- /dev/null +++ b/rbi/workos/user_organization_membership.rbi @@ -0,0 +1,83 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserOrganizationMembership + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T::Boolean) } + def directory_managed; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def directory_managed=(value); end + + sig { returns(T.nilable(String)) } + def organization_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_name=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def custom_attributes; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def custom_attributes=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(WorkOS::SlimRole) } + def role; end + + sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } + def role=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_organization_membership_base_list_data.rbi b/rbi/workos/user_organization_membership_base_list_data.rbi new file mode 100644 index 00000000..0a285892 --- /dev/null +++ b/rbi/workos/user_organization_membership_base_list_data.rbi @@ -0,0 +1,77 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserOrganizationMembershipBaseListData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T::Boolean) } + def directory_managed; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def directory_managed=(value); end + + sig { returns(T.nilable(String)) } + def organization_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_name=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def custom_attributes; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def custom_attributes=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_sessions_impersonator.rbi b/rbi/workos/user_sessions_impersonator.rbi new file mode 100644 index 00000000..4a8e7b33 --- /dev/null +++ b/rbi/workos/user_sessions_impersonator.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserSessionsImpersonator + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def email; end + + sig { params(value: String).returns(String) } + def email=(value); end + + sig { returns(T.nilable(String)) } + def reason; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def reason=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_sessions_list_item.rbi b/rbi/workos/user_sessions_list_item.rbi new file mode 100644 index 00000000..4679d500 --- /dev/null +++ b/rbi/workos/user_sessions_list_item.rbi @@ -0,0 +1,95 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserSessionsListItem + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(T.nilable(WorkOS::UserSessionsImpersonator)) } + def impersonator; end + + sig { params(value: T.nilable(WorkOS::UserSessionsImpersonator)).returns(T.nilable(WorkOS::UserSessionsImpersonator)) } + def impersonator=(value); end + + sig { returns(T.nilable(String)) } + def ip_address; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ip_address=(value); end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def user_agent; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_agent=(value); end + + sig { returns(String) } + def user_id; end + + sig { params(value: String).returns(String) } + def user_id=(value); end + + sig { returns(String) } + def auth_method; end + + sig { params(value: String).returns(String) } + def auth_method=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(String) } + def expires_at; end + + sig { params(value: String).returns(String) } + def expires_at=(value); end + + sig { returns(T.nilable(String)) } + def ended_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def ended_at=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/user_updated.rbi b/rbi/workos/user_updated.rbi new file mode 100644 index 00000000..dcb93c98 --- /dev/null +++ b/rbi/workos/user_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::User) } + def data; end + + sig { params(value: WorkOS::User).returns(WorkOS::User) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/validate_api_key.rbi b/rbi/workos/validate_api_key.rbi new file mode 100644 index 00000000..a0f29ab6 --- /dev/null +++ b/rbi/workos/validate_api_key.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class ValidateApiKey + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def value; end + + sig { params(value: String).returns(String) } + def value=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_byok_key_verification_completed.rbi b/rbi/workos/vault_byok_key_verification_completed.rbi new file mode 100644 index 00000000..8f452eca --- /dev/null +++ b/rbi/workos/vault_byok_key_verification_completed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultByokKeyVerificationCompleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::VaultByokKeyVerificationCompletedData) } + def data; end + + sig { params(value: WorkOS::VaultByokKeyVerificationCompletedData).returns(WorkOS::VaultByokKeyVerificationCompletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_byok_key_verification_completed_data.rbi b/rbi/workos/vault_byok_key_verification_completed_data.rbi new file mode 100644 index 00000000..844584c0 --- /dev/null +++ b/rbi/workos/vault_byok_key_verification_completed_data.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultByokKeyVerificationCompletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(String) } + def key_provider; end + + sig { params(value: String).returns(String) } + def key_provider=(value); end + + sig { returns(T::Boolean) } + def verified; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def verified=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_data_created.rbi b/rbi/workos/vault_data_created.rbi new file mode 100644 index 00000000..8e12e163 --- /dev/null +++ b/rbi/workos/vault_data_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDataCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::VaultDataCreatedData) } + def data; end + + sig { params(value: WorkOS::VaultDataCreatedData).returns(WorkOS::VaultDataCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_data_created_data.rbi b/rbi/workos/vault_data_created_data.rbi new file mode 100644 index 00000000..66bdb5af --- /dev/null +++ b/rbi/workos/vault_data_created_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDataCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def actor_id; end + + sig { params(value: String).returns(String) } + def actor_id=(value); end + + sig { returns(String) } + def actor_source; end + + sig { params(value: String).returns(String) } + def actor_source=(value); end + + sig { returns(String) } + def actor_name; end + + sig { params(value: String).returns(String) } + def actor_name=(value); end + + sig { returns(String) } + def kv_name; end + + sig { params(value: String).returns(String) } + def kv_name=(value); end + + sig { returns(String) } + def key_id; end + + sig { params(value: String).returns(String) } + def key_id=(value); end + + sig { returns(T::Hash[String, String]) } + def key_context; end + + sig { params(value: T::Hash[String, String]).returns(T::Hash[String, String]) } + def key_context=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_data_deleted.rbi b/rbi/workos/vault_data_deleted.rbi new file mode 100644 index 00000000..d353cd38 --- /dev/null +++ b/rbi/workos/vault_data_deleted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDataDeleted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::VaultDataDeletedData) } + def data; end + + sig { params(value: WorkOS::VaultDataDeletedData).returns(WorkOS::VaultDataDeletedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_data_deleted_data.rbi b/rbi/workos/vault_data_deleted_data.rbi new file mode 100644 index 00000000..bf957d95 --- /dev/null +++ b/rbi/workos/vault_data_deleted_data.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDataDeletedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def actor_id; end + + sig { params(value: String).returns(String) } + def actor_id=(value); end + + sig { returns(String) } + def actor_source; end + + sig { params(value: String).returns(String) } + def actor_source=(value); end + + sig { returns(String) } + def actor_name; end + + sig { params(value: String).returns(String) } + def actor_name=(value); end + + sig { returns(String) } + def kv_name; end + + sig { params(value: String).returns(String) } + def kv_name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_data_read.rbi b/rbi/workos/vault_data_read.rbi new file mode 100644 index 00000000..5106c8fa --- /dev/null +++ b/rbi/workos/vault_data_read.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDataRead + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::VaultDataReadData) } + def data; end + + sig { params(value: WorkOS::VaultDataReadData).returns(WorkOS::VaultDataReadData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_data_read_data.rbi b/rbi/workos/vault_data_read_data.rbi new file mode 100644 index 00000000..58b26b19 --- /dev/null +++ b/rbi/workos/vault_data_read_data.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDataReadData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def actor_id; end + + sig { params(value: String).returns(String) } + def actor_id=(value); end + + sig { returns(String) } + def actor_source; end + + sig { params(value: String).returns(String) } + def actor_source=(value); end + + sig { returns(String) } + def actor_name; end + + sig { params(value: String).returns(String) } + def actor_name=(value); end + + sig { returns(String) } + def kv_name; end + + sig { params(value: String).returns(String) } + def kv_name=(value); end + + sig { returns(String) } + def key_id; end + + sig { params(value: String).returns(String) } + def key_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_data_updated.rbi b/rbi/workos/vault_data_updated.rbi new file mode 100644 index 00000000..f889f13e --- /dev/null +++ b/rbi/workos/vault_data_updated.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDataUpdated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::VaultDataUpdatedData) } + def data; end + + sig { params(value: WorkOS::VaultDataUpdatedData).returns(WorkOS::VaultDataUpdatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_data_updated_data.rbi b/rbi/workos/vault_data_updated_data.rbi new file mode 100644 index 00000000..7126675d --- /dev/null +++ b/rbi/workos/vault_data_updated_data.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDataUpdatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def actor_id; end + + sig { params(value: String).returns(String) } + def actor_id=(value); end + + sig { returns(String) } + def actor_source; end + + sig { params(value: String).returns(String) } + def actor_source=(value); end + + sig { returns(String) } + def actor_name; end + + sig { params(value: String).returns(String) } + def actor_name=(value); end + + sig { returns(String) } + def kv_name; end + + sig { params(value: String).returns(String) } + def kv_name=(value); end + + sig { returns(String) } + def key_id; end + + sig { params(value: String).returns(String) } + def key_id=(value); end + + sig { returns(T::Hash[String, String]) } + def key_context; end + + sig { params(value: T::Hash[String, String]).returns(T::Hash[String, String]) } + def key_context=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_dek_decrypted.rbi b/rbi/workos/vault_dek_decrypted.rbi new file mode 100644 index 00000000..2b4edf8b --- /dev/null +++ b/rbi/workos/vault_dek_decrypted.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDekDecrypted + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::VaultDekDecryptedData) } + def data; end + + sig { params(value: WorkOS::VaultDekDecryptedData).returns(WorkOS::VaultDekDecryptedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_dek_decrypted_data.rbi b/rbi/workos/vault_dek_decrypted_data.rbi new file mode 100644 index 00000000..50ca3987 --- /dev/null +++ b/rbi/workos/vault_dek_decrypted_data.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDekDecryptedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def actor_id; end + + sig { params(value: String).returns(String) } + def actor_id=(value); end + + sig { returns(String) } + def actor_source; end + + sig { params(value: String).returns(String) } + def actor_source=(value); end + + sig { returns(String) } + def actor_name; end + + sig { params(value: String).returns(String) } + def actor_name=(value); end + + sig { returns(String) } + def key_id; end + + sig { params(value: String).returns(String) } + def key_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_dek_read.rbi b/rbi/workos/vault_dek_read.rbi new file mode 100644 index 00000000..13e766c3 --- /dev/null +++ b/rbi/workos/vault_dek_read.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDekRead + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::VaultDekReadData) } + def data; end + + sig { params(value: WorkOS::VaultDekReadData).returns(WorkOS::VaultDekReadData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_dek_read_data.rbi b/rbi/workos/vault_dek_read_data.rbi new file mode 100644 index 00000000..bd7f4ac1 --- /dev/null +++ b/rbi/workos/vault_dek_read_data.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultDekReadData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def actor_id; end + + sig { params(value: String).returns(String) } + def actor_id=(value); end + + sig { returns(String) } + def actor_source; end + + sig { params(value: String).returns(String) } + def actor_source=(value); end + + sig { returns(String) } + def actor_name; end + + sig { params(value: String).returns(String) } + def actor_name=(value); end + + sig { returns(T::Array[String]) } + def key_ids; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def key_ids=(value); end + + sig { returns(T::Hash[String, String]) } + def key_context; end + + sig { params(value: T::Hash[String, String]).returns(T::Hash[String, String]) } + def key_context=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_kek_created.rbi b/rbi/workos/vault_kek_created.rbi new file mode 100644 index 00000000..59fda959 --- /dev/null +++ b/rbi/workos/vault_kek_created.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultKekCreated + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::VaultKekCreatedData) } + def data; end + + sig { params(value: WorkOS::VaultKekCreatedData).returns(WorkOS::VaultKekCreatedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_kek_created_data.rbi b/rbi/workos/vault_kek_created_data.rbi new file mode 100644 index 00000000..a70b6302 --- /dev/null +++ b/rbi/workos/vault_kek_created_data.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultKekCreatedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def actor_id; end + + sig { params(value: String).returns(String) } + def actor_id=(value); end + + sig { returns(String) } + def actor_source; end + + sig { params(value: String).returns(String) } + def actor_source=(value); end + + sig { returns(String) } + def actor_name; end + + sig { params(value: String).returns(String) } + def actor_name=(value); end + + sig { returns(String) } + def key_name; end + + sig { params(value: String).returns(String) } + def key_name=(value); end + + sig { returns(String) } + def key_id; end + + sig { params(value: String).returns(String) } + def key_id=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_metadata_read.rbi b/rbi/workos/vault_metadata_read.rbi new file mode 100644 index 00000000..90d43dcd --- /dev/null +++ b/rbi/workos/vault_metadata_read.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultMetadataRead + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::VaultMetadataReadData) } + def data; end + + sig { params(value: WorkOS::VaultMetadataReadData).returns(WorkOS::VaultMetadataReadData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_metadata_read_data.rbi b/rbi/workos/vault_metadata_read_data.rbi new file mode 100644 index 00000000..212473d6 --- /dev/null +++ b/rbi/workos/vault_metadata_read_data.rbi @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultMetadataReadData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def actor_id; end + + sig { params(value: String).returns(String) } + def actor_id=(value); end + + sig { returns(String) } + def actor_source; end + + sig { params(value: String).returns(String) } + def actor_source=(value); end + + sig { returns(String) } + def actor_name; end + + sig { params(value: String).returns(String) } + def actor_name=(value); end + + sig { returns(String) } + def kv_name; end + + sig { params(value: String).returns(String) } + def kv_name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_names_listed.rbi b/rbi/workos/vault_names_listed.rbi new file mode 100644 index 00000000..a3155914 --- /dev/null +++ b/rbi/workos/vault_names_listed.rbi @@ -0,0 +1,53 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultNamesListed + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def event; end + + sig { params(value: String).returns(String) } + def event=(value); end + + sig { returns(WorkOS::VaultNamesListedData) } + def data; end + + sig { params(value: WorkOS::VaultNamesListedData).returns(WorkOS::VaultNamesListedData) } + def data=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T.nilable(WorkOS::EventContext)) } + def context; end + + sig { params(value: T.nilable(WorkOS::EventContext)).returns(T.nilable(WorkOS::EventContext)) } + def context=(value); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/vault_names_listed_data.rbi b/rbi/workos/vault_names_listed_data.rbi new file mode 100644 index 00000000..28ccb8fe --- /dev/null +++ b/rbi/workos/vault_names_listed_data.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultNamesListedData + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def actor_id; end + + sig { params(value: String).returns(String) } + def actor_id=(value); end + + sig { returns(String) } + def actor_source; end + + sig { params(value: String).returns(String) } + def actor_source=(value); end + + sig { returns(String) } + def actor_name; end + + sig { params(value: String).returns(String) } + def actor_name=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/verify_email_address.rbi b/rbi/workos/verify_email_address.rbi new file mode 100644 index 00000000..96d9af1c --- /dev/null +++ b/rbi/workos/verify_email_address.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VerifyEmailAddress + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def code; end + + sig { params(value: String).returns(String) } + def code=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/verify_email_response.rbi b/rbi/workos/verify_email_response.rbi new file mode 100644 index 00000000..335a9f65 --- /dev/null +++ b/rbi/workos/verify_email_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VerifyEmailResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(WorkOS::User) } + def user; end + + sig { params(value: WorkOS::User).returns(WorkOS::User) } + def user=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/webhook_endpoint.rbi b/rbi/workos/webhook_endpoint.rbi new file mode 100644 index 00000000..b752841c --- /dev/null +++ b/rbi/workos/webhook_endpoint.rbi @@ -0,0 +1,65 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class WebhookEndpoint + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def endpoint_url; end + + sig { params(value: String).returns(String) } + def endpoint_url=(value); end + + sig { returns(String) } + def secret; end + + sig { params(value: String).returns(String) } + def secret=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T::Array[String]) } + def events; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def events=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/webhooks.rbi b/rbi/workos/webhooks.rbi new file mode 100644 index 00000000..73fc68b9 --- /dev/null +++ b/rbi/workos/webhooks.rbi @@ -0,0 +1,51 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Webhooks + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + before: T.nilable(String), + after: T.nilable(String), + limit: T.nilable(Integer), + order: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_webhook_endpoints(before:, after:, limit:, order:, request_options:); end + + sig do + params( + endpoint_url: String, + events: T::Array[String], + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::WebhookEndpoint) + end + def create_webhook_endpoint(endpoint_url:, events:, request_options:); end + + sig do + params( + id: String, + endpoint_url: T.nilable(String), + status: T.nilable(String), + events: T.nilable(T::Array[String]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::WebhookEndpoint) + end + def update_webhook_endpoint(id:, endpoint_url:, status:, events:, request_options:); end + + sig do + params( + id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_webhook_endpoint(id:, request_options:); end + + end +end diff --git a/rbi/workos/widget_session_token.rbi b/rbi/workos/widget_session_token.rbi new file mode 100644 index 00000000..dab99ffc --- /dev/null +++ b/rbi/workos/widget_session_token.rbi @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class WidgetSessionToken + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(value); end + + sig { returns(T.nilable(String)) } + def user_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def user_id=(value); end + + sig { returns(T.nilable(T::Array[String])) } + def scopes; end + + sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } + def scopes=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/widget_session_token_response.rbi b/rbi/workos/widget_session_token_response.rbi new file mode 100644 index 00000000..bf91ee36 --- /dev/null +++ b/rbi/workos/widget_session_token_response.rbi @@ -0,0 +1,23 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class WidgetSessionTokenResponse + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def token; end + + sig { params(value: String).returns(String) } + def token=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/widgets.rbi b/rbi/workos/widgets.rbi new file mode 100644 index 00000000..60ae5ed3 --- /dev/null +++ b/rbi/workos/widgets.rbi @@ -0,0 +1,22 @@ +# frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Widgets + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + organization_id: String, + user_id: T.nilable(String), + scopes: T.nilable(T::Array[String]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::WidgetSessionTokenResponse) + end + def create_token(organization_id:, user_id:, scopes:, request_options:); end + + end +end diff --git a/script/ci b/script/ci new file mode 100755 index 00000000..a1affc4b --- /dev/null +++ b/script/ci @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname "$0")/.." + +echo "==> standardrb (lint)" +bundle exec standardrb + +# Ruby has no separate type-check step here: this gem doesn't ship Sorbet +# (.rbi) or RBS signatures. If we add either later, run `srb tc` or +# `rbs validate` here. + +echo "==> rake test" +bundle exec rake test + +echo "==> All checks passed." diff --git a/test/fixtures/profile.txt b/test/fixtures/profile.txt deleted file mode 100644 index 5e8df665..00000000 --- a/test/fixtures/profile.txt +++ /dev/null @@ -1 +0,0 @@ -{"profile":{"object":"profile","id":"prof_01DRA1XNSJDZ19A31F183ECQW5","email":"demo@workos-okta.com","first_name":"WorkOS","organization_id":"org_01FG53X8636WSNW2WEKB2C31ZB","connection_id":"conn_01EMH8WAK20T42N2NBMNBCYHAG","connection_type":"OktaSAML","last_name":"Demo","role":{"slug": "admin"},"roles":[{"slug": "admin"}],"groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357","custom_attributes":{"license": "professional"},"raw_attributes":{"id":"prof_01DRA1XNSJDZ19A31F183ECQW5","email":"demo@workos-okta.com","first_name":"WorkOS","last_name":"Demo","groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357","license": "professional"}},"access_token":"01DVX6QBS3EG6FHY2ESAA5Q65X"} diff --git a/test/fixtures/vcr_cassettes/audit_logs/create_event.yml b/test/fixtures/vcr_cassettes/audit_logs/create_event.yml deleted file mode 100644 index 4f64036a..00000000 --- a/test/fixtures/vcr_cassettes/audit_logs/create_event.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/audit_logs/events - body: - encoding: UTF-8 - string: '{"organization_id":"org_123","event":{"action":"user.signed_in","occurred_at":"2022-08-22T15:04:19.704Z","actor":{"id":"user_123","type":"user","name":"User","metadata":{"foo":"bar"}},"targets":[{"id":"team_123","type":"team","name":"Team","metadata":{"foo":"bar"}}],"context":{"location":"1.1.1.1","user_agent":"Mozilla"}}}' - headers: - Content-Type: "application/json" - Accept-Encoding: "gzip;q=1.0,deflate;q=0.6,identity;q=0.3" - Accept: "*/*" - User-Agent: "WorkOS; ruby/3.0.2; x86_64-darwin21; v2.5.1" - Authorization: "Bearer example_api_key" - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Access-Control-Allow-Origin: - - https://dashboard.workos.com - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - X-Dns-Prefetch-Control: - - "off" - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - 1cf9b8e7-5910-4a6d-a333-46bcf841422e - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "16" - Etag: - - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA" - Date: - - Sat, 11 Jan 2020 04:22:48 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"success":true}' - http_version: - recorded_at: Sat, 11 Jan 2020 04:22:48 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml b/test/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml deleted file mode 100644 index c590f60d..00000000 --- a/test/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/audit_logs/events - body: - encoding: UTF-8 - string: '{"organization_id":"org_123","event":{"action":"user.signed_in","occurred_at":"2022-08-22T15:04:19.704Z","actor":{"id":"user_123","type":"user","name":"User","metadata":{"foo":"bar"}},"targets":[{"id":"team_123","type":"team","name":"Team","metadata":{"foo":"bar"}}],"context":{"location":"1.1.1.1","user_agent":"Mozilla"}}}' - headers: - Content-Type: "application/json" - Accept-Encoding: "gzip;q=1.0,deflate;q=0.6,identity;q=0.3" - Accept: "*/*" - User-Agent: "WorkOS; ruby/3.0.2; x86_64-darwin21; v2.5.1" - Authorization: "Bearer example_api_key" - Idempotency-Key: "idempotency_key" - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Access-Control-Allow-Origin: - - https://dashboard.workos.com - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - X-Dns-Prefetch-Control: - - "off" - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - 1cf9b8e7-5910-4a6d-a333-46bcf841422e - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "16" - Etag: - - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA" - Date: - - Sat, 11 Jan 2020 04:22:48 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"success":true}' - http_version: - recorded_at: Sat, 11 Jan 2020 04:22:48 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml b/test/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml deleted file mode 100644 index fb5e3a63..00000000 --- a/test/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/audit_logs/events - body: - encoding: UTF-8 - string: '{"organization_id":"org_123","event":{"action":"user.signed_in","occurred_at":"2022-08-22T15:04:19.704Z","actor":{"id":"user_123","type":"user","name":"User","metadata":{"foo":"bar"}},"targets":[{"id":"team_123","type":"team","name":"Team","metadata":{"foo":"bar"}}],"context":{"location":"1.1.1.1","user_agent":"Mozilla"}}}' - headers: - Content-Type: "application/json" - Accept-Encoding: "gzip;q=1.0,deflate;q=0.6,identity;q=0.3" - Accept: "*/*" - User-Agent: "WorkOS; ruby/3.0.2; x86_64-darwin21; v2.5.1" - Authorization: "Bearer example_api_key" - response: - status: - code: 400 - message: Bad Request - headers: - Server: - - Cowboy - Connection: - - keep-alive - Access-Control-Allow-Origin: - - https://dashboard.workos.com - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - X-Dns-Prefetch-Control: - - "off" - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - 1cf9b8e7-5910-4a6d-a333-46bcf841422e - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "16" - Etag: - - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA" - Date: - - Sat, 11 Jan 2020 04:22:48 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"code":"invalid_audit_log","message":"Invalid Audit Log event","errors":[{"instancePath":"/targets/0/type","schemaPath":"#/properties/targets/allOf/0/contains/properties/type/const","keyword":"const","params":{"allowValues":["team"]},"message":"must be equal to constant","schema":"team","parentSchema":{"enum":["team"],"type":"string"},"data":"user"}]}' - http_version: - recorded_at: Sat, 11 Jan 2020 04:22:48 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/audit_logs/create_export.yml b/test/fixtures/vcr_cassettes/audit_logs/create_export.yml deleted file mode 100644 index 8bd71cbc..00000000 --- a/test/fixtures/vcr_cassettes/audit_logs/create_export.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/audit_logs/exports - body: - encoding: UTF-8 - string: '{"organization_id":"org_123","range_start":"2022-06-22T15:04:19.704Z","range_end":"2022-08-22T15:04:19.704Z"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin21; v2.5.1 - Authorization: - - "Bearer example_api_key" - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 22 Aug 2022 17:47:49 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "26" - Connection: - - keep-alive - Cf-Ray: - - 73ed6f92c9161847-ATL - Etag: - - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (a302eeabfffb) - Cf-Cache-Status: - - DYNAMIC - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - eb09b349-08f4-b79b-ccb2-87fa4609c1ee - X-Xss-Protection: - - "0" - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"audit_log_export","id":"audit_log_export_123","state":"pending","created_at":"2022-08-22T15:04:19.704Z","updated_at":"2022-08-22T15:04:19.704Z"}' - http_version: - recorded_at: Mon, 22 Aug 2022 17:47:49 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml b/test/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml deleted file mode 100644 index 11e27b87..00000000 --- a/test/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml +++ /dev/null @@ -1,77 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/audit_logs/exports - body: - encoding: UTF-8 - string: - '{"organization_id":"org_123","range_start":"2022-06-22T15:04:19.704Z","range_end":"2022-08-22T15:04:19.704Z","actions":["user.signed_in"],"actors":["Jon Smith"],"actor_names":["Jon Smith"],"actor_ids":["user_123"],"targets":["user","team"]}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin21; v2.5.1 - Authorization: - - "Bearer example_api_key" - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 22 Aug 2022 17:47:49 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "26" - Connection: - - keep-alive - Cf-Ray: - - 73ed6f92c9161847-ATL - Etag: - - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (a302eeabfffb) - Cf-Cache-Status: - - DYNAMIC - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - eb09b349-08f4-b79b-ccb2-87fa4609c1ee - X-Xss-Protection: - - "0" - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"audit_log_export","id":"audit_log_export_123","state":"pending","created_at":"2022-08-22T15:04:19.704Z","updated_at":"2022-08-22T15:04:19.704Z"}' - http_version: - recorded_at: Mon, 22 Aug 2022 17:47:49 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/audit_logs/get_export.yml b/test/fixtures/vcr_cassettes/audit_logs/get_export.yml deleted file mode 100644 index 589f7377..00000000 --- a/test/fixtures/vcr_cassettes/audit_logs/get_export.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- -http_interactions: - - request: - method: get - uri: https://api.workos.com/audit_logs/exports/audit_log_export_123 - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin21; v2.5.1 - Authorization: - - "Bearer example_api_key" - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 22 Aug 2022 17:47:49 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "26" - Connection: - - keep-alive - Cf-Ray: - - 73ed6f92c9161847-ATL - Etag: - - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (a302eeabfffb) - Cf-Cache-Status: - - DYNAMIC - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - eb09b349-08f4-b79b-ccb2-87fa4609c1ee - X-Xss-Protection: - - "0" - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"audit_log_export","id":"audit_log_export_123","state":"ready","url":"https://audit-logs.com/download.csv","created_at":"2022-08-22T15:04:19.704Z","updated_at":"2022-08-22T15:04:19.704Z"}' - http_version: - recorded_at: Mon, 22 Aug 2022 17:47:49 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/audit_trail/create_event.yml b/test/fixtures/vcr_cassettes/audit_trail/create_event.yml deleted file mode 100644 index 79c77eea..00000000 --- a/test/fixtures/vcr_cassettes/audit_trail/create_event.yml +++ /dev/null @@ -1,65 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/events - body: - encoding: UTF-8 - string: '{"group":"Terrace House","location":"1.1.1.1","action":"house.created","action_type":"C","actor_name":"Daiki - Miyagi","actor_id":"user_12345","target_name":"Ryota Yamasato","target_id":"user_67890","occurred_at":"2020-01-10T15:30:00-05:00","metadata":{"a":"b"}}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.6.5; x86_64-darwin19; v0.1.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Access-Control-Allow-Origin: - - https://dashboard.workos.com - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Dns-Prefetch-Control: - - 'off' - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - b0aea387-fce0-446b-95e9-600dd869a8b0 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '16' - Etag: - - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA" - Date: - - Sat, 11 Jan 2020 04:24:02 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"success":true}' - http_version: - recorded_at: Sat, 11 Jan 2020 04:24:02 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml b/test/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml deleted file mode 100644 index db658401..00000000 --- a/test/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml +++ /dev/null @@ -1,67 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/events - body: - encoding: UTF-8 - string: '{"group":"Terrace House","location":"1.1.1.1","action":"house.created","action_type":"C","actor_name":"Daiki - Miyagi","actor_id":"user_12345","target_name":"Ryota Yamasato","target_id":"user_67890","occurred_at":"2020-01-10T15:30:00-05:00","metadata":{"a":"b"}}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.6.5; x86_64-darwin19; v0.1.0 - Authorization: - - Bearer - Idempotency-Key: - - key - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Access-Control-Allow-Origin: - - https://dashboard.workos.com - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Dns-Prefetch-Control: - - 'off' - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - 1cf9b8e7-5910-4a6d-a333-46bcf841422e - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '16' - Etag: - - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA" - Date: - - Sat, 11 Jan 2020 04:22:48 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"success":true}' - http_version: - recorded_at: Sat, 11 Jan 2020 04:22:48 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml b/test/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml deleted file mode 100644 index 1fb1b91b..00000000 --- a/test/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml +++ /dev/null @@ -1,68 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/events - body: - encoding: UTF-8 - string: '{"group":"Terrace House","location":"1.1.1.1","action":"house.created","actor_name":"Daiki - Miyagi","actor_id":"user_12345","target_name":"Ryota Yamasato","target_id":"user_67890","occurred_at":"2020-01-10T15:30:00-05:00","metadata":{"a":"b"}}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.6.5; x86_64-darwin19; v0.1.0 - Authorization: - - Bearer - response: - status: - code: 422 - message: Unprocessable Entity - headers: - Server: - - Cowboy - Connection: - - keep-alive - Access-Control-Allow-Origin: - - https://dashboard.workos.com - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Dns-Prefetch-Control: - - 'off' - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - b5e5033d-4d6c-4459-9018-4746be643113 - Request-Id: - - b5e5033d-4d6c-4459-9018-4746be643113 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '104' - Etag: - - W/"68-JY6dzr9lnqlivbnfVxCBKwKt3Zc" - Date: - - Sat, 11 Jan 2020 02:32:14 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"Validation failed","errors":[{"field":"action_type","code":"action_type - must be a string"}]}' - http_version: - recorded_at: Sat, 11 Jan 2020 02:32:14 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml b/test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml deleted file mode 100644 index 85957340..00000000 --- a/test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml +++ /dev/null @@ -1,131 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/events - body: - encoding: UTF-8 - string: '{"group":"Terrace House","location":"1.1.1.1","action":"house.created","action_type":"C","actor_name":"Daiki - Miyagi","actor_id":"user_12345","target_name":"Ryota Yamasato","target_id":"user_67890","occurred_at":"2020-01-10T15:30:00-05:00","metadata":{"a":"b"}}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.6.5; x86_64-darwin19; v0.1.0 - Authorization: - - Bearer - Idempotency-Key: - - foo - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Access-Control-Allow-Origin: - - https://dashboard.workos.com - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Dns-Prefetch-Control: - - 'off' - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - 495fd4e3-a66c-4154-8922-22fb3fb1f809 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '16' - Etag: - - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA" - Date: - - Sat, 11 Jan 2020 04:25:32 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"success":true}' - http_version: - recorded_at: Sat, 11 Jan 2020 04:25:32 GMT -- request: - method: post - uri: https://api.workos.com/events - body: - encoding: UTF-8 - string: '{"group":"Terrace House","location":"1.1.1.1","action":"house.created","action_type":"C","actor_name":"Daiki - Miyagi","actor_id":"user_12345","target_name":"Ryota Yamasato","target_id":"user_67890","occurred_at":"2020-01-10T15:30:00-05:00","metadata":{"a":"b"}}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.6.5; x86_64-darwin19; v0.1.0 - Authorization: - - Bearer - Idempotency-Key: - - foo - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Access-Control-Allow-Origin: - - https://dashboard.workos.com - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Dns-Prefetch-Control: - - 'off' - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - 66cf2a20-65a5-47ae-94f9-fd215f1705a3 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '16' - Etag: - - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA" - Date: - - Sat, 11 Jan 2020 04:25:32 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"success":true}' - http_version: - recorded_at: Sat, 11 Jan 2020 04:25:32 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml b/test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml deleted file mode 100644 index 63a86e27..00000000 --- a/test/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml +++ /dev/null @@ -1,134 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/events - body: - encoding: UTF-8 - string: '{"group":"Terrace House","location":"1.1.1.1","action":"house.created","action_type":"C","actor_name":"Daiki - Miyagi","actor_id":"user_12345","target_name":"Ryota Yamasato","target_id":"user_67890","occurred_at":"2020-01-10T15:30:00-05:00","metadata":{"a":"b"}}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.6.5; x86_64-darwin19; v0.1.0 - Authorization: - - Bearer - Idempotency-Key: - - bar - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Access-Control-Allow-Origin: - - https://dashboard.workos.com - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Dns-Prefetch-Control: - - 'off' - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - fb5891e8-eb0c-4257-b476-c5aea60623c3 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '16' - Etag: - - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA" - Date: - - Sat, 11 Jan 2020 04:48:06 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"success":true}' - http_version: - recorded_at: Sat, 11 Jan 2020 04:48:06 GMT -- request: - method: post - uri: https://api.workos.com/events - body: - encoding: UTF-8 - string: '{"group":"Terrace House","location":"1.1.1.1","action":"house.created","action_type":"C","actor_name":"Tetsuya - Sugaya","actor_id":"user_12345","target_name":"Ryota Yamasato","target_id":"user_67890","occurred_at":"2020-01-10T15:30:00-05:00","metadata":{"a":"b"}}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.6.5; x86_64-darwin19; v0.1.0 - Authorization: - - Bearer - Idempotency-Key: - - bar - response: - status: - code: 400 - message: Bad Request - headers: - Server: - - Cowboy - Connection: - - keep-alive - Access-Control-Allow-Origin: - - https://dashboard.workos.com - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Dns-Prefetch-Control: - - 'off' - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - 3f060f0b-2c26-46c2-a2f8-76c4332e84aa - Request-Id: - - 3f060f0b-2c26-46c2-a2f8-76c4332e84aa - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '128' - Etag: - - W/"80-jILfJK6SRXhN8oqz8Na6yutVwHM" - Date: - - Sat, 11 Jan 2020 04:48:06 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"Another idempotency key (bar) with different request parameters - was found. Please use a different idempotency key."}' - http_version: - recorded_at: Sat, 11 Jan 2020 04:48:06 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/audit_trail/get_events.yml b/test/fixtures/vcr_cassettes/audit_trail/get_events.yml deleted file mode 100644 index f888e16d..00000000 --- a/test/fixtures/vcr_cassettes/audit_trail/get_events.yml +++ /dev/null @@ -1,61 +0,0 @@ ---- -http_interactions: - - request: - method: get - uri: https://api.workos.com/events - body: - encoding: US-ASCII - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - X-Dns-Prefetch-Control: - - "off" - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - "" - Content-Type: - - application/json; charset=utf-8 - Etag: - - W/"1784-HtVN7X+AT30Dlt9nZrirP0nnyV8" - Date: - - Fri, 31 Jul 2020 14:41:12 GMT - Connection: - - keep-alive - Transfer-Encoding: - - chunked - body: - encoding: ASCII-8BIT - string: - '{"data":[{"object":"event","id":"evt_01EEJM9Q9SMC3W2SZDKA5VJ8XQ","group":"workos.com","location":"::1","latitude":null,"longitude":null,"type":"r","actor_name":"foo@example.com","actor_id":"user_01EEG9P7A1DA9VY9CX7GT47RPF","target_name":"api_key_query","target_id":"key_01EEG9MPHAYX46BBZKGK3BGQXJ","metadata":{"description":"User - viewed API key.","x_request_id":""},"occurred_at":"2020-07-31T14:27:00.384Z","action":{"object":"event_action","id":"evt_action_01EEGQXWAHB065P5JD0QDAAGDC","name":"user.viewed_api_key","client_id":"project_01DZB0E7HQMA6G85PQNHQJMZD0"}},{"object":"event","id":"evt_01EEJM9Q7GMR1VGT6VXN2N2JJQ","group":"workos.com","location":"::1","latitude":null,"longitude":null,"type":"r","actor_name":"foo@example.com","actor_id":"user_01EEG9P7A1DA9VY9CX7GT47RPF","target_name":"api_key_query","target_id":"key_01EEG9MPGM8KFT9VBQHJMV8YZB","metadata":{"description":"User - viewed API key.","x_request_id":""},"occurred_at":"2020-07-31T14:27:00.360Z","action":{"object":"event_action","id":"evt_action_01EEGQXWAHB065P5JD0QDAAGDC","name":"user.viewed_api_key","client_id":"project_01DZB0E7HQMA6G85PQNHQJMZD0"}}],"listMetadata":{"before":"evt_01EEJKZDAR6G4JHFQT4R3KSZDQ","after":null}}' - http_version: - recorded_at: Fri, 31 Jul 2020 14:41:12 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml b/test/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml deleted file mode 100644 index 1e2acb5e..00000000 --- a/test/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml +++ /dev/null @@ -1,66 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/audit_logs/events - body: - encoding: UTF-8 - string: '{}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - '*/*' - User-Agent: - - WorkOS; ruby/2.6.5; x86_64-darwin19; v0.1.0 - Authorization: - - 'Bearer ' - response: - status: - code: 401 - message: Unauthorized - headers: - Server: - - Cowboy - Connection: - - keep-alive - Access-Control-Allow-Origin: - - https://dashboard.workos-test.com - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Dns-Prefetch-Control: - - 'off' - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - 32a67a24-bfaf-4463-bf47-c407d54955d3 - Request-Id: - - 32a67a24-bfaf-4463-bf47-c407d54955d3 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '26' - Etag: - - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw" - Date: - - Sat, 11 Jan 2020 03:50:27 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"Unauthorized"}' - http_version: - recorded_at: Sat, 11 Jan 2020 03:50:27 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/delete_directory.yml b/test/fixtures/vcr_cassettes/directory_sync/delete_directory.yml deleted file mode 100644 index 3749a318..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/delete_directory.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.workos.com/directories/directory_01F2T098SKN5PCTVSJ7CWP70N5 - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin20; v0.10.3 - Authorization: - - Bearer - response: - status: - code: 202 - message: Accepted - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 834c3434-80dd-4e5e-bda7-95cd1412ad29 - Content-Type: - - text/plain; charset=utf-8 - Content-Length: - - '8' - Etag: - - W/"8-YaBXLEiT7zQxEyDYTILfiL6oPhE" - Date: - - Wed, 21 Apr 2021 22:26:51 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: Accepted - http_version: - recorded_at: Wed, 21 Apr 2021 22:26:51 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml b/test/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml deleted file mode 100644 index e75364f4..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directories/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v1.6.1 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Sun, 07 Nov 2021 19:18:31 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - - Etag: - - W/"5d-Sx4XoCfDLxkGIc0yAjSbi2ILYww" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=9UGS4Swz%2BHWvLOf0MGTCQbJyS0uBKnB72E77LfjybUN%2FXbJaDPBYfHnAUcgVM7JZbTefNquu4bG0Fw0edgQVoGnTK9OWPuO6fVKmo8XkF1G%2FNgibe8B715ZZje%2FZM7m3%2B9bEbNout5ArQfFyyQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6aa8e86f7b5a66bf-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"message":"Directory not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}' - http_version: - recorded_at: Sun, 07 Nov 2021 19:18:31 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml b/test/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml deleted file mode 100644 index ed47256e..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directories/directory_01FK17DWRHH7APAFXT5B52PV0W - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v1.6.1 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Sun, 07 Nov 2021 19:18:31 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - c63229f4-faa3-4693-a769-f132af1d156e - Etag: - - W/"149-gnrinkKr5pyIOSLENIObBLph9N0" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=8pe6lAa%2BE5FfpwjmgW1wU%2Fn%2BqfVS0xUHV0FKT%2Fvt%2FpQCa1A4nNwqR1hMyE9ytoi%2F3InXs3rP9ELYw%2FpJZ1Ow0uaNd3xoll7al5maCCPI1JWivjr%2Bxx6G1Otiw5iTIaAh3MXoP0pjUAnZVsf4bw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6aa8e86daa570b76-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"directory","id":"directory_01FK17DWRHH7APAFXT5B52PV0W","organization_id":"org_01F6Q6TFP7RD2PF6J03ANNWDKV","name":"Testing - Active Attribute","external_key":"QArgyQQkq4G0MquM","type":"azure scim v2.0","state":"linked","created_at":"2021-10-27T15:55:47.856Z","updated_at":"2021-10-27T16:03:43.990Z","domain":"example.me"}' - http_version: - recorded_at: Sun, 07 Nov 2021 19:18:31 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/get_group.yml b/test/fixtures/vcr_cassettes/directory_sync/get_group.yml deleted file mode 100644 index 31a7bd35..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/get_group.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_groups/directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.2; arm64-darwin21; v2.3.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 14 Jul 2022 16:49:09 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"277-8j8DgAIILf/mCF7LCmvrqcqdwK4" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (b642bf20b975) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 0f21c2f3-e24a-e3a2-85d3-41ee9e45b3e2 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=Hnm%2BEiBTG2ROFxqX2mdwcp0HvQ173SgQlQDCmTmBQEbLv9w2dkcl2qMqYh44OSHRABBCkRfuJ2MtnHuqb6sQ5RjHRMKSCfRqklsOrgd%2FHo0PEE6mW0u%2BlZqBMIlN1BEp"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 72abc002fbd9f039-EWR - body: - encoding: ASCII-8BIT - string: '{"object":"directory_group","id":"directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG","idp_id":"01jlao4614two3d","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","organization_id":"org_01EGS4P7QR31EZ4YWD1Z1XA176","name":"Sales","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-07-13T17:45:42.618Z","raw_attributes":{"id":"01jlao4614two3d","etag":"\"SEQQBYC70u6XQ2UUjmjNYw6b0a5EzY0mTMShjiZga8A/uLYJ0Hrx1gXXVg9z-zGLBZET2Wo\"","kind":"admin#directory#group","name":"Sales","email":"sales@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["sales@foo-corp.com.test-google-a.com"]}}' - http_version: - recorded_at: Thu, 14 Jul 2022 16:49:09 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml b/test/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml deleted file mode 100644 index 06d79deb..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_groups/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.2.3 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Dns-Prefetch-Control: - - 'off' - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - bbf92391-32bd-4d77-bbdc-0e77983d04d4 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '23' - Etag: - - W/"17-SuRA/yvUWUo8rK6x7dKURLeBo+0" - Date: - - Thu, 30 Apr 2020 04:48:28 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"Not Found"}' - http_version: - recorded_at: Thu, 30 Apr 2020 04:48:28 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/get_user.yml b/test/fixtures/vcr_cassettes/directory_sync/get_user.yml deleted file mode 100644 index 25717c4d..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/get_user.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_users/directory_user_01FAZYNPC8M0HRYTKFP2GNX852 - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.2; arm64-darwin21; v2.3.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 14 Jul 2022 16:46:23 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '616' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"680-NPvBik348v8xg6EE7iZMYwD5UXw" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (b642bf20b975) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 51a82273-b413-cead-b968-c07ba4d6fd08 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=OS7ELJ3A8tkzMafvaIThD%2B5JlYmul1puZlAXTxEKYBLlq%2B6DCtqDqAi4dtr4yRP3khNmg6MwPiuLqtdOXRmPOtag9Ti%2FGK8ra%2BJOlpwkFjD965CNBfzao4EJtExDkbS3"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 72abbbf2b93e8ca5-EWR - body: - encoding: ASCII-8BIT - string: '{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","organization_id":"org_01FAZWCWR03DVWA83NCJYKKD54","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","role":{"slug":"member"},"roles":[{"slug":"member"}],"raw_attributes":{"id":"6092c280a3f1e19ef6d8cef8","name":"Bob - Bob Fakename","teams":["5f696c8e9a63a60e965aaca8"],"spokeId":null,"lastName":"Fakename","created_at":"2021-05-05T16:06:24+0000","firstName":"Bob","updated_at":"2021-11-11T05:08:14+0000","workEmail":"bob.fakename@workos.com","department":"Infra","departmentId":"5f27ada9a5e9bc0001a0ae4a"},"custom_attributes":{},"created_at":"2021-07-19T17:57:57.268Z","updated_at":"2022-01-24T11:23:01.614Z","groups":[{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","idp_id":"5f696c8e9a63a60e965aaca8","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","organization_id":"org_01FAZWCWR03DVWA83NCJYKKD54","name":"Team - - Platform","created_at":"2021-07-19T17:57:56.580Z","updated_at":"2022-01-24T11:23:01.333Z","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNN1NZWMBRAXXDSTB5NFH","idp_id":"5f27ada9a5e9bc0001a0ae4a","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","organization_id":"org_01FAZWCWR03DVWA83NCJYKKD54","name":"Department - - Infra","role":{"slug":"member"},"created_at":"2021-07-19T17:57:55.893Z","updated_at":"2022-01-24T11:23:01.333Z","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae4a","name":"Infra","parent":"5f27ada9a5e9bc0001a0ae48"}}]}' - http_version: - recorded_at: Thu, 14 Jul 2022 16:46:23 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml b/test/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml deleted file mode 100644 index f973e481..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_users/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.2.3 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Dns-Prefetch-Control: - - 'off' - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Xss-Protection: - - 1; mode=block - X-Request-Id: - - 19dfa905-2015-44fb-8d5f-46f2d6c49826 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '23' - Etag: - - W/"17-SuRA/yvUWUo8rK6x7dKURLeBo+0" - Date: - - Thu, 30 Apr 2020 04:45:35 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"Not Found"}' - http_version: - recorded_at: Thu, 30 Apr 2020 04:45:35 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml deleted file mode 100644 index 88f043f4..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml +++ /dev/null @@ -1,87 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directories?after=directory_01FGCPNV312FHFRCX0BYWHVSE1&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v1.6.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Sun, 31 Oct 2021 23:16:20 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 9b8b2fde-c533-499f-8255-ae5a38dec1c9 - Etag: - - W/"57d-b8X7nQ95z8XcpGDAg30zxtq4cyU" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=bjisueAcX0y8T%2Bw7bzZ80xRsaJ5DYZJgfN2zGa5B24dZ%2BZPVtKMFVRMw4L9VpcpSuElvsrz9f503dDZJ46JT6sbHmUEE188lRzuHV1UC45wkzjRb%2B%2BMdPysI9473RJMX2ilURb2knzhC29H0YA%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6a7097287c0866e3-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"directory","id":"directory_01FK3HFFGMC2WF32RR8SKWC8KA","organization_id":"org_01FHRF60X0CDBB8F6A0YGSJJ2B","name":"Azure - Set Up Test","external_key":"Ii2mw43BMAIqiKuA","type":"azure scim v2.0","state":"linked","created_at":"2021-10-28T13:29:54.451Z","updated_at":"2021-10-28T13:32:03.737Z"},{"object":"directory","id":"directory_01FK17DWRHH7APAFXT5B52PV0W","organization_id":"org_01F6Q6TFP7RD2PF6J03ANNWDKV","name":"Testing - Active Attribute","external_key":"QArgyQQkq4G0MquM","type":"azure scim v2.0","state":"linked","created_at":"2021-10-27T15:55:47.856Z","updated_at":"2021-10-27T16:03:43.990Z","domain":"example.me"},{"object":"directory","id":"directory_01FHZKS052FGZQQCZHAX0E4AC0","organization_id":"org_01FHRF60X0CDBB8F6A0YGSJJ2B","name":"Okta - SCIM Test","external_key":"z76YkVQ9vEK0AUyy","type":"okta scim v2.0","state":"linked","created_at":"2021-10-14T14:37:24.004Z","updated_at":"2021-10-27T15:50:21.248Z"},{"object":"directory","id":"directory_01FGCQE0KD0V01GB46NJ7871F7","organization_id":"org_01FGCPJPQ35DR0WGGGBEC2V1GN","name":"Azure - Test","external_key":"S16nSw4AaAyW06ia","type":"azure scim v2.0","state":"linked","created_at":"2021-09-24T20:20:02.285Z","updated_at":"2021-10-27T15:50:21.579Z"}],"list_metadata":{"before":"directory_01FGCQE0KD0V01GB46NJ7871F7","after":null},"listMetadata":{"before":"directory_01FGCQE0KD0V01GB46NJ7871F7","after":null}}' - http_version: - recorded_at: Sun, 31 Oct 2021 23:16:20 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml deleted file mode 100644 index 5af2a63b..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml +++ /dev/null @@ -1,89 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directories?before=directory_01FGCPNV312FHFRCX0BYWHVSE1&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v1.6.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Sun, 31 Oct 2021 23:16:19 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - f6691c56-0bec-4224-b82c-ca59bab86bfc - Etag: - - W/"7fd-djK1P4BOpjA1geoLytAYBJmPVUE" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=QqBEPSIOhswfJhIT0bQZkAmYAUYn4aciBJ0IqnBShioQo9rrCjEqe7v0ZLpVdPgxr7acbaWOaHuUZZM3gdx1ad7S5TDNP5sMWZJCRhwBG9qxX2A678OHDThvHQQqHSFjUq7CKfKt%2F3h%2FAOKRZA%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6a709726ea2966dd-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"directory","id":"directory_01FG7FERZ204FKVG0YJA2CKFNG","organization_id":"org_01FG52B571GYMYNX3JNY5X3QAK","name":"Azure - Test","external_key":"UtCjmfF8gmEiOU0O","type":"azure scim v2.0","state":"linked","created_at":"2021-09-22T19:24:26.462Z","updated_at":"2021-10-27T15:50:20.636Z","domain":"example.com"},{"object":"directory","id":"directory_01FG226GXGR369PTWYGFNDWR9D","organization_id":"org_01FCPEJXEZR4DSBA625YMGQT9N","name":"JumpCloud - Test","external_key":"NRgx1V0pe8m4ai6u","type":"generic scim v2.0","state":"linked","created_at":"2021-09-20T16:56:32.434Z","updated_at":"2021-10-27T15:50:20.888Z","domain":"example.io"},{"object":"directory","id":"directory_01FFR1120F90Z4YJC29JT37VK0","organization_id":"org_01F8873JSZWN1MJCDN537FEK1H","name":"Azure","external_key":"rAaT6GNCDuyyYkKq","type":"azure - scim v2.0","state":"linked","created_at":"2021-09-16T19:23:40.419Z","updated_at":"2021-10-27T15:50:19.998Z"},{"object":"directory","id":"directory_01FE1VTQYEQF7S3T2G0R2MFHN9","organization_id":"org_01FCPEJXEZR4DSBA625YMGQT9N","name":"Okta - SCIM test","external_key":"JCik62hLK6CA804q","type":"okta scim v2.0","state":"linked","created_at":"2021-08-26T18:33:51.309Z","updated_at":"2021-10-27T15:50:19.921Z","domain":"example.io"},{"object":"directory","id":"directory_01FCV1FRW3D93X8VBZBCAQWEVS","organization_id":"org_01F9293WD2PDEEV4Y625XPZVG7","name":"Testing","external_key":"p2TZ3heuEoyU2kWk","type":"azure - scim v2.0","state":"linked","created_at":"2021-08-11T16:42:20.416Z","updated_at":"2021-10-27T15:50:19.430Z","domain":"foo-corp.com"},{"object":"directory","id":"directory_01F9M7F68PZP8QXP8G7X5QRHS7","organization_id":"org_01F8873JSZWN1MJCDN537FEK1H","name":"Example - Directory","external_key":"houUTobogoaaI0A0","type":"okta scim v2.0","state":"linked","created_at":"2021-07-02T18:25:06.343Z","updated_at":"2021-10-27T15:50:14.624Z"}],"list_metadata":{"before":null,"after":"directory_01FG7FERZ204FKVG0YJA2CKFNG"},"listMetadata":{"before":null,"after":"directory_01FG7FERZ204FKVG0YJA2CKFNG"}}' - http_version: - recorded_at: Sun, 31 Oct 2021 23:16:19 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml deleted file mode 100644 index 5d1893fd..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directories?domain=foo-corp.com&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v1.6.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Sun, 31 Oct 2021 23:03:01 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 6d450b69-226e-43b9-85e2-a9af8acc3587 - Etag: - - W/"1ae-fFF8nGLOuVotMa13kni7myHqhLI" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=8ezv4P5avuKkdxcUh1hzoLa%2B%2BqrY3KNgK6vvzH8%2F57%2B3ByY9kRBf%2By1wrM7Q84StvoG4mBzl9qAmmpOPIVCiMiZjpY2rB3WJwY5ZcJ7Mc0qAHhwH5oE88orepnesd5BIZUO0hViBpvfcyJ8lfA%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6a7083ab7fa8ecaf-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"directory","id":"directory_01FCV1FRW3D93X8VBZBCAQWEVS","organization_id":"org_01F9293WD2PDEEV4Y625XPZVG7","name":"Testing","external_key":"p2TZ3heuEoyU2kWk","type":"azure - scim v2.0","state":"linked","created_at":"2021-08-11T16:42:20.416Z","updated_at":"2021-10-27T15:50:19.430Z","domain":"foo-corp.com"}],"list_metadata":{"before":null,"after":null},"listMetadata":{"before":null,"after":null}}' - http_version: - recorded_at: Sun, 31 Oct 2021 23:03:01 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml deleted file mode 100644 index 91e88b7d..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml +++ /dev/null @@ -1,85 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directories?limit=2&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v1.6.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Sun, 31 Oct 2021 23:03:02 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 5ce37d38-1376-429a-9052-f8b3a20b7a1f - Etag: - - W/"32e-Omiowe6KK7MTqS3mgnIBMR53RMc" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=FokV%2F1WK8Sg4dLf6m6Id%2F8wfHWKcdGsLenHbJdpxkh6Pc8TLsRsSD68RDAeDY%2FwavJ%2Bf1TjFwDsuIF%2FV2bPMJFMAqZ6uinTANK2iNXp8FGA9pM98aa9v8bekYflxceYXqDzkW8VhWtv6Wiv%2BsQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6a7083b1f8086799-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"directory","id":"directory_01FK3HFFGMC2WF32RR8SKWC8KA","organization_id":"org_01FHRF60X0CDBB8F6A0YGSJJ2B","name":"Azure - Set Up Test","external_key":"Ii2mw43BMAIqiKuA","type":"azure scim v2.0","state":"linked","created_at":"2021-10-28T13:29:54.451Z","updated_at":"2021-10-28T13:32:03.737Z"},{"object":"directory","id":"directory_01FK17DWRHH7APAFXT5B52PV0W","organization_id":"org_01F6Q6TFP7RD2PF6J03ANNWDKV","name":"Testing - Active Attribute","external_key":"QArgyQQkq4G0MquM","type":"azure scim v2.0","state":"linked","created_at":"2021-10-27T15:55:47.856Z","updated_at":"2021-10-27T16:03:43.990Z","domain":"example.me"}],"list_metadata":{"before":"directory_01FK17DWRHH7APAFXT5B52PV0W","after":null},"listMetadata":{"before":"directory_01FK17DWRHH7APAFXT5B52PV0W","after":null}}' - http_version: - recorded_at: Sun, 31 Oct 2021 23:03:02 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml deleted file mode 100644 index 9cc8fb33..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml +++ /dev/null @@ -1,93 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directories?order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v1.6.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Sun, 31 Oct 2021 23:03:01 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 6009e44d-df2c-40f3-86ad-929ea9362079 - Etag: - - W/"cc4-a76uP4WPcu7cTLA79G0DPZmGW9Q" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=O7wQC%2B7g1ppMHWz9lao8DR2my83z8XtBX68EnYTeP8X1d4tSho2n8jpWq%2FT4xaKExSPn%2BnvlIotIUwtrZ5pkoULZQQvn1vHxHBE3eRKYZi7W0TO86ct3jtxDne%2B3FLOzLjCmkwYVgEEjkeb5Jg%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6a7083a96c520bef-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"directory","id":"directory_01FK3HFFGMC2WF32RR8SKWC8KA","organization_id":"org_01FHRF60X0CDBB8F6A0YGSJJ2B","name":"Azure - Set Up Test","external_key":"Ii2mw43BMAIqiKuA","type":"azure scim v2.0","state":"linked","created_at":"2021-10-28T13:29:54.451Z","updated_at":"2021-10-28T13:32:03.737Z"},{"object":"directory","id":"directory_01FK17DWRHH7APAFXT5B52PV0W","organization_id":"org_01F6Q6TFP7RD2PF6J03ANNWDKV","name":"Testing - Active Attribute","external_key":"QArgyQQkq4G0MquM","type":"azure scim v2.0","state":"linked","created_at":"2021-10-27T15:55:47.856Z","updated_at":"2021-10-27T16:03:43.990Z","domain":"example.me"},{"object":"directory","id":"directory_01FHZKS052FGZQQCZHAX0E4AC0","organization_id":"org_01FHRF60X0CDBB8F6A0YGSJJ2B","name":"Okta - SCIM Test","external_key":"z76YkVQ9vEK0AUyy","type":"okta scim v2.0","state":"linked","created_at":"2021-10-14T14:37:24.004Z","updated_at":"2021-10-27T15:50:21.248Z"},{"object":"directory","id":"directory_01FGCQE0KD0V01GB46NJ7871F7","organization_id":"org_01FGCPJPQ35DR0WGGGBEC2V1GN","name":"Azure - Test","external_key":"S16nSw4AaAyW06ia","type":"azure scim v2.0","state":"linked","created_at":"2021-09-24T20:20:02.285Z","updated_at":"2021-10-27T15:50:21.579Z"},{"object":"directory","id":"directory_01FGCPNV312FHFRCX0BYWHVSE1","organization_id":"org_01FGCPJPQ35DR0WGGGBEC2V1GN","name":"Jump - Cloud Test","external_key":"amuPHnduKW0WQWmc","type":"generic scim v2.0","state":"linked","created_at":"2021-09-24T20:06:50.208Z","updated_at":"2021-10-27T15:50:21.493Z"},{"object":"directory","id":"directory_01FG7FERZ204FKVG0YJA2CKFNG","organization_id":"org_01FG52B571GYMYNX3JNY5X3QAK","name":"Azure - Test","external_key":"UtCjmfF8gmEiOU0O","type":"azure scim v2.0","state":"linked","created_at":"2021-09-22T19:24:26.462Z","updated_at":"2021-10-27T15:50:20.636Z","domain":"example.com"},{"object":"directory","id":"directory_01FG226GXGR369PTWYGFNDWR9D","organization_id":"org_01FCPEJXEZR4DSBA625YMGQT9N","name":"JumpCloud - Test","external_key":"NRgx1V0pe8m4ai6u","type":"generic scim v2.0","state":"linked","created_at":"2021-09-20T16:56:32.434Z","updated_at":"2021-10-27T15:50:20.888Z","domain":"example.io"},{"object":"directory","id":"directory_01FFR1120F90Z4YJC29JT37VK0","organization_id":"org_01F8873JSZWN1MJCDN537FEK1H","name":"Azure","external_key":"rAaT6GNCDuyyYkKq","type":"azure - scim v2.0","state":"linked","created_at":"2021-09-16T19:23:40.419Z","updated_at":"2021-10-27T15:50:19.998Z"},{"object":"directory","id":"directory_01FE1VTQYEQF7S3T2G0R2MFHN9","organization_id":"org_01FCPEJXEZR4DSBA625YMGQT9N","name":"Okta - SCIM test","external_key":"JCik62hLK6CA804q","type":"okta scim v2.0","state":"linked","created_at":"2021-08-26T18:33:51.309Z","updated_at":"2021-10-27T15:50:19.921Z","domain":"example.io"},{"object":"directory","id":"directory_01FCV1FRW3D93X8VBZBCAQWEVS","organization_id":"org_01F9293WD2PDEEV4Y625XPZVG7","name":"Testing","external_key":"p2TZ3heuEoyU2kWk","type":"azure - scim v2.0","state":"linked","created_at":"2021-08-11T16:42:20.416Z","updated_at":"2021-10-27T15:50:19.430Z","domain":"foo-corp.com"}],"list_metadata":{"before":"before-id","after":null},"listMetadata":{"before":"before-id","after":null}}' - http_version: - recorded_at: Sun, 31 Oct 2021 23:03:01 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml b/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml deleted file mode 100644 index 99868832..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml +++ /dev/null @@ -1,85 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directories?order=desc&search=Testing - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v1.6.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Sun, 31 Oct 2021 23:16:19 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 11c4f81a-6849-4809-8c57-a3d1b56612eb - Etag: - - W/"2f8-aWsjddKqVKL34/+wL752xfuiH2Q" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=t8d6LCrGu92dvmMmTECbvhqH82TcvvWNxTw%2Bz6jGMz8S0Y7mg91uXsTylK4KEs9uMr5gnnYAi%2FHAq1FwNpt5MoYMFTqfR1wDpE3UIsNusj%2F1TxwAUwx2J3BclqJl0riP44WITzFLdv66r3kd1g%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6a7097250eb40baf-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"directory","id":"directory_01FK17DWRHH7APAFXT5B52PV0W","organization_id":"org_01F6Q6TFP7RD2PF6J03ANNWDKV","name":"Testing - Active Attribute","external_key":"QArgyQQkq4G0MquM","type":"azure scim v2.0","state":"linked","created_at":"2021-10-27T15:55:47.856Z","updated_at":"2021-10-27T16:03:43.990Z","domain":"example.me"},{"object":"directory","id":"directory_01FCV1FRW3D93X8VBZBCAQWEVS","organization_id":"org_01F9293WD2PDEEV4Y625XPZVG7","name":"Testing","external_key":"p2TZ3heuEoyU2kWk","type":"azure - scim v2.0","state":"linked","created_at":"2021-08-11T16:42:20.416Z","updated_at":"2021-10-27T15:50:19.430Z","domain":"foo-corp.com"}],"list_metadata":{"before":null,"after":null},"listMetadata":{"before":null,"after":null}}' - http_version: - recorded_at: Sun, 31 Oct 2021 23:16:19 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml deleted file mode 100644 index 4c12cd3e..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml +++ /dev/null @@ -1,90 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_groups?after=directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG&directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 07 Jun 2022 22:28:36 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '1163' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"15fc-zBhUbLZyJQxiq8umMaogT0kzj/8" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (664a92218d61) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f3944a4c-8532-4b6a-196a-84ee38216e1b - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=1YP42SeOofST3UnTgCIrEFd696HKzEJZ8n%2BBstJNNpMA98mb0YLj3fWYfmEA7eO5zxgderbhiUaenVJ9XVHdxOrOqKVitgdDejHBmbTFCceoPJf%2BQoH4wH6aOuSDALnFIe9cPUIsWo3nhxVpvg%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 717cd2605c599ecb-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"directory_group","id":"directory_group_01G2Z8D5VBM14YQKFY02DHGFHD","idp_id":"01fob9te1lgjaw4","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Security","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"01fob9te1lgjaw4","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/i0mPa7pjMhSlP3jSyX-lRL7ScU8\"","kind":"admin#directory#group","name":"Security","email":"security@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["security@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D5SAKF3GXE9BTR6KZCJR","idp_id":"028h4qwu0uyrb9k","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Risk - Management","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"028h4qwu0uyrb9k","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/F0K5jmtHPYux11G_e7no2r29804\"","kind":"admin#directory#group","name":"Risk - Management","email":"risk@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["risk@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D5P1AFTJ8XK16RQ1FKWD","idp_id":"02szc72q2sp1i88","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Michael - Youngs Group","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"02szc72q2sp1i88","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/nF7tojOSI2G7C_nIp74DiIKrzbs\"","kind":"admin#directory#group","name":"Michael - Youngs Group","email":"michaelyoungsgroup@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["Michaelyoungsgroup@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D5MBRDS85VWEHFHF74SZ","idp_id":"01y810tw1ti9q8c","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Marketing","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"01y810tw1ti9q8c","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/41snDYeG-HeWJ3n0Q3SGWwlvUpo\"","kind":"admin#directory#group","name":"Marketing","email":"marketing@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["marketing@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D5JD50HDRNPDYB8VWXSE","idp_id":"02xcytpi45aqkmr","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Finance","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"02xcytpi45aqkmr","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/fjF75r0GGL7S9fWA5ngkflNIduQ\"","kind":"admin#directory#group","name":"Finance","email":"finance@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["finance@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D5F80M4DEMGGMFPHV4XV","idp_id":"03as4poj49cz6j9","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Documentation","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"03as4poj49cz6j9","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/-sI8PUONUvqYWMpmaVCxKjp8YBY\"","kind":"admin#directory#group","name":"Documentation","email":"docs@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"2","nonEditableAliases":["docs@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D59X1K7Q38CJCN0T9KPR","idp_id":"02iq8gzs1b2i1ae","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Contractors","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"02iq8gzs1b2i1ae","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/JHD88ylaaIXdP90ob6UHKZ_PYHo\"","kind":"admin#directory#group","name":"Contractors","email":"contractors@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["contractors@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D586TSJBGTFJ5SGS3BAC","idp_id":"03fwokq01u3hhmd","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Sync - Delay Test All Users","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"03fwokq01u3hhmd","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/reGSvbZ45OETFOEVxJtCcqUYi3A\"","kind":"admin#directory#group","name":"Sync - Delay Test All Users","email":"allusers@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["allusers@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D50AEFFZHKBFNRE0Y16C","idp_id":"041mghml1ld1sg5","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Sync - Delay 2","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"041mghml1ld1sg5","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/5tCYHwRu-uImFIfoexVJvinM9rM\"","kind":"admin#directory#group","name":"Sync - Delay 2","email":"sd2@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["sd2@foo-corp.com.test-google-a.com"]}}],"list_metadata":{"before":"directory_group_01G2Z8D50AEFFZHKBFNRE0Y16C","after":null},"listMetadata":{"before":"directory_group_01G2Z8D50AEFFZHKBFNRE0Y16C","after":null}}' - http_version: - recorded_at: Tue, 07 Jun 2022 22:28:36 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml deleted file mode 100644 index 4300c26a..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml +++ /dev/null @@ -1,90 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_groups?before=directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG&directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 07 Jun 2022 22:28:36 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '1244' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"190a-JonqCohX6cL7n0wcQQA8Kg+TPEE" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (664a92218d61) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 82d22803-f18d-3631-8423-6656d7140a01 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=FhQofzBw3L0rL%2BFOl1ANeGyokRua2ZrLG6GhpGAfljx6D7qHsvDTHxGiC%2BfeyodCbzXyK5u0rsbEH5WBkLPsbVH%2BnCUHm%2FcQRJ1cCam7OloBoWYNCS5oqkk4n0dVg2KvRF2Pk6lsnnYViryjhw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 717cd25e4bdc9f12-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"directory_group","id":"directory_group_01G2Z8D4Z78331QJ6NS4SS23R2","idp_id":"03ep43zb4k5jctj","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Top - Level Testing Group","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"03ep43zb4k5jctj","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/Rv3rXSfY7UNiJs3Pr3ZQF_awbJs\"","kind":"admin#directory#group","name":"Top - Level Testing Group","email":"top-level-testing-group@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"2","nonEditableAliases":["top-level-testing-group@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4YNGM52FAMCN957G2MN","idp_id":"02u6wntf1dyjihd","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Solutions - Engineering","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"02u6wntf1dyjihd","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/5l7SbdbosPbGq61b1rf0xJ7uVv4\"","kind":"admin#directory#group","name":"Solutions - Engineering","email":"solutions@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["solutions@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4Y3CBBJ0A3NFGRKYGHJ","idp_id":"01baon6m2km2f35","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"All - users add test","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"01baon6m2km2f35","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/mRuvBpx11GHfb70eGtUSI9PTi7Y\"","kind":"admin#directory#group","name":"All - users add test","email":"auad1@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"2","nonEditableAliases":["auad1@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4WVTPFCAAY49PWKXJ8G","idp_id":"04du1wux3xtq7g3","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"nested-testing-group","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"04du1wux3xtq7g3","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/wVI7nPHi3T9SxQSeubz8XktrUrA\"","kind":"admin#directory#group","name":"nested-testing-group","email":"nested-testing-group@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"3","nonEditableAliases":["nested-testing-group@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4WBJAZ5KNPHN9RNC3NN","idp_id":"03hv69ve1ssgpby","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Product","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"03hv69ve1ssgpby","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/akv0W7AtILwAbK00X1pIhnOcYz0\"","kind":"admin#directory#group","name":"Product","email":"product@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["product@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4VSSEM22MQ9GXMJFRWQ","idp_id":"045jfvxd1049v32","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Partnerships","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"045jfvxd1049v32","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/A3klhKGDCgS_gA9TeU3-CmtPuOA\"","kind":"admin#directory#group","name":"Partnerships","email":"partnerships@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["partnerships@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4TXW3JPSK425M710KRM","idp_id":"03dy6vkm1y2alqi","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Design","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"03dy6vkm1y2alqi","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/fFPsJbCjOImSDOp5Krvi2NKdjIY\"","kind":"admin#directory#group","name":"Design","email":"design@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"2","nonEditableAliases":["design@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4SF1Q3JSKQ3ATXXRM6S","idp_id":"030j0zll1b5a1gf","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Engineering","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"030j0zll1b5a1gf","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/FMy2bHceMX55_T9U8C44ZRK7l3U\"","kind":"admin#directory#group","name":"Engineering","email":"engineering@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"4","nonEditableAliases":["engineering@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4RA97JQ3ECAK7T9DN8J","idp_id":"04iylrwe0qvafhv","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"David - Testing Group","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"04iylrwe0qvafhv","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/YJOEah4Cy1mft4AbEfWfvAXsHDs\"","kind":"admin#directory#group","name":"David - Testing Group","email":"davidtesting@foo-corp.com","description":"Group description","adminCreated":true,"directMembersCount":"5","nonEditableAliases":["davidtesting@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4PCZPAAB9CGS8EB34G5","idp_id":"00gjdgxs2s95kg4","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Admins","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"00gjdgxs2s95kg4","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/Un_xfweaPs74WQWtUQJesHlOKAk\"","kind":"admin#directory#group","name":"Admins","email":"admins@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"3","nonEditableAliases":["admins@foo-corp.com.test-google-a.com"]}}],"list_metadata":{"before":"directory_group_01G2Z8D4PCZPAAB9CGS8EB34G5","after":"directory_group_01G2Z8D4Z78331QJ6NS4SS23R2"},"listMetadata":{"before":"directory_group_01G2Z8D4PCZPAAB9CGS8EB34G5","after":"directory_group_01G2Z8D4Z78331QJ6NS4SS23R2"}}' - http_version: - recorded_at: Tue, 07 Jun 2022 22:28:36 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml deleted file mode 100644 index c122604e..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml +++ /dev/null @@ -1,90 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_groups?directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 07 Jun 2022 22:28:36 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '1243' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"1841-2gkLQD4hUD6PBarO4U2C81W0gKg" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (664a92218d61) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - e3f3c46f-ede7-b953-5759-8ea11b26f399 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=JPK0RC%2FHk5EEQXYqzHAsvuafRQM1lOQtie9k7un6jLH6mDrH3GNtRLL99bjIp0fpa4J5mPxskq0IhgW2y7eBFmCxdz1LiC1zVmvf%2ForQan9eMf5Z2Gx5Tup6zbAUlAAWV6j7ABycBL%2B%2B9VfUmQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 717cd25c2b619f1f-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"directory_group","id":"directory_group_01G2Z8D5VBM14YQKFY02DHGFHD","idp_id":"01fob9te1lgjaw4","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Security","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"01fob9te1lgjaw4","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/i0mPa7pjMhSlP3jSyX-lRL7ScU8\"","kind":"admin#directory#group","name":"Security","email":"security@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["security@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D5SAKF3GXE9BTR6KZCJR","idp_id":"028h4qwu0uyrb9k","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Risk - Management","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"028h4qwu0uyrb9k","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/F0K5jmtHPYux11G_e7no2r29804\"","kind":"admin#directory#group","name":"Risk - Management","email":"risk@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["risk@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D5P1AFTJ8XK16RQ1FKWD","idp_id":"02szc72q2sp1i88","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Michael - Youngs Group","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"02szc72q2sp1i88","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/nF7tojOSI2G7C_nIp74DiIKrzbs\"","kind":"admin#directory#group","name":"Michael - Youngs Group","email":"michaelyoungsgroup@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["Michaelyoungsgroup@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D5MBRDS85VWEHFHF74SZ","idp_id":"01y810tw1ti9q8c","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Marketing","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"01y810tw1ti9q8c","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/41snDYeG-HeWJ3n0Q3SGWwlvUpo\"","kind":"admin#directory#group","name":"Marketing","email":"marketing@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["marketing@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D5JD50HDRNPDYB8VWXSE","idp_id":"02xcytpi45aqkmr","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Finance","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"02xcytpi45aqkmr","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/fjF75r0GGL7S9fWA5ngkflNIduQ\"","kind":"admin#directory#group","name":"Finance","email":"finance@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["finance@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D5F80M4DEMGGMFPHV4XV","idp_id":"03as4poj49cz6j9","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Documentation","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"03as4poj49cz6j9","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/-sI8PUONUvqYWMpmaVCxKjp8YBY\"","kind":"admin#directory#group","name":"Documentation","email":"docs@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"2","nonEditableAliases":["docs@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D59X1K7Q38CJCN0T9KPR","idp_id":"02iq8gzs1b2i1ae","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Contractors","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"02iq8gzs1b2i1ae","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/JHD88ylaaIXdP90ob6UHKZ_PYHo\"","kind":"admin#directory#group","name":"Contractors","email":"contractors@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["contractors@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D586TSJBGTFJ5SGS3BAC","idp_id":"03fwokq01u3hhmd","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Sync - Delay Test All Users","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"03fwokq01u3hhmd","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/reGSvbZ45OETFOEVxJtCcqUYi3A\"","kind":"admin#directory#group","name":"Sync - Delay Test All Users","email":"allusers@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["allusers@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D50AEFFZHKBFNRE0Y16C","idp_id":"041mghml1ld1sg5","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Sync - Delay 2","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"041mghml1ld1sg5","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/5tCYHwRu-uImFIfoexVJvinM9rM\"","kind":"admin#directory#group","name":"Sync - Delay 2","email":"sd2@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["sd2@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG","idp_id":"01jlao4614two3d","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Sales","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"01jlao4614two3d","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/uLYJ0Hrx1gXXVg9z-zGLBZET2Wo\"","kind":"admin#directory#group","name":"Sales","email":"sales@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["sales@foo-corp.com.test-google-a.com"]}}],"list_metadata":{"before":"directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG","after":null},"listMetadata":{"before":"directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG","after":null}}' - http_version: - recorded_at: Tue, 07 Jun 2022 22:28:36 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml deleted file mode 100644 index 33f79b66..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_groups?directory=directory_01G2Z8ADK5NPMVTWF48MVVE4HT&limit=2&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 07 Jun 2022 22:52:29 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '535' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"56b-KvIBGDPohNpRGKEuGxgDZ///hJs" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (664a92218d61) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - b47d9803-9cf2-54c0-e486-7ccfd9c0e907 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=vSG1OnIauGCT8ZAsX5cDWB039V9IkDGSonMdZpLOKLLen1RYfIjaFTYr%2FecbDYVEqbjnY%2BMVcT3R4G5DIopjOZ8Ebtjl3FMcHXmFzr0Hvbnp7BkiTqo4xgAP2rWkLYThrztmMUWMEPWYc%2FURsg%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 717cf558df300c3d-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"directory_group","id":"directory_group_01G2Z8D5VBM14YQKFY02DHGFHD","idp_id":"01fob9te1lgjaw4","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Security","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"01fob9te1lgjaw4","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/i0mPa7pjMhSlP3jSyX-lRL7ScU8\"","kind":"admin#directory#group","name":"Security","email":"security@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["security@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D5SAKF3GXE9BTR6KZCJR","idp_id":"028h4qwu0uyrb9k","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Risk - Management","created_at":"2022-05-13T17:45:32.577Z","updated_at":"2022-06-07T17:45:36.258Z","raw_attributes":{"id":"028h4qwu0uyrb9k","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/F0K5jmtHPYux11G_e7no2r29804\"","kind":"admin#directory#group","name":"Risk - Management","email":"risk@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"0","nonEditableAliases":["risk@foo-corp.com.test-google-a.com"]}}],"list_metadata":{"before":"directory_group_01G2Z8D5SAKF3GXE9BTR6KZCJR","after":null},"listMetadata":{"before":"directory_group_01G2Z8D5SAKF3GXE9BTR6KZCJR","after":null}}' - http_version: - recorded_at: Tue, 07 Jun 2022 22:52:29 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml deleted file mode 100644 index 3f8bc762..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_groups?order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 422 - message: Unprocessable Entity - headers: - Date: - - Tue, 07 Jun 2022 22:28:35 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '219' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"db-gphk1TAe8P3eXtQnl1v8qxKQjZs" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (664a92218d61) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 0e9b2e8d-129e-8cd7-c4a3-078f18455441 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=rolm9dOV9PPapql1sEHtD4Pxu5K%2BTSSv9bNRONOED4qxiBE5Vc6TfLylhv1o%2F9bJz90IQmRlzm%2BtQRgd8gBOPag8j8rxue7PfVNAyiBLaY5nqLUUwtb64q9UTRBUGbncG7SUNxtqPSHjjRznrw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 717cd25a3c3a9eca-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: UTF-8 - string: '{"message":"Validation failed","errors":[{"field":"directory","code":"Please - provide either \"directory\" or \"user\" parameters."},{"field":"user","code":"Please - provide either \"directory\" or \"user\" parameters."}]}' - http_version: - recorded_at: Tue, 07 Jun 2022 22:28:35 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml b/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml deleted file mode 100644 index 845866d5..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_groups?order=desc&user=directory_user_01G2Z8D4FDB28ZNSRRBVCF2E0P - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 07 Jun 2022 22:48:29 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '612' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"74a-JABiWu66XPEPqE+CDJ+LFYrX/Hk" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (664a92218d61) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 7d909909-c03b-ab72-02b3-ec7385d008de - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=m9ozUh%2F7%2FiIWkqLPDWhF9aDd1CTE9Gv%2BMhuCdh%2Binj7dHVBAUTML3swCnyIXiCnOhTdSSx8IIrUM%2B5q2WRd3HFw%2FnZ7c7aKhd2lEqTh4NZohxhuKiLz9CIcnbcbUuo0HkOeRNenlqBdnxhRwWA%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 717cef8159a993e9-DFW - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"directory_group","id":"directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG","idp_id":"01jlao4614two3d","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Sales","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"01jlao4614two3d","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/uLYJ0Hrx1gXXVg9z-zGLBZET2Wo\"","kind":"admin#directory#group","name":"Sales","email":"sales@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"1","nonEditableAliases":["sales@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4TXW3JPSK425M710KRM","idp_id":"03dy6vkm1y2alqi","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Design","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"03dy6vkm1y2alqi","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/fFPsJbCjOImSDOp5Krvi2NKdjIY\"","kind":"admin#directory#group","name":"Design","email":"design@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"2","nonEditableAliases":["design@foo-corp.com.test-google-a.com"]}},{"object":"directory_group","id":"directory_group_01G2Z8D4PCZPAAB9CGS8EB34G5","idp_id":"00gjdgxs2s95kg4","directory_id":"directory_01G2Z8ADK5NPMVTWF48MVVE4HT","name":"Admins","created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-06-07T17:45:35.739Z","raw_attributes":{"id":"00gjdgxs2s95kg4","etag":"\"DaDAXuEwpvygu_Ul-89tlT4iVJBEvO3LZpQ0lrbYRrc/Un_xfweaPs74WQWtUQJesHlOKAk\"","kind":"admin#directory#group","name":"Admins","email":"admins@foo-corp.com","description":"","adminCreated":true,"directMembersCount":"3","nonEditableAliases":["admins@foo-corp.com.test-google-a.com"]}}],"list_metadata":{"before":null,"after":null},"listMetadata":{"before":null,"after":null}}' - http_version: - recorded_at: Tue, 07 Jun 2022 22:48:29 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml deleted file mode 100644 index b9b4f84b..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml +++ /dev/null @@ -1,186 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_users?after=directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF&directory=directory_01FAZYMST676QMTFN1DDJZZX87&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 17:40:53 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 7077a5fa-612c-4e79-9c8f-f023e91c0478 - Etag: - - W/"25b2-5RmyJGVmMYCXhCM7c6dJtsTkYO8" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=VaJiLsTSS%2B6C9T8F1J5qbkIMTFIAud3HLWKwrvtGDqvy1OPthVZ4YtYNnZCaNkSA6WG4fQ0quxXg9pg5lNSR0Lhcn0jgb7AOUcVeSO%2B1Tk3Z3%2FJKq6sV8ciJXj1CTqHtNjcOuURLbOfZrqVl%2BQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c2c5a75f520bc4-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","listMetadata":{"before":"directory_user_01FC73296N43TB1NW9J9CQ8AHT","after":null},"data":[{"object":"directory_user","id":"directory_user_01FC73296N43TB1NW9J9CQ8AHT","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6104db3b6246f63d0df47ac5","username":"dave.liu@workos.com","emails":[{"primary":true,"value":"dave.liu@workos.com"}],"first_name":"Dave","last_name":"Liu","job_title":"Software Engineer","state":"active","created_at":"2021-07-31T05:10:19+0000","updated_at":"2021-07-31T08:02:36+0000","raw_attributes":{"id":"6104db3b6246f63d0df47ac5","name":"Dave - Liu","teams":["5f696c8e9a63a60e965aaca8","6101bf5fa9e1adf3c668a1ad","6104da936b1079a2e20debb5","6104daab1a8ff9a9f023a689","6104dae33d1730d92ca27c51"],"spokeId":null,"lastName":"Liu","firstName":"Dave","workEmail":"dave.liu@workos.com","department":"Engineering","departmentId":"5f27ada9a5e9bc0001a0ae48"},"custom_attributes":{"department":"Engineering"},"groups":[{"object":"directory_group","id":"directory_group_01FBXGP7AM2ZTG9C2NT96E0T8B","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua. Neque viverra justo nec - ultrices dui sapien. Eu scelerisque felis imperdiet proin fermentum leo. Tincidunt - vitae semper quis lectus. Aliquet enim tortor at auctor urna nunc id cursus - metus. Sapien et ligula ullamcorper malesuada proin. Tellus pellentesque eu - tincidunt tortor aliquam nulla facilisi cras. Id aliquet risus feugiat in - ante. Consectetur adipiscing elit duis tristique sollicitudin nibh sit amet. - Eleifend mi in nulla posuere. Nec dui nunc mattis enim ut. Volutpat commodo - sed egestas egestas fringilla. Quis eleifend quam adipiscing vitae proin sagittis. - Amet facilisis magna etiam tempor orci. Quam nulla porttitor massa id neque. - Laoreet sit amet cursus sit amet dictum sit amet. Scelerisque eleifend donec - pretium vulputate sapien. Faucibus turpis in eu mi bibendum. Magna sit amet - purus gravida quis. Placerat vestibulum lectus mauris ultrices eros. Volutpat - est velit egestas dui id ornare. Aliquet eget sit amet tellus cras adipiscing - enim eu. Velit scelerisque in dictum non consectetur. Egestas fringilla phasellus - faucibus scelerisque eleifend donec pretium vulputate sapien. Malesuada nunc - vel risus commodo viverra maecenas accumsan lacus vel. Senectus et netus et - malesuada fames ac turpis. In mollis nunc sed id semper risus in hendrerit. - Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec. - Purus semper eget duis at tellus. Et ligula ullamcorper malesuada proin libero - nunc consequat interdum varius. Odio aenean sed adipiscing diam donec adipiscing. - Pretium quam vulputate dignissim suspendisse in est ante. Orci nulla pellentesque - dignissim enim sit amet venenatis urna. Viverra aliquet eget sit amet tellus - cras adipiscing enim. Lacus viverra vitae congue eu consequat ac felis donec. - Quis ipsum suspendisse ultrices gravida dictum fusce ut. Faucibus turpis - in eu mi bibendum. Lorem sed risus ultricies tristique nulla. Habitant morbi - tristique senectus et. Vitae suscipit tellus mauris a. Id leo in vitae turpis - massa sed. In hac habitasse platea dictumst vestibulum rhoncus est pellentesque. - Ornare arcu dui vivamus arcu felis bibendum ut tristique et. Ut aliquam purus - sit amet luctus venenatis lectus magna. Mollis aliquam ut porttitor leo a - diam. Pulvinar pellentesque habitant morbi tristique senectus et netus et. - Eget felis eget nunc lobortis. Viverra adipiscing at in tellus. Morbi tempus - iaculis urna id volutpat lacus laoreet non curabitur. Nam aliquam sem et tortor. - Maecenas sed enim ut sem viverra aliquet eget sit. Nec dui nunc mattis enim. - Donec ac odio tempor orci dapibus ultrices in iaculis. Tristique risus nec - feugiat in fermentum posuere urna nec. Suscipit adipiscing bibendum est ultricies. - Magna fringilla urna porttitor rhoncus. Cum sociis natoque penatibus et magnis - dis parturient montes nascetur. Amet nulla facilisi morbi tempus iaculis. - Mattis vulputate enim nulla aliquet porttitor lacus. Adipiscing elit duis - tristique sollicitudin nibh sit. Placerat duis ultricies lacus sed turpis - tincidunt id aliquet. Ut sem viverra aliquet eget sit amet tellus. Sagittis - id consectetur purus ut faucibus pulvinar. Id faucibus nisl tincidunt eget - nullam. Sed augue lacus viverra vitae congue eu consequat ac felis. Interdum - varius sit amet mattis vulputate enim. Ut venenatis tellus in metus vulputate - eu scelerisque. Lacus sed viverra tellus in hac habitasse. Nulla facilisi - etiam dignissim diam quis. Id porta nibh venenatis cras sed felis eget velit. - Orci porta non pulvinar neque laoreet suspendisse interdum consectetur.","raw_attributes":{"id":"6104dae33d1730d92ca27c51","name":"Lorem - ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt - ut labore et dolore magna aliqua. Neque viverra justo nec ultrices dui sapien. - Eu scelerisque felis imperdiet proin fermentum leo. Tincidunt vitae semper - quis lectus. Aliquet enim tortor at auctor urna nunc id cursus metus. Sapien - et ligula ullamcorper malesuada proin. Tellus pellentesque eu tincidunt tortor - aliquam nulla facilisi cras. Id aliquet risus feugiat in ante. Consectetur - adipiscing elit duis tristique sollicitudin nibh sit amet. Eleifend mi in - nulla posuere. Nec dui nunc mattis enim ut. Volutpat commodo sed egestas egestas - fringilla. Quis eleifend quam adipiscing vitae proin sagittis. Amet facilisis - magna etiam tempor orci. Quam nulla porttitor massa id neque. Laoreet sit - amet cursus sit amet dictum sit amet. Scelerisque eleifend donec pretium - vulputate sapien. Faucibus turpis in eu mi bibendum. Magna sit amet purus - gravida quis. Placerat vestibulum lectus mauris ultrices eros. Volutpat est - velit egestas dui id ornare. Aliquet eget sit amet tellus cras adipiscing - enim eu. Velit scelerisque in dictum non consectetur. Egestas fringilla phasellus - faucibus scelerisque eleifend donec pretium vulputate sapien. Malesuada nunc - vel risus commodo viverra maecenas accumsan lacus vel. Senectus et netus et - malesuada fames ac turpis. In mollis nunc sed id semper risus in hendrerit. - Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec. - Purus semper eget duis at tellus. Et ligula ullamcorper malesuada proin libero - nunc consequat interdum varius. Odio aenean sed adipiscing diam donec adipiscing. - Pretium quam vulputate dignissim suspendisse in est ante. Orci nulla pellentesque - dignissim enim sit amet venenatis urna. Viverra aliquet eget sit amet tellus - cras adipiscing enim. Lacus viverra vitae congue eu consequat ac felis donec. - Quis ipsum suspendisse ultrices gravida dictum fusce ut. Faucibus turpis - in eu mi bibendum. Lorem sed risus ultricies tristique nulla. Habitant morbi - tristique senectus et. Vitae suscipit tellus mauris a. Id leo in vitae turpis - massa sed. In hac habitasse platea dictumst vestibulum rhoncus est pellentesque. - Ornare arcu dui vivamus arcu felis bibendum ut tristique et. Ut aliquam purus - sit amet luctus venenatis lectus magna. Mollis aliquam ut porttitor leo a - diam. Pulvinar pellentesque habitant morbi tristique senectus et netus et. - Eget felis eget nunc lobortis. Viverra adipiscing at in tellus. Morbi tempus - iaculis urna id volutpat lacus laoreet non curabitur. Nam aliquam sem et tortor. - Maecenas sed enim ut sem viverra aliquet eget sit. Nec dui nunc mattis enim. - Donec ac odio tempor orci dapibus ultrices in iaculis. Tristique risus nec - feugiat in fermentum posuere urna nec. Suscipit adipiscing bibendum est ultricies. - Magna fringilla urna porttitor rhoncus. Cum sociis natoque penatibus et magnis - dis parturient montes nascetur. Amet nulla facilisi morbi tempus iaculis. - Mattis vulputate enim nulla aliquet porttitor lacus. Adipiscing elit duis - tristique sollicitudin nibh sit. Placerat duis ultricies lacus sed turpis - tincidunt id aliquet. Ut sem viverra aliquet eget sit amet tellus. Sagittis - id consectetur purus ut faucibus pulvinar. Id faucibus nisl tincidunt eget - nullam. Sed augue lacus viverra vitae congue eu consequat ac felis. Interdum - varius sit amet mattis vulputate enim. Ut venenatis tellus in metus vulputate - eu scelerisque. Lacus sed viverra tellus in hac habitasse. Nulla facilisi - etiam dignissim diam quis. Id porta nibh venenatis cras sed felis eget velit. - Orci porta non pulvinar neque laoreet suspendisse interdum consectetur.","parent":null}},{"object":"directory_group","id":"directory_group_01FBXGP79EJAYKW0WS9JCK1V6E","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Fight Club","raw_attributes":{"id":"6104daab1a8ff9a9f023a689","name":"Fight - Club","parent":null}},{"object":"directory_group","id":"directory_group_01FBXGP743J13S0CNRM84M8RZT","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Party Planners","raw_attributes":{"id":"6104da936b1079a2e20debb5","name":"Party - Planners","parent":null}},{"object":"directory_group","id":"directory_group_01FBQDKP34JY5AWYYMZT3ME8VX","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - The Best Team","raw_attributes":{"id":"6101bf5fa9e1adf3c668a1ad","name":"The - Best Team","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Platform","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNMV2TDE78FEAH724YGMP","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department - - Engineering","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae48","name":"Engineering","parent":null}}]}]}' - http_version: - recorded_at: Mon, 09 Aug 2021 17:40:53 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml deleted file mode 100644 index 8dc6c865..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml +++ /dev/null @@ -1,88 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_users?before=directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF&directory=directory_01FAZYMST676QMTFN1DDJZZX87&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 17:40:52 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 429298f1-659a-45d4-be75-7fc7af8def7d - Etag: - - W/"8dc-bUq/ea3T9pcZBOpZ/yYPHrEhh3k" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=7NNLKAJOPN0IObmEqZaikaYDnp8fIe4SYh4GMEW1urJYFu3DIEK5L38iIDVUlcSXokBwnFOk%2BzvwByh%2BU5tmFY27BTo84CxqYVt4aYmCunLwgc4G84acdsNZwuydcDuF6pbBDuQ7gBdTuj2ehw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c2c5a4c8970b71-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","listMetadata":{"before":null,"after":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852"},"data":[{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","created_at":"2021-05-05T16:06:24+0000","updated_at":"2021-07-19T19:17:52+0000","raw_attributes":{"id":"6092c280a3f1e19ef6d8cef8","name":"Bob - Bob Fakename","teams":["5f696c8e9a63a60e965aaca8"],"spokeId":null,"lastName":"Fakename","firstName":"Bob","workEmail":"bob.fakename@workos.com","department":"Infra","departmentId":"5f27ada9a5e9bc0001a0ae4a"},"custom_attributes":{"department":"Infra"},"groups":[{"object":"directory_group","id":"directory_group_01FAZYNN1NZWMBRAXXDSTB5NFH","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department - - Infra","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae4a","name":"Infra","parent":"5f27ada9a5e9bc0001a0ae48"}},{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Platform","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}}]},{"object":"directory_user","id":"directory_user_01FAZYNPC8DYPEWZ0BSHBA21RM","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"5f27ada8a5e9bc0001a0adcf","username":"workos@test.com","emails":[{"primary":true,"value":"workos@test.com"}],"first_name":"Michael","last_name":"Grinich","job_title":"CEO","state":"active","created_at":"2020-08-03T06:24:40+0000","updated_at":"2021-07-07T08:50:53+0000","raw_attributes":{"id":"5f27ada8a5e9bc0001a0adcf","name":"Michael - Grinich","teams":[],"spokeId":null,"lastName":"Grinich","firstName":"Michael","workEmail":"workos@test.com","department":"Marketing","departmentId":"5f27ada9a5e9bc0001a0ae4e"},"custom_attributes":{"department":"Marketing"},"groups":[{"object":"directory_group","id":"directory_group_01FAZYNMWS67E66CD01E7A1PC4","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department - - Marketing","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae4e","name":"Marketing","parent":null}}]}]}' - http_version: - recorded_at: Mon, 09 Aug 2021 17:40:52 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml deleted file mode 100644 index c2de5b1c..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml +++ /dev/null @@ -1,194 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_users?directory=directory_01FAZYMST676QMTFN1DDJZZX87&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 17:36:11 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 7bec1c90-22f4-482d-81c2-484bdd0c7d33 - Etag: - - W/"32ac-tppjb9CvAhoQDyAQeujCJrrMZLQ" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=6PJUMNnvc7Ear%2FtCtz8uML%2F6roM0a5DvAYUo9VOlOZebpMPWW3rffAM2scIUyh%2Bnvo7PUXUK3eVx34Z6HMi%2Bwd8Y5BuMj7LF23oJaAtTjFY4V9xIza3avCksCayUGk%2BG2TXIR4sqYqSOP0pb3w%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c2bec519580e6a-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","listMetadata":{"before":null,"after":null},"data":[{"object":"directory_user","id":"directory_user_01FC73296N43TB1NW9J9CQ8AHT","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6104db3b6246f63d0df47ac5","username":"dave.liu@workos.com","emails":[{"primary":true,"value":"dave.liu@workos.com"}],"first_name":"Dave","last_name":"Liu","job_title":"Software Engineer","state":"active","created_at":"2021-07-31T05:10:19+0000","updated_at":"2021-07-31T08:02:36+0000","raw_attributes":{"id":"6104db3b6246f63d0df47ac5","name":"Dave - Liu","teams":["5f696c8e9a63a60e965aaca8","6101bf5fa9e1adf3c668a1ad","6104da936b1079a2e20debb5","6104daab1a8ff9a9f023a689","6104dae33d1730d92ca27c51"],"spokeId":null,"lastName":"Liu","firstName":"Dave","workEmail":"dave.liu@workos.com","department":"Engineering","departmentId":"5f27ada9a5e9bc0001a0ae48"},"custom_attributes":{"department":"Engineering"},"groups":[{"object":"directory_group","id":"directory_group_01FBXGP7AM2ZTG9C2NT96E0T8B","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua. Neque viverra justo nec - ultrices dui sapien. Eu scelerisque felis imperdiet proin fermentum leo. Tincidunt - vitae semper quis lectus. Aliquet enim tortor at auctor urna nunc id cursus - metus. Sapien et ligula ullamcorper malesuada proin. Tellus pellentesque eu - tincidunt tortor aliquam nulla facilisi cras. Id aliquet risus feugiat in - ante. Consectetur adipiscing elit duis tristique sollicitudin nibh sit amet. - Eleifend mi in nulla posuere. Nec dui nunc mattis enim ut. Volutpat commodo - sed egestas egestas fringilla. Quis eleifend quam adipiscing vitae proin sagittis. - Amet facilisis magna etiam tempor orci. Quam nulla porttitor massa id neque. - Laoreet sit amet cursus sit amet dictum sit amet. Scelerisque eleifend donec - pretium vulputate sapien. Faucibus turpis in eu mi bibendum. Magna sit amet - purus gravida quis. Placerat vestibulum lectus mauris ultrices eros. Volutpat - est velit egestas dui id ornare. Aliquet eget sit amet tellus cras adipiscing - enim eu. Velit scelerisque in dictum non consectetur. Egestas fringilla phasellus - faucibus scelerisque eleifend donec pretium vulputate sapien. Malesuada nunc - vel risus commodo viverra maecenas accumsan lacus vel. Senectus et netus et - malesuada fames ac turpis. In mollis nunc sed id semper risus in hendrerit. - Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec. - Purus semper eget duis at tellus. Et ligula ullamcorper malesuada proin libero - nunc consequat interdum varius. Odio aenean sed adipiscing diam donec adipiscing. - Pretium quam vulputate dignissim suspendisse in est ante. Orci nulla pellentesque - dignissim enim sit amet venenatis urna. Viverra aliquet eget sit amet tellus - cras adipiscing enim. Lacus viverra vitae congue eu consequat ac felis donec. - Quis ipsum suspendisse ultrices gravida dictum fusce ut. Faucibus turpis - in eu mi bibendum. Lorem sed risus ultricies tristique nulla. Habitant morbi - tristique senectus et. Vitae suscipit tellus mauris a. Id leo in vitae turpis - massa sed. In hac habitasse platea dictumst vestibulum rhoncus est pellentesque. - Ornare arcu dui vivamus arcu felis bibendum ut tristique et. Ut aliquam purus - sit amet luctus venenatis lectus magna. Mollis aliquam ut porttitor leo a - diam. Pulvinar pellentesque habitant morbi tristique senectus et netus et. - Eget felis eget nunc lobortis. Viverra adipiscing at in tellus. Morbi tempus - iaculis urna id volutpat lacus laoreet non curabitur. Nam aliquam sem et tortor. - Maecenas sed enim ut sem viverra aliquet eget sit. Nec dui nunc mattis enim. - Donec ac odio tempor orci dapibus ultrices in iaculis. Tristique risus nec - feugiat in fermentum posuere urna nec. Suscipit adipiscing bibendum est ultricies. - Magna fringilla urna porttitor rhoncus. Cum sociis natoque penatibus et magnis - dis parturient montes nascetur. Amet nulla facilisi morbi tempus iaculis. - Mattis vulputate enim nulla aliquet porttitor lacus. Adipiscing elit duis - tristique sollicitudin nibh sit. Placerat duis ultricies lacus sed turpis - tincidunt id aliquet. Ut sem viverra aliquet eget sit amet tellus. Sagittis - id consectetur purus ut faucibus pulvinar. Id faucibus nisl tincidunt eget - nullam. Sed augue lacus viverra vitae congue eu consequat ac felis. Interdum - varius sit amet mattis vulputate enim. Ut venenatis tellus in metus vulputate - eu scelerisque. Lacus sed viverra tellus in hac habitasse. Nulla facilisi - etiam dignissim diam quis. Id porta nibh venenatis cras sed felis eget velit. - Orci porta non pulvinar neque laoreet suspendisse interdum consectetur.","raw_attributes":{"id":"6104dae33d1730d92ca27c51","name":"Lorem - ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt - ut labore et dolore magna aliqua. Neque viverra justo nec ultrices dui sapien. - Eu scelerisque felis imperdiet proin fermentum leo. Tincidunt vitae semper - quis lectus. Aliquet enim tortor at auctor urna nunc id cursus metus. Sapien - et ligula ullamcorper malesuada proin. Tellus pellentesque eu tincidunt tortor - aliquam nulla facilisi cras. Id aliquet risus feugiat in ante. Consectetur - adipiscing elit duis tristique sollicitudin nibh sit amet. Eleifend mi in - nulla posuere. Nec dui nunc mattis enim ut. Volutpat commodo sed egestas egestas - fringilla. Quis eleifend quam adipiscing vitae proin sagittis. Amet facilisis - magna etiam tempor orci. Quam nulla porttitor massa id neque. Laoreet sit - amet cursus sit amet dictum sit amet. Scelerisque eleifend donec pretium - vulputate sapien. Faucibus turpis in eu mi bibendum. Magna sit amet purus - gravida quis. Placerat vestibulum lectus mauris ultrices eros. Volutpat est - velit egestas dui id ornare. Aliquet eget sit amet tellus cras adipiscing - enim eu. Velit scelerisque in dictum non consectetur. Egestas fringilla phasellus - faucibus scelerisque eleifend donec pretium vulputate sapien. Malesuada nunc - vel risus commodo viverra maecenas accumsan lacus vel. Senectus et netus et - malesuada fames ac turpis. In mollis nunc sed id semper risus in hendrerit. - Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec. - Purus semper eget duis at tellus. Et ligula ullamcorper malesuada proin libero - nunc consequat interdum varius. Odio aenean sed adipiscing diam donec adipiscing. - Pretium quam vulputate dignissim suspendisse in est ante. Orci nulla pellentesque - dignissim enim sit amet venenatis urna. Viverra aliquet eget sit amet tellus - cras adipiscing enim. Lacus viverra vitae congue eu consequat ac felis donec. - Quis ipsum suspendisse ultrices gravida dictum fusce ut. Faucibus turpis - in eu mi bibendum. Lorem sed risus ultricies tristique nulla. Habitant morbi - tristique senectus et. Vitae suscipit tellus mauris a. Id leo in vitae turpis - massa sed. In hac habitasse platea dictumst vestibulum rhoncus est pellentesque. - Ornare arcu dui vivamus arcu felis bibendum ut tristique et. Ut aliquam purus - sit amet luctus venenatis lectus magna. Mollis aliquam ut porttitor leo a - diam. Pulvinar pellentesque habitant morbi tristique senectus et netus et. - Eget felis eget nunc lobortis. Viverra adipiscing at in tellus. Morbi tempus - iaculis urna id volutpat lacus laoreet non curabitur. Nam aliquam sem et tortor. - Maecenas sed enim ut sem viverra aliquet eget sit. Nec dui nunc mattis enim. - Donec ac odio tempor orci dapibus ultrices in iaculis. Tristique risus nec - feugiat in fermentum posuere urna nec. Suscipit adipiscing bibendum est ultricies. - Magna fringilla urna porttitor rhoncus. Cum sociis natoque penatibus et magnis - dis parturient montes nascetur. Amet nulla facilisi morbi tempus iaculis. - Mattis vulputate enim nulla aliquet porttitor lacus. Adipiscing elit duis - tristique sollicitudin nibh sit. Placerat duis ultricies lacus sed turpis - tincidunt id aliquet. Ut sem viverra aliquet eget sit amet tellus. Sagittis - id consectetur purus ut faucibus pulvinar. Id faucibus nisl tincidunt eget - nullam. Sed augue lacus viverra vitae congue eu consequat ac felis. Interdum - varius sit amet mattis vulputate enim. Ut venenatis tellus in metus vulputate - eu scelerisque. Lacus sed viverra tellus in hac habitasse. Nulla facilisi - etiam dignissim diam quis. Id porta nibh venenatis cras sed felis eget velit. - Orci porta non pulvinar neque laoreet suspendisse interdum consectetur.","parent":null}},{"object":"directory_group","id":"directory_group_01FBXGP79EJAYKW0WS9JCK1V6E","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Fight Club","raw_attributes":{"id":"6104daab1a8ff9a9f023a689","name":"Fight - Club","parent":null}},{"object":"directory_group","id":"directory_group_01FBXGP743J13S0CNRM84M8RZT","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Party Planners","raw_attributes":{"id":"6104da936b1079a2e20debb5","name":"Party - Planners","parent":null}},{"object":"directory_group","id":"directory_group_01FBQDKP34JY5AWYYMZT3ME8VX","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - The Best Team","raw_attributes":{"id":"6101bf5fa9e1adf3c668a1ad","name":"The - Best Team","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Platform","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNMV2TDE78FEAH724YGMP","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department - - Engineering","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae48","name":"Engineering","parent":null}}]},{"object":"directory_user","id":"directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"5f6e1d0d67a73900a6c29e15","username":"henry@workos.com","emails":[{"primary":true,"value":"henry@workos.com"}],"first_name":"Henry","last_name":"Chan","job_title":"Software Engineer","state":"active","created_at":"2020-09-25T16:38:37+0000","updated_at":"2021-07-07T08:46:02+0000","raw_attributes":{"id":"5f6e1d0d67a73900a6c29e15","name":"Henry - Chan","teams":["5f696c8e9a63a60e965aaca8"],"spokeId":null,"lastName":"Chan","firstName":"Henry","workEmail":"henry@workos.com","department":"Engineering","departmentId":"5f27ada9a5e9bc0001a0ae48"},"custom_attributes":{"department":"Engineering"},"groups":[{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Platform","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNMV2TDE78FEAH724YGMP","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department - - Engineering","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae48","name":"Engineering","parent":null}}]},{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","created_at":"2021-05-05T16:06:24+0000","updated_at":"2021-07-19T19:17:52+0000","raw_attributes":{"id":"6092c280a3f1e19ef6d8cef8","name":"Bob - Bob Fakename","teams":["5f696c8e9a63a60e965aaca8"],"spokeId":null,"lastName":"Fakename","firstName":"Bob","workEmail":"bob.fakename@workos.com","department":"Infra","departmentId":"5f27ada9a5e9bc0001a0ae4a"},"custom_attributes":{"department":"Infra"},"groups":[{"object":"directory_group","id":"directory_group_01FAZYNN1NZWMBRAXXDSTB5NFH","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department - - Infra","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae4a","name":"Infra","parent":"5f27ada9a5e9bc0001a0ae48"}},{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Platform","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}}]},{"object":"directory_user","id":"directory_user_01FAZYNPC8DYPEWZ0BSHBA21RM","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"5f27ada8a5e9bc0001a0adcf","username":"workos@test.com","emails":[{"primary":true,"value":"workos@test.com"}],"first_name":"Michael","last_name":"Grinich","job_title":"CEO","state":"active","created_at":"2020-08-03T06:24:40+0000","updated_at":"2021-07-07T08:50:53+0000","raw_attributes":{"id":"5f27ada8a5e9bc0001a0adcf","name":"Michael - Grinich","teams":[],"spokeId":null,"lastName":"Grinich","firstName":"Michael","workEmail":"workos@test.com","department":"Marketing","departmentId":"5f27ada9a5e9bc0001a0ae4e"},"custom_attributes":{"department":"Marketing"},"groups":[{"object":"directory_group","id":"directory_group_01FAZYNMWS67E66CD01E7A1PC4","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department - - Marketing","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae4e","name":"Marketing","parent":null}}]}]}' - http_version: - recorded_at: Mon, 09 Aug 2021 17:36:11 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml deleted file mode 100644 index e445d34d..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml +++ /dev/null @@ -1,186 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_users?group=directory_group_01FBXGP79EJAYKW0WS9JCK1V6E&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 17:43:06 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - b28d9d07-dc0d-4177-90b8-1ca2e6ad16e3 - Etag: - - W/"258b-TDvtW7zDvbYuZdWKeuyMG81fF4M" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=NyMWn6qw%2F8J517ZNHJhdMcl0UcJUbuX7WkWKCMjp6ftJ8fpIkqWSwVPWVog50K6RGzaS07i9JmdyOqlXTYgjWo%2Bix4ZS0WxYhLjMMiWPsvvcBQkaOAKpB9r0vL8pNA5F%2BH%2BeKzhdgx%2F3u47t1Q%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c2c8e75b50ec7a-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","listMetadata":{"before":null,"after":null},"data":[{"object":"directory_user","id":"directory_user_01FC73296N43TB1NW9J9CQ8AHT","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6104db3b6246f63d0df47ac5","username":"dave.liu@workos.com","emails":[{"primary":true,"value":"dave.liu@workos.com"}],"first_name":"Dave","last_name":"Liu","job_title":"Software Engineer","state":"active","created_at":"2021-07-31T05:10:19+0000","updated_at":"2021-07-31T08:02:36+0000","raw_attributes":{"id":"6104db3b6246f63d0df47ac5","name":"Dave - Liu","teams":["5f696c8e9a63a60e965aaca8","6101bf5fa9e1adf3c668a1ad","6104da936b1079a2e20debb5","6104daab1a8ff9a9f023a689","6104dae33d1730d92ca27c51"],"spokeId":null,"lastName":"Liu","firstName":"Dave","workEmail":"dave.liu@workos.com","department":"Engineering","departmentId":"5f27ada9a5e9bc0001a0ae48"},"custom_attributes":{"department":"Engineering"},"groups":[{"object":"directory_group","id":"directory_group_01FBXGP7AM2ZTG9C2NT96E0T8B","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua. Neque viverra justo nec - ultrices dui sapien. Eu scelerisque felis imperdiet proin fermentum leo. Tincidunt - vitae semper quis lectus. Aliquet enim tortor at auctor urna nunc id cursus - metus. Sapien et ligula ullamcorper malesuada proin. Tellus pellentesque eu - tincidunt tortor aliquam nulla facilisi cras. Id aliquet risus feugiat in - ante. Consectetur adipiscing elit duis tristique sollicitudin nibh sit amet. - Eleifend mi in nulla posuere. Nec dui nunc mattis enim ut. Volutpat commodo - sed egestas egestas fringilla. Quis eleifend quam adipiscing vitae proin sagittis. - Amet facilisis magna etiam tempor orci. Quam nulla porttitor massa id neque. - Laoreet sit amet cursus sit amet dictum sit amet. Scelerisque eleifend donec - pretium vulputate sapien. Faucibus turpis in eu mi bibendum. Magna sit amet - purus gravida quis. Placerat vestibulum lectus mauris ultrices eros. Volutpat - est velit egestas dui id ornare. Aliquet eget sit amet tellus cras adipiscing - enim eu. Velit scelerisque in dictum non consectetur. Egestas fringilla phasellus - faucibus scelerisque eleifend donec pretium vulputate sapien. Malesuada nunc - vel risus commodo viverra maecenas accumsan lacus vel. Senectus et netus et - malesuada fames ac turpis. In mollis nunc sed id semper risus in hendrerit. - Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec. - Purus semper eget duis at tellus. Et ligula ullamcorper malesuada proin libero - nunc consequat interdum varius. Odio aenean sed adipiscing diam donec adipiscing. - Pretium quam vulputate dignissim suspendisse in est ante. Orci nulla pellentesque - dignissim enim sit amet venenatis urna. Viverra aliquet eget sit amet tellus - cras adipiscing enim. Lacus viverra vitae congue eu consequat ac felis donec. - Quis ipsum suspendisse ultrices gravida dictum fusce ut. Faucibus turpis - in eu mi bibendum. Lorem sed risus ultricies tristique nulla. Habitant morbi - tristique senectus et. Vitae suscipit tellus mauris a. Id leo in vitae turpis - massa sed. In hac habitasse platea dictumst vestibulum rhoncus est pellentesque. - Ornare arcu dui vivamus arcu felis bibendum ut tristique et. Ut aliquam purus - sit amet luctus venenatis lectus magna. Mollis aliquam ut porttitor leo a - diam. Pulvinar pellentesque habitant morbi tristique senectus et netus et. - Eget felis eget nunc lobortis. Viverra adipiscing at in tellus. Morbi tempus - iaculis urna id volutpat lacus laoreet non curabitur. Nam aliquam sem et tortor. - Maecenas sed enim ut sem viverra aliquet eget sit. Nec dui nunc mattis enim. - Donec ac odio tempor orci dapibus ultrices in iaculis. Tristique risus nec - feugiat in fermentum posuere urna nec. Suscipit adipiscing bibendum est ultricies. - Magna fringilla urna porttitor rhoncus. Cum sociis natoque penatibus et magnis - dis parturient montes nascetur. Amet nulla facilisi morbi tempus iaculis. - Mattis vulputate enim nulla aliquet porttitor lacus. Adipiscing elit duis - tristique sollicitudin nibh sit. Placerat duis ultricies lacus sed turpis - tincidunt id aliquet. Ut sem viverra aliquet eget sit amet tellus. Sagittis - id consectetur purus ut faucibus pulvinar. Id faucibus nisl tincidunt eget - nullam. Sed augue lacus viverra vitae congue eu consequat ac felis. Interdum - varius sit amet mattis vulputate enim. Ut venenatis tellus in metus vulputate - eu scelerisque. Lacus sed viverra tellus in hac habitasse. Nulla facilisi - etiam dignissim diam quis. Id porta nibh venenatis cras sed felis eget velit. - Orci porta non pulvinar neque laoreet suspendisse interdum consectetur.","raw_attributes":{"id":"6104dae33d1730d92ca27c51","name":"Lorem - ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt - ut labore et dolore magna aliqua. Neque viverra justo nec ultrices dui sapien. - Eu scelerisque felis imperdiet proin fermentum leo. Tincidunt vitae semper - quis lectus. Aliquet enim tortor at auctor urna nunc id cursus metus. Sapien - et ligula ullamcorper malesuada proin. Tellus pellentesque eu tincidunt tortor - aliquam nulla facilisi cras. Id aliquet risus feugiat in ante. Consectetur - adipiscing elit duis tristique sollicitudin nibh sit amet. Eleifend mi in - nulla posuere. Nec dui nunc mattis enim ut. Volutpat commodo sed egestas egestas - fringilla. Quis eleifend quam adipiscing vitae proin sagittis. Amet facilisis - magna etiam tempor orci. Quam nulla porttitor massa id neque. Laoreet sit - amet cursus sit amet dictum sit amet. Scelerisque eleifend donec pretium - vulputate sapien. Faucibus turpis in eu mi bibendum. Magna sit amet purus - gravida quis. Placerat vestibulum lectus mauris ultrices eros. Volutpat est - velit egestas dui id ornare. Aliquet eget sit amet tellus cras adipiscing - enim eu. Velit scelerisque in dictum non consectetur. Egestas fringilla phasellus - faucibus scelerisque eleifend donec pretium vulputate sapien. Malesuada nunc - vel risus commodo viverra maecenas accumsan lacus vel. Senectus et netus et - malesuada fames ac turpis. In mollis nunc sed id semper risus in hendrerit. - Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec. - Purus semper eget duis at tellus. Et ligula ullamcorper malesuada proin libero - nunc consequat interdum varius. Odio aenean sed adipiscing diam donec adipiscing. - Pretium quam vulputate dignissim suspendisse in est ante. Orci nulla pellentesque - dignissim enim sit amet venenatis urna. Viverra aliquet eget sit amet tellus - cras adipiscing enim. Lacus viverra vitae congue eu consequat ac felis donec. - Quis ipsum suspendisse ultrices gravida dictum fusce ut. Faucibus turpis - in eu mi bibendum. Lorem sed risus ultricies tristique nulla. Habitant morbi - tristique senectus et. Vitae suscipit tellus mauris a. Id leo in vitae turpis - massa sed. In hac habitasse platea dictumst vestibulum rhoncus est pellentesque. - Ornare arcu dui vivamus arcu felis bibendum ut tristique et. Ut aliquam purus - sit amet luctus venenatis lectus magna. Mollis aliquam ut porttitor leo a - diam. Pulvinar pellentesque habitant morbi tristique senectus et netus et. - Eget felis eget nunc lobortis. Viverra adipiscing at in tellus. Morbi tempus - iaculis urna id volutpat lacus laoreet non curabitur. Nam aliquam sem et tortor. - Maecenas sed enim ut sem viverra aliquet eget sit. Nec dui nunc mattis enim. - Donec ac odio tempor orci dapibus ultrices in iaculis. Tristique risus nec - feugiat in fermentum posuere urna nec. Suscipit adipiscing bibendum est ultricies. - Magna fringilla urna porttitor rhoncus. Cum sociis natoque penatibus et magnis - dis parturient montes nascetur. Amet nulla facilisi morbi tempus iaculis. - Mattis vulputate enim nulla aliquet porttitor lacus. Adipiscing elit duis - tristique sollicitudin nibh sit. Placerat duis ultricies lacus sed turpis - tincidunt id aliquet. Ut sem viverra aliquet eget sit amet tellus. Sagittis - id consectetur purus ut faucibus pulvinar. Id faucibus nisl tincidunt eget - nullam. Sed augue lacus viverra vitae congue eu consequat ac felis. Interdum - varius sit amet mattis vulputate enim. Ut venenatis tellus in metus vulputate - eu scelerisque. Lacus sed viverra tellus in hac habitasse. Nulla facilisi - etiam dignissim diam quis. Id porta nibh venenatis cras sed felis eget velit. - Orci porta non pulvinar neque laoreet suspendisse interdum consectetur.","parent":null}},{"object":"directory_group","id":"directory_group_01FBXGP79EJAYKW0WS9JCK1V6E","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Fight Club","raw_attributes":{"id":"6104daab1a8ff9a9f023a689","name":"Fight - Club","parent":null}},{"object":"directory_group","id":"directory_group_01FBXGP743J13S0CNRM84M8RZT","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Party Planners","raw_attributes":{"id":"6104da936b1079a2e20debb5","name":"Party - Planners","parent":null}},{"object":"directory_group","id":"directory_group_01FBQDKP34JY5AWYYMZT3ME8VX","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - The Best Team","raw_attributes":{"id":"6101bf5fa9e1adf3c668a1ad","name":"The - Best Team","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Platform","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNMV2TDE78FEAH724YGMP","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department - - Engineering","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae48","name":"Engineering","parent":null}}]}]}' - http_version: - recorded_at: Mon, 09 Aug 2021 17:43:06 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml deleted file mode 100644 index ea1edd89..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml +++ /dev/null @@ -1,189 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/directory_users?directory=directory_01FAZYMST676QMTFN1DDJZZX87&limit=2&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 17:36:12 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 3f0bbea9-a104-41d9-8874-1cfaa40500b5 - Etag: - - W/"2a64-2f0QLR9cfINRAJthEtaNWgEMUzM" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=cfIgbm%2BpcD4MTnwWaVE2uYye00h3eAh0OwvQwGsmIYIdurSQ6Rw8YQC%2BVLJ4U8iSgVcnlH1%2FLFYTqH6EitVKKLYlw1UZnARCPz1TlnP%2FRQoOntlLA%2B5LjnbChqh6lBwDt%2FRrt4o8u2SCutj4jA%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c2bece58300c46-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","listMetadata":{"before":"directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF","after":null},"data":[{"object":"directory_user","id":"directory_user_01FC73296N43TB1NW9J9CQ8AHT","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6104db3b6246f63d0df47ac5","username":"dave.liu@workos.com","emails":[{"primary":true,"value":"dave.liu@workos.com"}],"first_name":"Dave","last_name":"Liu","job_title":"Software Engineer","state":"active","created_at":"2021-07-31T05:10:19+0000","updated_at":"2021-07-31T08:02:36+0000","raw_attributes":{"id":"6104db3b6246f63d0df47ac5","name":"Dave - Liu","teams":["5f696c8e9a63a60e965aaca8","6101bf5fa9e1adf3c668a1ad","6104da936b1079a2e20debb5","6104daab1a8ff9a9f023a689","6104dae33d1730d92ca27c51"],"spokeId":null,"lastName":"Liu","firstName":"Dave","workEmail":"dave.liu@workos.com","department":"Engineering","departmentId":"5f27ada9a5e9bc0001a0ae48"},"custom_attributes":{"department":"Engineering"},"groups":[{"object":"directory_group","id":"directory_group_01FBXGP7AM2ZTG9C2NT96E0T8B","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua. Neque viverra justo nec - ultrices dui sapien. Eu scelerisque felis imperdiet proin fermentum leo. Tincidunt - vitae semper quis lectus. Aliquet enim tortor at auctor urna nunc id cursus - metus. Sapien et ligula ullamcorper malesuada proin. Tellus pellentesque eu - tincidunt tortor aliquam nulla facilisi cras. Id aliquet risus feugiat in - ante. Consectetur adipiscing elit duis tristique sollicitudin nibh sit amet. - Eleifend mi in nulla posuere. Nec dui nunc mattis enim ut. Volutpat commodo - sed egestas egestas fringilla. Quis eleifend quam adipiscing vitae proin sagittis. - Amet facilisis magna etiam tempor orci. Quam nulla porttitor massa id neque. - Laoreet sit amet cursus sit amet dictum sit amet. Scelerisque eleifend donec - pretium vulputate sapien. Faucibus turpis in eu mi bibendum. Magna sit amet - purus gravida quis. Placerat vestibulum lectus mauris ultrices eros. Volutpat - est velit egestas dui id ornare. Aliquet eget sit amet tellus cras adipiscing - enim eu. Velit scelerisque in dictum non consectetur. Egestas fringilla phasellus - faucibus scelerisque eleifend donec pretium vulputate sapien. Malesuada nunc - vel risus commodo viverra maecenas accumsan lacus vel. Senectus et netus et - malesuada fames ac turpis. In mollis nunc sed id semper risus in hendrerit. - Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec. - Purus semper eget duis at tellus. Et ligula ullamcorper malesuada proin libero - nunc consequat interdum varius. Odio aenean sed adipiscing diam donec adipiscing. - Pretium quam vulputate dignissim suspendisse in est ante. Orci nulla pellentesque - dignissim enim sit amet venenatis urna. Viverra aliquet eget sit amet tellus - cras adipiscing enim. Lacus viverra vitae congue eu consequat ac felis donec. - Quis ipsum suspendisse ultrices gravida dictum fusce ut. Faucibus turpis - in eu mi bibendum. Lorem sed risus ultricies tristique nulla. Habitant morbi - tristique senectus et. Vitae suscipit tellus mauris a. Id leo in vitae turpis - massa sed. In hac habitasse platea dictumst vestibulum rhoncus est pellentesque. - Ornare arcu dui vivamus arcu felis bibendum ut tristique et. Ut aliquam purus - sit amet luctus venenatis lectus magna. Mollis aliquam ut porttitor leo a - diam. Pulvinar pellentesque habitant morbi tristique senectus et netus et. - Eget felis eget nunc lobortis. Viverra adipiscing at in tellus. Morbi tempus - iaculis urna id volutpat lacus laoreet non curabitur. Nam aliquam sem et tortor. - Maecenas sed enim ut sem viverra aliquet eget sit. Nec dui nunc mattis enim. - Donec ac odio tempor orci dapibus ultrices in iaculis. Tristique risus nec - feugiat in fermentum posuere urna nec. Suscipit adipiscing bibendum est ultricies. - Magna fringilla urna porttitor rhoncus. Cum sociis natoque penatibus et magnis - dis parturient montes nascetur. Amet nulla facilisi morbi tempus iaculis. - Mattis vulputate enim nulla aliquet porttitor lacus. Adipiscing elit duis - tristique sollicitudin nibh sit. Placerat duis ultricies lacus sed turpis - tincidunt id aliquet. Ut sem viverra aliquet eget sit amet tellus. Sagittis - id consectetur purus ut faucibus pulvinar. Id faucibus nisl tincidunt eget - nullam. Sed augue lacus viverra vitae congue eu consequat ac felis. Interdum - varius sit amet mattis vulputate enim. Ut venenatis tellus in metus vulputate - eu scelerisque. Lacus sed viverra tellus in hac habitasse. Nulla facilisi - etiam dignissim diam quis. Id porta nibh venenatis cras sed felis eget velit. - Orci porta non pulvinar neque laoreet suspendisse interdum consectetur.","raw_attributes":{"id":"6104dae33d1730d92ca27c51","name":"Lorem - ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt - ut labore et dolore magna aliqua. Neque viverra justo nec ultrices dui sapien. - Eu scelerisque felis imperdiet proin fermentum leo. Tincidunt vitae semper - quis lectus. Aliquet enim tortor at auctor urna nunc id cursus metus. Sapien - et ligula ullamcorper malesuada proin. Tellus pellentesque eu tincidunt tortor - aliquam nulla facilisi cras. Id aliquet risus feugiat in ante. Consectetur - adipiscing elit duis tristique sollicitudin nibh sit amet. Eleifend mi in - nulla posuere. Nec dui nunc mattis enim ut. Volutpat commodo sed egestas egestas - fringilla. Quis eleifend quam adipiscing vitae proin sagittis. Amet facilisis - magna etiam tempor orci. Quam nulla porttitor massa id neque. Laoreet sit - amet cursus sit amet dictum sit amet. Scelerisque eleifend donec pretium - vulputate sapien. Faucibus turpis in eu mi bibendum. Magna sit amet purus - gravida quis. Placerat vestibulum lectus mauris ultrices eros. Volutpat est - velit egestas dui id ornare. Aliquet eget sit amet tellus cras adipiscing - enim eu. Velit scelerisque in dictum non consectetur. Egestas fringilla phasellus - faucibus scelerisque eleifend donec pretium vulputate sapien. Malesuada nunc - vel risus commodo viverra maecenas accumsan lacus vel. Senectus et netus et - malesuada fames ac turpis. In mollis nunc sed id semper risus in hendrerit. - Phasellus faucibus scelerisque eleifend donec pretium vulputate sapien nec. - Purus semper eget duis at tellus. Et ligula ullamcorper malesuada proin libero - nunc consequat interdum varius. Odio aenean sed adipiscing diam donec adipiscing. - Pretium quam vulputate dignissim suspendisse in est ante. Orci nulla pellentesque - dignissim enim sit amet venenatis urna. Viverra aliquet eget sit amet tellus - cras adipiscing enim. Lacus viverra vitae congue eu consequat ac felis donec. - Quis ipsum suspendisse ultrices gravida dictum fusce ut. Faucibus turpis - in eu mi bibendum. Lorem sed risus ultricies tristique nulla. Habitant morbi - tristique senectus et. Vitae suscipit tellus mauris a. Id leo in vitae turpis - massa sed. In hac habitasse platea dictumst vestibulum rhoncus est pellentesque. - Ornare arcu dui vivamus arcu felis bibendum ut tristique et. Ut aliquam purus - sit amet luctus venenatis lectus magna. Mollis aliquam ut porttitor leo a - diam. Pulvinar pellentesque habitant morbi tristique senectus et netus et. - Eget felis eget nunc lobortis. Viverra adipiscing at in tellus. Morbi tempus - iaculis urna id volutpat lacus laoreet non curabitur. Nam aliquam sem et tortor. - Maecenas sed enim ut sem viverra aliquet eget sit. Nec dui nunc mattis enim. - Donec ac odio tempor orci dapibus ultrices in iaculis. Tristique risus nec - feugiat in fermentum posuere urna nec. Suscipit adipiscing bibendum est ultricies. - Magna fringilla urna porttitor rhoncus. Cum sociis natoque penatibus et magnis - dis parturient montes nascetur. Amet nulla facilisi morbi tempus iaculis. - Mattis vulputate enim nulla aliquet porttitor lacus. Adipiscing elit duis - tristique sollicitudin nibh sit. Placerat duis ultricies lacus sed turpis - tincidunt id aliquet. Ut sem viverra aliquet eget sit amet tellus. Sagittis - id consectetur purus ut faucibus pulvinar. Id faucibus nisl tincidunt eget - nullam. Sed augue lacus viverra vitae congue eu consequat ac felis. Interdum - varius sit amet mattis vulputate enim. Ut venenatis tellus in metus vulputate - eu scelerisque. Lacus sed viverra tellus in hac habitasse. Nulla facilisi - etiam dignissim diam quis. Id porta nibh venenatis cras sed felis eget velit. - Orci porta non pulvinar neque laoreet suspendisse interdum consectetur.","parent":null}},{"object":"directory_group","id":"directory_group_01FBXGP79EJAYKW0WS9JCK1V6E","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Fight Club","raw_attributes":{"id":"6104daab1a8ff9a9f023a689","name":"Fight - Club","parent":null}},{"object":"directory_group","id":"directory_group_01FBXGP743J13S0CNRM84M8RZT","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Party Planners","raw_attributes":{"id":"6104da936b1079a2e20debb5","name":"Party - Planners","parent":null}},{"object":"directory_group","id":"directory_group_01FBQDKP34JY5AWYYMZT3ME8VX","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - The Best Team","raw_attributes":{"id":"6101bf5fa9e1adf3c668a1ad","name":"The - Best Team","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Platform","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNMV2TDE78FEAH724YGMP","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department - - Engineering","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae48","name":"Engineering","parent":null}}]},{"object":"directory_user","id":"directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"5f6e1d0d67a73900a6c29e15","username":"henry@workos.com","emails":[{"primary":true,"value":"henry@workos.com"}],"first_name":"Henry","last_name":"Chan","job_title":"Software Engineer","state":"active","created_at":"2020-09-25T16:38:37+0000","updated_at":"2021-07-07T08:46:02+0000","raw_attributes":{"id":"5f6e1d0d67a73900a6c29e15","name":"Henry - Chan","teams":["5f696c8e9a63a60e965aaca8"],"spokeId":null,"lastName":"Chan","firstName":"Henry","workEmail":"henry@workos.com","department":"Engineering","departmentId":"5f27ada9a5e9bc0001a0ae48"},"custom_attributes":{"department":"Engineering"},"groups":[{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team - - Platform","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNMV2TDE78FEAH724YGMP","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department - - Engineering","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae48","name":"Engineering","parent":null}}]}]}' - http_version: - recorded_at: Mon, 09 Aug 2021 17:36:12 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml b/test/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml deleted file mode 100644 index acef6cbf..00000000 --- a/test/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml +++ /dev/null @@ -1,75 +0,0 @@ ---- -http_interactions: - - request: - method: get - uri: https://api.workos.com/directory_users?order=desc - body: - encoding: US-ASCII - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.10.3 - Authorization: - - Bearer - response: - status: - code: 422 - message: Unprocessable Entity - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - X-Dns-Prefetch-Control: - - "off" - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - "0" - X-Request-Id: - - 7ec78e21-576f-44a4-895f-bd911a3f4b04 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "222" - Etag: - - W/"de-33B+CY27z2HlOGKZPu4nzUVQpuI" - Date: - - Thu, 22 Apr 2021 21:58:34 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: - '{"message":"Validation failed","errors":[{"field":"directory","code":"Please - provide either \"directory\" or \"group\" parameters."},{"field":"group","code":"Please - provide either \"directory\" or \"group\" parameters."}]}' - http_version: - recorded_at: Thu, 22 Apr 2021 21:58:34 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/events/list_events_with_after.yml b/test/fixtures/vcr_cassettes/events/list_events_with_after.yml deleted file mode 100644 index dd4a45f8..00000000 --- a/test/fixtures/vcr_cassettes/events/list_events_with_after.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/events?after=event_01FGCPNV312FHFRCX0BYWHVSE1&events=dsync.user.created - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.2; arm64-darwin21; v2.3.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 14 Jul 2022 16:46:23 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '616' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"680-NPvBik348v8xg6EE7iZMYwD5UXw" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (b642bf20b975) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 51a82273-b413-cead-b968-c07ba4d6fd08 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=OS7ELJ3A8tkzMafvaIThD%2B5JlYmul1puZlAXTxEKYBLlq%2B6DCtqDqAi4dtr4yRP3khNmg6MwPiuLqtdOXRmPOtag9Ti%2FGK8ra%2BJOlpwkFjD965CNBfzao4EJtExDkbS3"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 72abbbf2b93e8ca5-EWR - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"event","id":"event_01FK3HFFGMC2WF32RR8SKWC8KA","event":"dsync.user.created","created_at":"2021-10-28T13:29:54.451Z","data":{"email":"foo@foocorp.com"}}], "list_metadata":{"after":null}}' - http_version: - recorded_at: Thu, 14 Jul 2022 16:46:23 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/events/list_events_with_event.yml b/test/fixtures/vcr_cassettes/events/list_events_with_event.yml deleted file mode 100644 index 3d84e8a1..00000000 --- a/test/fixtures/vcr_cassettes/events/list_events_with_event.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/events?events=connection.activated - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.2; arm64-darwin21; v2.3.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 14 Jul 2022 16:46:23 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '616' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"680-NPvBik348v8xg6EE7iZMYwD5UXw" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (b642bf20b975) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 51a82273-b413-cead-b968-c07ba4d6fd08 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=OS7ELJ3A8tkzMafvaIThD%2B5JlYmul1puZlAXTxEKYBLlq%2B6DCtqDqAi4dtr4yRP3khNmg6MwPiuLqtdOXRmPOtag9Ti%2FGK8ra%2BJOlpwkFjD965CNBfzao4EJtExDkbS3"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 72abbbf2b93e8ca5-EWR - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"event","id":"event_01FK3HFFGMC2WF32RR8SKWC8KA","event":"dsync.user.created","created_at":"2021-10-28T13:29:54.451Z","data":{"email":"foo@foocorp.com"}}], "list_metadata":{"after":null}}' - http_version: - recorded_at: Thu, 14 Jul 2022 16:46:23 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/events/list_events_with_no_options.yml b/test/fixtures/vcr_cassettes/events/list_events_with_no_options.yml deleted file mode 100644 index 9e1efab8..00000000 --- a/test/fixtures/vcr_cassettes/events/list_events_with_no_options.yml +++ /dev/null @@ -1,81 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/events - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.3.0; arm64-darwin23; v4.1.0 - Authorization: - - Bearer - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Thu, 11 Apr 2024 15:44:49 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '140' - Connection: - - keep-alive - Cf-Ray: - - 872c19a65dcb3af9-IAD - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"8c-3NPoweNh0oXUDzElVKxg5PG7PWk" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 660c0035-b70d-4939-a0d3-2b0917535e7f - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=UpBr7jsatrWLaunHA8NhaflwkUco6FBxeXhgwz2bAoM-1712850289-1.0.1.1-KJCKaoohiG088DieTdV2V91AtW1fbs7ec.x7gsal9xsVzA2OPf67b0R__57KFvEsEZ97obgydtH.VEwyYhpGTw; - path=/; expires=Thu, 11-Apr-24 16:14:49 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=bbad8ba60df9a023f0ba77749b5c0b92162e6ed3-1712850289; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"message":"One or more event names (e.g. dsync.user.created) must - be provided using the events parameter.","code":"invalid_events_request"}' - http_version: - recorded_at: Thu, 11 Apr 2024 15:44:49 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml b/test/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml deleted file mode 100644 index 83339061..00000000 --- a/test/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/events?events=dsync.user.created&organization_id=org_1234 - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.2; arm64-darwin21; v2.3.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 14 Jul 2022 16:46:23 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '616' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"680-NPvBik348v8xg6EE7iZMYwD5UXw" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (b642bf20b975) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 51a82273-b413-cead-b968-c07ba4d6fd08 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=OS7ELJ3A8tkzMafvaIThD%2B5JlYmul1puZlAXTxEKYBLlq%2B6DCtqDqAi4dtr4yRP3khNmg6MwPiuLqtdOXRmPOtag9Ti%2FGK8ra%2BJOlpwkFjD965CNBfzao4EJtExDkbS3"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 72abbbf2b93e8ca5-EWR - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"event","id":"event_01FK3HFFGMC2WF32RR8SKWC8KA","event":"dsync.user.created","created_at":"2021-10-28T13:29:54.451Z","data":{"email":"foo@foocorp.com"}}], "list_metadata":{"after":null}}' - http_version: - recorded_at: Thu, 14 Jul 2022 16:46:23 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/events/list_events_with_range.yml b/test/fixtures/vcr_cassettes/events/list_events_with_range.yml deleted file mode 100644 index bec211c4..00000000 --- a/test/fixtures/vcr_cassettes/events/list_events_with_range.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/events?events=dsync.user.created&range_end=2023-01-03T00:00:00Z&range_start=2023-01-01T00:00:00Z - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.2; arm64-darwin21; v2.3.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 14 Jul 2022 16:46:23 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '616' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"680-NPvBik348v8xg6EE7iZMYwD5UXw" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (b642bf20b975) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 51a82273-b413-cead-b968-c07ba4d6fd08 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=OS7ELJ3A8tkzMafvaIThD%2B5JlYmul1puZlAXTxEKYBLlq%2B6DCtqDqAi4dtr4yRP3khNmg6MwPiuLqtdOXRmPOtag9Ti%2FGK8ra%2BJOlpwkFjD965CNBfzao4EJtExDkbS3"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 72abbbf2b93e8ca5-EWR - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"event","id":"event_01FK3HFFGMC2WF32RR8SKWC8KA","event":"dsync.user.created","created_at":"2021-10-28T13:29:54.451Z","data":{"email":"foo@foocorp.com"}}], "list_metadata":{"after":null}}' - http_version: - recorded_at: Thu, 14 Jul 2022 16:46:23 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml b/test/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml deleted file mode 100644 index ba4e04e5..00000000 --- a/test/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/auth/factors/auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M/challenge - body: - encoding: UTF-8 - string: '{"sms_template":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Sun, 27 Mar 2022 05:15:26 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '290' - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 6f320a1f-92d8-496c-9c30-69355787d21e - Etag: - - W/"122-QtSiaXex7UKEyydEC3oPpuHzGNw" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=2kePZ4Q7kGQ1by5iXZxRevmSkQq4vTbW1vXTqFev99eLBrrfEHOLK2%2FE0ItWB2GAKoQvhPBk3rhS%2FKg0rtK3ZH4DGTf%2FEQKGFPT6BxtCqQE2L%2ByfEv1AgU152ZwIBPVYjQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f25a5f0dddf088d-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: UTF-8 - string: '{"object":"authentication_challenge","id":"auth_challenge_01FZ4WSWV2SCEDX3GKY1NA9YTN","created_at":"2022-03-27T05:15:26.432Z","updated_at":"2022-03-27T05:15:26.432Z","expires_at":"2022-03-27T05:25:26.434Z","code":"541295","authentication_factor_id":"auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M"}' - http_version: - recorded_at: Sun, 27 Mar 2022 05:15:26 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml b/test/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml deleted file mode 100644 index 51ead07f..00000000 --- a/test/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/auth/factors/auth_factor_01FZ4TS14D1PHFNZ9GF6YD8M1F/challenge - body: - encoding: UTF-8 - string: '{"sms_template":"Your code is {{code}}"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Sun, 27 Mar 2022 05:03:26 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '274' - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - b9c66c87-adf4-4a9a-854f-d838f966ea5c - Etag: - - W/"112-VpD9nscbxE6VOcsJlK2RHEzlq3s" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=yNaSbl1oXtixmxb7lJOn7tDKzD0mN8jSFHJmTsZfD6YTlSGeMrdBgfi3LUFeDv1ldKcdNe5eZ%2BkRrVM986RUizGOhL2xzdl2AkJEdudIRaaJCMdWbjQDmGLbC4OPFajMIA%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f25945b9ee639b4-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: UTF-8 - string: '{"object":"authentication_challenge","id":"auth_challenge_01FZ4W3XG1VD8ZD5TXSYQMFMSR","created_at":"2022-03-27T05:03:26.203Z","updated_at":"2022-03-27T05:03:26.203Z","expires_at":"2022-03-27T05:13:26.204Z","authentication_factor_id":"auth_factor_01FZ4TS14D1PHFNZ9GF6YD8M1F"}' - http_version: - recorded_at: Sun, 27 Mar 2022 05:03:26 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml b/test/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml deleted file mode 100644 index 3686f6d8..00000000 --- a/test/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/auth/factors/auth_factor_01FZ4TS0MWPZR7GATS7KCXANQZ/challenge - body: - encoding: UTF-8 - string: '{"sms_template":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Sun, 27 Mar 2022 05:03:25 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '234' - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - f04282d0-e78a-42f8-9403-23cebbb4bb66 - Etag: - - W/"ea-SVZUKXJpb27hGw8Q2jIf8W5kZA8" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=yZfS4xxk1lbY3jrk5QxKFnwdRyRdSajEVp0nlEAoJsESmp40wQP7kosvTWU4dHccBOuEaTIEvPHXVd5buOQbKDmOhuHmVNM89nsd3ukSicS%2BhcutdMpwnTNO5xgqErdEzA%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f2594595b62e46e-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: UTF-8 - string: '{"object":"authentication_challenge","id":"auth_challenge_01FZ4W3X566NPKJRNB85KHF74F","created_at":"2022-03-27T05:03:25.859Z","updated_at":"2022-03-27T05:03:25.859Z","expires_at":"2022-03-27T05:13:26.204Z","authentication_factor_id":"auth_factor_01FZ4TS0MWPZR7GATS7KCXANQZ"}' - http_version: - recorded_at: Sun, 27 Mar 2022 05:03:25 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/delete_factor.yml b/test/fixtures/vcr_cassettes/mfa/delete_factor.yml deleted file mode 100644 index dd32c420..00000000 --- a/test/fixtures/vcr_cassettes/mfa/delete_factor.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.workos.com/auth/factors/auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 204 - message: No Content - headers: - Date: - - Sun, 27 Mar 2022 19:18:03 GMT - Content-Length: - - '0' - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 80c43068-a8f1-4132-9cb8-43375017ed5d - Etag: - - W/"a-bAsFyilMr4Ra1hIU5PyoyFRunpI" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=XQ3mj7g%2Bn7W16dxobD%2FNQjo7xvTl1Huh7T%2BF0Jgnk6p%2FFLlz%2BB3monRxzeVDU8oG2%2Ff81D40WjwV2e1YNqLivRnaSIB9u19O2gLXlatMVa9tjYA6XsvSIipvvmbUDPvYjQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f2a78410ca0609b-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: UTF-8 - string: '' - http_version: - recorded_at: Sun, 27 Mar 2022 19:18:03 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml b/test/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml deleted file mode 100644 index 9268869c..00000000 --- a/test/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/auth/factors/enroll - body: - encoding: UTF-8 - string: '{"type":"generic_otp","totp_issuer":null,"totp_user":null,"phone_number":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Sun, 27 Mar 2022 05:12:43 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '239' - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - bd24abb9-3aa1-4106-8d6a-df425ff1d209 - Etag: - - W/"ef-wqcMjWChK4ut5ZQqtU8qO89bfTU" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=iQMKZkYKfEuWDKP6gbTQAS9tfzZ9%2F%2Bre2CD6Fy1rRsuFC8Jz0dioXUQ8G95%2Bmrhlz4R6Tji1nCsXfNLiDCwFFmowX%2B%2BOf1HfeVgk10CkJcOUbBcTZ5%2BxoR6RnWaYwQrCBA%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f25a1f8b80430d4-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: UTF-8 - string: '{"object":"authentication_factor","id":"auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M","created_at":"2022-03-27T05:12:43.689Z","updated_at":"2022-03-27T05:12:43.689Z","type":"generic_otp"}' - http_version: - recorded_at: Sun, 27 Mar 2022 05:12:43 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml b/test/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml deleted file mode 100644 index f76594a1..00000000 --- a/test/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/auth/factors/enroll - body: - encoding: UTF-8 - string: '{"type":"sms","totp_issuer":null,"totp_user":null,"phone_number":"16073517112"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 28 Mar 2022 15:21:01 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '269' - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - e71fdbab-074a-4bf3-a31d-734e6210fdb9 - Etag: - - W/"10d-s7YFa2CZnDwEUgFqpAYbiwzv0+U" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=J%2BBvROB9mj71IVd8IMQvLNpgfbJcnEsWO7yH6hwf%2Fn6S8kZeDiyTReKQlGZwK76iF%2FZeSTNAINWXatf7zB4lxEDy%2FWOesjX2kRVNDLc7rSWAC%2F0Z4wyfxW%2FZnWS6o3k9ig%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f315a63e8b76083-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: UTF-8 - string: '{"object":"authentication_factor","id":"auth_factor_01FZ8HVEV5XV0YQ0ENHWM14CCB","created_at":"2022-03-28T15:21:00.975Z","updated_at":"2022-03-28T15:21:00.975Z","type":"sms","sms":{"phone_number":"+55555555555"}}' - http_version: - recorded_at: Mon, 28 Mar 2022 15:21:01 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml b/test/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml deleted file mode 100644 index 4be279b7..00000000 --- a/test/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/auth/factors/enroll - body: - encoding: UTF-8 - string: '{"type":"totp","totp_issuer":"WorkOS","totp_user":"some_user","phone_number":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Sun, 27 Mar 2022 04:40:00 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - b5f94f4b-f7d0-4251-88cf-5843e9dc0689 - Etag: - - W/"1852-PXRL614j7Vn/X3IdFKgKqOVSMe8" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=LJ%2F1lJPNJg66mkvbR04zhJEIQlBW1LVeRaV4OtIwaCgRXJghmP6z%2BaoiXMEdD03wqMIZZFN13KrjaKv7Q%2FmIiahSd3o2bzXl6zHzlu%2FXDdx%2FyWo%2FMNFyeVPKsLpwJYmICw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f257208da875fe0-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"authentication_factor","id":"auth_factor_01FZ4TS0MWPZR7GATS7KCXANQZ","created_at":"2022-03-27T04:40:00.410Z","updated_at":"2022-03-27T04:40:00.410Z","type":"totp","totp":{"qr_code":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlAAAAJQCAYAAABB4lpFAAAAAklEQVR4AewaftIAABDASURBVO3B0Y0s2w0EsJJw80+57BT0zkdjsCQnScPPaptfNjP5Utu8mJn8ZW3zYmbypbb50szkl7XNl2YmL9rmSzMTftcGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDg5F8etQ3/3cyE/65tvtQ2L2YmL9rmxczkS23zYmbyYmbyl7XNi5nJl9rmL2sb/ruZyYsNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkAwDAyb98bGbyy9rml81MvtQ2L2Ym/Hdt88va5sXM5Je1zYuZyYu2eTEzeTEzedE2f9nM5Je1zZc2AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJ/8CD9rmS23zpZnJl2YmL9rmxczkRdt8qW2+NDN5MTP50szkS23zYmbyom34uzYAAJxsAAA42QAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkAwDAyQYAgJMNAAAn/wIfmpm8aJsvtc2LmcmXZiYv2ubFzOSXtc2LtnkxM3nRNr9sZgJf2QAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJz8y8faht81M/nSzORF2/yytvnSzORF23xpZvJiZvKibV60zS+bmfCdtuG/2wAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJz8y6OZCX9X27yYmbxomxczkxdt88tmJi/a5sXM5EXbfKltXsxMXrTNi5nJi7b5Utu8mJn8spkJ39kAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACc/Gsb+ErbvJiZvGibFzOTX9Y2L2YmL9rmxczkRdv8spnJi7Z5MTPhv2sbftcGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZJI0D9rmxcyE/65t+O9mJl9qm182M/lS27yYmbxomy/NTF60zYuZyYu2+ctmJvx3bfOlDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkkaR60Dd+ZmfxlbfNiZvKibb40M/lS27yYmXypbV7MTOCvapsXM5Mvtc2LDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMn0//JgZvKibf6ymQl/V9v8spnJl9rmxcyE39U2X5qZvGibL81MvtQ2L2YmX9oAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcTP8vH5qZvGibL81MXrTNl2YmL9rmxcyE/65tXsxMXrTNXzYz+VLb/LKZyZfa5sXM5EXbfGlm8qJtftnM5MUGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDg5N/M5EXbvGibL81MXrTNi5nJl9rmxczkl7XNi5nJL2ubFzOTF23zYmbCfzcz+WVt86W2eTEzedE2f9nM5EsbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAk0nS/GFt82Jm8qJt/rKZyYu2eTEzedE2X5qZ/LK2eTEz+VLbvJiZfKltvjQzedE2fGdm8qJtXsxMXrTNiw0AACcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJv7Z5MTN50TZfmpl8aWbyom2+NDP5y2YmX2qbFzOTF23zYmbyom1ezEy+1Da/bGbypZnJi7b5y2Ymf9nM5MUGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDg5F8etc0va5sXM5MXbfNiZvKibfi72ubFzORF27yYmfxlM5Nf1jYvZiZfmpm8aJtf1ja/rG1ebAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE4mSfOHtc2XZiYv2ubFzORF2/xlM5MXbfNiZvKltnkxM/llbcN3Zia/rG1ezExetM2LmclftgEA4GQDAMDJBgCAkw0AACcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnGwAADj51zYvZia/bGbyom1etM2X2ubFzOQva5tf1jZ/Wdt8aWbyy9rml7XNXzYz+VLbvJiZvGibFxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTf/lY2/xlM5Mvtc0va5sXM5MvzUy+NDP5y2YmL9rmS23zpZnJi7Z50TZfmpm8aJsXbfNiZvKXzUxebAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE7+5VHbfGlm8qJtXsxMXrTNl2YmL9rmxczkxczkRdu8mJn8srb50szkl81MvjQz+VLb/LKZyS+bmfDftc2LDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMm/mQn/Xdu8mJl8qW1ezExetM2Lmckva5sXM5MvzUxetM2XZiYv2ubFzORF23xpZsJ/NzP5y2Ymv2wDAMDJBgCAkw0AACcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnGwAADjZAABwMv2/PJiZ8N+1zV82M3nRNi9mJi/a5sXM5Ett86WZyZfa5sXM5Je1zYuZyYu2+dLM5Ett88tmJi/a5kszkxcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAk0nSPGibFzOTF23zYmbyl7XNl2YmL9rmSzOTF23zYmbypbZ5MTN50Tb8dzOTF23zpZnJi7b50szkRdv8ZTOTF23zYgMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHDyr21ezEz+srb5y2YmL9rmL5uZfKltftnM5EXb/LKZyZdmJr9sZvKibV60zZdmJi/a5i/bAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnPzLo7Z5MTN5MTN50TZfmpl8qW1etM2Lmclf1jYvZiZ/Wdu8mJm8aJtf1ja/bGbyom1ezExetM2LmcmLtvnSzORF23xpAwDAyQYAgJMNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJxsAAA42QAAcDJJmg+1zYuZyS9rmy/NTF60zZdmJi/a5kszk1/WNi9mJl9qmxczky+1zYuZyS9rmxczkxdt82Jm8qJtXsxMXrTNi5nJi7b50gYAgJMNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkkjQP2ubFzORF27yYmbxomxczkxdt85fNTL7UNi9mJi/a5i+bmfxlbfOlmcmLtvllM5Mvtc2XZiZ/2QYAgJMNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkkjQP2uZLM5MXbfNiZvKibX7ZzOQva5tfNjN50TZfmpm8aJsXM5Nf1jZfmpl8qW2+NDPhO23zYgMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHAySZoHbfNiZvKibV7MTF60zYuZyZfa5kszk7+sbX7ZzORF27yYmXypbV7MTF60zS+bmbxomxczE/ivNgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACf/2uZLbfOltvlS23xpZvKibb7UNi9mJi/a5sXM5EXb8HfNTH5Z2/yytvllM5MXbfOlmcmLtnmxAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAOPk3M+F3tc2LtvllM5MXbfNiZvKibV7MTP6ytnkxM3kxM3nRNr9sZsJ/NzN50TZ/Wdu8mJm82AAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJz8y6O24b+bmXxpZvLL2uZLbfNiZvKXzUxetM0vm5n8srbhv2sbftcGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDg5F8+NjP5ZW3zl7XNi5nJl2YmX2qbL81MXrTNL2ubFzOTF23zpZnJl2Ymv2xmwn83M3nRNi/a5sUGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDgZAMAwMkGAICTDQAAJxsAAE42AACcbAAAONkAAHCyAQDg5F/gwczkRdv8ZTOTL7XNl2YmX2qbL81MXrTNl2YmX2qbFzOTX9Y2L2YmX2qbX7YBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJxsAAA42QAAcLIBAOBkAwDAyQYAgJMNAAAnGwAATjYAAJxsAAA4+Rd40DYvZiZ/Wdu8mJm8mJm8aJsXbfNiZvKltuHvapsvzUxetM2LmcmLtvnSzOTFBgCAkw0AACcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnGwAADjZAABwsgEA4ORfPtY2fKdtXsxMvtQ2X5qZ/LK2+dLM5EszE/67tnkxM3kxM/llM5MXbfOltnkxM3nRNl/aAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnPzLo5kJv2tm8pfNTL40M/nSzOQva5svzUxetM1f1jYvZia/bGbyom1ezExetM2LmcmXNgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACcbAABONgAAnGwAADjZAABwsgEA4GQDAMDJBgCAkw0AACf/A/2hv8Y3aFg+AAAAAElFTkSuQmCC","secret":"LNASAT3PGQDTE5J4M4YDCTTOPZGBCAIW","uri":"otpauth://totp/WorkOS:some_user?secret=LNASAT3PGQDTE5J4M4YDCTTOPZGBCAIW&issuer=WorkOS"}}' - http_version: - recorded_at: Sun, 27 Mar 2022 04:40:00 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml b/test/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml deleted file mode 100644 index f7e1a16f..00000000 --- a/test/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/auth/factors/auth_factor_invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Sun, 27 Mar 2022 19:13:46 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 420e600d-eefe-4d5a-9553-ecd64696df9a - Etag: - - W/"81-gfVNI7PEuzipMtQc8g0k4FkGMX4" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=rs%2Bgf1yWJ3sruiTdP60bWgdBvyit6Pwe097bf8zWCXoc9vNlILeU5%2B3GUsiiT7cIgs8Uz%2FXhFrYCGD%2FegiqaotpP2Te7Blj2JYFSJydjQndRo2t6MHFS5kQ4NHn4ES%2B8%2BQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f2a71f749c5601c-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: ASCII-8BIT - string: '{"message":"Authentication Factor not found: ''auth_factor_invalid''.","code":"entity_not_found","entity_id":"auth_factor_invalid"}' - http_version: - recorded_at: Sun, 27 Mar 2022 19:13:46 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/get_factor_valid.yml b/test/fixtures/vcr_cassettes/mfa/get_factor_valid.yml deleted file mode 100644 index 37ff9691..00000000 --- a/test/fixtures/vcr_cassettes/mfa/get_factor_valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/auth/factors/auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Sun, 27 Mar 2022 19:11:09 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 5766763a-5aaf-4892-8ae9-2f929398230e - Etag: - - W/"ef-wqcMjWChK4ut5ZQqtU8qO89bfTU" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=7FLax7DlJtEaLUKB4v2ggq5QhJ9I9geEoDfZJd7em4t8cEqamHvfjLoLu7SkHbLzHSs%2FiaBNO7Ux9D4ESkvvw50exovd2wNpO%2B96U79ZYnWqtijqucWaL4jBB2aJ2jhdUQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f2a6e231fc039fc-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"authentication_factor","id":"auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M","created_at":"2022-03-27T05:12:43.689Z","updated_at":"2022-03-27T05:12:43.689Z","type":"generic_otp"}' - http_version: - recorded_at: Sun, 27 Mar 2022 19:11:09 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml b/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml deleted file mode 100644 index ceffcad8..00000000 --- a/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/auth/challenges/auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J/verify - body: - encoding: UTF-8 - string: '{"code":"897792"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 422 - message: Unprocessable Entity - headers: - Date: - - Sun, 27 Mar 2022 05:54:30 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '167' - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 3bf7c473-ef39-4a3f-85fa-609ab4fcfdb4 - Etag: - - W/"a7-3Az5u04ipYu1XY+wqhSwUOFImFI" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=gQNkvWQQyL0h1kES333sXgQvo4JV9Bzm%2Bre%2BzJSsD8l%2F4sVjZ1ehj0dDfP40lHYCwx%2FLZ93avI155XM9JkY%2BxYyCAlRXobk2DfsyKmkTkhnWR4AxV%2BTWECeARqtTewSryA%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f25df294a253a32-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: UTF-8 - string: '{"code":"authentication_challenge_expired","message":"The - authentication challenge ''auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J'' has - expired."}' - http_version: - recorded_at: Sun, 27 Mar 2022 05:54:30 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml b/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml deleted file mode 100644 index 25118022..00000000 --- a/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/auth/challenges/auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J/verify - body: - encoding: UTF-8 - string: '{"code":"897792"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 422 - message: Unprocessable Entity - headers: - Date: - - Sun, 27 Mar 2022 05:54:30 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '167' - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 3bf7c473-ef39-4a3f-85fa-609ab4fcfdb4 - Etag: - - W/"a7-3Az5u04ipYu1XY+wqhSwUOFImFI" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=gQNkvWQQyL0h1kES333sXgQvo4JV9Bzm%2Bre%2BzJSsD8l%2F4sVjZ1ehj0dDfP40lHYCwx%2FLZ93avI155XM9JkY%2BxYyCAlRXobk2DfsyKmkTkhnWR4AxV%2BTWECeARqtTewSryA%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f25df294a253a32-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: UTF-8 - string: '{"code":"authentication_challenge_previously_verified","message":"The - authentication challenge ''auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J'' has - already been verified."}' - http_version: - recorded_at: Sun, 27 Mar 2022 05:54:30 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml b/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml deleted file mode 100644 index abf1dc8a..00000000 --- a/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/auth/challenges/auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J/verify - body: - encoding: UTF-8 - string: '{"code":"897792"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Sun, 27 Mar 2022 05:53:03 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '317' - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 78db6375-0b0a-4492-a913-5e0802a721b7 - Etag: - - W/"13d-MlhrtKBkD4LjqRYZFv0nos58XA8" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=bN92hPz7GN42QtyRg4YR%2BKMTuzd3R241D6A2ktALsB%2F%2FaFwI%2BeJHUMZ9G0oXrDbp%2Binu76aBI%2FC0ICO2Tr0zc8fi9tF1q4XnqyLfgosTjaDE%2BNDcPlRmaduFoDmkc28D4w%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f25dd0d0882dee9-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: UTF-8 - string: '{"challenge":{"object":"authentication_challenge","id":"auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J","created_at":"2022-03-27T05:51:24.531Z","updated_at":"2022-03-27T05:51:24.531Z","expires_at":"2022-03-27T06:01:24.532Z","code":"897792","authentication_factor_id":"auth_factor_01FZ4YVH2XFQBJXJ4NQVJSSY8Q"},"valid":true}' - http_version: - recorded_at: Sun, 27 Mar 2022 05:53:03 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml b/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml deleted file mode 100644 index c6d7dd3f..00000000 --- a/test/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/auth/challenges/auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J/verify - body: - encoding: UTF-8 - string: '{"code":"897792"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.1.1 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Sun, 27 Mar 2022 05:53:03 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '317' - Connection: - - keep-alive - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - X-Request-Id: - - 78db6375-0b0a-4492-a913-5e0802a721b7 - Etag: - - W/"13d-MlhrtKBkD4LjqRYZFv0nos58XA8" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=bN92hPz7GN42QtyRg4YR%2BKMTuzd3R241D6A2ktALsB%2F%2FaFwI%2BeJHUMZ9G0oXrDbp%2Binu76aBI%2FC0ICO2Tr0zc8fi9tF1q4XnqyLfgosTjaDE%2BNDcPlRmaduFoDmkc28D4w%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 6f25dd0d0882dee9-SEA - Alt-Svc: - - h3=":443"; ma=86400, h3-29=":443"; ma=86400 - body: - encoding: UTF-8 - string: '{"challenge":{"object":"authentication_challenge","id":"auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J","created_at":"2022-03-27T05:51:24.531Z","updated_at":"2022-03-27T05:51:24.531Z","expires_at":"2022-03-27T06:01:24.532Z","code":"897792","authentication_factor_id":"auth_factor_01FZ4YVH2XFQBJXJ4NQVJSSY8Q"},"valid":false}' - http_version: - recorded_at: Sun, 27 Mar 2022 05:53:03 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/create.yml b/test/fixtures/vcr_cassettes/organization/create.yml deleted file mode 100644 index c95e6284..00000000 --- a/test/fixtures/vcr_cassettes/organization/create.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/organizations - body: - encoding: UTF-8 - string: '{"domains":["example.io"],"name":"Test Organization"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 09 Aug 2021 21:55:02 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '282' - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 6483f5a5-7111-4a7c-8d37-bbd8b11d9cf6 - Etag: - - W/"11a-W3HwT5v+4QMV1RW0fsNqZgToUYw" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=ykoyQ2sd754E5iwEQ0DlRIKT%2F16ZGCpmRzGV8bqw4IjGX7xZqUcjJ13W8dCryN3JXAKfNnlhUehDTJRODkBDqdKsPQQEbEtocrtdlj%2F8hh6tHOSXVxVFgez6oCnbyY7qF%2BK3KkHhiXLXBq4eVQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c439f51d8f2ece-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: UTF-8 - string: '{"object":"organization","id":"org_01FCPEJXEZR4DSBA625YMGQT9N","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2021-08-09T21:55:02.755Z","updated_at":"2021-08-09T21:55:02.755Z","domains":[{"object":"organization_domain","id":"org_domain_01FCPEJXF4CTFEDFEGDTRN1MZG","domain":"example.io"}]}' - http_version: - recorded_at: Mon, 09 Aug 2021 21:55:02 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/create_invalid.yml b/test/fixtures/vcr_cassettes/organization/create_invalid.yml deleted file mode 100644 index 610b6fe1..00000000 --- a/test/fixtures/vcr_cassettes/organization/create_invalid.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/organizations - body: - encoding: UTF-8 - string: '{"domains":["example.com"],"name":"Test Organization 2"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.5.0 - Authorization: - - Bearer - response: - status: - code: 409 - message: Conflict - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 929940d6-33dd-404c-9856-eca6cc606d28 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '73' - Etag: - - W/"49-8i1S2EtfSciiA8rvGWbYFNlSlhw" - Date: - - Wed, 09 Sep 2020 21:26:03 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"An Organization with the domain example.com already exists."}' - http_version: - recorded_at: Wed, 09 Sep 2020 21:26:03 GMT -recorded_with: VCR 5.0.0 \ No newline at end of file diff --git a/test/fixtures/vcr_cassettes/organization/create_with_domain_data.yml b/test/fixtures/vcr_cassettes/organization/create_with_domain_data.yml deleted file mode 100644 index 6d38c424..00000000 --- a/test/fixtures/vcr_cassettes/organization/create_with_domain_data.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/organizations - body: - encoding: UTF-8 - string: '{"domain_data":[{"domain":"example.io","state":"verified"}],"domains":null,"name":"Test - Organization","allow_profiles_outside_organization":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin22; v4.3.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Tue, 30 Apr 2024 01:01:42 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '378' - Connection: - - keep-alive - Cf-Ray: - - 87c39a22cb2a7c04-LAX - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"17a-e7OoplZHJrHgxom5pCSqqpDxJjs" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 314446f5-ae74-4a34-a75b-4a048e295e96 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=JRrIwwneHyRFvW2HY7HQeYKUAcqrygAM1Wd8iPoHBk8-1714438902-1.0.1.1-NySWD9QTWwy29v8Z1.CIWx943aVg9v1Y0Pr2e63CRHVJ8StvW7QRbW0gMe04VkNyj17genn8g3s1kVcqd4oWwQ; - path=/; expires=Tue, 30-Apr-24 01:31:42 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=b1ea2c30a368e0f51f64c01389ed23411ab148f1-1714438902; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"organization","id":"org_01HWP8B4G64K6MAHZKTMVZ5RGP","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2024-04-30T01:01:42.277Z","updated_at":"2024-04-30T01:01:42.277Z","domains":[{"verification_strategy":"manual","state":"verified","object":"organization_domain","id":"org_domain_01HWP8B4GWBH9APRM8KPBFCNHW","domain":"example.io"}]}' - http_version: - recorded_at: Tue, 30 Apr 2024 01:01:42 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/create_with_domains.yml b/test/fixtures/vcr_cassettes/organization/create_with_domains.yml deleted file mode 100644 index a08052e9..00000000 --- a/test/fixtures/vcr_cassettes/organization/create_with_domains.yml +++ /dev/null @@ -1,81 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/organizations - body: - encoding: UTF-8 - string: '{"domain_data":null,"domains":["example.io"],"name":"Test Organization","allow_profiles_outside_organization":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin22; v4.3.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Tue, 30 Apr 2024 01:06:58 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '352' - Connection: - - keep-alive - Cf-Ray: - - 87c3a1dc79f82f1c-LAX - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"160-DoBiYByX9XrgXYYHDZKVF2kbtrY" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - c11d19bf-bd68-4d3e-ba59-9e2ec6f5e71f - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=1Qt0kSHHEyud3lsP.gz06VPTCcv5J35Xq1b2FudzKFk-1714439218-1.0.1.1-Pb5WXPCKuJfKXO3ri73EA_RuzaBMD.6brPkMihsQQzaC6gPRJdGiB_g3OT3eoN6km3RwF72MqD_Jlf8xb.Nb2A; - path=/; expires=Tue, 30-Apr-24 01:36:58 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=d4e3496284dd882965f61d10e392da91c73aa5c2-1714439218; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"organization","id":"org_01HWP8MSH28Z7SW2H6KK65S6VF","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2024-04-30T01:06:58.720Z","updated_at":"2024-04-30T01:06:58.720Z","domains":[{"state":"legacy_verified","object":"organization_domain","id":"org_domain_01HWP8MSHEX4KR7TJJFAFN9MK2","domain":"example.io"}]}' - http_version: - recorded_at: Tue, 30 Apr 2024 01:06:58 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml b/test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml deleted file mode 100644 index 4e866144..00000000 --- a/test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml +++ /dev/null @@ -1,155 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/organizations - body: - encoding: UTF-8 - string: '{"domains":["example.me"],"name":"Test Organization","allow_profiles_outside_organization":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.5.1 - Authorization: - - Bearer - Idempotency-Key: - - bar - response: - status: - code: 201 - message: Created - headers: - Date: - - Fri, 19 Aug 2022 13:40:02 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '326' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"146-afNLOMwUQIrtlSBL9lu7IDJkGmE" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (a302eeabfffb) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - e9f565ee-a58a-b2a1-5e71-93f14afdd747 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Server: - - cloudflare - Cf-Ray: - - 73d34c789f228e9c-DEN - body: - encoding: UTF-8 - string: '{"object":"organization","id":"org_01GAV5A1WPHEZSV53EAPCTBR9B","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2022-08-19T13:40:02.070Z","updated_at":"2022-08-19T13:40:02.070Z","domains":[{"object":"organization_domain","id":"org_domain_01GAV5A1ZFCW6RQDRV10ZE483J","domain":"example.me"}]}' - http_version: - recorded_at: Fri, 19 Aug 2022 13:40:02 GMT -- request: - method: post - uri: https://api.workos.com/organizations - body: - encoding: UTF-8 - string: '{"domains":["example.me"],"name":"Organization Test","allow_profiles_outside_organization":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.5.1 - Authorization: - - Bearer - Idempotency-Key: - - bar - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Fri, 19 Aug 2022 13:40:02 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '128' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"80-jILfJK6SRXhN8oqz8Na6yutVwHM" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (a302eeabfffb) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - afbf7322-2e3e-22ae-62a6-08ecdd247a30 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Server: - - cloudflare - Cf-Ray: - - 73d34c7a6b778e9c-DEN - body: - encoding: UTF-8 - string: '{"message":"Another idempotency key (bar) with different request parameters - was found. Please use a different idempotency key."}' - http_version: - recorded_at: Fri, 19 Aug 2022 13:40:02 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml b/test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml deleted file mode 100644 index c9537095..00000000 --- a/test/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml +++ /dev/null @@ -1,154 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/organizations - body: - encoding: UTF-8 - string: '{"domains":["example.com"],"name":"Test Organization","allow_profiles_outside_organization":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.5.1 - Authorization: - - Bearer - Idempotency-Key: - - foo - response: - status: - code: 201 - message: Created - headers: - Date: - - Fri, 19 Aug 2022 13:40:01 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '327' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"147-YF7FuE2/wP7OMOkruNN4e9OkzCY" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (a302eeabfffb) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 6162afb9-dba5-9e18-7d3a-f373facb51e1 - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Server: - - cloudflare - Cf-Ray: - - 73d34c747c868eaa-DEN - body: - encoding: UTF-8 - string: '{"object":"organization","id":"org_01GAV5A1B248PX6WRB13XARPTZ","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2022-08-19T13:40:01.505Z","updated_at":"2022-08-19T13:40:01.505Z","domains":[{"object":"organization_domain","id":"org_domain_01GAV5A1BBGR8WCV5971BFZAQX","domain":"example.com"}]}' - http_version: - recorded_at: Fri, 19 Aug 2022 13:40:01 GMT -- request: - method: post - uri: https://api.workos.com/organizations - body: - encoding: UTF-8 - string: '{"domains":["example.com"],"name":"Test Organization","allow_profiles_outside_organization":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.5.1 - Authorization: - - Bearer - Idempotency-Key: - - foo - response: - status: - code: 201 - message: Created - headers: - Date: - - Fri, 19 Aug 2022 13:40:01 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '327' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"147-6F+ebkGefNxiuuyTjUt6cZjj5f4" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (a302eeabfffb) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 04aa9022-1a6a-8041-ec60-e218f5fd8ffa - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Server: - - cloudflare - Cf-Ray: - - 73d34c765de88ea8-DEN - body: - encoding: UTF-8 - string: '{"id":"org_01GAV5A1B248PX6WRB13XARPTZ","name":"Test Organization","object":"organization","domains":[{"id":"org_domain_01GAV5A1BBGR8WCV5971BFZAQX","domain":"example.com","object":"organization_domain"}],"created_at":"2022-08-19T13:40:01.505Z","updated_at":"2022-08-19T13:40:01.505Z","allow_profiles_outside_organization":false}' - http_version: - recorded_at: Fri, 19 Aug 2022 13:40:01 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/create_with_external_id.yml b/test/fixtures/vcr_cassettes/organization/create_with_external_id.yml deleted file mode 100644 index 92470cc5..00000000 --- a/test/fixtures/vcr_cassettes/organization/create_with_external_id.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/organizations - body: - encoding: UTF-8 - string: '{"name":"Test Organization with External ID","external_id":"ext_org_123"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin24; v5.20.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Tue, 22 Jul 2025 18:55:20 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '286' - Connection: - - keep-alive - Cf-Ray: - - 963526d76e29aafd-YYZ - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"11e-Op9TWXVRjSmUm44yQl7F4OmXvVQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 56c9630e-4889-4c81-989b-5a0399cdfcc2 - X-Xss-Protection: - - '0' - Report-To: - - '{"endpoints":[{"url":"https:\/\/csp-reporting.cloudflare.com\/cdn-cgi\/script_monitor\/report?m=RvRh6EQA2egPx6JdFhsw.m.1RATK00LOdPev9hq3f8A-1753210520-1.0.1.1-Uchst_eeyl0_BAQRRODtUIhYDUBNZKYADoELB62ZrhleV2Q.J_Wdk59lUFdfwSqAAX2vWrW_nejregFofyr3sox0aNmZolb8G_7Nzpy2RD9uyKH4l3OgsDbo.LRttnqfDPXocdCCB9G61E4QJ8Q1ug"}],"group":"cf-csp-endpoint","max_age":86400}' - Content-Security-Policy-Report-Only: - - script-src 'none'; connect-src 'none'; report-uri https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report?m=RvRh6EQA2egPx6JdFhsw.m.1RATK00LOdPev9hq3f8A-1753210520-1.0.1.1-Uchst_eeyl0_BAQRRODtUIhYDUBNZKYADoELB62ZrhleV2Q.J_Wdk59lUFdfwSqAAX2vWrW_nejregFofyr3sox0aNmZolb8G_7Nzpy2RD9uyKH4l3OgsDbo.LRttnqfDPXocdCCB9G61E4QJ8Q1ug; - report-to cf-csp-endpoint - Set-Cookie: - - _cfuvid=PQ8Lx7_xKyiAL1Mx.Ib3Gjf0xXL4n9.aJfbpov473xY-1753210520423-0.0.1.1-604800000; - path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"organization","id":"org_01K0SQV0S6EPWK2ZDEFD1CP1JC","name":"Test - Organization with External ID","allow_profiles_outside_organization":false,"created_at":"2025-07-22T18:55:20.355Z","updated_at":"2025-07-22T18:55:20.355Z","domains":[],"metadata":{},"external_id":"ext_org_123"}' - http_version: - recorded_at: Tue, 22 Jul 2025 18:55:20 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml b/test/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml deleted file mode 100644 index 82599a97..00000000 --- a/test/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml +++ /dev/null @@ -1,79 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/organizations - body: - encoding: UTF-8 - string: '{"domains":["example.io"],"name":"Test Organization","allow_profiles_outside_organization":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v2.5.1 - Authorization: - - Bearer - Idempotency-Key: - - key - response: - status: - code: 201 - message: Created - headers: - Date: - - Fri, 19 Aug 2022 13:40:01 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '326' - Connection: - - keep-alive - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Etag: - - W/"146-1Y3p/YYf611sd+3wEGWn2SaT/YM" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (a302eeabfffb) - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 47225769-fc34-e3c4-f4bd-b98b85e438bb - X-Xss-Protection: - - '0' - Cf-Cache-Status: - - DYNAMIC - Server: - - cloudflare - Cf-Ray: - - 73d34c722ae5c7b9-DEN - body: - encoding: UTF-8 - string: '{"object":"organization","id":"org_01GAV5A104T7PM2DHC3VQH8MP6","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2022-08-19T13:40:01.155Z","updated_at":"2022-08-19T13:40:01.155Z","domains":[{"object":"organization_domain","id":"org_domain_01GAV5A10EA6R0YNJR5H5A9N6C","domain":"example.io"}]}' - http_version: - recorded_at: Fri, 19 Aug 2022 13:40:01 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/create_without_domains.yml b/test/fixtures/vcr_cassettes/organization/create_without_domains.yml deleted file mode 100644 index 424ba948..00000000 --- a/test/fixtures/vcr_cassettes/organization/create_without_domains.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/organizations - body: - encoding: UTF-8 - string: '{"domain_data":null,"domains":null,"name":"Test Organization","allow_profiles_outside_organization":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin22; v4.3.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Tue, 30 Apr 2024 00:58:00 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '227' - Connection: - - keep-alive - Cf-Ray: - - 87c394b48ef82f6f-LAX - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"e3-wm7ZLsZabhBpnQsj6nbIuYbCvJ4" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 42653293-fec5-40f5-8e3e-f74a3a63235f - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=sr2v7XzZkDug4GaS8ZFVyNHQiFplJ1GRbehICEMbZEo-1714438680-1.0.1.1-jU4xGUlzCWlJcDjQ5PKN5v4BSetomhms7WYP1StgzZ.LO0oKDIOCW9R6CiS6BPfPB511ANRh9ricOnRoSM5x2A; - path=/; expires=Tue, 30-Apr-24 01:28:00 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=2ff6acd824f790442a69e03d7abbce5aa0842988-1714438680; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Report-To: - - '{"endpoints":[{"url":"https:\/\/csp-reporting.cloudflare.com\/cdn-cgi\/script_monitor\/report?m=MN1QYUE50Syo3whI3PgTAR0DEl89teeSttp_39ZoiJU-1714438680-1.0.1.1-7pyU.qZhlSTg4R9BBGC.xRSgae6EmLeyPE9ody07LpgLwMncwzQrnPFDhOwpi7MUiFfKAyRbUY80xGEvP_5Fzrw7a8AVy_K637dqtX8nmIuKEC.2VZJYNNRloqn4xCeFu8o6Q2luN6WANE.FKxrw0Q"}],"group":"cf-csp-endpoint","max_age":86400}' - Content-Security-Policy-Report-Only: - - script-src 'none'; connect-src 'none'; report-uri https://csp-reporting.cloudflare.com/cdn-cgi/script_monitor/report?m=MN1QYUE50Syo3whI3PgTAR0DEl89teeSttp_39ZoiJU-1714438680-1.0.1.1-7pyU.qZhlSTg4R9BBGC.xRSgae6EmLeyPE9ody07LpgLwMncwzQrnPFDhOwpi7MUiFfKAyRbUY80xGEvP_5Fzrw7a8AVy_K637dqtX8nmIuKEC.2VZJYNNRloqn4xCeFu8o6Q2luN6WANE.FKxrw0Q; - report-to cf-csp-endpoint - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"organization","id":"org_01HWP84BDGAVGEEWB22A0CVV7G","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2024-04-30T00:57:59.983Z","updated_at":"2024-04-30T00:57:59.983Z","domains":[]}' - http_version: - recorded_at: Tue, 30 Apr 2024 00:58:00 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/delete.yml b/test/fixtures/vcr_cassettes/organization/delete.yml deleted file mode 100644 index 05a05274..00000000 --- a/test/fixtures/vcr_cassettes/organization/delete.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.workos.com/organizations/org_01F4A8TD0B4N1Y9SJ8SH635HDB - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.1.0 - Authorization: - - Bearer - response: - status: - code: 202 - message: Accepted - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - - Content-Type: - - text/plain; charset=utf-8 - Content-Length: - - '8' - Etag: - - W/"8-YaBXLEiT7zQxEyDYTILfiL6oPhE" - Date: - - Mon, 24 May 2021 21:07:34 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: Accepted - http_version: - recorded_at: Mon, 24 May 2021 21:07:34 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/delete_invalid.yml b/test/fixtures/vcr_cassettes/organization/delete_invalid.yml deleted file mode 100644 index 26db383b..00000000 --- a/test/fixtures/vcr_cassettes/organization/delete_invalid.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.workos.com/organizations/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.1.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '23' - Etag: - - W/"17-SuRA/yvUWUo8rK6x7dKURLeBo+0" - Date: - - Mon, 24 May 2021 21:07:34 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"Not Found"}' - http_version: - recorded_at: Mon, 24 May 2021 21:07:34 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/get.yml b/test/fixtures/vcr_cassettes/organization/get.yml deleted file mode 100644 index aefafc64..00000000 --- a/test/fixtures/vcr_cassettes/organization/get.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/organizations/org_01F9293WD2PDEEV4Y625XPZVG7 - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 21:53:34 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - d94b1563-0d09-48cd-810e-d29847b44711 - Etag: - - W/"113-c2EcE6OaGdH7UcEB3NeDrhAgRVw" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=ZxchjMhoCSe%2Bpd%2B6InVLLWbhBhjiQRmhAg90mBPrrr0RtaQpZHdrbD%2BYSZUuOHhzOf2ik65mfrqNkaOoYX%2FpystsKQc1ZlsU%2FttVfaMeK9pUcLSW%2BMG2ZZhwqj%2Fl7REqbI36LFacoSb%2BcPXijw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c437cb99bd0f22-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"organization","id":"org_01F9293WD2PDEEV4Y625XPZVG7","name":"Foo - Corp","allow_profiles_outside_organization":false,"created_at":"2021-06-25T19:07:33.155Z","updated_at":"2021-06-25T19:07:33.155Z","domains":[{"object":"organization_domain","id":"org_domain_01F9293WD8KZAS4ESBK57SZ4D8","domain":"foo-corp.com"}]}' - http_version: - recorded_at: Mon, 09 Aug 2021 21:53:34 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/get_invalid.yml b/test/fixtures/vcr_cassettes/organization/get_invalid.yml deleted file mode 100644 index 7083c97f..00000000 --- a/test/fixtures/vcr_cassettes/organization/get_invalid.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/organizations/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v0.11.1 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '23' - Etag: - - W/"17-SuRA/yvUWUo8rK6x7dKURLeBo+0" - Date: - - Mon, 10 May 2021 17:21:43 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"Not Found"}' - http_version: - recorded_at: Mon, 10 May 2021 17:21:43 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/list.yml b/test/fixtures/vcr_cassettes/organization/list.yml deleted file mode 100644 index 95e432b2..00000000 --- a/test/fixtures/vcr_cassettes/organization/list.yml +++ /dev/null @@ -1,87 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/organizations?order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 21:55:03 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 51340d5e-8bf4-46b7-bd98-d8bd341c31fd - Etag: - - W/"66d-kHGfUV7VPT8Z9tinExkUpFHsUCg" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=8pFemWbyzUcoSyVJie5nWnOSzuP36h%2F6bRGTgFS15DxCcqa4S%2BGaKYUuU9EjHvoWAE3hHKc7ciNjiDrA3TXyazf6C5ZdTMfLIdtOB6dq1oUf4EPBq%2Bs%2B6t5nHMKqRexVozFykpBbx0rDKPBwxA%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c439f788cc2832-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"organization","id":"org_01FCPEJXEZR4DSBA625YMGQT9N","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2021-08-09T21:55:02.755Z","updated_at":"2021-08-09T21:55:02.755Z","domains":[{"object":"organization_domain","id":"org_domain_01FCPEJXF4CTFEDFEGDTRN1MZG","domain":"example.io"}]},{"object":"organization","id":"org_01F9293WD2PDEEV4Y625XPZVG7","name":"Foo - Corp","allow_profiles_outside_organization":false,"created_at":"2021-06-25T19:07:33.155Z","updated_at":"2021-06-25T19:07:33.155Z","domains":[{"object":"organization_domain","id":"org_domain_01F9293WD8KZAS4ESBK57SZ4D8","domain":"foo-corp.com"}]},{"object":"organization","id":"org_01F8873JSZWN1MJCDN537FEK1H","name":"Example - Organization","allow_profiles_outside_organization":false,"created_at":"2021-06-15T16:12:10.942Z","updated_at":"2021-06-15T16:12:10.942Z","domains":[]},{"object":"organization","id":"org_01F79Z8TGGTA8Q67Q50FDXAYN3","name":"gmail.com","allow_profiles_outside_organization":false,"created_at":"2021-06-03T22:18:01.100Z","updated_at":"2021-06-03T22:18:01.100Z","domains":[{"object":"organization_domain","id":"org_domain_01F79Z8TGS4VYFX0246RAWSZMP","domain":"gmail.com"}]},{"object":"organization","id":"org_01F6Q6TFP7RD2PF6J03ANNWDKV","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2021-05-27T15:24:25.670Z","updated_at":"2021-08-09T21:53:34.525Z","domains":[{"object":"organization_domain","id":"org_domain_01FCPEG7BAYMQ4CHMG41Y2VNHF","domain":"example.me"}]},{"object":"organization","id":"org_01F6Q6NGZS8R5ZTH3C1XR96JK7","name":"WorkOS","allow_profiles_outside_organization":false,"created_at":"2021-05-27T15:21:43.160Z","updated_at":"2021-05-27T15:21:43.160Z","domains":[{"object":"organization_domain","id":"org_domain_01F6Q6NGZZ54WSX1XCMCKSC4DA","domain":"workos.com"}]}],"listMetadata":{"before":"before-id","after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 21:55:03 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml b/test/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml deleted file mode 100644 index 3907287f..00000000 --- a/test/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/organizations/org_01HX7Q7R12H1JMAKN75SH2G529/feature-flags?order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin24; v5.24.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 04 Aug 2025 18:37:04 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 96a029f4191e2f57-LAX - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"1f7-g5rU0vT2OhGT9sAPsywR3YS8ePw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 9cd52998-5106-40cf-9080-82c07528c672 - X-Xss-Protection: - - '0' - Set-Cookie: - - _cfuvid=_9dbE_0fDVZ45WXvgEp8frEFOIlVDyARPbMk3AffOcs-1754332624329-0.0.1.1-604800000; - path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"feature_flag","id":"flag_01K1V04FV94RNDSN5GKSZVQMYN","slug":"new-sidebar-layout","name":"New - Sidebar Layout","description":"","created_at":"2025-08-04T16:55:15.557Z","updated_at":"2025-08-04T16:55:15.557Z"},{"object":"feature_flag","id":"flag_01K1V02KNS6WHYXKG0DWB87THK","slug":"dark-mode-toggle","name":"Dark - Mode Toggle","description":"","created_at":"2025-08-04T16:54:13.942Z","updated_at":"2025-08-04T16:54:13.942Z"}],"list_metadata":{"before":null,"after":null}}' - recorded_at: Mon, 04 Aug 2025 18:37:04 GMT -recorded_with: VCR 6.3.1 diff --git a/test/fixtures/vcr_cassettes/organization/list_organization_roles.yml b/test/fixtures/vcr_cassettes/organization/list_organization_roles.yml deleted file mode 100644 index be7064da..00000000 --- a/test/fixtures/vcr_cassettes/organization/list_organization_roles.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: get - uri: https://api.workos.com/organizations/org_01JEXP6Z3X7HE4CB6WQSH9ZAFE/roles - body: - encoding: US-ASCII - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.3.6; arm64-darwin23; v5.9.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 23 Dec 2024 20:23:07 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 8f6b114e5e60c96a-IAD - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"6b6-bZ2pS5djCBrbcATBSFlbZ90PHB8" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - a8db37d7-9244-4e2a-b183-b5e2a67d8104 - X-Xss-Protection: - - "0" - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: - '{"object":"list","data":[{"object":"role","id":"role_01HS1C7GRJE08PBR3M6Y0ZYGDZ","description":"Write - access to every resource available","name":"Admin","slug":"admin","permissions":["admin:all","read:users","write:users","manage:roles"],"type":"EnvironmentRole","created_at":"2024-03-15T15:38:29.521Z","updated_at":"2024-11-14T17:08:00.556Z"},{"object":"role","id":"role_01JA8GJZRDSZEB9289DQXJ3N9Z","description":"","name":"Billing - Manager","slug":"billing","permissions":["read:billing","write:billing"],"type":"EnvironmentRole","created_at":"2024-10-15T16:36:11.653Z","updated_at":"2024-12-19T21:27:01.286Z"},{"object":"role","id":"role_01HSBH4R6RX0V86S3R590NNZW2","description":"Developer - role","name":"Developer","slug":"developer","permissions":["read:code","write:code","deploy:apps"],"type":"EnvironmentRole","created_at":"2024-03-19T14:16:46.038Z","updated_at":"2024-03-19T14:16:46.038Z"},{"object":"role","id":"role_01HS4GDWJ8T6NQPTX2D0R5KBHN","description":"Edit - and view access to non-critical resources","name":"Editor","slug":"editor","permissions":["read:content","write:content","publish:content"],"type":"EnvironmentRole","created_at":"2024-03-16T20:49:35.815Z","updated_at":"2024-03-16T20:52:19.410Z"},{"object":"role","id":"role_01HRFZE22WS2MGX6EWAG2JX6NW","description":"The - default user role","name":"Member","slug":"member","permissions":["read:basic"],"type":"EnvironmentRole","created_at":"2024-03-08T21:27:47.034Z","updated_at":"2024-08-14T00:27:46.265Z"},{"object":"role","id":"role_01JEYJ2Z5MYG0TZYTDF02MW11N","description":"Manage - billing for organization.","name":"Billing manager","slug":"org-billing-manager","permissions":["read:org:billing","write:org:billing"],"type":"OrganizationRole","created_at":"2024-12-12T23:08:28.712Z","updated_at":"2024-12-12T23:08:28.712Z"},{"object":"role","id":"role_01JF0B7MQ9X414WQRAQMQYE1GS","description":"","name":"Platform - Manager","slug":"org-platform-manager","permissions":[],"type":"OrganizationRole","created_at":"2024-12-13T15:47:10.692Z","updated_at":"2024-12-13T15:47:10.692Z"}]}' - http_version: - recorded_at: Mon, 23 Dec 2024 20:23:07 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/update.yml b/test/fixtures/vcr_cassettes/organization/update.yml deleted file mode 100644 index a6bb9460..00000000 --- a/test/fixtures/vcr_cassettes/organization/update.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/organizations/org_01F6Q6TFP7RD2PF6J03ANNWDKV - body: - encoding: UTF-8 - string: '{"domains":["example.me"],"name":"Test Organization"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 21:53:34 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - b8c5da9a-d1f7-470c-abbd-a2de3f2edf77 - Etag: - - W/"11a-SLpC9UGp2O5SWQr5VJZSNCpOF/Q" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=jh1EtP1h1CwA2nWmx0cvFGD5NdEiga3dbTCmcQH%2BgrdDPGqko8R8mehU9ywQ%2BW1AKKTGWbmRNHiRXpVhaJTNrULEuLt9TpGVoDH0IrixJhVS4N0Czi7n2UfPL0m684giLJtD2t7EVEj1XeeLlQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c437cdde060bb8-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"organization","id":"org_01F6Q6TFP7RD2PF6J03ANNWDKV","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2021-05-27T15:24:25.670Z","updated_at":"2021-08-09T21:53:34.525Z","domains":[{"object":"organization_domain","id":"org_domain_01FCPEG7BAYMQ4CHMG41Y2VNHF","domain":"example.me"}]}' - http_version: - recorded_at: Mon, 09 Aug 2021 21:53:34 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/update_with_external_id.yml b/test/fixtures/vcr_cassettes/organization/update_with_external_id.yml deleted file mode 100644 index 8811e883..00000000 --- a/test/fixtures/vcr_cassettes/organization/update_with_external_id.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/organizations/org_01K0SQV0S6EPWK2ZDEFD1CP1JC - body: - encoding: UTF-8 - string: '{"name":"Test Organization","external_id":"ext_org_456"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin24; v5.20.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 22 Jul 2025 18:59:20 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 96352cb1598936bf-YYZ - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"10d-7PesLGj94PWb6A5HO530ZxGdEf4" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - fdca4330-1a27-4bd5-9e78-75e58eefb233 - X-Xss-Protection: - - '0' - Set-Cookie: - - _cfuvid=hbA98zPccWnkbrQxoYNYNSHeQq3brYDB.grPijC_WV4-1753210760158-0.0.1.1-604800000; - path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"organization","id":"org_01K0SQV0S6EPWK2ZDEFD1CP1JC","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2025-07-22T18:55:20.355Z","updated_at":"2025-07-22T18:59:20.064Z","domains":[],"metadata":{},"external_id":"ext_org_456"}' - http_version: - recorded_at: Tue, 22 Jul 2025 18:59:20 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml b/test/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml deleted file mode 100644 index f01e5b11..00000000 --- a/test/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/organizations/org_01K0SQV0S6EPWK2ZDEFD1CP1JC - body: - encoding: UTF-8 - string: '{"name":"Test Organization","external_id":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin24; v5.22.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 23 Jul 2025 14:19:40 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 963bd06b7d9fac70-YYZ - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"104-iVnG8ziU2vR/dhIQFse9HLEGA6c" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f38969a5-158e-4ed5-b165-a7789d1b0a07 - X-Xss-Protection: - - '0' - Set-Cookie: - - _cfuvid=7pLWC5qh1CKmolFiECCkKsRg3QAx7aM07F6bX4r6VMU-1753280380885-0.0.1.1-604800000; - path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"organization","id":"org_01K0SQV0S6EPWK2ZDEFD1CP1JC","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2025-07-22T18:55:20.355Z","updated_at":"2025-07-23T14:19:40.831Z","domains":[],"metadata":{},"external_id":null}' - http_version: - recorded_at: Wed, 23 Jul 2025 14:19:40 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml b/test/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml deleted file mode 100644 index 29d6deeb..00000000 --- a/test/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/organizations/org_01JJ5H14CAA2SQ5G9HNN6TBZ05 - body: - encoding: UTF-8 - string: '{"name":"Test Organization","stripe_customer_id":"cus_123"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin24; v5.11.1 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 22 Jan 2025 16:50:26 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 90610b03f84db9f1-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"1cc-uqKwJf4L85rLspCK9lJ1ceRlbSA" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 7b62039f-40f4-4c2c-9ef9-7b1f63615481 - X-Xss-Protection: - - '0' - Set-Cookie: - - _cfuvid=TPT.bwe9giSuDXv9bDFC8leHolKCFKy2kdsa0G89jGI-1737564626875-0.0.1.1-604800000; - path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"organization","id":"org_01JJ5H14CAA2SQ5G9HNN6TBZ05","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2025-01-21T22:51:46.441Z","updated_at":"2025-01-22T16:50:26.789Z","domains":[{"verification_strategy":"manual","state":"verified","object":"organization_domain","id":"org_domain_01JJ5H14CKRGAE9HVA1Y9YABSX","organization_id":"org_01JJ5H14CAA2SQ5G9HNN6TBZ05","domain":"example.me"}],"stripe_customer_id":"cus_123"}' - http_version: - recorded_at: Wed, 22 Jan 2025 16:50:26 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/organization/update_without_name.yml b/test/fixtures/vcr_cassettes/organization/update_without_name.yml deleted file mode 100644 index 8f8a49e5..00000000 --- a/test/fixtures/vcr_cassettes/organization/update_without_name.yml +++ /dev/null @@ -1,85 +0,0 @@ ---- -http_interactions: - - request: - method: put - uri: https://api.workos.com/organizations/org_01F6Q6TFP7RD2PF6J03ANNWDKV - body: - encoding: UTF-8 - string: '{"domains":["example.me"]}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 21:53:34 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - X-Dns-Prefetch-Control: - - "off" - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - "0" - X-Request-Id: - - b8c5da9a-d1f7-470c-abbd-a2de3f2edf77 - Etag: - - W/"11a-SLpC9UGp2O5SWQr5VJZSNCpOF/Q" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=jh1EtP1h1CwA2nWmx0cvFGD5NdEiga3dbTCmcQH%2BgrdDPGqko8R8mehU9ywQ%2BW1AKKTGWbmRNHiRXpVhaJTNrULEuLt9TpGVoDH0IrixJhVS4N0Czi7n2UfPL0m684giLJtD2t7EVEj1XeeLlQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c437cdde060bb8-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: - '{"object":"organization","id":"org_01F6Q6TFP7RD2PF6J03ANNWDKV","name":"Test - Organization","allow_profiles_outside_organization":false,"created_at":"2021-05-27T15:24:25.670Z","updated_at":"2021-08-09T21:53:34.525Z","domains":[{"object":"organization_domain","id":"org_domain_01FCPEG7BAYMQ4CHMG41Y2VNHF","domain":"example.me"}]}' - http_version: - recorded_at: Mon, 09 Aug 2021 21:53:34 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/passwordless/create_session.yml b/test/fixtures/vcr_cassettes/passwordless/create_session.yml deleted file mode 100644 index 7d974763..00000000 --- a/test/fixtures/vcr_cassettes/passwordless/create_session.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/passwordless/sessions - body: - encoding: UTF-8 - string: '{"email":"demo@workos-okta.com","type":"MagicLink"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.7.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 611c2a85-84e1-4bad-a2ec-43cf8371f134 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '238' - Etag: - - W/"ee-6KkIusxSXraxKqTLP+31C0PeHDU" - Date: - - Wed, 16 Sep 2020 15:39:08 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"object":"passwordless_session","id":"passwordless_session_01EJBS3JSXFE2DP6JC6ZVBZ095","email":"demo@workos-okta.com","expires_at":"2020-09-16T15:44:08.475Z","link":"https://api.workos.com/passwordless/ZBxkn2ZTUYqa82ky6QEYecemI/confirm"}' - http_version: - recorded_at: Wed, 16 Sep 2020 15:39:08 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml b/test/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml deleted file mode 100644 index be934f89..00000000 --- a/test/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/passwordless/sessions - body: - encoding: UTF-8 - string: "{}" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.7.0 - Authorization: - - Bearer sk_4q5ka3d9bx0XJiZhkKmUIOG87 - response: - status: - code: 422 - message: Unprocessable Entity - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - e3ca7215-2b2d-45cf-a04f-90279225f27e - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '150' - Etag: - - W/"96-O5ltHaJ3rEQ8+dqFwhN+Lhmgdb0" - Date: - - Wed, 16 Sep 2020 17:34:07 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"Validation failed","errors":[{"field":"email","code":"email - must be a string"},{"field":"type","code":"type must be a valid enum value"}]}' - http_version: - recorded_at: Wed, 16 Sep 2020 17:34:07 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/passwordless/send_session.yml b/test/fixtures/vcr_cassettes/passwordless/send_session.yml deleted file mode 100644 index a8ac69a1..00000000 --- a/test/fixtures/vcr_cassettes/passwordless/send_session.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/passwordless/sessions/passwordless_session_01EJC0F4KH42T11Y2DHPEB09BM/send - body: - encoding: UTF-8 - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.7.0 - Authorization: - - Bearer sk_4q5ka3d9bx0XJiZhkKmUIOG87 - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - d7d72520-9223-4145-b34e-df5e80a776d6 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '16' - Etag: - - W/"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA" - Date: - - Wed, 16 Sep 2020 17:47:47 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"success":true}' - http_version: - recorded_at: Wed, 16 Sep 2020 17:47:47 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml b/test/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml deleted file mode 100644 index 396f6501..00000000 --- a/test/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/passwordless/sessions/session_123/send - body: - encoding: UTF-8 - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.7.0 - Authorization: - - Bearer sk_4q5ka3d9bx0XJiZhkKmUIOG87 - response: - status: - code: 422 - message: Unprocessable Entity - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 6c22578f-9d49-4118-a7bd-18014d447aad - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '79' - Etag: - - W/"4f-NjqaLicbRDM9SfS5gYKHlSgozt0" - Date: - - Wed, 16 Sep 2020 17:52:24 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"The passwordless session ''session_123'' has expired or - is invalid."}' - http_version: - recorded_at: Wed, 16 Sep 2020 17:52:24 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml b/test/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml deleted file mode 100644 index b1703296..00000000 --- a/test/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/portal/generate_link - body: - encoding: UTF-8 - string: '{"intent":"audit_logs","organization":"org_01EHQMYV6MBK39QC5PZXHY59C3","return_url":null,"success_url":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.10.1 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - X-Dns-Prefetch-Control: - - "off" - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - "0" - X-Request-Id: - - 5cf84612-cd60-4d91-9c7e-e1e11bb6b074 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "319" - Etag: - - W/"13f-riW7JK+w7gdYvKYPzZmuQc+wFXk" - Date: - - Wed, 03 Mar 2021 22:08:00 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"link":"https://id.workos.com/portal/launch?secret=secret"}' - http_version: - recorded_at: Wed, 03 Mar 2021 22:08:00 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml b/test/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml deleted file mode 100644 index 543078f0..00000000 --- a/test/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/portal/generate_link - body: - encoding: UTF-8 - string: '{"intent":"certificate_renewal","organization":"org_01EHQMYV6MBK39QC5PZXHY59C3","return_url":null,"success_url":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.5.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - cb9ad5cf-243a-4084-a4f6-2d7d2b097b8b - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '79' - Etag: - - W/"4f-NN86NUZRu/GQgPAYTexTS6/9DnM" - Date: - - Wed, 09 Sep 2020 23:43:07 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"link":"https://id.workos.com/portal/launch?secret=secret"}' - http_version: - recorded_at: Wed, 09 Sep 2020 23:43:07 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml b/test/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml deleted file mode 100644 index 2da1824d..00000000 --- a/test/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/portal/generate_link - body: - encoding: UTF-8 - string: '{"intent":"domain_verification","organization":"org_01EHQMYV6MBK39QC5PZXHY59C3","return_url":null,"success_url":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.5.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - cb9ad5cf-243a-4084-a4f6-2d7d2b097b8b - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '79' - Etag: - - W/"4f-NN86NUZRu/GQgPAYTexTS6/9DnM" - Date: - - Wed, 09 Sep 2020 23:43:07 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"link":"https://id.workos.com/portal/launch?secret=secret"}' - http_version: - recorded_at: Wed, 09 Sep 2020 23:43:07 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/portal/generate_link_dsync.yml b/test/fixtures/vcr_cassettes/portal/generate_link_dsync.yml deleted file mode 100644 index 1d17d24a..00000000 --- a/test/fixtures/vcr_cassettes/portal/generate_link_dsync.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/portal/generate_link - body: - encoding: UTF-8 - string: '{"intent":"dsync","organization":"org_01EHQMYV6MBK39QC5PZXHY59C3","return_url":null,"success_url":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.10.1 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 5cf84612-cd60-4d91-9c7e-e1e11bb6b074 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '319' - Etag: - - W/"13f-riW7JK+w7gdYvKYPzZmuQc+wFXk" - Date: - - Wed, 03 Mar 2021 22:08:00 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"link":"https://id.workos.com/portal/launch?secret=secret"}' - http_version: - recorded_at: Wed, 03 Mar 2021 22:08:00 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/portal/generate_link_invalid.yml b/test/fixtures/vcr_cassettes/portal/generate_link_invalid.yml deleted file mode 100644 index 817c1e6a..00000000 --- a/test/fixtures/vcr_cassettes/portal/generate_link_invalid.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/portal/generate_link - body: - encoding: UTF-8 - string: '{"intent":"sso","organization":"bogus-id","return_url":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.5.0 - Authorization: - - Bearer - response: - status: - code: 400 - message: Bad Request - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - f1c46aa5-0d87-4d9a-b2ce-dc0505eb8f75 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '67' - Etag: - - W/"43-kRRkij6uWMfZoSUJpiGbSXw7SNc" - Date: - - Thu, 10 Sep 2020 16:14:41 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"Could not find an organization with the id, bogus-id."}' - http_version: - recorded_at: Thu, 10 Sep 2020 16:14:41 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/portal/generate_link_sso.yml b/test/fixtures/vcr_cassettes/portal/generate_link_sso.yml deleted file mode 100644 index befde7cc..00000000 --- a/test/fixtures/vcr_cassettes/portal/generate_link_sso.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/portal/generate_link - body: - encoding: UTF-8 - string: '{"intent":"sso","organization":"org_01EHQMYV6MBK39QC5PZXHY59C3","return_url":null,"success_url":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.5.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - cb9ad5cf-243a-4084-a4f6-2d7d2b097b8b - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '79' - Etag: - - W/"4f-NN86NUZRu/GQgPAYTexTS6/9DnM" - Date: - - Wed, 09 Sep 2020 23:43:07 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"link":"https://id.workos.com/portal/launch?secret=secret"}' - http_version: - recorded_at: Wed, 09 Sep 2020 23:43:07 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml b/test/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml deleted file mode 100644 index fa237067..00000000 --- a/test/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.workos.com/connections/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.10.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '23' - Etag: - - W/"17-SuRA/yvUWUo8rK6x7dKURLeBo+0" - Date: - - Thu, 04 Feb 2021 17:20:08 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"Not Found"}' - http_version: - recorded_at: Thu, 04 Feb 2021 17:20:08 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml b/test/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml deleted file mode 100644 index 2c739955..00000000 --- a/test/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml +++ /dev/null @@ -1,70 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.workos.com/connections/conn_01EX55FRVN1V2PCA9YWTMZQMMQ - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.10.0 - Authorization: - - Bearer - response: - status: - code: 204 - message: No Content - headers: - Server: - - Cowboy - Content-Length: - - '0' - Connection: - - keep-alive - Vary: - - Origin - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - - Etag: - - W/"a-bAsFyilMr4Ra1hIU5PyoyFRunpI" - Date: - - Thu, 04 Feb 2021 17:20:08 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '' - http_version: - recorded_at: Thu, 04 Feb 2021 17:20:08 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml b/test/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml deleted file mode 100644 index b8d9fd4c..00000000 --- a/test/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/connections/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/2.7.1; x86_64-darwin19; v0.10.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '23' - Etag: - - W/"17-SuRA/yvUWUo8rK6x7dKURLeBo+0" - Date: - - Fri, 29 Jan 2021 15:36:23 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: '{"message":"Not Found"}' - http_version: - recorded_at: Fri, 29 Jan 2021 15:36:23 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml b/test/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml deleted file mode 100644 index be3f1548..00000000 --- a/test/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/connections/conn_01FA3WGCWPCCY1V2FGES2FDNP7 - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:17 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - c49f3ab1-1103-4834-a164-c341615b173a - Etag: - - W/"89d-wOSqRmSA/e8kfF0JMEPulcmeRsI" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=qimXmLGVK0egx58Jw3RuvjdRR0akAgiuCs122xhYanp3wX54yh2cQoWCPGDIZdbHk%2Bu%2B88TZVUbZkaARB%2BpWNabnkDXUlP7VR2bzs0JuqpXxrIJigJrMcFtC5qXv9RLNLFyBAgGhBdmm%2F0JaZw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c443190cf30e62-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"connection","id":"conn_01FA3WGCWPCCY1V2FGES2FDNP7","organization_id":"org_01F9293WD2PDEEV4Y625XPZVG7","connection_type":"OktaSAML","name":"Foo - Corp","state":"active","created_at":"2021-07-08T20:21:22.437Z","updated_at":"2021-07-08T20:24:38.887Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01F9293WD8KZAS4ESBK57SZ4D8","domain":"foo-corp.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":"http://www.okta.com/exk2d7kaj52WBRvhU4x7","saml_idp_url":"https://foo-corp.okta.com/app/foo-corp_blairdemoandteststagingworkostestapp_1/exk2d7kaj52WBRvhU4x7/sso/saml","saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":["-----BEGIN - CERTIFICATE-----\nMIIDoDCCAoigAwIBAgIGAXAljl6nMA0GCSqGSIb3DQEBCwUAMIGQMQswCQYDVQQGEwJVUzETMBEG\r\nA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU\r\nMBIGA1UECwwLU1NPUHJvdmlkZXIxETAPBgNVBAMMCGZvby1jb3JwMRwwGgYJKoZIhvcNAQkBFg1p\r\nbmZvQG9rdGEuY29tMB4XDTIwMDIwODE2MDYzMloXDTMwMDIwODE2MDczMlowgZAxCzAJBgNVBAYT\r\nAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ0wCwYDVQQK\r\nDARPa3RhMRQwEgYDVQQLDAtTU09Qcm92aWRlcjERMA8GA1UEAwwIZm9vLWNvcnAxHDAaBgkqhkiG\r\n9w0BCQEWDWluZm9Ab2t0YS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDm1D64\r\nRglMbkUbbSFWCDnlQQ4Ocj++/DJQUsdi1imh2H3mUWj+BhYo3FPqLxnEklo1UnJk4ZgUK6DotefP\r\nl5eH0/tX2m0xYs94Uu+aHEiz8c2QjVNJrLHpoXLYdBaeh/cdDJiLic0XVCHpW9HeghtMW44IFK/3\r\n9uNhF/n2BTz0jCP7bmmds3ATNguaAelri3YPXDZ3Kl4WTzxm5M73ygfkeeNIVYC5Mh2Z454L8iTu\r\ndauu3BfAuVDXXmOshGd2Nwo9bR5SqxYpCbXwztXU25mO0hCuSVdEke7qelz3nPd3B9urc6vbOv2B\r\n2yEfvlqUQhG6LUV+NwfKADDJ4crGcjAnAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAKKtksfJZ9cd\r\nKO1hMvlX+CWdHdxllYFc9aReMfOhHEnMK2mhN3KMs8T3rcNqX8Z98L31hJ/6EYzMYP+/ayEXJ5if\r\nKRIpR07FC2Cy4oYQUNED5aP008dSB9dCVW5SeZbHMgS1S3qVlh1f7i8NENBgAWnFVpGvtGFM6AfY\r\nsPxIY8qhkzTdhz7glv231ftytXqXKJIxRd7fhoJmnt+f2g62NhAEsx9wGFfDH8IoX+3hi47iuOzo\r\nT/Bz8dz5fpjjq8ic2F0uowfVQaI3c4zCpSVtmVyGA0hkIsjrpjP1z3fE/Kv8d4XVlTLS8saWlvFL\r\nMSLmMqACEOKSuGjX2YFh8cnm+3I=\r\n-----END - CERTIFICATE-----\n"],"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:17 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/list_connections/with_after.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_after.yml deleted file mode 100644 index 4a0d0066..00000000 --- a/test/fixtures/vcr_cassettes/sso/list_connections/with_after.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/connections?after=conn_01FA3WGCWPCCY1V2FGES2FDNP7&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:16 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - f0ca1391-24f7-42ab-96e1-03708170a415 - Etag: - - W/"59a-ZIKgWSqL79Vk1PhmBPwwz8b4bhU" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=zcH%2FppoPRB%2BmUlJabP9ZSUe5cPHU7%2FBBbFhBBbfnttHbFCsiSIpwTqTp4tefv%2BR6SEeQEpNhai3Ra7Zs7YmwYxdAw0ECz4bFh9D1NJeV%2BBEvWpoaIj475X5J%2FiPdUkqGAhTQ9nKkIeMW4MJIkw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c443171d2b0f22-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"data":[{"object":"connection","id":"conn_01FBQN064TFAT9A3KYPPP85VXK","organization_id":"org_01F79Z8TGGTA8Q67Q50FDXAYN3","connection_type":"MagicLink","name":"MagicLink","state":"active","created_at":"2021-07-28T22:50:41.632Z","updated_at":"2021-07-28T22:50:41.632Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01F79Z8TGS4VYFX0246RAWSZMP","domain":"gmail.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FAK8CHVMK2QVT20ZG7ZQ1JVX","organization_id":"org_01F8873JSZWN1MJCDN537FEK1H","connection_type":"ShibbolethSAML","name":"Shibboleth","state":"inactive","created_at":"2021-07-14T19:37:35.856Z","updated_at":"2021-07-14T19:37:35.856Z","status":"unlinked","domains":[],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":"https://auth.workos.email/XLvFXZ1tssoaiUkU60IcagSQQ","saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null}],"listMetadata":{"before":"conn_01FAK8CHVMK2QVT20ZG7ZQ1JVX","after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:16 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/list_connections/with_before.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_before.yml deleted file mode 100644 index 574c80f6..00000000 --- a/test/fixtures/vcr_cassettes/sso/list_connections/with_before.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/connections?before=conn_01FA3WGCWPCCY1V2FGES2FDNP7&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:16 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 80b9d46c-ab79-41a0-ac63-0afab5dbe8f4 - Etag: - - W/"a75-HKo0bWjw/aMpbUHuuusiqqwVe+k" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=ElnTPt%2BZ5sT5Jj3gdjDAvKRuAIl%2F9MW4GqdQ8Km6HNrcSRKBuCuTDkf27hpLIdGsX5YHaZlIjfcNVU1YuhqD0TyUtOuTkwMAwU79bYb%2FRCzVbOngrvJhhtMjmvaZ9cmGjSDH02dUC9%2BzxFbjlg%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c44313882128d1-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"data":[{"object":"connection","id":"conn_01F79Z8TJP48W73H0F879S7TAP","organization_id":"org_01F79Z8TGGTA8Q67Q50FDXAYN3","connection_type":"GoogleOAuth","name":"Google - OAuth","state":"active","created_at":"2021-06-03T22:18:01.115Z","updated_at":"2021-06-03T22:18:01.115Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01F79Z8TGS4VYFX0246RAWSZMP","domain":"gmail.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":"950693390536-3t7scpogivcoap4bomkshfgbajpq8ifb.apps.googleusercontent.com","oauth_secret":"1fu91TBNiOLUIVxP1_zIkw53","oauth_redirect_uri":"https://auth.workos.com/sso/oauth/google/aOrKxybKyAsKIcgwYGG0WyIaq/callback"},{"object":"connection","id":"conn_01F6Q6TKSG0YPYM41D51Z2VXKQ","organization_id":"org_01F6Q6TFP7RD2PF6J03ANNWDKV","connection_type":"GoogleOAuth","name":"Google - OAuth","state":"active","created_at":"2021-05-27T15:24:29.812Z","updated_at":"2021-05-27T15:24:29.812Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01FCPEG7BAYMQ4CHMG41Y2VNHF","domain":"example.me"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":"950693390536-3t7scpogivcoap4bomkshfgbajpq8ifb.apps.googleusercontent.com","oauth_secret":"1fu91TBNiOLUIVxP1_zIkw53","oauth_redirect_uri":"https://auth.workos.com/sso/oauth/google/aOrKxybKyAsKIcgwYGG0WyIaq/callback"},{"object":"connection","id":"conn_01F6Q6NPK0G2198KKK4G9E03A6","organization_id":"org_01F6Q6NGZS8R5ZTH3C1XR96JK7","connection_type":"GoogleOAuth","name":"Google - OAuth","state":"active","created_at":"2021-05-27T15:21:48.837Z","updated_at":"2021-05-27T15:21:48.837Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01F6Q6NGZZ54WSX1XCMCKSC4DA","domain":"workos.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":"950693390536-3t7scpogivcoap4bomkshfgbajpq8ifb.apps.googleusercontent.com","oauth_secret":"1fu91TBNiOLUIVxP1_zIkw53","oauth_redirect_uri":"https://auth.workos.com/sso/oauth/google/aOrKxybKyAsKIcgwYGG0WyIaq/callback"}],"listMetadata":{"before":null,"after":"conn_01F79Z8TJP48W73H0F879S7TAP"}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:16 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml deleted file mode 100644 index db89e1e7..00000000 --- a/test/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml +++ /dev/null @@ -1,90 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/connections?connection_type=OktaSAML&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:14 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 7058469e-045f-4742-8f53-eb76129f1798 - Etag: - - W/"2d96-v9q8E6Hhaoenezek+rLrpCbNXas" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=FaQyOnAlqvcP1wdJdjCJ3bZqgNuUnIadrUvZuZgYBVLUuLaOITOVJbynFbstpEZFAzrZ3%2BoFu6xLJZRdGGnEnm0qHvhJt%2FSZoCozDg3WJSirjySp0xJmyzzYjT2Ugjsw%2BPFVM93c2FRePzdmxg%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c44307caf42ee9-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"data":[{"object":"connection","id":"conn_01FCP832EJXY0XGA7KHSY4TR1Z","organization_id":"org_01FCP82TN6M8Z1MMYD8KNAFK9K","connection_type":"OktaSAML","name":"demo-1628539283","state":"inactive","created_at":"2021-08-09T20:01:31.988Z","updated_at":"2021-08-09T20:01:31.988Z","status":"unlinked","domains":[{"object":"connection_domain","id":"org_domain_01FCP82TPXNSMGX7J152ZCAPZZ","domain":"demo-1628539283.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FCP2QYEPS1DB3XBC7BAQCMEJ","organization_id":"org_01FCP2QN01T5SSFBTSRR4WAEEB","connection_type":"OktaSAML","name":"demo-1628533674835","state":"inactive","created_at":"2021-08-09T18:28:04.688Z","updated_at":"2021-08-09T18:28:04.688Z","status":"unlinked","domains":[{"object":"connection_domain","id":"org_domain_01FCP2QN077A256HSKQ8SSRSJ6","domain":"demo-1628533674835.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FCP09066HGAJ4PHQP0RV6S9X","organization_id":"org_01FCP08FE35AVZSGSN3D0KAPXV","connection_type":"OktaSAML","name":"demo-1628531080559","state":"inactive","created_at":"2021-08-09T17:44:57.793Z","updated_at":"2021-08-09T17:44:57.793Z","status":"unlinked","domains":[{"object":"connection_domain","id":"org_domain_01FCP08FEAJC8GNDNHGSG7JPSV","domain":"demo-1628531080559.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FCNWFDKC05NA7276PXFWASSG","organization_id":"org_01FCNWEX3GMQT5M4ABPRA40KXE","connection_type":"OktaSAML","name":"demo-1628527096","state":"active","created_at":"2021-08-09T16:38:33.834Z","updated_at":"2021-08-09T16:38:35.045Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01FCNWEX57RE3NEA9X5J8XKN4E","domain":"demo-1628527096.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":"http://www.okta.com/exk43g6nngUr0YT3B4x7","saml_idp_url":"https://foo-corp.okta.com/app/foo-corp_demo1628527096stagingworkostestapp_1/exk43g6nngUr0YT3B4x7/sso/saml","saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":["-----BEGIN - CERTIFICATE-----\nMIIDoDCCAoigAwIBAgIGAXAljl6nMA0GCSqGSIb3DQEBCwUAMIGQMQswCQYDVQQGEwJVUzETMBEG\nA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU\nMBIGA1UECwwLU1NPUHJvdmlkZXIxETAPBgNVBAMMCGZvby1jb3JwMRwwGgYJKoZIhvcNAQkBFg1p\nbmZvQG9rdGEuY29tMB4XDTIwMDIwODE2MDYzMloXDTMwMDIwODE2MDczMlowgZAxCzAJBgNVBAYT\nAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ0wCwYDVQQK\nDARPa3RhMRQwEgYDVQQLDAtTU09Qcm92aWRlcjERMA8GA1UEAwwIZm9vLWNvcnAxHDAaBgkqhkiG\n9w0BCQEWDWluZm9Ab2t0YS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDm1D64\nRglMbkUbbSFWCDnlQQ4Ocj++/DJQUsdi1imh2H3mUWj+BhYo3FPqLxnEklo1UnJk4ZgUK6DotefP\nl5eH0/tX2m0xYs94Uu+aHEiz8c2QjVNJrLHpoXLYdBaeh/cdDJiLic0XVCHpW9HeghtMW44IFK/3\n9uNhF/n2BTz0jCP7bmmds3ATNguaAelri3YPXDZ3Kl4WTzxm5M73ygfkeeNIVYC5Mh2Z454L8iTu\ndauu3BfAuVDXXmOshGd2Nwo9bR5SqxYpCbXwztXU25mO0hCuSVdEke7qelz3nPd3B9urc6vbOv2B\n2yEfvlqUQhG6LUV+NwfKADDJ4crGcjAnAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAKKtksfJZ9cd\nKO1hMvlX+CWdHdxllYFc9aReMfOhHEnMK2mhN3KMs8T3rcNqX8Z98L31hJ/6EYzMYP+/ayEXJ5if\nKRIpR07FC2Cy4oYQUNED5aP008dSB9dCVW5SeZbHMgS1S3qVlh1f7i8NENBgAWnFVpGvtGFM6AfY\nsPxIY8qhkzTdhz7glv231ftytXqXKJIxRd7fhoJmnt+f2g62NhAEsx9wGFfDH8IoX+3hi47iuOzo\nT/Bz8dz5fpjjq8ic2F0uowfVQaI3c4zCpSVtmVyGA0hkIsjrpjP1z3fE/Kv8d4XVlTLS8saWlvFL\nMSLmMqACEOKSuGjX2YFh8cnm+3I=\n-----END - CERTIFICATE-----"],"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FCNS1WR28HVSFB3Z1AHBQJ3B","organization_id":"org_01FCNS1GZSB9XTWPRS8NK9HW4K","connection_type":"OktaSAML","name":"demo-1628523512","state":"inactive","created_at":"2021-08-09T15:38:44.861Z","updated_at":"2021-08-09T15:38:44.861Z","status":"unlinked","domains":[{"object":"connection_domain","id":"org_domain_01FCNS1H1H0X7ZDMGTSCJS39R9","domain":"demo-1628523512.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FCNRJVGVA1C33W3B2KC2QS9A","organization_id":"org_01FCNRJJH4THHVBR6JWWX3ZJ5Y","connection_type":"OktaSAML","name":"team_lcPvqVaZp1rExEnjjZYxiS04","state":"inactive","created_at":"2021-08-09T15:30:32.085Z","updated_at":"2021-08-09T15:30:32.085Z","status":"unlinked","domains":[{"object":"connection_domain","id":"org_domain_01FCNRJJHAJQ9C09F46KE0JT0G","domain":"lcPvqVaZp1rExEnjjZYxiS04.vercel"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FCNQNT12QQAZG79Q4ZGS1QSV","organization_id":"org_01FCNQN278D9DFTG47DBE8ZYS8","connection_type":"OktaSAML","name":"demo-1628522055","state":"inactive","created_at":"2021-08-09T15:14:40.284Z","updated_at":"2021-08-09T15:14:40.284Z","status":"unlinked","domains":[{"object":"connection_domain","id":"org_domain_01FCNQN290BKE936XBM330PMAP","domain":"demo-1628522055.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FCNFFB4XTTEBQZKF41FZWFWE","organization_id":"org_01FCNFEE3TBRDRMN311RCK3HZR","connection_type":"OktaSAML","name":"demo-1628513449","state":"inactive","created_at":"2021-08-09T12:51:19.832Z","updated_at":"2021-08-09T12:51:19.832Z","status":"unlinked","domains":[{"object":"connection_domain","id":"org_domain_01FCNFEE5K9CJE1J4RGJNHYBHM","domain":"demo-1628513449.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FCNCC3N129W1M0HYMGTTSSS2","organization_id":"org_01FCNCC3METTBSXR8AEV680SR9","connection_type":"OktaSAML","name":"FooCorp","state":"active","created_at":"2021-08-09T11:57:08.125Z","updated_at":"2021-08-09T11:57:10.874Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01FCNCC3MQE1Y7ENVVP3HH60KA","domain":"foo-corp.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":"http://www.okta.com/exk43cj5tqUvJXYfb4x7","saml_idp_url":"https://foo-corp.okta.com/app/foo-corp_pitchstagingworkostestapp_1/exk43cj5tqUvJXYfb4x7/sso/saml","saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":["-----BEGIN - CERTIFICATE-----\nMIIDoDCCAoigAwIBAgIGAXAljl6nMA0GCSqGSIb3DQEBCwUAMIGQMQswCQYDVQQGEwJVUzETMBEG\nA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU\nMBIGA1UECwwLU1NPUHJvdmlkZXIxETAPBgNVBAMMCGZvby1jb3JwMRwwGgYJKoZIhvcNAQkBFg1p\nbmZvQG9rdGEuY29tMB4XDTIwMDIwODE2MDYzMloXDTMwMDIwODE2MDczMlowgZAxCzAJBgNVBAYT\nAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ0wCwYDVQQK\nDARPa3RhMRQwEgYDVQQLDAtTU09Qcm92aWRlcjERMA8GA1UEAwwIZm9vLWNvcnAxHDAaBgkqhkiG\n9w0BCQEWDWluZm9Ab2t0YS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDm1D64\nRglMbkUbbSFWCDnlQQ4Ocj++/DJQUsdi1imh2H3mUWj+BhYo3FPqLxnEklo1UnJk4ZgUK6DotefP\nl5eH0/tX2m0xYs94Uu+aHEiz8c2QjVNJrLHpoXLYdBaeh/cdDJiLic0XVCHpW9HeghtMW44IFK/3\n9uNhF/n2BTz0jCP7bmmds3ATNguaAelri3YPXDZ3Kl4WTzxm5M73ygfkeeNIVYC5Mh2Z454L8iTu\ndauu3BfAuVDXXmOshGd2Nwo9bR5SqxYpCbXwztXU25mO0hCuSVdEke7qelz3nPd3B9urc6vbOv2B\n2yEfvlqUQhG6LUV+NwfKADDJ4crGcjAnAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAKKtksfJZ9cd\nKO1hMvlX+CWdHdxllYFc9aReMfOhHEnMK2mhN3KMs8T3rcNqX8Z98L31hJ/6EYzMYP+/ayEXJ5if\nKRIpR07FC2Cy4oYQUNED5aP008dSB9dCVW5SeZbHMgS1S3qVlh1f7i8NENBgAWnFVpGvtGFM6AfY\nsPxIY8qhkzTdhz7glv231ftytXqXKJIxRd7fhoJmnt+f2g62NhAEsx9wGFfDH8IoX+3hi47iuOzo\nT/Bz8dz5fpjjq8ic2F0uowfVQaI3c4zCpSVtmVyGA0hkIsjrpjP1z3fE/Kv8d4XVlTLS8saWlvFL\nMSLmMqACEOKSuGjX2YFh8cnm+3I=\n-----END - CERTIFICATE-----"],"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FCN5ZCK6GG2M8D84VW4T6MWH","organization_id":"org_01FCN5Y5PQ3DA8QYSSY09MFKGE","connection_type":"OktaSAML","name":"The - best workspace ever","state":"active","created_at":"2021-08-09T10:05:19.842Z","updated_at":"2021-08-09T10:08:35.130Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01FCN5Y5PYJCBAVEFWHACWX0CJ","domain":"coolestworkspace.dev"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":"http://www.okta.com/exk1ficbhpjz8xVVh5d7","saml_idp_url":"https://dev-94282250.okta.com/app/dev-94282250_pitch_2/exk1ficbhpjz8xVVh5d7/sso/saml","saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":["-----BEGIN - CERTIFICATE-----\nMIIDqDCCApCgAwIBAgIGAXsc4wsnMA0GCSqGSIb3DQEBCwUAMIGUMQswCQYDVQQGEwJVUzETMBEG\r\nA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU\r\nMBIGA1UECwwLU1NPUHJvdmlkZXIxFTATBgNVBAMMDGRldi05NDI4MjI1MDEcMBoGCSqGSIb3DQEJ\r\nARYNaW5mb0Bva3RhLmNvbTAeFw0yMTA4MDYxOTEzMDZaFw0zMTA4MDYxOTE0MDZaMIGUMQswCQYD\r\nVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsG\r\nA1UECgwET2t0YTEUMBIGA1UECwwLU1NPUHJvdmlkZXIxFTATBgNVBAMMDGRldi05NDI4MjI1MDEc\r\nMBoGCSqGSIb3DQEJARYNaW5mb0Bva3RhLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC\r\nggEBAMKJPo2wg37/5C5Iho0unQLY+ZpgWEEy7f5Ckgjjo2iKRIr5K+SncU7EJ8Fw1TP8TU//Hmx9\r\nHzN3cj9l4d0LJ7xQAp2RLgHooDB2u/zkvb4KQJM3wDwWdfZAATHcG7OJfo+vEFTciqGVSrB8Ibac\r\ny0WEazbxfX7GAGHqf8SaEmzPm9j3moh0LC84HzI4JfDBhJumoSCqr+aDimV7DAG3IV4dFXy+SaQq\r\nDYkDllPPWy2/JwirerVKFH/9akLjRLVxT1JuF0j6TTtz6sUf7JuUdaul3OOCNGOfL+/q+2lv9E1V\r\nXQkNJ82U6ebcAhy3qA4+hMPtqTm6Ia/wbLNuqqAj+8cCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEA\r\nbUJTOUx3SxktI/iOrZN0b9ExhHqnumSqSFOhq1i0a9pA10Cq10fZK+ewfcCWEQik4ea9qX0FBio0\r\nNmO5o+SvGBOw6zAsfq5yFmZTH5AJnqSa/PRiw45s43rA9yzYQEELfn5Yh9YI5WNr71lP1T778pbh\r\nhu4Apk+O01ZXRkpJ2VqHTJiKiM8OnIe2Ysv4OqcmhRY8xZI0IQk/Faqwd+pzKJKO1EkoeHT0Id+7\r\nwaDRPwC//I+irql8Crr3WgcWn0Ios7FgguUeJN9wa5Tt1Vn85WzeljuVwAxn9UQ7wtYQWDRtaD4V\r\nFa6ZdvTarfbBL2G4nbbUD0Zt3wZA+Iesi+sDsg==\r\n-----END - CERTIFICATE-----\n"],"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null}],"listMetadata":{"before":"conn_01FCN5ZCK6GG2M8D84VW4T6MWH","after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:14 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml deleted file mode 100644 index 4fedc2c7..00000000 --- a/test/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/connections?domain=foo-corp.com&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:14 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 24492041-6fa0-45c9-b58b-62cdd41d86de - Etag: - - W/"8d4-KLH/pb5+0Lb31ZpVOsvjdPi7hcY" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=jqUpn%2FQ6EQmSEkHPIQv4Sko133YccSCQTxa%2Ffw5dC%2BTURs2kugUy0otw7ybSthyR0o1Jp%2BejA4lZeMyHm3JafVzdj10nK%2BQm0VmAfMx9NaPMUsFgWvqpZDAZK3eu99kuWhyUQ1N6iq%2FcuQJTTw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c4430badd028b7-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"data":[{"object":"connection","id":"conn_01FA3WGCWPCCY1V2FGES2FDNP7","organization_id":"org_01F9293WD2PDEEV4Y625XPZVG7","connection_type":"OktaSAML","name":"Foo - Corp","state":"active","created_at":"2021-07-08T20:21:22.437Z","updated_at":"2021-07-08T20:24:38.887Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01F9293WD8KZAS4ESBK57SZ4D8","domain":"foo-corp.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":"http://www.okta.com/exk2d7kaj52WBRvhU4x7","saml_idp_url":"https://foo-corp.okta.com/app/foo-corp_blairdemoandteststagingworkostestapp_1/exk2d7kaj52WBRvhU4x7/sso/saml","saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":["-----BEGIN - CERTIFICATE-----\nMIIDoDCCAoigAwIBAgIGAXAljl6nMA0GCSqGSIb3DQEBCwUAMIGQMQswCQYDVQQGEwJVUzETMBEG\r\nA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU\r\nMBIGA1UECwwLU1NPUHJvdmlkZXIxETAPBgNVBAMMCGZvby1jb3JwMRwwGgYJKoZIhvcNAQkBFg1p\r\nbmZvQG9rdGEuY29tMB4XDTIwMDIwODE2MDYzMloXDTMwMDIwODE2MDczMlowgZAxCzAJBgNVBAYT\r\nAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ0wCwYDVQQK\r\nDARPa3RhMRQwEgYDVQQLDAtTU09Qcm92aWRlcjERMA8GA1UEAwwIZm9vLWNvcnAxHDAaBgkqhkiG\r\n9w0BCQEWDWluZm9Ab2t0YS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDm1D64\r\nRglMbkUbbSFWCDnlQQ4Ocj++/DJQUsdi1imh2H3mUWj+BhYo3FPqLxnEklo1UnJk4ZgUK6DotefP\r\nl5eH0/tX2m0xYs94Uu+aHEiz8c2QjVNJrLHpoXLYdBaeh/cdDJiLic0XVCHpW9HeghtMW44IFK/3\r\n9uNhF/n2BTz0jCP7bmmds3ATNguaAelri3YPXDZ3Kl4WTzxm5M73ygfkeeNIVYC5Mh2Z454L8iTu\r\ndauu3BfAuVDXXmOshGd2Nwo9bR5SqxYpCbXwztXU25mO0hCuSVdEke7qelz3nPd3B9urc6vbOv2B\r\n2yEfvlqUQhG6LUV+NwfKADDJ4crGcjAnAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAKKtksfJZ9cd\r\nKO1hMvlX+CWdHdxllYFc9aReMfOhHEnMK2mhN3KMs8T3rcNqX8Z98L31hJ/6EYzMYP+/ayEXJ5if\r\nKRIpR07FC2Cy4oYQUNED5aP008dSB9dCVW5SeZbHMgS1S3qVlh1f7i8NENBgAWnFVpGvtGFM6AfY\r\nsPxIY8qhkzTdhz7glv231ftytXqXKJIxRd7fhoJmnt+f2g62NhAEsx9wGFfDH8IoX+3hi47iuOzo\r\nT/Bz8dz5fpjjq8ic2F0uowfVQaI3c4zCpSVtmVyGA0hkIsjrpjP1z3fE/Kv8d4XVlTLS8saWlvFL\r\nMSLmMqACEOKSuGjX2YFh8cnm+3I=\r\n-----END - CERTIFICATE-----\n"],"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null}],"listMetadata":{"before":null,"after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:15 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml deleted file mode 100644 index c2941dad..00000000 --- a/test/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/connections?limit=2&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:15 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - d4eb0623-1466-4e99-a500-119612d6bc9b - Etag: - - W/"59a-ZIKgWSqL79Vk1PhmBPwwz8b4bhU" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=qHLXTh7d4n3QFt805M6FLecdsq2AJM19ZHRepY4aqLg0e0zMYCudz5G%2BnGfWrzEGzYsUocUIx%2FVfp2D6Rsmy1ZR6mSeySF59z%2FGLEuruXgkqf3VOxMz1BBXe9iE%2B4kUeeFrG0Hzw9NuXkPSmhQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c44310a9ba2f79-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"data":[{"object":"connection","id":"conn_01FBQN064TFAT9A3KYPPP85VXK","organization_id":"org_01F79Z8TGGTA8Q67Q50FDXAYN3","connection_type":"MagicLink","name":"MagicLink","state":"active","created_at":"2021-07-28T22:50:41.632Z","updated_at":"2021-07-28T22:50:41.632Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01F79Z8TGS4VYFX0246RAWSZMP","domain":"gmail.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FAK8CHVMK2QVT20ZG7ZQ1JVX","organization_id":"org_01F8873JSZWN1MJCDN537FEK1H","connection_type":"ShibbolethSAML","name":"Shibboleth","state":"inactive","created_at":"2021-07-14T19:37:35.856Z","updated_at":"2021-07-14T19:37:35.856Z","status":"unlinked","domains":[],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":"https://auth.workos.email/XLvFXZ1tssoaiUkU60IcagSQQ","saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null}],"listMetadata":{"before":"conn_01FAK8CHVMK2QVT20ZG7ZQ1JVX","after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:15 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml deleted file mode 100644 index 1fb014a6..00000000 --- a/test/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml +++ /dev/null @@ -1,89 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/connections?order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:13 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - fdf4c9b7-8f95-4369-8a99-9b11639967b3 - Etag: - - W/"183d-yb1W7y6dzIHej2T2YBC3d5jdQ8k" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=9yHZIP2Ra%2FPNVnT63DAi%2FFOoC9AFPN3fWmhHpdAK9e%2FgpbAIgzbtWpbC%2BRcGyEtldiseJd1pubYlfopmHWmOQairCjGsmPRbz6rimyHZc3eyp%2FKZmjd%2FjBnaSSChh1lpLUhwI8rZJdxeA2V68A%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c44301bde50bf7-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"data":[{"object":"connection","id":"conn_01FBQN064TFAT9A3KYPPP85VXK","organization_id":"org_01F79Z8TGGTA8Q67Q50FDXAYN3","connection_type":"MagicLink","name":"MagicLink","state":"active","created_at":"2021-07-28T22:50:41.632Z","updated_at":"2021-07-28T22:50:41.632Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01F79Z8TGS4VYFX0246RAWSZMP","domain":"gmail.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FAK8CHVMK2QVT20ZG7ZQ1JVX","organization_id":"org_01F8873JSZWN1MJCDN537FEK1H","connection_type":"ShibbolethSAML","name":"Shibboleth","state":"inactive","created_at":"2021-07-14T19:37:35.856Z","updated_at":"2021-07-14T19:37:35.856Z","status":"unlinked","domains":[],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":"https://auth.workos.email/XLvFXZ1tssoaiUkU60IcagSQQ","saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01FA3WGCWPCCY1V2FGES2FDNP7","organization_id":"org_01F9293WD2PDEEV4Y625XPZVG7","connection_type":"OktaSAML","name":"Foo - Corp","state":"active","created_at":"2021-07-08T20:21:22.437Z","updated_at":"2021-07-08T20:24:38.887Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01F9293WD8KZAS4ESBK57SZ4D8","domain":"foo-corp.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":"http://www.okta.com/exk2d7kaj52WBRvhU4x7","saml_idp_url":"https://foo-corp.okta.com/app/foo-corp_blairdemoandteststagingworkostestapp_1/exk2d7kaj52WBRvhU4x7/sso/saml","saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":["-----BEGIN - CERTIFICATE-----\nMIIDoDCCAoigAwIBAgIGAXAljl6nMA0GCSqGSIb3DQEBCwUAMIGQMQswCQYDVQQGEwJVUzETMBEG\r\nA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU\r\nMBIGA1UECwwLU1NPUHJvdmlkZXIxETAPBgNVBAMMCGZvby1jb3JwMRwwGgYJKoZIhvcNAQkBFg1p\r\nbmZvQG9rdGEuY29tMB4XDTIwMDIwODE2MDYzMloXDTMwMDIwODE2MDczMlowgZAxCzAJBgNVBAYT\r\nAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ0wCwYDVQQK\r\nDARPa3RhMRQwEgYDVQQLDAtTU09Qcm92aWRlcjERMA8GA1UEAwwIZm9vLWNvcnAxHDAaBgkqhkiG\r\n9w0BCQEWDWluZm9Ab2t0YS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDm1D64\r\nRglMbkUbbSFWCDnlQQ4Ocj++/DJQUsdi1imh2H3mUWj+BhYo3FPqLxnEklo1UnJk4ZgUK6DotefP\r\nl5eH0/tX2m0xYs94Uu+aHEiz8c2QjVNJrLHpoXLYdBaeh/cdDJiLic0XVCHpW9HeghtMW44IFK/3\r\n9uNhF/n2BTz0jCP7bmmds3ATNguaAelri3YPXDZ3Kl4WTzxm5M73ygfkeeNIVYC5Mh2Z454L8iTu\r\ndauu3BfAuVDXXmOshGd2Nwo9bR5SqxYpCbXwztXU25mO0hCuSVdEke7qelz3nPd3B9urc6vbOv2B\r\n2yEfvlqUQhG6LUV+NwfKADDJ4crGcjAnAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAKKtksfJZ9cd\r\nKO1hMvlX+CWdHdxllYFc9aReMfOhHEnMK2mhN3KMs8T3rcNqX8Z98L31hJ/6EYzMYP+/ayEXJ5if\r\nKRIpR07FC2Cy4oYQUNED5aP008dSB9dCVW5SeZbHMgS1S3qVlh1f7i8NENBgAWnFVpGvtGFM6AfY\r\nsPxIY8qhkzTdhz7glv231ftytXqXKJIxRd7fhoJmnt+f2g62NhAEsx9wGFfDH8IoX+3hi47iuOzo\r\nT/Bz8dz5fpjjq8ic2F0uowfVQaI3c4zCpSVtmVyGA0hkIsjrpjP1z3fE/Kv8d4XVlTLS8saWlvFL\r\nMSLmMqACEOKSuGjX2YFh8cnm+3I=\r\n-----END - CERTIFICATE-----\n"],"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null},{"object":"connection","id":"conn_01F79Z8TJP48W73H0F879S7TAP","organization_id":"org_01F79Z8TGGTA8Q67Q50FDXAYN3","connection_type":"GoogleOAuth","name":"Google - OAuth","state":"active","created_at":"2021-06-03T22:18:01.115Z","updated_at":"2021-06-03T22:18:01.115Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01F79Z8TGS4VYFX0246RAWSZMP","domain":"gmail.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":"950693390536-3t7scpogivcoap4bomkshfgbajpq8ifb.apps.googleusercontent.com","oauth_secret":"1fu91TBNiOLUIVxP1_zIkw53","oauth_redirect_uri":"https://auth.workos.com/sso/oauth/google/aOrKxybKyAsKIcgwYGG0WyIaq/callback"},{"object":"connection","id":"conn_01F6Q6TKSG0YPYM41D51Z2VXKQ","organization_id":"org_01F6Q6TFP7RD2PF6J03ANNWDKV","connection_type":"GoogleOAuth","name":"Google - OAuth","state":"active","created_at":"2021-05-27T15:24:29.812Z","updated_at":"2021-05-27T15:24:29.812Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01FCPEG7BAYMQ4CHMG41Y2VNHF","domain":"example.me"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":"950693390536-3t7scpogivcoap4bomkshfgbajpq8ifb.apps.googleusercontent.com","oauth_secret":"1fu91TBNiOLUIVxP1_zIkw53","oauth_redirect_uri":"https://auth.workos.com/sso/oauth/google/aOrKxybKyAsKIcgwYGG0WyIaq/callback"},{"object":"connection","id":"conn_01F6Q6NPK0G2198KKK4G9E03A6","organization_id":"org_01F6Q6NGZS8R5ZTH3C1XR96JK7","connection_type":"GoogleOAuth","name":"Google - OAuth","state":"active","created_at":"2021-05-27T15:21:48.837Z","updated_at":"2021-05-27T15:21:48.837Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01F6Q6NGZZ54WSX1XCMCKSC4DA","domain":"workos.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":null,"saml_idp_url":null,"saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":null,"oauth_uid":"950693390536-3t7scpogivcoap4bomkshfgbajpq8ifb.apps.googleusercontent.com","oauth_secret":"1fu91TBNiOLUIVxP1_zIkw53","oauth_redirect_uri":"https://auth.workos.com/sso/oauth/google/aOrKxybKyAsKIcgwYGG0WyIaq/callback"}],"listMetadata":{"before":"before_id","after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:14 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml b/test/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml deleted file mode 100644 index cc38865d..00000000 --- a/test/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/connections?order=desc&organization_id=org_01F9293WD2PDEEV4Y625XPZVG7 - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:15 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 838c7c5c-4e59-4985-bbfc-a9dc991251a2 - Etag: - - W/"8d4-KLH/pb5+0Lb31ZpVOsvjdPi7hcY" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=5AOf5zrSQvY37vWuZbR73i3BCZAOyMn15ntBUVxQIgGNHftGH9tQH1HyvVd0IgcmwVrb4wEhDNkSLkPGiue%2FoVc%2FAuXD9en2pk4wnUCDpxR%2B9MWAVnpxz8I74Jl6kK0cEh55FsFnlc7k%2BMsFZw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c4430d7d2d286f-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"data":[{"object":"connection","id":"conn_01FA3WGCWPCCY1V2FGES2FDNP7","organization_id":"org_01F9293WD2PDEEV4Y625XPZVG7","connection_type":"OktaSAML","name":"Foo - Corp","state":"active","created_at":"2021-07-08T20:21:22.437Z","updated_at":"2021-07-08T20:24:38.887Z","status":"linked","domains":[{"object":"connection_domain","id":"org_domain_01F9293WD8KZAS4ESBK57SZ4D8","domain":"foo-corp.com"}],"oidc_client_id":null,"oidc_client_secret":null,"oidc_discovery_endpoint":null,"oidc_redirect_uri":null,"saml_entity_id":"http://www.okta.com/exk2d7kaj52WBRvhU4x7","saml_idp_url":"https://foo-corp.okta.com/app/foo-corp_blairdemoandteststagingworkostestapp_1/exk2d7kaj52WBRvhU4x7/sso/saml","saml_relying_party_private_key":null,"saml_relying_party_public_key":null,"saml_x509_certs":["-----BEGIN - CERTIFICATE-----\nMIIDoDCCAoigAwIBAgIGAXAljl6nMA0GCSqGSIb3DQEBCwUAMIGQMQswCQYDVQQGEwJVUzETMBEG\r\nA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzENMAsGA1UECgwET2t0YTEU\r\nMBIGA1UECwwLU1NPUHJvdmlkZXIxETAPBgNVBAMMCGZvby1jb3JwMRwwGgYJKoZIhvcNAQkBFg1p\r\nbmZvQG9rdGEuY29tMB4XDTIwMDIwODE2MDYzMloXDTMwMDIwODE2MDczMlowgZAxCzAJBgNVBAYT\r\nAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQ0wCwYDVQQK\r\nDARPa3RhMRQwEgYDVQQLDAtTU09Qcm92aWRlcjERMA8GA1UEAwwIZm9vLWNvcnAxHDAaBgkqhkiG\r\n9w0BCQEWDWluZm9Ab2t0YS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDm1D64\r\nRglMbkUbbSFWCDnlQQ4Ocj++/DJQUsdi1imh2H3mUWj+BhYo3FPqLxnEklo1UnJk4ZgUK6DotefP\r\nl5eH0/tX2m0xYs94Uu+aHEiz8c2QjVNJrLHpoXLYdBaeh/cdDJiLic0XVCHpW9HeghtMW44IFK/3\r\n9uNhF/n2BTz0jCP7bmmds3ATNguaAelri3YPXDZ3Kl4WTzxm5M73ygfkeeNIVYC5Mh2Z454L8iTu\r\ndauu3BfAuVDXXmOshGd2Nwo9bR5SqxYpCbXwztXU25mO0hCuSVdEke7qelz3nPd3B9urc6vbOv2B\r\n2yEfvlqUQhG6LUV+NwfKADDJ4crGcjAnAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAKKtksfJZ9cd\r\nKO1hMvlX+CWdHdxllYFc9aReMfOhHEnMK2mhN3KMs8T3rcNqX8Z98L31hJ/6EYzMYP+/ayEXJ5if\r\nKRIpR07FC2Cy4oYQUNED5aP008dSB9dCVW5SeZbHMgS1S3qVlh1f7i8NENBgAWnFVpGvtGFM6AfY\r\nsPxIY8qhkzTdhz7glv231ftytXqXKJIxRd7fhoJmnt+f2g62NhAEsx9wGFfDH8IoX+3hi47iuOzo\r\nT/Bz8dz5fpjjq8ic2F0uowfVQaI3c4zCpSVtmVyGA0hkIsjrpjP1z3fE/Kv8d4XVlTLS8saWlvFL\r\nMSLmMqACEOKSuGjX2YFh8cnm+3I=\r\n-----END - CERTIFICATE-----\n"],"oauth_uid":null,"oauth_secret":null,"oauth_redirect_uri":null}],"listMetadata":{"before":null,"after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:15 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/sso/profile.yml b/test/fixtures/vcr_cassettes/sso/profile.yml deleted file mode 100644 index 5fa50a65..00000000 --- a/test/fixtures/vcr_cassettes/sso/profile.yml +++ /dev/null @@ -1,74 +0,0 @@ ---- -http_interactions: - - request: - method: get - uri: https://api.workos.com/sso/profile - body: - encoding: US-ASCII - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; arm64-darwin20; v1.0.0 - Authorization: - - Bearer access_token - response: - status: - code: 200 - message: OK - headers: - Server: - - Cowboy - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - X-Dns-Prefetch-Control: - - "off" - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - "0" - X-Request-Id: - - 45f253d6-51bb-4171-879a-d532f0275044 - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "545" - Etag: - - W/"221-LoXMZbv3vrn7lnJvNn6G/pqr7+c" - Date: - - Tue, 18 May 2021 22:55:21 GMT - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: - '{"object":"profile","id":"prof_01EEJTY9SZ1R350RB7B73SNBKF","organization_id":"org_01FG53X8636WSNW2WEKB2C31ZB","connection_id":"conn_01E83FVYZHY7DM4S9503JHV0R5","connection_type":"GoogleOAuth","idp_id":"116485463307139932699","email":"bob.loblaw@workos.com","first_name":"Bob","last_name":"Loblaw","role":{"slug":"member"},"roles":[{"slug":"member"}],"custom_attributes":{},"raw_attributes":{"hd":"workos.com","id":"116485463307139932699","name":"Bob - Loblaw","email":"bob.loblaw@workos.com","locale":"en","picture":"https://lh3.googleusercontent.com/a-/AOh14GyO2hLlgZvteDQ3Ldi3_-RteZLya0hWH7247Cam=s96-c","given_name":"Bob","family_name":"Loblaw","verified_email":true}}' - http_version: - recorded_at: Tue, 18 May 2021 22:55:21 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml deleted file mode 100644 index 5e98f9c5..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"code":"invalid","client_id":"client_123","client_secret":"","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0 - (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"authorization_code"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Wed, 30 Aug 2023 19:51:51 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "92" - Connection: - - keep-alive - Cf-Ray: - - 7fef92211809c715-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"5c-iYZxvYBkO+QosPHgQENUzbE8Uac" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 470506e4-7be1-464c-8d2c-8ce98207bff6 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=T4FglgOdveH_UrrH3p1bZTMlmgx6dOp6MwUIacX.Ilw-1693425111-0-AeeLZFZ2Ai2iZTCSKu01aHk1f9fy95FYgYE79bYIpSi63zy8YTFMKhaIQlHj2CfrK485zE0frTrbD+76Rve+trw=; - path=/; expires=Wed, 30-Aug-23 20:21:51 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=3e9a5d359ba92753e7626245fef8b2f1ee096477-1693425111; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: - '{"error":"invalid_grant","error_description":"The code ''452079'' has - expired or is invalid."}' - http_version: - recorded_at: Wed, 30 Aug 2023 19:51:51 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml deleted file mode 100644 index 275ee799..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"code":"01H93ZZHA0JBHFJH9RR11S83YN","client_id":"client_123","client_secret":"","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0 - (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"authorization_code"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 30 Aug 2023 19:51:51 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fef921deeca091f-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"13b-pHataL1lHEvsW5EO4vq5QgAdcWw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 630bec5a-5a13-4311-a0b7-958889a3bbb2 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=o5KBdIAUFZp0azSQnnd1GlQcIlcPCz95uFg6hFNnKM8-1693425111-0-ARSauqdojZdKD6Z7vp12JBrxCp6wE1s0JzEhaN0XE2DqME76OnJiDJugj2TsbNGXtqWaH3By7XHUXVZDf+AdFxU=; - path=/; expires=Wed, 30-Aug-23 20:21:51 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=3e9a5d359ba92753e7626245fef8b2f1ee096477-1693425111; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"user":{"object":"user","id":"user_01H93ZY4F80YZRRS6N59Z2HFVS","email":"test@workos.app","email_verified":false,"first_name":"Lucille","last_name":"Bluth","created_at":"2023-08-30T19:50:13.214Z","updated_at":"2023-08-30T19:50:13.214Z","user_type":"managed","sso_profile_id":"prof_01H93ZTVWYPAT4RKDSPFPPXH0J"},"access_token":"","refresh_token":""}' - http_version: - recorded_at: Wed, 30 Aug 2023 19:51:51 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml deleted file mode 100644 index 30d13c4f..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: '{"code":"01HRX85ATQB2MN40K4FZ9C2HFR","client_id":"client_01GS91XFB2YPR1C0NR5SH758Q0","client_secret":"","ip_address":null,"user_agent":null,"grant_type":"authorization_code"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.1; arm64-darwin21; v4.0.0 - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 14 Mar 2024 01:10:34 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '875' - Connection: - - keep-alive - Cf-Ray: - - 8640628169fa0d54-LAX - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"47c-66YSPNMN47PZx4ahCgTQvmryR90" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f22ea52f-bf1a-4d5e-acb1-10b2e99ffbe5 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=pYiV6zsrN3V8vd8vKA_bp0qN2LYd1HUQAIVHcevLYw4-1710378634-1.0.1.1-wNPVRK6jpySHc7bqiAVCtM6T64oKxFAjrcvJNJAPU.RhZFRgPfQRGWYbC4l0ckcsyhZ2_I7GTu17yNowC.smHA; - path=/; expires=Thu, 14-Mar-24 01:40:34 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=914cc38ede83520e897d1eaef25a8e5daa4975d0-1710378634; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"user":{"object":"user","id":"user_01HP0B4ZV2FWWVY0BF16GFDAER","email":"bob@example.com","email_verified":false,"first_name":"Bob","last_name":"Loblaw","profile_picture_url":null,"created_at":"2024-02-06T23:13:18.137Z","updated_at":"2024-02-06T23:13:36.946Z"},"impersonator":{"email":"admin@foocorp.com","reason":"For testing."},"access_token":"","refresh_token":""}' - http_version: - recorded_at: Thu, 14 Mar 2024 01:10:34 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml deleted file mode 100644 index 7f5e0f05..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"code":"01H93ZZHA0JBHFJH9RR11S83YN","client_id":"client_123","client_secret":"","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0 - (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"authorization_code"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 30 Aug 2023 19:51:51 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fef921deeca091f-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"13b-pHataL1lHEvsW5EO4vq5QgAdcWw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 630bec5a-5a13-4311-a0b7-958889a3bbb2 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=o5KBdIAUFZp0azSQnnd1GlQcIlcPCz95uFg6hFNnKM8-1693425111-0-ARSauqdojZdKD6Z7vp12JBrxCp6wE1s0JzEhaN0XE2DqME76OnJiDJugj2TsbNGXtqWaH3By7XHUXVZDf+AdFxU=; - path=/; expires=Wed, 30-Aug-23 20:21:51 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=3e9a5d359ba92753e7626245fef8b2f1ee096477-1693425111; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"user":{"object":"user","id":"user_01H93ZY4F80YZRRS6N59Z2HFVS","email":"test@workos.app","email_verified":false,"first_name":"Lucille","last_name":"Bluth","created_at":"2023-08-30T19:50:13.214Z","updated_at":"2023-08-30T19:50:13.214Z","user_type":"managed","sso_profile_id":"prof_01H93ZTVWYPAT4RKDSPFPPXH0J"},"access_token":"","refresh_token":"","oauth_tokens":{"access_token":"oauth_access_token","refresh_token":"oauth_refresh_token","scopes":["read","write"],"expires_at":1234567890}}' - http_version: - recorded_at: Wed, 30 Aug 2023 19:51:51 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml deleted file mode 100644 index 014c4487..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"code":"invalid","client_id":"client_123","client_secret":"","grant_type":"urn:workos:oauth:grant-type:email-verification:code", "pending_authentication_token="pending_authentication_token_1234"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Wed, 30 Aug 2023 19:51:51 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fef921deeca091f-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"13b-pHataL1lHEvsW5EO4vq5QgAdcWw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 630bec5a-5a13-4311-a0b7-958889a3bbb2 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=o5KBdIAUFZp0azSQnnd1GlQcIlcPCz95uFg6hFNnKM8-1693425111-0-ARSauqdojZdKD6Z7vp12JBrxCp6wE1s0JzEhaN0XE2DqME76OnJiDJugj2TsbNGXtqWaH3By7XHUXVZDf+AdFxU=; - path=/; expires=Wed, 30-Aug-23 20:21:51 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=3e9a5d359ba92753e7626245fef8b2f1ee096477-1693425111; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: - '{"error":"invalid_grant","error_description":"The code ''452079'' has - expired or is invalid."}' - http_version: - recorded_at: Wed, 30 Aug 2023 19:51:51 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml deleted file mode 100644 index 25cdf812..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml +++ /dev/null @@ -1,81 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"code":"123456","client_id":"client_123","client_secret":"","grant_type":"urn:workos:oauth:grant-type:email-verification:code", "pending_authentication_token="pending_authentication_token_1234"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 30 Aug 2023 19:51:51 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fef921deeca091f-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"13b-pHataL1lHEvsW5EO4vq5QgAdcWw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 630bec5a-5a13-4311-a0b7-958889a3bbb2 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=o5KBdIAUFZp0azSQnnd1GlQcIlcPCz95uFg6hFNnKM8-1693425111-0-ARSauqdojZdKD6Z7vp12JBrxCp6wE1s0JzEhaN0XE2DqME76OnJiDJugj2TsbNGXtqWaH3By7XHUXVZDf+AdFxU=; - path=/; expires=Wed, 30-Aug-23 20:21:51 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=3e9a5d359ba92753e7626245fef8b2f1ee096477-1693425111; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"user":{"object":"user","id":"user_01H93ZY4F80YZRRS6N59Z2HFVS","email":"test@workos.app","email_verified":false,"first_name":"Lucille","last_name":"Bluth","created_at":"2023-08-30T19:50:13.214Z","updated_at":"2023-08-30T19:50:13.214Z","user_type":"managed","sso_profile_id":"prof_01H93ZTVWYPAT4RKDSPFPPXH0J"},"access_token":"","refresh_token":""}' - http_version: - recorded_at: Wed, 30 Aug 2023 19:51:51 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml deleted file mode 100644 index 85d2da91..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"code":"invalid","email":"test@workos.com","client_id":"client_123","client_secret":"","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0 - (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"urn:workos:oauth:grant-type:magic-auth:code"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Wed, 30 Aug 2023 18:58:01 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fef4344cb386811-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"86-X4Q7F02iXed9FifFtOSpB/M42Bc" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 4d33111f-a488-4250-a946-7dceb07af151 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=vPqfj2Z.hrS6vFkS6IuPzCyzTvKEzqKRxfwaaFAaaO8-1693421881-0-AUTukg7nPdQwavyZXIMKFWXnk+xXmC4q0ioe3Jalz3feLjTbouHB5lBI/Qp99KfZyslQxRxMlvJPeDo2iBOYbGs=; - path=/; expires=Wed, 30-Aug-23 19:28:01 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=16391e6119f12d4d9bca79552f799341cb54e8ef-1693421881; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"User not found: ''user_01H93WD0R0KWF8Q7BK02C0RPY''.","code":"entity_not_found","entity_id":"user_01H93WD0R0KWF8Q7BK02C0RPY"}' - http_version: - recorded_at: Wed, 30 Aug 2023 18:58:01 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml deleted file mode 100644 index 22b23850..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"code":"452079","email":"test@workos.com","client_id":"client_123","client_secret":"","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0 - (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"urn:workos:oauth:grant-type:magic-auth:code"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 30 Aug 2023 18:58:00 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fef43410e21ec40-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"178-SVaSEtrIczZQlwnTK57+aDrxt/g" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - ba8fd1ed-34e6-408e-afe0-75e16e6cf3cb - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=ltLsz5yJcK6FuzoGfz2T0FBF9H_Lii_9fMu.1kAgrw8-1693421880-0-AR414sJ/FdSxY+N35vtic7XqJ78+FE0W2D5l5tR5eJbVJcm2X5/eqNg9xzMprMd1J1Eegol3Qa1KMntgknAj9l8=; - path=/; expires=Wed, 30-Aug-23 19:28:00 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=d0c3b10fd259e1dd63341e19d261a235baabb4af-1693421880; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"user":{"object":"user","id":"user_01H93WD0R0KWF8Q7BK02C0RPYJ","email":"test@workos.app","email_verified":true,"first_name":"Lucille","last_name":"Bluth","created_at":"2023-08-30T18:48:26.517Z","updated_at":"2023-08-30T18:58:00.821Z","user_type":"unmanaged","email_verified_at":"2023-08-30T18:58:00.915Z","google_oauth_profile_id":null,"microsoft_oauth_profile_id":null},"access_token":"","refresh_token":""}' - http_version: - recorded_at: Wed, 30 Aug 2023 18:58:00 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml deleted file mode 100644 index 3b7ef234..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml +++ /dev/null @@ -1,81 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: '{"client_id":"project_01EGKAEB7G5N88E83MF99J785F","client_secret":"","ip_address":null,"user_agent":null,"grant_type":"urn:workos:oauth:grant-type:organization-selection","organization_id":"invalid_org_id","pending_authentication_token":"pending_authentication_token_1234"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.6; arm64-darwin23; v2.16.0 - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Wed, 20 Dec 2023 22:00:13 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '155' - Connection: - - keep-alive - Cf-Ray: - - 838b28288bab1588-SJC - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"9b-OK0o7f8HUr1VD42cGHuyxEaTUsQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - be14dde8-2d00-4b00-8619-4586c0d811af - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=7BxHtdm8uv2CHfYDw8rzp4.OIRtS41sROdLi.QeBoos-1703109613-1-AZjOgJ3uXY3OUH0x0E2p9lf4mQWAiN95j2vUJ2WZTkH/bRMjJMiKm0bBtrV4A8ok8elfmr34+mQGJaTw4FHR7ww=; - path=/; expires=Wed, 20-Dec-23 22:30:13 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=71b77aa5ec84c0fc82c02ff4d4fc8e8ae6d37ee3-1703109613; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"code":"invalid_pending_authentication_token","message":"The pending_authentication_token - ''pending_authentication_token_1234'' has expired or is invalid."}' - http_version: - recorded_at: Wed, 20 Dec 2023 22:00:13 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml deleted file mode 100644 index 61b18750..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"client_id":"project_01EGKAEB7G5N88E83MF99J785F","client_secret":"","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0 - (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"urn:workos:oauth:grant-type:organization-selection","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","pending_authentication_token":"pending_authentication_token_1234"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.6; arm64-darwin23; v2.16.0 - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 20 Dec 2023 22:00:12 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "155" - Connection: - - keep-alive - Cf-Ray: - - 838b2825b878fad6-SJC - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"9b-OK0o7f8HUr1VD42cGHuyxEaTUsQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 63def249-6e78-46d3-8289-939aab5b232e - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=VFWq3DG4vQE5c_IcmK6dGE.XEoss3DhFFsaogQ1KgCc-1703109612-1-AbJic+K1H2u1qaFULTbKzgQYpgyHIjzHB8DM2tkKUcC3nMNsOXV0WlSYcRS4s3l4BAMeAjDsdjllwxm3CLN063E=; - path=/; expires=Wed, 20-Dec-23 22:30:12 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=ca64bb4ffb95b2c79caf4149a1944be0a9d16462-1703109612; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","user":{"object":"user","id":"user_01H93WD0R0KWF8Q7BK02C0RPYJ","email":"test@workos.app","email_verified":true,"first_name":"Lucille","last_name":"Bluth","created_at":"2023-08-30T18:48:26.517Z","updated_at":"2023-08-30T18:58:00.821Z","user_type":"unmanaged","email_verified_at":"2023-08-30T18:58:00.915Z","google_oauth_profile_id":null,"microsoft_oauth_profile_id":null},"access_token":"","refresh_token":""}' - http_version: - recorded_at: Wed, 20 Dec 2023 22:00:12 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml deleted file mode 100644 index 472422db..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"client_id":"client_123","client_secret":"","email":"invalid@workos.app","password":"invalid","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0 - (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"password"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Tue, 29 Aug 2023 00:24:25 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fe0a6a5aff008df-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"68-vJ+qM+jhqT7OYdncb+ks9c+Wbao" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 0ed3cdf7-03f9-4b37-bbc8-b86834679ed9 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=_uZ1fHEnPVRWYuwQtAju5yf86eP5qqgBjNwvB2Albts-1693268665-0-Ads+iW6svcBYUZvMoNJBzxcUx+KQnhea78QwLCa2DUxT70OtGFXL95y+5BVHtkU4+a0vq1478vpuWzCr/dUzHls=; - path=/; expires=Tue, 29-Aug-23 00:54:25 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=beafd87202de7b7d34fd4a1af55696cb5d19364d-1693268665; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"User not found: ''other@blips.app''.","code":"entity_not_found","entity_id":"other@blips.app"}' - http_version: - recorded_at: Tue, 29 Aug 2023 00:24:25 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml deleted file mode 100644 index aa2fc1f5..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"client_id":"client_123","client_secret":"","email":"unverified@workos.app","password":"7YtYic00VWcXatPb","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0 - (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"password"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - '*/*' - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 403 - message: Email ownership must be verified before authentication. - headers: - Date: - - Tue, 29 Aug 2023 00:24:25 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fe0a6a27b0bc39c-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"16e-hoaHaR0EhmAH7TaNBOF8B2OHJq4" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 62990367-ddaf-46b3-a32f-38fc4f29d581 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=IiwoT1XAlPdVWj334oRTocU7zZyvKgYw61o0UoA7GtE-1693268665-0-AZTn/iGDfGV6R5j3aj7lcPod7FB9P3cbHc9pD1oN/U5ZmnUYvpCecp6AL+8p/+/bMuwwGqXGNMSa/eIpa0TVm+I=; - path=/; expires=Tue, 29-Aug-23 00:54:25 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=beafd87202de7b7d34fd4a1af55696cb5d19364d-1693268665; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"code":"email_verification_required", "message":"Email ownership must be verified before authentication.", "email":"unverified@workos.app", "pending_authentication_token":"RWx94aFHwanPOebv7tKbBkJm0", "email_verification_id":"email_verification_01JG43A0WYAFAPHMNBV5XF2R4M"}' - http_version: - recorded_at: Tue, 29 Aug 2023 00:24:25 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml deleted file mode 100644 index f7180823..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"client_id":"client_123","client_secret":"","email":"test@workos.app","password":"7YtYic00VWcXatPb","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0 - (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"password"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 29 Aug 2023 00:24:25 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fe0a6a27b0bc39c-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"16e-hoaHaR0EhmAH7TaNBOF8B2OHJq4" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 62990367-ddaf-46b3-a32f-38fc4f29d581 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=IiwoT1XAlPdVWj334oRTocU7zZyvKgYw61o0UoA7GtE-1693268665-0-AZTn/iGDfGV6R5j3aj7lcPod7FB9P3cbHc9pD1oN/U5ZmnUYvpCecp6AL+8p/+/bMuwwGqXGNMSa/eIpa0TVm+I=; - path=/; expires=Tue, 29-Aug-23 00:54:25 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=beafd87202de7b7d34fd4a1af55696cb5d19364d-1693268665; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"user":{"object":"user","id":"user_01H7TVSKS45SDHN5V9XPSM6H44","email":"test@workos.app","email_verified":true,"first_name":null,"last_name":null,"created_at":"2023-08-14T20:28:58.929Z","updated_at":"2023-08-28T15:56:19.798Z","user_type":"unmanaged","email_verified_at":"2023-08-22T11:18:01.850Z","google_oauth_profile_id":null,"microsoft_oauth_profile_id":null},"access_token":"","refresh_token":""}' - http_version: - recorded_at: Tue, 29 Aug 2023 00:24:25 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml deleted file mode 100644 index e29809e0..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml +++ /dev/null @@ -1,81 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: '{"refresh_token":"invalid","client_id":"client_123","client_secret":"","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0 - (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"refresh_token"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.2.2; arm64-darwin22; v4.0.0 - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Tue, 19 Mar 2024 16:06:37 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '70' - Connection: - - keep-alive - Cf-Ray: - - 866eb5f11e5f5304-SLC - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"46-6ugkBnqF9SxNnhijAAHjGcT083A" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 32619697-61a5-4ad1-80ab-9d26a6a74d12 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=QdnPZspsJTPGj.ljZ.hfxMSzw0C1in.rjVkGjY75Ht8-1710864397-1.0.1.1-dA2qdL_CwORHen0HwGvbeJXGixoc_htTepIFYUnChePSsMpTdvHI7pWe0ddNWtrRbDD6GEK7TkgM7qPdAXVsaw; - path=/; expires=Tue, 19-Mar-24 16:36:37 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=a7cc4637e2746cb557755f0665c5f2a6206b907a-1710864397; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"error":"invalid_grant","error_description":"Invalid refresh token."}' - http_version: - recorded_at: Tue, 19 Mar 2024 16:06:37 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml deleted file mode 100644 index dd1b3328..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"refresh_token":"some_refresh_token","client_id":"client_123","client_secret":"","ip_address":"200.240.210.16","user_agent":"Mozilla/5.0 - (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36","grant_type":"refresh_token"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - '*/*' - User-Agent: - - WorkOS; ruby/3.2.2; arm64-darwin22; v4.0.0 - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 18 Mar 2024 19:00:53 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 866777d63b4627e8-SLC - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"335-M3MDQYhs5724SayBHHCwnBDn3qA" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 995ed1ed-e892-4049-86c9-0e07baa6cc4b - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=2NHqv1cd1BisOc8KKcQ0oNzFxZZT4OHQd6c2QDuGnUU-1710788453-1.0.1.1-4BxBRzVrhL7rCH895PcfORXr_6Rnj3Oh5w1YG4xi7X1st62LMzb5dHZO7u7P.V1P8nBDAAt3Wbz7xsDTWrfWJg; - path=/; expires=Mon, 18-Mar-24 19:30:53 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=06035c17e9b60a1d7a42a5b568146a0bb71a06dc-1710788453; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"user":{"object":"user","id":"user_01H93WD0R0KWF8Q7BK02C0RPYJ","email":"test@workos.app","email_verified":true,"first_name":"Lucille","last_name":"Bluth","created_at":"2023-08-30T18:48:26.517Z","updated_at":"2023-08-30T18:58:00.821Z","user_type":"unmanaged","email_verified_at":"2023-08-30T18:58:00.915Z","google_oauth_profile_id":null,"microsoft_oauth_profile_id":null},"access_token":"","refresh_token":""}' - http_version: - recorded_at: Mon, 18 Mar 2024 19:00:53 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml deleted file mode 100644 index 0be3127f..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"code":"invalid","client_id":"client_123","client_secret":"","grant_type":"urn:workos:oauth:grant-type:mfa-totp", "pending_authentication_token="pending_authentication_token_1234", "authentication_challenge_id": "authentication_challenge_id_1234"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Wed, 30 Aug 2023 19:51:51 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fef921deeca091f-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"13b-pHataL1lHEvsW5EO4vq5QgAdcWw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 630bec5a-5a13-4311-a0b7-958889a3bbb2 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=o5KBdIAUFZp0azSQnnd1GlQcIlcPCz95uFg6hFNnKM8-1693425111-0-ARSauqdojZdKD6Z7vp12JBrxCp6wE1s0JzEhaN0XE2DqME76OnJiDJugj2TsbNGXtqWaH3By7XHUXVZDf+AdFxU=; - path=/; expires=Wed, 30-Aug-23 20:21:51 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=3e9a5d359ba92753e7626245fef8b2f1ee096477-1693425111; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: - '{"error":"invalid_grant","error_description":"The code ''452079'' has - expired or is invalid."}' - http_version: - recorded_at: Wed, 30 Aug 2023 19:51:51 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml b/test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml deleted file mode 100644 index a7b36591..00000000 --- a/test/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml +++ /dev/null @@ -1,81 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/authenticate - body: - encoding: UTF-8 - string: - '{"code":"123456","client_id":"client_123","client_secret":"","grant_type":"urn:workos:oauth:grant-type:mfa-totp", "pending_authentication_token="pending_authentication_token_1234", "authentication_challenge_id": "authentication_challenge_id_1234"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 30 Aug 2023 19:51:51 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fef921deeca091f-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"13b-pHataL1lHEvsW5EO4vq5QgAdcWw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 630bec5a-5a13-4311-a0b7-958889a3bbb2 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=o5KBdIAUFZp0azSQnnd1GlQcIlcPCz95uFg6hFNnKM8-1693425111-0-ARSauqdojZdKD6Z7vp12JBrxCp6wE1s0JzEhaN0XE2DqME76OnJiDJugj2TsbNGXtqWaH3By7XHUXVZDf+AdFxU=; - path=/; expires=Wed, 30-Aug-23 20:21:51 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=3e9a5d359ba92753e7626245fef8b2f1ee096477-1693425111; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"user":{"object":"user","id":"user_01H93ZY4F80YZRRS6N59Z2HFVS","email":"test@workos.app","email_verified":false,"first_name":"Lucille","last_name":"Bluth","created_at":"2023-08-30T19:50:13.214Z","updated_at":"2023-08-30T19:50:13.214Z","user_type":"managed","sso_profile_id":"prof_01H93ZTVWYPAT4RKDSPFPPXH0J"},"access_token":"","refresh_token":""}' - http_version: - recorded_at: Wed, 30 Aug 2023 19:51:51 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml b/test/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml deleted file mode 100644 index e944c016..00000000 --- a/test/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/password_reset/confirm - body: - encoding: UTF-8 - string: '{"token":"bogus_token","new_password":"new_password"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin23; v2.16.0 - Authorization: - - 'Bearer ' - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Sat, 25 Nov 2023 21:46:08 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '26' - Connection: - - keep-alive - Cf-Ray: - - 82bd15298d6aa562-GRU - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f1a0b3f8-67fb-4885-81f8-18a40a4dd2c5 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=bOqLLKZ3OqpZ3OPfDa2w7klrkJKdkS9Y9apX.l.nSYU-1700948768-0-AbdBkjCZaXQcftSAC9N6KB1K0k2BGHaZZkJ2fqyngyDfWsGZiI9MnCe7HXBU8jhuevFp6MC8kxfWFY3tgW2hFZI=; - path=/; expires=Sat, 25-Nov-23 22:16:08 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=7aeaa81f9fe2d2f5c00011adcc897a137e871796-1700948768; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"message":"Unauthorized"}' - http_version: - recorded_at: Sat, 25 Nov 2023 21:46:08 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml b/test/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml deleted file mode 100644 index ad91e49a..00000000 --- a/test/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/password_reset/confirm - body: - encoding: UTF-8 - string: '{"token":"eEgAgvAE0blvU1zWV3yWVAD22","new_password":"very_cool_new_pa$$word"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin23; v2.16.0 - Authorization: - - 'Bearer ' - response: - status: - code: 401 - message: Unauthorized - headers: - Date: - - Sat, 25 Nov 2023 21:46:08 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '26' - Connection: - - keep-alive - Cf-Ray: - - 82bd15254f97a56e-GRU - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 7b813ca7-add6-4a7f-a7de-62b6a888543a - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=hmCZ.6OoiqzmwuUv6cpz.7XUdZcGTwNtfljW2v0dgPU-1700948768-0-ARWxWopNivTNFw8yWMnXuWh02wkLM9ahNWpAbgpDrKDdgzjMG7NPI1AQS81qrJakN4McyBudLtMYxrrVSoLm0I0=; - path=/; expires=Sat, 25-Nov-23 22:16:08 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=7aeaa81f9fe2d2f5c00011adcc897a137e871796-1700948768; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"message":"Unauthorized"}' - http_version: - recorded_at: Sat, 25 Nov 2023 21:46:07 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml b/test/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml deleted file mode 100644 index 7f095046..00000000 --- a/test/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/magic_auth - body: - encoding: UTF-8 - string: '{"email":"test@workos.com","invitation_token":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.4.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Thu, 02 May 2024 23:50:29 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '274' - Connection: - - keep-alive - Cf-Ray: - - 87dbe9f0989051df-DEN - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"112-XzVK2s+8XVoqs9cCTPJC7VyC3IQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 0ffddb81-5eac-4de6-b5a9-e93fade6db93 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=Vlzipf6hw8yFfYVC2LuTclSbuxE96I2boK9h6dPBL8Q-1714693829-1.0.1.1-r0i0ukq1UXcWzb3__XYkiwuWdnr5jKhXUTYKG_qhrrhgDNzb7o7cUugM4YPS1YWV5RS1xdvDBXigLY0AV66mAg; - path=/; expires=Fri, 03-May-24 00:20:29 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=94afbb49471958910ded5cab91db63de8d3d47e6-1714693829; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"magic_auth","id":"magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9","user_id":"user_01HWXVEWSWSJ66VE29AD14KZ0C","email":"test@workos.com","code":"500013","expires_at":"2024-05-03T00:00:29.528Z","created_at":"2024-05-02T23:50:29.479Z","updated_at":"2024-05-02T23:50:29.479Z"}' - http_version: - recorded_at: Thu, 02 May 2024 23:50:29 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml b/test/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml deleted file mode 100644 index c11c81c1..00000000 --- a/test/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/organization_memberships - body: - encoding: UTF-8 - string: '{"user_id":"","organization_id":""}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 422 - message: Unprocessable Entity - headers: - Date: - - Wed, 16 Aug 2023 22:20:27 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '159' - Connection: - - keep-alive - Cf-Ray: - - 7f7d108dbb190c96-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"9f-BfzHwYu4Bw+fPyyn8hWTmMF4Lio" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 2613d428-dfcc-4a40-8a32-d8b5634ad25e - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=A.5rC7UV26nOVmm0JDUdbBqITMPrX4eH4TaWgNTR8vw-1692224427-0-Abv9MzVBcqqhkKXLp7mgiOMgg+6rW9W3BKhbbhAR3P3msKzRNGsvztll65omw63yshr4A4S4FTvipQJGajpKRws=; - path=/; expires=Wed, 16-Aug-23 22:50:27 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=e57296bbc6ac05c18bc3a943f7bfc936fa954094-1692224427; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"code":"invalid_request_parameters","message":"Validation failed","errors":[{"code":"user_id_string_required","message":"User ID - should be a non-empty string."}]}' - http_version: - recorded_at: Wed, 16 Aug 2023 22:20:27 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml b/test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml deleted file mode 100644 index 2ec456d1..00000000 --- a/test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/organization_memberships - body: - encoding: UTF-8 - string: '{"user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Thu, 17 Aug 2023 14:20:07 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '335' - Connection: - - keep-alive - Cf-Ray: - - 7f828e50ac5dc41d-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"14f-2n2KgFcHBXf1Yz7SYqzpAxR3E/E" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 8d277b87-b703-40d2-95ac-5f40bf96fcbf - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=Pd2y8tPXDzQthhv7HAd93AsNAjT9V0tbWdH6PzS_iyA-1692282007-0-AUsV9W08vMNk02vMMYwMWj3KVIAJtXMGZdhGaWVL9yL3e4S5D1cGL2925nELffPsxoejtsVqyeqdvIixzD7UnL8=; - path=/; expires=Thu, 17-Aug-23 14:50:07 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=432b4f1724bbd993a76e1e2e8c4d5e2381680fb1-1692282007; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status":"active","role":{"slug":"member"},"directory_managed":false,"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' - http_version: - recorded_at: Thu, 17 Aug 2023 14:20:07 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml b/test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml deleted file mode 100644 index c83a3f62..00000000 --- a/test/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/organization_memberships - body: - encoding: UTF-8 - string: '{"user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","role_slugs":["admin","member"]}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin24; v5.25.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Mon, 06 Oct 2025 19:57:34 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '26' - Connection: - - keep-alive - Server: - - cloudflare - Cf-Ray: - - 98a7ba7fea91ead7-ORD - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 6507807d-d3b9-4e8f-9ca8-f84c6f9c6eb4 - X-Xss-Protection: - - '0' - Set-Cookie: - - _cfuvid=recfIuOTSO3jIxK5SUOdhHRRfTGoiOFOMgSbEpVIjpg-1759780654123-0.0.1.1-604800000; - path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None - body: - encoding: UTF-8 - string: '{"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status":"active","role":{"slug":"member"}, "roles":[{"slug":"member"}, {"slug":"admin"}], "directory_managed":false,"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' - recorded_at: Mon, 06 Oct 2025 19:57:34 GMT -recorded_with: VCR 6.3.1 diff --git a/test/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml b/test/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml deleted file mode 100644 index d6f523ed..00000000 --- a/test/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/password_reset - body: - encoding: UTF-8 - string: '{"email":"blair@workos.com"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.6.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Thu, 23 May 2024 18:08:51 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '397' - Connection: - - keep-alive - Cf-Ray: - - 8886fe5e1c317b24-DEN - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"18d-Z6VC8jkvZuXmNL0BcJcqkF7M0BQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - db59df36-fce8-4174-a031-bd259bca32f8 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=d6moUiiUczj82CNolGPFWxb99g4YP_C.ZlaH9W7xnF8-1716487731-1.0.1.1-pRG1tKVpL4EV8NrdL78THPAhMdBiKwY_tOlgnuanVHgNFvw6MeMv2wJG0Nkp4oLwXdW629gkH1OwSaLIv9EuYQ; - path=/; expires=Thu, 23-May-24 18:38:51 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=bd64ac4e2572b6fc609d5cc06577eed03bc1bbcb-1716487731; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"password_reset","id":"password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT","user_id":"user_01HH5GTVSP6PEXV0SRB9ANFE9G","email":"test@workos.com","password_reset_token":"DmNQt1ZWOz7k5hulOoGDN0TZd","password_reset_url":"https://my-app.com/reset-password/?token=DmNQt1ZWOz7k5hulOoGDN0TZd","expires_at":"2024-05-23T18:23:51.024Z","created_at":"2024-05-23T18:08:51.024Z"}' - http_version: - recorded_at: Thu, 23 May 2024 18:08:50 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/create_user_invalid.yml b/test/fixtures/vcr_cassettes/user_management/create_user_invalid.yml deleted file mode 100644 index 2a23e25b..00000000 --- a/test/fixtures/vcr_cassettes/user_management/create_user_invalid.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/users - body: - encoding: UTF-8 - string: '{"email":"","password":null,"first_name":null,"last_name":null,"email_verified":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 422 - message: Unprocessable Entity - headers: - Date: - - Wed, 16 Aug 2023 22:20:27 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '159' - Connection: - - keep-alive - Cf-Ray: - - 7f7d108dbb190c96-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"9f-BfzHwYu4Bw+fPyyn8hWTmMF4Lio" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 2613d428-dfcc-4a40-8a32-d8b5634ad25e - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=A.5rC7UV26nOVmm0JDUdbBqITMPrX4eH4TaWgNTR8vw-1692224427-0-Abv9MzVBcqqhkKXLp7mgiOMgg+6rW9W3BKhbbhAR3P3msKzRNGsvztll65omw63yshr4A4S4FTvipQJGajpKRws=; - path=/; expires=Wed, 16-Aug-23 22:50:27 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=e57296bbc6ac05c18bc3a943f7bfc936fa954094-1692224427; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"code":"invalid_request_parameters","message":"Validation failed","errors":[{"code":"email_string_required","message":"Email - should be a non-empty string."}]}' - http_version: - recorded_at: Wed, 16 Aug 2023 22:20:27 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/create_user_valid.yml b/test/fixtures/vcr_cassettes/user_management/create_user_valid.yml deleted file mode 100644 index b137655a..00000000 --- a/test/fixtures/vcr_cassettes/user_management/create_user_valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/users - body: - encoding: UTF-8 - string: '{"email":"foo@example.com","password":null,"first_name":"Foo","last_name":"Bar","email_verified":true}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Thu, 17 Aug 2023 14:20:07 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '335' - Connection: - - keep-alive - Cf-Ray: - - 7f828e50ac5dc41d-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"14f-2n2KgFcHBXf1Yz7SYqzpAxR3E/E" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 8d277b87-b703-40d2-95ac-5f40bf96fcbf - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=Pd2y8tPXDzQthhv7HAd93AsNAjT9V0tbWdH6PzS_iyA-1692282007-0-AUsV9W08vMNk02vMMYwMWj3KVIAJtXMGZdhGaWVL9yL3e4S5D1cGL2925nELffPsxoejtsVqyeqdvIixzD7UnL8=; - path=/; expires=Thu, 17-Aug-23 14:50:07 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=432b4f1724bbd993a76e1e2e8c4d5e2381680fb1-1692282007; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"user","id":"user_01H81XWBPCV7Y9Q3DHCZHZ9SF8","email":"foo@example.com","first_name":"Foo","last_name":"Bar","created_at":"2023-08-17T14:20:07.199Z","updated_at":"2023-08-17T14:20:07.199Z","email_verified":true}' - http_version: - recorded_at: Thu, 17 Aug 2023 14:20:07 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml b/test/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml deleted file mode 100644 index 2447ebdc..00000000 --- a/test/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml +++ /dev/null @@ -1,77 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/users - body: - encoding: UTF-8 - string: '{"email":"external@example.com","password":null,"first_name":"External","last_name":"User","email_verified":null,"external_id":"ext_user_123","password_hash":null,"password_hash_type":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin24; v5.20.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Tue, 22 Jul 2025 19:00:50 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '326' - Connection: - - keep-alive - Cf-Ray: - - 96352ee9395c36b3-YYZ - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"146-upR+rp+FopOrmNrHPnshQZCSTFg" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 0ca01f80-ab79-4dac-ac38-85013ee190fc - X-Xss-Protection: - - '0' - Set-Cookie: - - _cfuvid=eS3jraDP_ZTVdNpNKtpQG80hPBRXhXcHuq1V_QbAQjY-1753210850912-0.0.1.1-604800000; - path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"user","id":"user_01K0SR53HJ58M957MYAB6TDZ9X","email":"external@example.com","email_verified":false,"first_name":"External","last_name":"User","profile_picture_url":null,"metadata":{},"last_sign_in_at":null,"created_at":"2025-07-22T19:00:50.852Z","updated_at":"2025-07-22T19:00:50.852Z","external_id":"ext_user_123"}' - http_version: - recorded_at: Tue, 22 Jul 2025 19:00:50 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml b/test/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml deleted file mode 100644 index d2e59d15..00000000 --- a/test/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -http_interactions: - - request: - method: put - uri: https://api.workos.com/user_management/organization_memberships/om_01HXYT0G3H5QG9YTSHSHFZQE6D/deactivate - body: - encoding: UTF-8 - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.3.0; arm64-darwin23; v4.5.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 15 May 2024 19:13:06 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Xss-Protection: - - "0" - body: - encoding: ASCII-8BIT - string: '{"object":"organization_membership","id":"om_01HXYT0G3H5QG9YTSHSHFZQE6D","organization_id":"org_01HRCVHACPY05V2FP0KEBQZYD3","user_id":"user_01HXYSZBKQE2N3NHBKZHDP1X5X","status":"inactive","role":{"slug":"member"},"directory_managed":false,"created_at":"2024-05-15T19:00:05.359Z","updated_at":"2024-05-15T19:13:06.259Z"}' - http_version: - recorded_at: Wed, 15 May 2024 19:13:06 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml b/test/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml deleted file mode 100644 index 99e5e407..00000000 --- a/test/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.workos.com/user_management/organization_memberships/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Fri, 25 Aug 2023 21:38:47 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fc6fbe4ef26ec80-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"58-5GtYccQgavNavjEU+gaKkOl1gq4" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f3bf3ce2-ed1c-4fdf-9bba-065c2ab4e5e3 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=VyJvcfBZAdCVUhGKRtHsl9enJXaR64T8urur5ClUQWY-1692999527-0-AahBwhyZ59RlA2LkZ5bsanqtnkJWCPSngTzr7vokapEBcsZzjppDl90U6KcM3t3w2iZ0p7uHvZZ5zI0G74Wlmg4=; - path=/; expires=Fri, 25-Aug-23 22:08:47 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=1a7b02324f49135ba91ab0fc79714ad620549ae5-1692999527; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"Organization Membership not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}' - http_version: - recorded_at: Fri, 25 Aug 2023 21:38:47 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml b/test/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml deleted file mode 100644 index 5077ad98..00000000 --- a/test/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.workos.com/user_management/organization_memberships/om_01H5JQDV7R7ATEYZDEG0W5PRYS - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Fri, 25 Aug 2023 21:34:33 GMT - Content-Length: - - '0' - Connection: - - keep-alive - Cf-Ray: - - 7fc6f5b3099d27a1-SEA - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 4360f118-e0a2-4268-b151-8d1937827fd6 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=oqV.TgF_9o3H.4tP5C9YodhA7dHiTLAoyxSgwfAobDU-1692999273-0-Abnb1JhKF9MP9ocItBnZFluz3W6rf1OEScevjc0NSioiyzuNkPdZLYPhsH0i388aVh6BWD+iLCQW3WgdYviU0DE=; - path=/; expires=Fri, 25-Aug-23 22:04:33 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=74c71c5ec19f5cb375dcedb89bcdb04a1d40efd6-1692999273; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '' - http_version: - recorded_at: Fri, 25 Aug 2023 21:34:33 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml b/test/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml deleted file mode 100644 index 69561c09..00000000 --- a/test/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.workos.com/user_management/users/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Fri, 25 Aug 2023 21:38:47 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fc6fbe4ef26ec80-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"58-5GtYccQgavNavjEU+gaKkOl1gq4" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f3bf3ce2-ed1c-4fdf-9bba-065c2ab4e5e3 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=VyJvcfBZAdCVUhGKRtHsl9enJXaR64T8urur5ClUQWY-1692999527-0-AahBwhyZ59RlA2LkZ5bsanqtnkJWCPSngTzr7vokapEBcsZzjppDl90U6KcM3t3w2iZ0p7uHvZZ5zI0G74Wlmg4=; - path=/; expires=Fri, 25-Aug-23 22:08:47 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=1a7b02324f49135ba91ab0fc79714ad620549ae5-1692999527; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"User not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}' - http_version: - recorded_at: Fri, 25 Aug 2023 21:38:47 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/delete_user/valid.yml b/test/fixtures/vcr_cassettes/user_management/delete_user/valid.yml deleted file mode 100644 index d7326bbb..00000000 --- a/test/fixtures/vcr_cassettes/user_management/delete_user/valid.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -http_interactions: -- request: - method: delete - uri: https://api.workos.com/user_management/users/user_01H7WRJBPAAHX1BYRQHEK7QC4A - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Fri, 25 Aug 2023 21:34:33 GMT - Content-Length: - - '0' - Connection: - - keep-alive - Cf-Ray: - - 7fc6f5b3099d27a1-SEA - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 4360f118-e0a2-4268-b151-8d1937827fd6 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=oqV.TgF_9o3H.4tP5C9YodhA7dHiTLAoyxSgwfAobDU-1692999273-0-Abnb1JhKF9MP9ocItBnZFluz3W6rf1OEScevjc0NSioiyzuNkPdZLYPhsH0i388aVh6BWD+iLCQW3WgdYviU0DE=; - path=/; expires=Fri, 25-Aug-23 22:04:33 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=74c71c5ec19f5cb375dcedb89bcdb04a1d40efd6-1692999273; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '' - http_version: - recorded_at: Fri, 25 Aug 2023 21:34:33 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml b/test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml deleted file mode 100644 index 74964278..00000000 --- a/test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/users/user_01H7TVSKS45SDHN5V9XPSM6H44/auth_factors - body: - encoding: US-ASCII - string: '{"type":"totp"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - 'Bearer ' - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Thu, 31 Aug 2023 23:40:52 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '26' - Connection: - - keep-alive - Cf-Ray: - - 7ff91efd88d838e1-YYZ - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 8eae4ac4-8213-4f3f-966f-a2421a113bf8 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=M_MJukGgDu7U9.wmReWdBW.NzCb1vSBzW1fvbnNPkMo-1693525252-0-AUtIKPsJjb1vSM1Q+ny4TPcpo5BpudZWt0gRLw9x5pZpvSPmYrftp68dc2cjpbRaKieTinfRpgEccLO5HiThNbQ=; - path=/; expires=Fri, 01-Sep-23 00:10:52 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=8d5f43bf29ca9bafc65d9794d1c54d31c49ef1bf-1693525252; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"message":"Unauthorized"}' - http_version: - recorded_at: Thu, 31 Aug 2023 23:40:52 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml b/test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml deleted file mode 100644 index 96a6cd04..00000000 --- a/test/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/users/user_01H7TVSKS45SDHN5V9XPSM6H44/auth_factors - body: - encoding: UTF-8 - string: '{"type":"totp"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: OK - headers: - Date: - - Fri, 25 Aug 2023 23:37:04 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fc7a9287d0330ba-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"153-w5d8Z7u7b9Obt9NziECtNSAY9Ac" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - b333b9e1-c9ec-4e99-ae4f-17a854859cf1 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=adC6w3NUNGTpdZDzNn39guANJ9wi798uCuqc_EI8190-1693006624-0-AcpsuyzFE/KdM7ev5pSVTt2vnGqCSZBOuQYZ0iKFiJT0mBlAuNITn3hICEKvcZ4LH7JUIyjnEOWfq2w7JyRmrJ4=; - path=/; expires=Sat, 26-Aug-23 00:07:04 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=1d0cc3edf886cc7b90bd0c9c3226f5611a385c1a-1693006624; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{ "authentication_factor": { "object": "authentication_factor", "id": "auth_factor_01H96FETXENNY99ARX0GRC804C", "user_id": "user_01H96FETWYSJMJEGF0Q3ZB272F", "type": "totp", "totp": { "issuer": "Foo Corp", "qr_code": "data:image/png;base64,iVBOR...", "secret": "OFAFOQAPHR6XMQKAIYMWU72XIE3DGI3P", "uri": "otpauth://totp/Foo%20Corp:user@foo-corp.com?secret=OFAFOQAPHR6XMQKAIYMWU72XIE3DGI3P&issuer=Foo%20Corp&algorithm=SHA1&digits=6&period=30", "user": "user@foo-corp.com" }, "created_at": "2023-08-31T18:59:57.962Z", "updated_at": "2023-08-31T18:59:57.962Z" }, "authentication_challenge": { "object": "authentication_challenge", "id": "auth_challenge_01H96FETXGTW1QMBSBT2T36PW0", "authentication_factor_id": "auth_factor_01H96FETXENNY99ARX0GRC804C", "expires_at": "2023-08-31T19:09:57.999Z", "created_at": "2023-08-31T18:59:57.962Z", "updated_at": "2023-08-31T18:59:57.962Z" } }' - http_version: - recorded_at: Fri, 25 Aug 2023 23:37:04 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml b/test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml deleted file mode 100644 index ada1c41d..00000000 --- a/test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/invitations/by_token/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.7.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 03 Jun 2024 20:16:37 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 88e25cab2e0c520c-DEN - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"5a-PPX6d4bMxLfMyXe/1aUqFNwW/Dc" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 7066479f-3c65-4eb0-a5ab-fa371e8747e5 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=V3RT_KMrnFyoIbj_1OgapyAtReNBXvdzeYmNZWQQt6Y-1717445797-1.0.1.1-XWQk50226uaRo4S1BTn3wou4.mFaLOC20eA_MhrSil._j0XoCx6I2Q0gmgtBp1j9.dHqkmf4ZwOw1j6RmBLSnQ; - path=/; expires=Mon, 03-Jun-24 20:46:37 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=cb54bc416259840c8c11ad58469ec2c5d9f88ff3-1717445797; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"Invitation not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}' - http_version: - recorded_at: Mon, 03 Jun 2024 20:16:37 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml b/test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml deleted file mode 100644 index 1fae0433..00000000 --- a/test/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/invitations/by_token/iUV3XbYajpJlbpw1Qt3ZKlaKx - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.7.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 03 Jun 2024 20:16:37 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 88e25ca97a127b32-DEN - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"1e5-ZUKH6e1N8G9JBxE8/nulDIEawKk" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 1359e287-00bc-4081-a3d9-6bfcded70273 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=WToCUplL1o5i0KSz5l81mSZ5SqsRh0MGwXHPwM7C.Sg-1717445797-1.0.1.1-KXhOU0BqmCe7ZDWcpEJ7V3gLLZpioBrWPxtyB5m2sOmYxj3GWOfjhqRz5d1L0cTOpGoT9OfeqzGa5qfmD0ELZw; - path=/; expires=Mon, 03-Jun-24 20:46:37 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=cb54bc416259840c8c11ad58469ec2c5d9f88ff3-1717445797; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"invitation","id":"invitation_01HZFVRAJ7EV7935K7H8NX2MRH","email":"blairlunceford@gmail.com","state":"pending","accepted_at":null,"revoked_at":null,"expires_at":"2024-06-10T20:13:21.862Z","organization_id":null,"inviter_user_id":null,"token":"iUV3XbYajpJlbpw1Qt3ZKlaKx","accept_invitation_url":"https://manageable-child-63-staging.authkit.app/invite/?invitation_token=iUV3XbYajpJlbpw1Qt3ZKlaKx","created_at":"2024-06-03T20:13:21.820Z","updated_at":"2024-06-03T20:13:21.820Z"}' - http_version: - recorded_at: Mon, 03 Jun 2024 20:16:37 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml b/test/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml deleted file mode 100644 index 28003c8f..00000000 --- a/test/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/email_verification/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.6.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Thu, 23 May 2024 18:04:34 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 8886f81a5d7e7b18-DEN - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"66-ESd/ROLsUvsCu/wiWkoaXfmv1gY" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 777e6230-9045-4858-9925-efb5c5783aa7 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=jfT91VpwVMXi901oaS57bdvcPNjXwzgT0NN.TADMkSA-1716487474-1.0.1.1-D3FZIQ5VQOMnMl3UudReuAR600DpJh8NzCxffFA.bRKl_H6zziPQu7Kk3_.wsy8_ESDjlcUQ3suhVmUb5Iwbhg; - path=/; expires=Thu, 23-May-24 18:34:34 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=387f8a46c39c44e43af2f39cd9fd8aea810da563-1716487474; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"Email Verification not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}' - http_version: - recorded_at: Thu, 23 May 2024 18:04:34 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml b/test/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml deleted file mode 100644 index 41ade083..00000000 --- a/test/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/email_verification/email_verification_01HYK9VKNJQ0MJDXEXQP0DA1VK - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.6.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 23 May 2024 18:20:20 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 88870f32dcd07c2e-DEN - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"12b-ekjr8XAvfdiqyjIkVD8WtynlLBo" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 52bf7914-d672-454b-bd61-353e397fdad5 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=huBpGvZo0rq1TOrNY2F0wBwT69_y.Paz9joecCAWK2Y-1716488420-1.0.1.1-YY9yAQE6aOIbVg6Vf8Rxc8ScBPueEKTcUGUXIQmi_AYXfCtcQUa3MzjWeeC0.vmO0AetYPSX3FmmWUf26GH2Fw; - path=/; expires=Thu, 23-May-24 18:50:20 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=823df799452104e182687db9c4f57d862b59f78e-1716488420; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"email_verification","id":"email_verification_01HYK9VKNJQ0MJDXEXQP0DA1VK","user_id":"user_01HYK9VAAW34TPP0KSYXCX44SB","email":"blairlunceford@gmail.com","code":"561814","expires_at":"2024-05-23T18:11:51.024Z","created_at":"2024-05-23T18:01:50.997Z","updated_at":"2024-05-23T18:01:50.997Z"}' - http_version: - recorded_at: Thu, 23 May 2024 18:20:20 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml b/test/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml deleted file mode 100644 index 492b60d6..00000000 --- a/test/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: get - uri: https://api.workos.com/user_management/invitations/invalid - body: - encoding: US-ASCII - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 14 Aug 2023 21:42:04 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7f6c5d952da1431b-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"141-O6DsNeF3SRNndlNrActm2XgXhM8" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - d774318d-c77b-47eb-9974-47e587a5242e - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=BV7wg6GRB.g.PmjVqpTueEgpVm4zhgL.Jb_FhpUkQDc-1692049324-0-AXZinFJJ+pibtaAcxVXaSSRque4aiUt1xUih81Q0oIyBpuoQFVT1fZc5kmyCUhdM/7VR/NhM818gxjJLjAC0BHE=; - path=/; expires=Mon, 14-Aug-23 22:12:04 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=5c73c06a5245951a8821c4d8302ae7be643317b4-1692049324; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"Invitation not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}' - http_version: - recorded_at: Mon, 14 Aug 2023 21:42:04 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml b/test/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml deleted file mode 100644 index 8a287c2a..00000000 --- a/test/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: get - uri: https://api.workos.com/user_management/invitations/invitation_01H5JQDV7R7ATEYZDEG0W5PRYS - body: - encoding: US-ASCII - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 14 Aug 2023 21:42:04 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7f6c5d952da1431b-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"141-O6DsNeF3SRNndlNrActm2XgXhM8" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - d774318d-c77b-47eb-9974-47e587a5242e - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=BV7wg6GRB.g.PmjVqpTueEgpVm4zhgL.Jb_FhpUkQDc-1692049324-0-AXZinFJJ+pibtaAcxVXaSSRque4aiUt1xUih81Q0oIyBpuoQFVT1fZc5kmyCUhdM/7VR/NhM818gxjJLjAC0BHE=; - path=/; expires=Mon, 14-Aug-23 22:12:04 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=5c73c06a5245951a8821c4d8302ae7be643317b4-1692049324; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' - http_version: - recorded_at: Mon, 14 Aug 2023 21:42:04 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml b/test/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml deleted file mode 100644 index e7dd9544..00000000 --- a/test/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/magic_auth/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.4.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Thu, 02 May 2024 23:53:49 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 87dbeed57a5a7c25-DEN - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"8a-boo9lPL4s/fqPxV0Hun3Ue0NFew" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 12cb618c-5540-43f8-8178-49a7be2248f9 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=X3.gnPiStpnIVzd_Qb5C1PUDQzD32Tj0PQ8CEME.KTQ-1714694029-1.0.1.1-WDZ9aX_PJfAtBDTUj9ukw8GtaRhOVXH0vH6tThVOZNhRk34Dpc_gqE1yEDegGQYHmlt.iXgul.WNXBE0ARpf_g; - path=/; expires=Fri, 03-May-24 00:23:49 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=39f5b22af74b005f407c542836af9e55e6d29816-1714694029; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"MagicAuth not found: ''magic_auth_invalid''.","code":"entity_not_found","entity_id":"magic_auth_invalid"}' - http_version: - recorded_at: Thu, 02 May 2024 23:53:49 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml b/test/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml deleted file mode 100644 index 5ea68f1b..00000000 --- a/test/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/magic_auth/magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9 - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 02 May 2024 23:53:49 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 87dbeed47df151f4-DEN - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"112-XzVK2s+8XVoqs9cCTPJC7VyC3IQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 6f38d8ca-904f-4940-9730-4d99e2d20496 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=bIa76a4FQCxR5oYEFQNr.0UhmZVnvLLanztY9NFBwU4-1714694029-1.0.1.1-DzZkmhziT4tSpAsSZeVbyo63E5nFiiF8FTiZzuaERD.QiWNXfAP5zI9KlghVfgv0FzogjoFzubEGmY_S1Xu.zg; - path=/; expires=Fri, 03-May-24 00:23:49 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=39f5b22af74b005f407c542836af9e55e6d29816-1714694029; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"magic_auth","id":"magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9","user_id":"user_01HWXVEWSWSJ66VE29AD14KZ0C","email":"test@workos.com","code":"500013","expires_at":"2024-05-03T00:00:29.528Z","created_at":"2024-05-02T23:50:29.479Z","updated_at":"2024-05-02T23:50:29.479Z"}' - http_version: - recorded_at: Thu, 02 May 2024 23:53:49 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/get_organization_membership.yml b/test/fixtures/vcr_cassettes/user_management/get_organization_membership.yml deleted file mode 100644 index 8d79d6dc..00000000 --- a/test/fixtures/vcr_cassettes/user_management/get_organization_membership.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: get - uri: https://api.workos.com/user_management/organization_memberships/om_01H5JQDV7R7ATEYZDEG0W5PRYS - body: - encoding: US-ASCII - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 14 Aug 2023 21:42:04 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7f6c5d952da1431b-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"141-O6DsNeF3SRNndlNrActm2XgXhM8" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - d774318d-c77b-47eb-9974-47e587a5242e - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=BV7wg6GRB.g.PmjVqpTueEgpVm4zhgL.Jb_FhpUkQDc-1692049324-0-AXZinFJJ+pibtaAcxVXaSSRque4aiUt1xUih81Q0oIyBpuoQFVT1fZc5kmyCUhdM/7VR/NhM818gxjJLjAC0BHE=; - path=/; expires=Mon, 14-Aug-23 22:12:04 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=5c73c06a5245951a8821c4d8302ae7be643317b4-1692049324; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object": "organization_membership", "id": "om_01H5JQDV7R7ATEYZDEG0W5PRYS", "user_id": "user_01H5JQDV7R7ATEYZDEG0W5PRYS", "organization_id": "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", "status": "active", "role": {"slug": "member"}, "directory_managed": false, "created_at": "2023-07-18T02:07:19.911Z", "updated_at": "2023-07-18T02:07:19.911Z"}' - http_version: - recorded_at: Mon, 14 Aug 2023 21:42:04 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml b/test/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml deleted file mode 100644 index 27ca3be9..00000000 --- a/test/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/password_reset/invalid - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.6.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Thu, 23 May 2024 18:04:34 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 8886f81cb89c7b00-DEN - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"62-MwEIS86+oNNsmjVX0JyWZTcjZ9s" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 5b33aeae-7a47-4893-8fef-f014e6692866 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=nkAinUzRPwshxLJMd18TIu20ff0fkGCILsc2NGkWLcs-1716487474-1.0.1.1-Ci9e5PwUuKRRSCrdjfPf3hLETEBr8qGDcVdllyCDW39my5OtwL58BZDu0vB0kuC_6vsPe4UrLSzfoz6XMyjmmw; - path=/; expires=Thu, 23-May-24 18:34:34 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=387f8a46c39c44e43af2f39cd9fd8aea810da563-1716487474; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"Password Reset not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}' - http_version: - recorded_at: Thu, 23 May 2024 18:04:34 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml b/test/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml deleted file mode 100644 index 031fa605..00000000 --- a/test/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/password_reset/password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.6.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 23 May 2024 18:10:20 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 8887008eb83c51eb-DEN - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"18d-Z6VC8jkvZuXmNL0BcJcqkF7M0BQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - bd5403d4-e651-4b63-acde-50287326e0d7 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=YhPLb6u6gDZZcI3AVyfPTCitp9JKWpSMhZ236D6EPJI-1716487820-1.0.1.1-F0GOL.FAH1ROxtTJumLoe_YGWkO6uoozp7qv4oFniAc0aX20kqay7JvCfszxpxRsEbvj5mPTJcqVyvDm7qedeA; - path=/; expires=Thu, 23-May-24 18:40:20 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=cdbb09208777e3b5b5ee0ae80b61e07279d590c0-1716487820; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"password_reset","id":"password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT","user_id":"user_01HH5GTVSP6PEXV0SRB9ANFE9G","email":"blair@workos.com","password_reset_token":"DmNQt1ZWOz7k5hulOoGDN0TZd","password_reset_url":"https://manageable-child-63-staging.authkit.app/reset-password/?token=DmNQt1ZWOz7k5hulOoGDN0TZd","expires_at":"2024-05-23T18:23:51.024Z","created_at":"2024-05-23T18:08:51.024Z"}' - http_version: - recorded_at: Thu, 23 May 2024 18:10:20 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/get_user.yml b/test/fixtures/vcr_cassettes/user_management/get_user.yml deleted file mode 100644 index 8946b20a..00000000 --- a/test/fixtures/vcr_cassettes/user_management/get_user.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/users/user_01HP0B4ZV2FWWVY0BF16GFDAER - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.1; arm64-darwin21; v3.0.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 06 Feb 2024 23:16:59 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 85171aa13cb71017-LAX - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"fc-DvbCxkCW5Wocu/IoMzE4Fvwf0ns" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - d889e317-2368-4fe7-b0a2-1c47be3d9ca3 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=zsxf6bU0PO_IAuZj57IP3Rk5q298HNg4.dSEXeYctso-1707261419-1-AdcDe/e31u5UfcVRh4MJqIcXlsdh/l5nwm8LpGN+dPD9ouq8nTzZ4nfMdt4Ukpc91Tohr0dOd9F6590AmrTiLUM=; - path=/; expires=Tue, 06-Feb-24 23:46:59 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=60c1b96c058658fb8ea6f02357a98f597642db51-1707261419; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"user","id":"user_01HP0B4ZV2FWWVY0BF16GFDAER","email":"bob@example.com","email_verified":false,"first_name":"Bob","last_name":"Loblaw","profile_picture_url":null,"last_sign_in_at":"2024-02-06T23:13:18.137Z","created_at":"2024-02-06T23:13:18.137Z","updated_at":"2024-02-06T23:13:36.946Z"}' - http_version: - recorded_at: Tue, 06 Feb 2024 23:16:59 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml b/test/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml deleted file mode 100644 index 0115eb5a..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/users/user_01H7TVSKS45SDHN5V9XPSM6H44/auth_factors - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - 'Bearer ' - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Thu, 31 Aug 2023 23:40:52 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '26' - Connection: - - keep-alive - Cf-Ray: - - 7ff91efd88d838e1-YYZ - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 8eae4ac4-8213-4f3f-966f-a2421a113bf8 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=M_MJukGgDu7U9.wmReWdBW.NzCb1vSBzW1fvbnNPkMo-1693525252-0-AUtIKPsJjb1vSM1Q+ny4TPcpo5BpudZWt0gRLw9x5pZpvSPmYrftp68dc2cjpbRaKieTinfRpgEccLO5HiThNbQ=; - path=/; expires=Fri, 01-Sep-23 00:10:52 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=8d5f43bf29ca9bafc65d9794d1c54d31c49ef1bf-1693525252; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"message":"Unauthorized"}' - http_version: - recorded_at: Thu, 31 Aug 2023 23:40:52 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml b/test/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml deleted file mode 100644 index 10aa1cf5..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/users/user_01H7TVSKS45SDHN5V9XPSM6H44/auth_factors - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 15 Aug 2023 16:37:20 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7f72dc925ef34288-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"18f-HNgxIMGB3lWwWoxKErsd68S0puU" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 18685295-6afd-47bd-9cc2-e16850f607de - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=hzs97IV1P8X7vKS74iCCMRDY7sFzoYGcysP2LGdKV4c-1692117440-0-AVjOj8T6njnoEKqAZOnpqnTNC2ufENAOsWFxOZ9qjDN/s/IkKgauQmDgEimgKTQ9w6YFRg7dX1fOt25dRgyLJ/U=; - path=/; expires=Tue, 15-Aug-23 17:07:20 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=c652b2f4b8b1daf1d2315e44c356d62a89c8d451-1692117440; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object": "list", "data":[{ "object": "authentication_factor", "id": "auth_factor_01H96FETXENNY99ARX0GRC804C", "user_id": "user_01H96FETWYSJMJEGF0Q3ZB272F", "type": "totp", "totp": { "issuer": "Foo Corp", "user": "user@foo-corp.com" }, "created_at": "2023-08-31T18:59:57.962Z", "updated_at": "2023-08-31T18:59:57.962Z" }], "list_metadata": {"before":null, "after":null}}' - http_version: - recorded_at: Tue, 15 Aug 2023 16:37:20 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml b/test/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml deleted file mode 100644 index e9dd5900..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/invitations?after=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:16 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - f0ca1391-24f7-42ab-96e1-03708170a415 - Etag: - - W/"59a-ZIKgWSqL79Vk1PhmBPwwz8b4bhU" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=zcH%2FppoPRB%2BmUlJabP9ZSUe5cPHU7%2FBBbFhBBbfnttHbFCsiSIpwTqTp4tefv%2BR6SEeQEpNhai3Ra7Zs7YmwYxdAw0ECz4bFh9D1NJeV%2BBEvWpoaIj475X5J%2FiPdUkqGAhTQ9nKkIeMW4MJIkw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c443171d2b0f22-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test2@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:16 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml b/test/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml deleted file mode 100644 index 069d63a0..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/invitations?before=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:16 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 80b9d46c-ab79-41a0-ac63-0afab5dbe8f4 - Etag: - - W/"a75-HKo0bWjw/aMpbUHuuusiqqwVe+k" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=ElnTPt%2BZ5sT5Jj3gdjDAvKRuAIl%2F9MW4GqdQ8Km6HNrcSRKBuCuTDkf27hpLIdGsX5YHaZlIjfcNVU1YuhqD0TyUtOuTkwMAwU79bYb%2FRCzVbOngrvJhhtMjmvaZ9cmGjSDH02dUC9%2BzxFbjlg%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c44313882128d1-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test3@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:16 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml b/test/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml deleted file mode 100644 index b1eff258..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/invitations?limit=2&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:15 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - d4eb0623-1466-4e99-a500-119612d6bc9b - Etag: - - W/"59a-ZIKgWSqL79Vk1PhmBPwwz8b4bhU" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=qHLXTh7d4n3QFt805M6FLecdsq2AJM19ZHRepY4aqLg0e0zMYCudz5G%2BnGfWrzEGzYsUocUIx%2FVfp2D6Rsmy1ZR6mSeySF59z%2FGLEuruXgkqf3VOxMz1BBXe9iE%2B4kUeeFrG0Hzw9NuXkPSmhQ%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c44310a9ba2f79-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test2@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:15 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml b/test/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml deleted file mode 100644 index 794b4fd0..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/invitations?order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:13 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - fdf4c9b7-8f95-4369-8a99-9b11639967b3 - Etag: - - W/"183d-yb1W7y6dzIHej2T2YBC3d5jdQ8k" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=9yHZIP2Ra%2FPNVnT63DAi%2FFOoC9AFPN3fWmhHpdAK9e%2FgpbAIgzbtWpbC%2BRcGyEtldiseJd1pubYlfopmHWmOQairCjGsmPRbz6rimyHZc3eyp%2FKZmjd%2FjBnaSSChh1lpLUhwI8rZJdxeA2V68A%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c44301bde50bf7-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_02H5JQDV7R7ATEYZDEG0W5PRYS","email":"john@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_02H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_03H5JQDV7R7ATEYZDEG0W5PRYS","email":"jane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_03H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_04H5JQDV7R7ATEYZDEG0W5PRYS","email":"emma@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_04H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_05H5JQDV7R7ATEYZDEG0W5PRYS","email":"alex@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_05H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":"before_id","after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:14 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml b/test/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml deleted file mode 100644 index f8c9e2b3..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/invitations?order=desc&organization_id=org_01H5JQDV7R7ATEYZDEG0W5PRYS - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.1; x86_64-darwin19; v1.4.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 09 Aug 2021 22:01:15 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - X-Dns-Prefetch-Control: - - 'off' - Expect-Ct: - - max-age=0 - X-Frame-Options: - - SAMEORIGIN - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - X-Download-Options: - - noopen - X-Content-Type-Options: - - nosniff - X-Permitted-Cross-Domain-Policies: - - none - Referrer-Policy: - - no-referrer - X-Xss-Protection: - - '0' - X-Request-Id: - - 838c7c5c-4e59-4985-bbfc-a9dc991251a2 - Etag: - - W/"8d4-KLH/pb5+0Lb31ZpVOsvjdPi7hcY" - Via: - - 1.1 vegur - Cf-Cache-Status: - - DYNAMIC - Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=5AOf5zrSQvY37vWuZbR73i3BCZAOyMn15ntBUVxQIgGNHftGH9tQH1HyvVd0IgcmwVrb4wEhDNkSLkPGiue%2FoVc%2FAuXD9en2pk4wnUCDpxR%2B9MWAVnpxz8I74Jl6kK0cEh55FsFnlc7k%2BMsFZw%3D%3D"}],"group":"cf-nel","max_age":604800}' - Nel: - - '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}' - Server: - - cloudflare - Cf-Ray: - - 67c4430d7d2d286f-DFW - Alt-Svc: - - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; - ma=86400 - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}' - http_version: - recorded_at: Mon, 09 Aug 2021 22:01:15 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml b/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml deleted file mode 100644 index 0b1c1b8d..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: get - uri: https://api.workos.com/user_management/organization_memberships?order=desc - body: - encoding: US-ASCII - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 15 Aug 2023 14:12:43 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7f7208b9af6541cf-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"2d1-u275JFe/r7mH64R8Evuu34AnYmE" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 28b84ff5-db0c-410f-b9a4-18df7eb917a8 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=wMmnd1gfGjxBRGzSo8Dwzn9FC6zW5RxBoKOWZSwPLGw-1692108763-0-AWO+Bvuk5v7ZV5lVHwZjiPTItOBLT92RlkSQAEdkMc1s27v3kioQDDJXQATNMEwdtmPlvULWS6fUDnREJLP8rik=; - path=/; expires=Tue, 15-Aug-23 14:42:43 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=97d5345d27145cb1d89e42374c4e9de181f7f60d-1692108763; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status": "active","role":{"slug":"member"},"directory_managed":false,"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}, {"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status": "active","role":{"slug":"member"},"directory_managed":false,"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":"before-id","after":null}}' - http_version: - recorded_at: Tue, 15 Aug 2023 14:12:43 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml b/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml deleted file mode 100644 index c43f3a2b..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/organization_memberships?limit=5&order=desc&user_id=user_01H5JQDV7R7ATEYZDEG0W5PRYS - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 15 Aug 2023 16:37:20 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7f72dc925ef34288-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"18f-HNgxIMGB3lWwWoxKErsd68S0puU" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 18685295-6afd-47bd-9cc2-e16850f607de - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=hzs97IV1P8X7vKS74iCCMRDY7sFzoYGcysP2LGdKV4c-1692117440-0-AVjOj8T6njnoEKqAZOnpqnTNC2ufENAOsWFxOZ9qjDN/s/IkKgauQmDgEimgKTQ9w6YFRg7dX1fOt25dRgyLJ/U=; - path=/; expires=Tue, 15-Aug-23 17:07:20 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=c652b2f4b8b1daf1d2315e44c356d62a89c8d451-1692117440; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status": "active","role":{"slug":"member"},"directory_managed":false,"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}' - http_version: - recorded_at: Tue, 15 Aug 2023 16:37:20 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml b/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml deleted file mode 100644 index 47a16d40..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -http_interactions: - - request: - method: get - uri: https://api.workos.com/user_management/organization_memberships?limit=5&order=desc&statuses=inactive&user_id=user_01HXYSZBKQE2N3NHBKZHDP1X5X - body: - encoding: US-ASCII - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.3.0; arm64-darwin23; v4.5.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 15 May 2024 19:14:44 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Xss-Protection: - - "0" - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"organization_membership","id":"om_01HXYT0G3H5QG9YTSHSHFZQE6D","organization_id":"org_01HRCVHACPY05V2FP0KEBQZYD3","user_id":"user_01HXYSZBKQE2N3NHBKZHDP1X5X","status":"active","role":{"slug":"member"},"directory_managed":false,"created_at":"2024-05-15T19:00:05.359Z","updated_at":"2024-05-15T19:13:06.427Z"}],"list_metadata":{"before":null,"after":null}}' - http_version: - recorded_at: Wed, 15 May 2024 19:14:44 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml b/test/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml deleted file mode 100644 index 34bc3cf9..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/users/user_01H7TVSKS45SDHN5V9XPSM6H44/sessions?order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 05 Jan 2026 12:00:00 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"session","id":"session_01H96FETXGTW2S0V5V9XPSM6H44","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:146.0) Gecko/20100101 Firefox/146.0","ip_address":"192.168.1.1","organization_id":"org_01H96FETXGTW2SXRA136PCMAQJ0","user_id":"user_01H7TVSKS45SDHN5V9XPSM6H44","auth_method":"password","status":"active","expires_at":"2027-01-02T03:47:13.027Z","ended_at":null,"created_at":"2026-01-02T03:47:13.024Z","updated_at":"2026-01-05T02:56:09.379Z"}],"list_metadata":{"before":null,"after":null}}' - http_version: - recorded_at: Mon, 05 Jan 2026 12:00:00 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_users/no_options.yml b/test/fixtures/vcr_cassettes/user_management/list_users/no_options.yml deleted file mode 100644 index 74e6e730..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_users/no_options.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: get - uri: https://api.workos.com/user_management/users?order=desc - body: - encoding: US-ASCII - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 15 Aug 2023 14:12:43 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7f7208b9af6541cf-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"2d1-u275JFe/r7mH64R8Evuu34AnYmE" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 28b84ff5-db0c-410f-b9a4-18df7eb917a8 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=wMmnd1gfGjxBRGzSo8Dwzn9FC6zW5RxBoKOWZSwPLGw-1692108763-0-AWO+Bvuk5v7ZV5lVHwZjiPTItOBLT92RlkSQAEdkMc1s27v3kioQDDJXQATNMEwdtmPlvULWS6fUDnREJLP8rik=; - path=/; expires=Tue, 15-Aug-23 14:42:43 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=97d5345d27145cb1d89e42374c4e9de181f7f60d-1692108763; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"user","id":"user_01H7WRJBPAAHX1BYRQHEK7QC4A","email":"lucy.lawless@example.com","first_name":"Lucy","last_name":"Lawless","created_at":"2023-08-15T14:11:04.519Z","updated_at":"2023-08-15T14:11:04.519Z","email_verified":false},{"object":"user","id":"user_01H7TVSKS45SDHN5V9XPSM6H44","email":"bob@loblaw.com","first_name":"Bob","last_name":"Loblaw","created_at":"2023-08-14T20:28:58.929Z","updated_at":"2023-08-14T20:28:58.929Z","email_verified":false}],"list_metadata":{"before":"before-id","after":null}}' - http_version: - recorded_at: Tue, 15 Aug 2023 14:12:43 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/list_users/with_options.yml b/test/fixtures/vcr_cassettes/user_management/list_users/with_options.yml deleted file mode 100644 index 049d6a67..00000000 --- a/test/fixtures/vcr_cassettes/user_management/list_users/with_options.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: get - uri: https://api.workos.com/user_management/users?email=lucy.lawless@example.com&limit=5&order=desc - body: - encoding: US-ASCII - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 15 Aug 2023 16:37:20 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7f72dc925ef34288-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"18f-HNgxIMGB3lWwWoxKErsd68S0puU" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 18685295-6afd-47bd-9cc2-e16850f607de - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=hzs97IV1P8X7vKS74iCCMRDY7sFzoYGcysP2LGdKV4c-1692117440-0-AVjOj8T6njnoEKqAZOnpqnTNC2ufENAOsWFxOZ9qjDN/s/IkKgauQmDgEimgKTQ9w6YFRg7dX1fOt25dRgyLJ/U=; - path=/; expires=Tue, 15-Aug-23 17:07:20 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=c652b2f4b8b1daf1d2315e44c356d62a89c8d451-1692117440; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"list","data":[{"object":"user","id":"user_01H7WRJBPAAHX1BYRQHEK7QC4A","email":"lucy.lawless@example.com","first_name":"Lucy","last_name":"Lawless","created_at":"2023-08-15T14:11:04.519Z","updated_at":"2023-08-15T14:11:04.519Z","email_verified":false}],"list_metadata":{"before":null,"after":null}}' - http_version: - recorded_at: Tue, 15 Aug 2023 16:37:20 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml b/test/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml deleted file mode 100644 index 9efa4677..00000000 --- a/test/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml +++ /dev/null @@ -1,64 +0,0 @@ ---- -http_interactions: - - request: - method: put - uri: https://api.workos.com/user_management/organization_memberships/om_01HXYT0G3H5QG9YTSHSHFZQE6D/reactivate - body: - encoding: UTF-8 - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.3.0; arm64-darwin23; v4.5.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 15 May 2024 19:13:06 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Xss-Protection: - - "0" - body: - encoding: ASCII-8BIT - string: '{"object":"organization_membership","id":"om_01HXYT0G3H5QG9YTSHSHFZQE6D","organization_id":"org_01HRCVHACPY05V2FP0KEBQZYD3","user_id":"user_01HXYSZBKQE2N3NHBKZHDP1X5X","status":"active","role":{"slug":"member"},"directory_managed":false,"created_at":"2024-05-15T19:00:05.359Z","updated_at":"2024-05-15T19:13:06.427Z"}' - http_version: - recorded_at: Wed, 15 May 2024 19:13:06 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml b/test/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml deleted file mode 100644 index a9965525..00000000 --- a/test/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/invitations/invitation_01H5JQDV7R7ATEYZDEG0W5PRYS/resend - body: - encoding: UTF-8 - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Mon, 17 Nov 2025 18:28:05 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fa4ef0eeafe8c12-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"56-2Auj80JGmZ1uWGCY950ud8v4KLQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f5f06564-2f73-4b73-989b-b577cfbdaa9a - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=v55WlV2dq1rXkfx9668LFtglSD5c9292fFLKsviMegY-1692642485-0-AWmCDzQSIwCjWvanffzmFA5KJT/nWucOWyv7i3fyyXeH+i5iM9ZusABSbNOUR6zO2mcugNYr/TRj6ltRmm8eC3M=; - path=/; expires=Mon, 21-Aug-23 18:58:05 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=bea6b3e4c8ea6479881eb565b1ab9a0b6deabae9-1692642485; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"code":"invite_accepted","message":"Invite has already been accepted."}' - http_version: - recorded_at: Mon, 17 Nov 2025 18:28:05 GMT -recorded_with: VCR 5.0.0 - diff --git a/test/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml b/test/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml deleted file mode 100644 index 75c2bde8..00000000 --- a/test/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/invitations/invitation_01H5JQDV7R7ATEYZDEG0W5PRYS/resend - body: - encoding: UTF-8 - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Mon, 17 Nov 2025 18:28:05 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fa4ef0eeafe8c12-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"56-2Auj80JGmZ1uWGCY950ud8v4KLQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f5f06564-2f73-4b73-989b-b577cfbdaa9a - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=v55WlV2dq1rXkfx9668LFtglSD5c9292fFLKsviMegY-1692642485-0-AWmCDzQSIwCjWvanffzmFA5KJT/nWucOWyv7i3fyyXeH+i5iM9ZusABSbNOUR6zO2mcugNYr/TRj6ltRmm8eC3M=; - path=/; expires=Mon, 21-Aug-23 18:58:05 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=bea6b3e4c8ea6479881eb565b1ab9a0b6deabae9-1692642485; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"code":"invite_expired","message":"Invite has expired."}' - http_version: - recorded_at: Mon, 17 Nov 2025 18:28:05 GMT -recorded_with: VCR 5.0.0 - diff --git a/test/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml b/test/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml deleted file mode 100644 index 91c16a03..00000000 --- a/test/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/invitations/invalid_id/resend - body: - encoding: UTF-8 - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 17 Nov 2025 18:28:05 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fa4ef0eeafe8c12-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"56-2Auj80JGmZ1uWGCY950ud8v4KLQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f5f06564-2f73-4b73-989b-b577cfbdaa9a - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=v55WlV2dq1rXkfx9668LFtglSD5c9292fFLKsviMegY-1692642485-0-AWmCDzQSIwCjWvanffzmFA5KJT/nWucOWyv7i3fyyXeH+i5iM9ZusABSbNOUR6zO2mcugNYr/TRj6ltRmm8eC3M=; - path=/; expires=Mon, 21-Aug-23 18:58:05 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=bea6b3e4c8ea6479881eb565b1ab9a0b6deabae9-1692642485; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"Invitation not found: ''invalid_id''.","code":"entity_not_found","entity_id":"bad_id"}' - http_version: - recorded_at: Mon, 17 Nov 2025 18:28:05 GMT -recorded_with: VCR 5.0.0 - diff --git a/test/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml b/test/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml deleted file mode 100644 index 6466bc33..00000000 --- a/test/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/invitations/invitation_01H5JQDV7R7ATEYZDEG0W5PRYS/resend - body: - encoding: UTF-8 - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Mon, 17 Nov 2025 18:28:05 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fa4ef0eeafe8c12-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"56-2Auj80JGmZ1uWGCY950ud8v4KLQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f5f06564-2f73-4b73-989b-b577cfbdaa9a - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=v55WlV2dq1rXkfx9668LFtglSD5c9292fFLKsviMegY-1692642485-0-AWmCDzQSIwCjWvanffzmFA5KJT/nWucOWyv7i3fyyXeH+i5iM9ZusABSbNOUR6zO2mcugNYr/TRj6ltRmm8eC3M=; - path=/; expires=Mon, 21-Aug-23 18:58:05 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=bea6b3e4c8ea6479881eb565b1ab9a0b6deabae9-1692642485; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"code":"invite_revoked","message":"Invite has been revoked."}' - http_version: - recorded_at: Mon, 17 Nov 2025 18:28:05 GMT -recorded_with: VCR 5.0.0 - diff --git a/test/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml b/test/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml deleted file mode 100644 index 37d19423..00000000 --- a/test/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/invitations/invitation_01H5JQDV7R7ATEYZDEG0W5PRYS/resend - body: - encoding: UTF-8 - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 17 Nov 2025 18:28:05 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "376" - Connection: - - keep-alive - Cf-Ray: - - 7ff6b9122b60f8dd-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"178-SVaSEtrIczZQlwnTK57+aDrxt/g" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - df30b890-b6d9-494f-b59c-317e85b5b5f0 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=9k_hHql8o3VCr_ugrzhVkuvFJBIFO5rLKq88Tg1FQzI-1693500106-0-AWUpQpsgsfMWdRySOy7cT3NmqbANvylwBZn7ontxTsDKPijdiGDVMsPih2HAbK3+ldKDe9A1Ul6Mf2+9mfyLrjQ=; - path=/; expires=Thu, 31-Aug-23 17:11:46 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=40a4c5b06423ba61b4c78144e7e0eddc58e13ff4-1693500106; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":null,"revoked_at":null,"expires_at":"2023-07-25T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' - http_version: - recorded_at: Mon, 17 Nov 2025 18:28:05 GMT -recorded_with: VCR 5.0.0 - diff --git a/test/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml b/test/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml deleted file mode 100644 index df17b8ef..00000000 --- a/test/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/password_reset/confirm - body: - encoding: UTF-8 - string: '{"token":"bogus_token","new_password":"new_password"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Tue, 22 Aug 2023 20:37:23 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fade9d76fd5c443-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"6e-ewNsQiFn+97Q628gVxOcxYY8/4k" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 6de35dcb-7631-4ffe-95f7-2e0f45fa4fe0 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=3YpjDFO_KeR0V.HElgb4nKH0.Ixe_Kr3uSwR.sbSmsM-1692736643-0-AV69ETcL8wiAv3YIQ5mB+YssIizhLxQx5gSh4jLBpVKsr/fLS5pivrU+7BBuCSl8xrrR4HGvB8ijEIYiYyF0P7I=; - path=/; expires=Tue, 22-Aug-23 21:07:23 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=d094d0e9ed722cc5178c6d8aa368d9761b1b2e5c-1692736643; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"Could not locate user with provided token: ''bogus_token''","code":"password_reset_token_not_found"}' - http_version: - recorded_at: Tue, 22 Aug 2023 20:37:23 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/reset_password/valid.yml b/test/fixtures/vcr_cassettes/user_management/reset_password/valid.yml deleted file mode 100644 index 26bbecc0..00000000 --- a/test/fixtures/vcr_cassettes/user_management/reset_password/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/password_reset/confirm - body: - encoding: UTF-8 - string: '{"token":"eEgAgvAE0blvU1zWV3yWVAD22","new_password":"very_cool_new_pa$$word"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Tue, 22 Aug 2023 20:35:40 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '327' - Connection: - - keep-alive - Cf-Ray: - - 7fade751ac5ec468-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"147-j3/W7XHKx6tuvwZhBiKvsK7XVG4" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - c921b63e-c9ec-4397-bfc4-cfb7a740880d - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=HGGZ5slgbvhqsmhXQpwInebeKVPg5gvChLNIPC_O46g-1692736540-0-AbnpCKW5I+JexTqMQiWhaBv7h2Ohf7MQTC+2iUFEVvL/NLbuOx4BWhvPhUN3TM8jUgIuAcldYOWjKuxfZfVL+rE=; - path=/; expires=Tue, 22-Aug-23 21:05:40 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=d4db2e7c2f1e661b363d5566a7aa592cc5e1710e-1692736540; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"user":{"object":"user","id":"user_01H7WRJBPAAHX1BYRQHEK7QC4A","email":"lucy.lawless@example.com","first_name":"Lucy","last_name":"Lawless","created_at":"2023-08-15T14:11:04.519Z","updated_at":"2023-08-22T20:34:49.277Z","email_verified":false}}' - http_version: - recorded_at: Tue, 22 Aug 2023 20:35:40 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml b/test/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml deleted file mode 100644 index bad8352e..00000000 --- a/test/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/invitations/invalid_id/revoke - body: - encoding: UTF-8 - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 21 Aug 2023 18:28:05 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fa4ef0eeafe8c12-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"56-2Auj80JGmZ1uWGCY950ud8v4KLQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f5f06564-2f73-4b73-989b-b577cfbdaa9a - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=v55WlV2dq1rXkfx9668LFtglSD5c9292fFLKsviMegY-1692642485-0-AWmCDzQSIwCjWvanffzmFA5KJT/nWucOWyv7i3fyyXeH+i5iM9ZusABSbNOUR6zO2mcugNYr/TRj6ltRmm8eC3M=; - path=/; expires=Mon, 21-Aug-23 18:58:05 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=bea6b3e4c8ea6479881eb565b1ab9a0b6deabae9-1692642485; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"Invitation not found: ''invalid_id''.","code":"entity_not_found","entity_id":"bad_id"}' - http_version: - recorded_at: Mon, 21 Aug 2023 18:28:05 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml b/test/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml deleted file mode 100644 index 5770353e..00000000 --- a/test/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/invitations/invitation_01H5JQDV7R7ATEYZDEG0W5PRYS/revoke - body: - encoding: UTF-8 - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 31 Aug 2023 16:41:46 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "376" - Connection: - - keep-alive - Cf-Ray: - - 7ff6b9122b60f8dd-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"178-SVaSEtrIczZQlwnTK57+aDrxt/g" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - df30b890-b6d9-494f-b59c-317e85b5b5f0 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=9k_hHql8o3VCr_ugrzhVkuvFJBIFO5rLKq88Tg1FQzI-1693500106-0-AWUpQpsgsfMWdRySOy7cT3NmqbANvylwBZn7ontxTsDKPijdiGDVMsPih2HAbK3+ldKDe9A1Ul6Mf2+9mfyLrjQ=; - path=/; expires=Thu, 31-Aug-23 17:11:46 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=40a4c5b06423ba61b4c78144e7e0eddc58e13ff4-1693500106; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' - http_version: - recorded_at: Thu, 31 Aug 2023 16:41:46 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml b/test/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml deleted file mode 100644 index 9d80c301..00000000 --- a/test/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/sessions/revoke - body: - encoding: UTF-8 - string: '{"session_id":"session_01H5JQDV7R7ATEYZDEG0W5PRYS"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin22; v4.2.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Thu, 11 Apr 2024 22:36:42 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 872e74fd9ed6db9e-LAX - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"91-9u3slgvENRDVFp/62vKalhPzVuw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - bc0771a4-8d66-4b34-809c-d3d8976af390 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=iJMFbMBT_gDvh2ZbVYwAWHii9wrMPSJJeFQ3sXKSNNw-1712875002-1.0.1.1-d0033NtW0ShwCrgulDZg60Nw0yfEROthaCZQWVIAnWbbmaoa5HDqSkl4DsECxoAaZNdoLWqOxi9YXtZx9FqVSA; - path=/; expires=Thu, 11-Apr-24 23:06:42 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=c2a61e4869ba7669d8dd1d11a8e59bba189e21ba-1712875002; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"Session not found: ''session_01H5JQDV7R7ATEYZDEG0W5PRYS''.","code":"entity_not_found","entity_id":"session_01H5JQDV7R7ATEYZDEG0W5PRYS"}' - http_version: - recorded_at: Thu, 11 Apr 2024 22:36:42 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml b/test/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml deleted file mode 100644 index 74377de9..00000000 --- a/test/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/sessions/revoke - body: - encoding: UTF-8 - string: '{"session_id":"session_01HRX85ATNADY1GQ053AHRFFN6"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin22; v4.2.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 11 Apr 2024 22:36:42 GMT - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 872e74fc2ee3092d-LAX - Cf-Cache-Status: - - DYNAMIC - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 1b04e560-4438-40ba-97d2-05ae571aeedf - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=lXssAzjuk1ajbWnDLtD_SUYIufESNBd9WVxCY8MCxJU-1712875002-1.0.1.1-oBbEhifco.kAMIrc30VrsrzW8tP4OpouniBD3jTd.5UowyS_IWs6ah59yKeFO9X6IqMLjlJt6n5O9lTpN0.2fw; - path=/; expires=Thu, 11-Apr-24 23:06:42 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=c2a61e4869ba7669d8dd1d11a8e59bba189e21ba-1712875002; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '' - http_version: - recorded_at: Thu, 11 Apr 2024 22:36:42 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml b/test/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml deleted file mode 100644 index e97d2d21..00000000 --- a/test/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/invitations - body: - encoding: UTF-8 - string: '{"email":"invalid@workos.com"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 409 - message: Conflict - headers: - Date: - - Tue, 22 Aug 2023 15:17:55 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '185' - Connection: - - keep-alive - Cf-Ray: - - 7fac15db0d8878d0-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"b9-MwpjOZS5P8vwlJwJ2Wcz1gYyf6Y" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 2b2e336d-0505-43c3-9cc5-4b18841bd31c - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=RJi4ZoHPaRE92J8Hyh7jvHe9uc55nnVpOMBuQKZfCb8-1692717475-0-AeTId8BwH1uElzCNWtu+dsvrIY89q9vKqVJ8qd0hEON/AbMwDbsLatlPjyGecK9XamUFzX78taIjJLW5cRIxLF8=; - path=/; expires=Tue, 22-Aug-23 15:47:55 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=67a732b1ed159ca5729e30e84c73587d61e22441-1692717475; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"message":"An Invitation with the email invalid@workos.com already exists."}' - http_version: - recorded_at: Tue, 22 Aug 2023 15:17:55 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml b/test/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml deleted file mode 100644 index 290ad88d..00000000 --- a/test/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/invitations - body: - encoding: UTF-8 - string: '{"email":"test@workos.com"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Tue, 22 Aug 2023 15:17:54 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '372' - Connection: - - keep-alive - Cf-Ray: - - 7fac15d95b344307-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"174-DVzVYOTqyX3q/AyatAXKdpEIXt0" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 81a9837a-98c2-4672-b676-c0373801bee7 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=umdTRtFxoQN.4ktEcYtcbX1s8jKssJoHPtyhIn6WTks-1692717474-0-AdDIQx1e2bzuszzeXKtvCNRha0v3k93d1P8K+nwBMI2ZwMwU28jXRrsrZibk4tPRFo9wk5sXm2BSyKn+cb8wH+o=; - path=/; expires=Tue, 22-Aug-23 15:47:54 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=18d4d766679a0d25305751659ba8551c12a6ab44-1692717474; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' - http_version: - recorded_at: Tue, 22 Aug 2023 15:17:54 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml b/test/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml deleted file mode 100644 index 83d7fc2a..00000000 --- a/test/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/magic_auth/send - body: - encoding: UTF-8 - string: '{"email":"test@gmail.com"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Thu, 31 Aug 2023 16:32:01 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7ff6aac8a91ceb47-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"178-SVaSEtrIczZQlwnTK57+aDrxt/g" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - da040d8f-af6a-4e18-b3c2-b6699af7192f - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=_w1FUKj.vmq5qCPLMdQK1z.IYo.DZCBbMuv5f_MLM9c-1693499521-0-AbZOZE8BJY6cjmbbx648+DYgD0U58SwqkYxCyk0G4ZHpWcMYzo4q+XXLUXdX1Ru4vLjg7F3Ph7ubEUkplQ0vUaU=; - path=/; expires=Thu, 31-Aug-23 17:02:01 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=7aa6c21d75500d36fdd87e87095d451bcaaa7136-1693499521; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: "" - http_version: - recorded_at: Thu, 31 Aug 2023 16:32:01 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml b/test/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml deleted file mode 100644 index e3ebeb8d..00000000 --- a/test/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/password_reset/send - body: - encoding: UTF-8 - string: '{"email":"foo@bar.com","password_reset_url":""}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 422 - message: Unprocessable Entity - headers: - Date: - - Tue, 22 Aug 2023 15:17:55 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '185' - Connection: - - keep-alive - Cf-Ray: - - 7fac15db0d8878d0-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"b9-MwpjOZS5P8vwlJwJ2Wcz1gYyf6Y" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 2b2e336d-0505-43c3-9cc5-4b18841bd31c - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=RJi4ZoHPaRE92J8Hyh7jvHe9uc55nnVpOMBuQKZfCb8-1692717475-0-AeTId8BwH1uElzCNWtu+dsvrIY89q9vKqVJ8qd0hEON/AbMwDbsLatlPjyGecK9XamUFzX78taIjJLW5cRIxLF8=; - path=/; expires=Tue, 22-Aug-23 15:47:55 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=67a732b1ed159ca5729e30e84c73587d61e22441-1692717475; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"code":"invalid_request_parameters","message":"Validation failed","errors":[{"code":"password_reset_url_string_required","message":"Password - Reset Url should be a non-empty string."}]}' - http_version: - recorded_at: Tue, 22 Aug 2023 15:17:55 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml b/test/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml deleted file mode 100644 index 4217e677..00000000 --- a/test/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/password_reset/send - body: - encoding: UTF-8 - string: '{"email":"lucy.lawless@example.com","password_reset_url":"https://example.com/reset"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Tue, 22 Aug 2023 15:17:54 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '372' - Connection: - - keep-alive - Cf-Ray: - - 7fac15d95b344307-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"174-DVzVYOTqyX3q/AyatAXKdpEIXt0" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 81a9837a-98c2-4672-b676-c0373801bee7 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=umdTRtFxoQN.4ktEcYtcbX1s8jKssJoHPtyhIn6WTks-1692717474-0-AdDIQx1e2bzuszzeXKtvCNRha0v3k93d1P8K+nwBMI2ZwMwU28jXRrsrZibk4tPRFo9wk5sXm2BSyKn+cb8wH+o=; - path=/; expires=Tue, 22-Aug-23 15:47:54 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=18d4d766679a0d25305751659ba8551c12a6ab44-1692717474; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '' - http_version: - recorded_at: Tue, 22 Aug 2023 15:17:54 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml b/test/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml deleted file mode 100644 index bee7673a..00000000 --- a/test/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/users/bad_id/email_verification/send - body: - encoding: UTF-8 - string: '' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 21 Aug 2023 18:28:05 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fa4ef0eeafe8c12-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"56-2Auj80JGmZ1uWGCY950ud8v4KLQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f5f06564-2f73-4b73-989b-b577cfbdaa9a - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=v55WlV2dq1rXkfx9668LFtglSD5c9292fFLKsviMegY-1692642485-0-AWmCDzQSIwCjWvanffzmFA5KJT/nWucOWyv7i3fyyXeH+i5iM9ZusABSbNOUR6zO2mcugNYr/TRj6ltRmm8eC3M=; - path=/; expires=Mon, 21-Aug-23 18:58:05 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=bea6b3e4c8ea6479881eb565b1ab9a0b6deabae9-1692642485; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"User not found: ''bad_id''.","code":"entity_not_found","entity_id":"bad_id"}' - http_version: - recorded_at: Mon, 21 Aug 2023 18:28:05 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml b/test/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml deleted file mode 100644 index 61657244..00000000 --- a/test/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/users/user_01H93WD0R0KWF8Q7BK02C0RPYJ/email_verification/send - body: - encoding: UTF-8 - string: "" - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Thu, 31 Aug 2023 16:41:46 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "376" - Connection: - - keep-alive - Cf-Ray: - - 7ff6b9122b60f8dd-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"178-SVaSEtrIczZQlwnTK57+aDrxt/g" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - df30b890-b6d9-494f-b59c-317e85b5b5f0 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=9k_hHql8o3VCr_ugrzhVkuvFJBIFO5rLKq88Tg1FQzI-1693500106-0-AWUpQpsgsfMWdRySOy7cT3NmqbANvylwBZn7ontxTsDKPijdiGDVMsPih2HAbK3+ldKDe9A1Ul6Mf2+9mfyLrjQ=; - path=/; expires=Thu, 31-Aug-23 17:11:46 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=40a4c5b06423ba61b4c78144e7e0eddc58e13ff4-1693500106; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"user":{"object":"user","id":"user_01H93WD0R0KWF8Q7BK02C0RPYJ","email":"test@gmail.com","email_verified":true,"first_name":"Adam","last_name":"Zinder","created_at":"2023-08-30T18:48:26.517Z","updated_at":"2023-08-30T18:58:00.821Z","user_type":"unmanaged","email_verified_at":"2023-08-30T18:58:00.915Z","google_oauth_profile_id":null,"microsoft_oauth_profile_id":null}}' - http_version: - recorded_at: Thu, 31 Aug 2023 16:41:46 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml b/test/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml deleted file mode 100644 index 00574817..00000000 --- a/test/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/user_management/organization_memberships/invalid - body: - encoding: US-ASCII - string: '{"id":"invalid","role_slug":"admin"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Wed, 15 May 2024 19:13:06 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fc6fbe4ef26ec80-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"58-5GtYccQgavNavjEU+gaKkOl1gq4" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - f3bf3ce2-ed1c-4fdf-9bba-065c2ab4e5e3 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=VyJvcfBZAdCVUhGKRtHsl9enJXaR64T8urur5ClUQWY-1692999527-0-AahBwhyZ59RlA2LkZ5bsanqtnkJWCPSngTzr7vokapEBcsZzjppDl90U6KcM3t3w2iZ0p7uHvZZ5zI0G74Wlmg4=; - path=/; expires=Fri, 25-Aug-23 22:08:47 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=1a7b02324f49135ba91ab0fc79714ad620549ae5-1692999527; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"Organization Membership not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}' - http_version: - recorded_at: Wed, 15 May 2024 19:13:06 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml b/test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml deleted file mode 100644 index 8e993fac..00000000 --- a/test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- - http_interactions: - - request: - method: put - uri: https://api.workos.com/user_management/organization_memberships/om_01H5JQDV7R7ATEYZDEG0W5PRYS - body: - encoding: UTF-8 - string: '{"id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","role_slug":"admin"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin22; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 15 May 2024 19:13:06 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '335' - Connection: - - keep-alive - Cf-Ray: - - 7f828e50ac5dc41d-EWR - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"14f-2n2KgFcHBXf1Yz7SYqzpAxR3E/E" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 8d277b87-b703-40d2-95ac-5f40bf96fcbf - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=Pd2y8tPXDzQthhv7HAd93AsNAjT9V0tbWdH6PzS_iyA-1692282007-0-AUsV9W08vMNk02vMMYwMWj3KVIAJtXMGZdhGaWVL9yL3e4S5D1cGL2925nELffPsxoejtsVqyeqdvIixzD7UnL8=; - path=/; expires=Thu, 17-Aug-23 14:50:07 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=432b4f1724bbd993a76e1e2e8c4d5e2381680fb1-1692282007; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status":"active","role":{"slug":"admin"},"directory_managed":false,"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' - http_version: - recorded_at: Wed, 15 May 2024 19:13:06 GMT - recorded_with: VCR 5.0.0 - \ No newline at end of file diff --git a/test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml b/test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml deleted file mode 100644 index 68c88fd1..00000000 --- a/test/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/user_management/organization_memberships/om_01H5JQDV7R7ATEYZDEG0W5PRYS - body: - encoding: UTF-8 - string: '{"id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","role_slugs":["admin","editor"]}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin24; v5.25.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Tue, 07 Oct 2025 14:22:26 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '26' - Connection: - - keep-alive - Server: - - cloudflare - Cf-Ray: - - 98ae0cf66dd9344d-ORD - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"1a-pljHtlo127JYJR4E/RYOPb6ucbw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 92b6245b-40a8-4bdd-95d1-e32f6e9d1d70 - X-Xss-Protection: - - '0' - Set-Cookie: - - _cfuvid=hq7zKar8D7SHPwNzTjLw.29beujgLQlq6cOYaWvYhEM-1759846946364-0.0.1.1-604800000; - path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None - body: - encoding: UTF-8 - string: '{"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status":"active","role":{"slug":"admin"},"roles":[{"slug":"admin"},{"slug":"editor"}],"directory_managed":false,"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' - recorded_at: Tue, 07 Oct 2025 14:22:26 GMT -recorded_with: VCR 6.3.1 diff --git a/test/fixtures/vcr_cassettes/user_management/update_user/email.yml b/test/fixtures/vcr_cassettes/user_management/update_user/email.yml deleted file mode 100644 index 593467f0..00000000 --- a/test/fixtures/vcr_cassettes/user_management/update_user/email.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/user_management/users/user_01H7TVSKS45SDHN5V9XPSM6H44 - body: - encoding: UTF-8 - string: '{"email":"jane@example.com"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Fri, 25 Aug 2023 23:37:04 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fc7a9287d0330ba-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"153-w5d8Z7u7b9Obt9NziECtNSAY9Ac" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - b333b9e1-c9ec-4e99-ae4f-17a854859cf1 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=adC6w3NUNGTpdZDzNn39guANJ9wi798uCuqc_EI8190-1693006624-0-AcpsuyzFE/KdM7ev5pSVTt2vnGqCSZBOuQYZ0iKFiJT0mBlAuNITn3hICEKvcZ4LH7JUIyjnEOWfq2w7JyRmrJ4=; - path=/; expires=Sat, 26-Aug-23 00:07:04 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=1d0cc3edf886cc7b90bd0c9c3226f5611a385c1a-1693006624; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"user","id":"user_01H7TVSKS45SDHN5V9XPSM6H44","email":"jane@example.com","email_verified":false,"first_name":"Jane","last_name":"Doe","created_at":"2023-08-14T20:28:58.929Z","updated_at":"2023-08-25T22:57:44.262Z","user_type":"unmanaged","email_verified_at":null,"google_oauth_profile_id":null,"microsoft_oauth_profile_id":null}' - http_version: - recorded_at: Fri, 12 May 2025 23:37:04 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/update_user/invalid.yml b/test/fixtures/vcr_cassettes/user_management/update_user/invalid.yml deleted file mode 100644 index 397a89c3..00000000 --- a/test/fixtures/vcr_cassettes/user_management/update_user/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/user_management/users/invalid - body: - encoding: UTF-8 - string: '{"first_name":null,"last_name":null,"email_verified":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Fri, 25 Aug 2023 23:37:04 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fc7a92b09d3c72d-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"58-5GtYccQgavNavjEU+gaKkOl1gq4" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 38ca771a-8830-4cd3-8ad8-24301b84227e - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=.ejt2HnS5CltjCokoiWNGvcelIrjbEeJt_eLx7pUehg-1693006624-0-AXDxxrtQzE1gAyhllC75t08lyrxEweakQ266OP/kDgQfbJorvG+W03Wu5hNHlt2KlL1DbgqS+HFDMVQV3oS40lM=; - path=/; expires=Sat, 26-Aug-23 00:07:04 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=1d0cc3edf886cc7b90bd0c9c3226f5611a385c1a-1693006624; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"User not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}' - http_version: - recorded_at: Fri, 25 Aug 2023 23:37:04 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/update_user/locale.yml b/test/fixtures/vcr_cassettes/user_management/update_user/locale.yml deleted file mode 100644 index 6b3177c6..00000000 --- a/test/fixtures/vcr_cassettes/user_management/update_user/locale.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/user_management/users/user_01K78B3ZB5B7119MYEXTQE5KNE - body: - encoding: UTF-8 - string: '{"locale":"en-US"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin23; v5.25.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Sat, 11 Oct 2025 00:40:19 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 98ca4e2ece4df13a-ORD - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"14b-avtqVpGgr9LY49Al2c3gzw62Mbc" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - e9a5015e-44f0-4321-990a-66d2ba4a3e15 - X-Xss-Protection: - - '0' - Set-Cookie: - - _cfuvid=IZBV12JrFjDy0rHr.O3LoIyI0iKnOHdGa_R3uam5bZI-1760143219077-0.0.1.1-604800000; - path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"user","id":"user_01K78B3ZB5B7119MYEXTQE5KNE","email":"test-locale@example.com","email_verified":false,"first_name":"Jane","last_name":"Doe","profile_picture_url":null,"metadata":{},"last_sign_in_at":null,"locale":"en-US","created_at":"2025-10-11T00:35:49.727Z","updated_at":"2025-10-11T00:40:19.051Z","external_id":null}' - recorded_at: Sat, 11 Oct 2025 00:40:19 GMT -recorded_with: VCR 6.3.1 diff --git a/test/fixtures/vcr_cassettes/user_management/update_user/valid.yml b/test/fixtures/vcr_cassettes/user_management/update_user/valid.yml deleted file mode 100644 index e3565592..00000000 --- a/test/fixtures/vcr_cassettes/user_management/update_user/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/user_management/users/user_01H7TVSKS45SDHN5V9XPSM6H44 - body: - encoding: UTF-8 - string: '{"first_name":"Jane","last_name":"Doe","email_verified":false,"external_id":"123"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Fri, 25 Aug 2023 23:37:04 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fc7a9287d0330ba-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"153-w5d8Z7u7b9Obt9NziECtNSAY9Ac" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - b333b9e1-c9ec-4e99-ae4f-17a854859cf1 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=adC6w3NUNGTpdZDzNn39guANJ9wi798uCuqc_EI8190-1693006624-0-AcpsuyzFE/KdM7ev5pSVTt2vnGqCSZBOuQYZ0iKFiJT0mBlAuNITn3hICEKvcZ4LH7JUIyjnEOWfq2w7JyRmrJ4=; - path=/; expires=Sat, 26-Aug-23 00:07:04 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=1d0cc3edf886cc7b90bd0c9c3226f5611a385c1a-1693006624; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"user","id":"user_01H7TVSKS45SDHN5V9XPSM6H44","email":"willman@blips.app","email_verified":false,"first_name":"Jane","last_name":"Doe","external_id":"123","created_at":"2023-08-14T20:28:58.929Z","updated_at":"2023-08-25T22:57:44.262Z","user_type":"unmanaged","email_verified_at":null,"google_oauth_profile_id":null,"microsoft_oauth_profile_id":null}' - http_version: - recorded_at: Fri, 25 Aug 2023 23:37:04 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml b/test/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml deleted file mode 100644 index fa81b88f..00000000 --- a/test/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml +++ /dev/null @@ -1,77 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/user_management/users/user_01K0SR53HJ58M957MYAB6TDZ9X - body: - encoding: UTF-8 - string: '{"first_name":"John","external_id":null}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.1.4; arm64-darwin24; v5.22.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Wed, 23 Jul 2025 14:19:37 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 963bd0578b723987-YYZ - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"138-cAQWhb1gyLa/WXSej+rjaxcQD5k" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - e32c5c22-9dba-480d-9b70-cb985f8de386 - X-Xss-Protection: - - '0' - Set-Cookie: - - _cfuvid=0ljO.TFpHbzOeVWd7XzlanO5UxaeU_RBUAsoWNtWaF0-1753280377738-0.0.1.1-604800000; - path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"user","id":"user_01K0SR53HJ58M957MYAB6TDZ9X","email":"external@example.com","email_verified":false,"first_name":"John","last_name":"User","profile_picture_url":null,"metadata":{},"last_sign_in_at":null,"created_at":"2025-07-22T19:00:50.852Z","updated_at":"2025-07-23T14:19:37.660Z","external_id":null}' - http_version: - recorded_at: Wed, 23 Jul 2025 14:19:37 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml b/test/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml deleted file mode 100644 index 15b34c62..00000000 --- a/test/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: put - uri: https://api.workos.com/users/invalid/password - body: - encoding: UTF-8 - string: '{"password":"7YtYic00VWcXatPb"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Mon, 28 Aug 2023 15:56:20 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fddbe61b8b0c640-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"58-5GtYccQgavNavjEU+gaKkOl1gq4" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 98c19433-0f41-41a1-a537-d13f945e13e9 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=oxMduXqG4tJltur4hhHtf228S1C4mqCCiDS7tkuookU-1693238180-0-AY4QB0e2vOlrEMOJ+fitseU1NpLX+wPTazEyzqNWSHAskugsJudUH9ez7hjqC3LUQzPDFcDmyPfRogmfWrQPYrA=; - path=/; expires=Mon, 28-Aug-23 16:26:20 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=e3feded68c14c8d3436b33fb36466e0939556da0-1693238180; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"User not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}' - http_version: - recorded_at: Mon, 28 Aug 2023 15:56:20 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml b/test/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml deleted file mode 100644 index a758fa9d..00000000 --- a/test/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: put - uri: https://api.workos.com/users/user_01H7TVSKS45SDHN5V9XPSM6H44/password - body: - encoding: UTF-8 - string: '{"password":"7YtYic00VWcXatPb"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 200 - message: OK - headers: - Date: - - Mon, 28 Aug 2023 15:56:19 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7fddbe5dfc1216d9-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"165-qp1dXUlqqjv5X1XvmWqlvZ/NGSQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - fbce9361-1d65-4b3c-8cbd-f0095f3e4141 - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=J3vNmHK1YPJVev.rkMAZ9FTLeJzcHKsk3guGQi775Ho-1693238179-0-AUdn0HNzvr6HUmQ4AXUyJZ61yHDc4Xs+XSI4hvhcGZ9jxsCJD4JhJmknzcIY4wELXZDlnn2QD2+EOsLZVoGsVqI=; - path=/; expires=Mon, 28-Aug-23 16:26:19 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=43d140b605df7e6da0318c6a7d599e333d850c2f-1693238179; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"object":"user","id":"user_01H7TVSKS45SDHN5V9XPSM6H44","email":"test@workos.app","email_verified":true,"first_name":null,"last_name":null,"created_at":"2023-08-14T20:28:58.929Z","updated_at":"2023-08-28T15:56:19.798Z","user_type":"unmanaged","email_verified_at":"2023-08-22T11:18:01.850Z","google_oauth_profile_id":null,"microsoft_oauth_profile_id":null}' - http_version: - recorded_at: Mon, 28 Aug 2023 15:56:20 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml b/test/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml deleted file mode 100644 index 23a83d07..00000000 --- a/test/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml +++ /dev/null @@ -1,83 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/users/user_01H93WD0R0KWF8Q7BK02C0RPYJ/email_verification/confirm - body: - encoding: UTF-8 - string: '{"code":"000000"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 400 - message: Bad Request - headers: - Date: - - Thu, 31 Aug 2023 16:41:48 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '94' - Connection: - - keep-alive - Cf-Ray: - - 7ff6b919e9c6ec80-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"5e-7Q2jqJ24EIqia0hYl0f8UavvB1I" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - e10e2199-a4e7-44aa-90ee-2fe45664072a - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=K_MuDGjknjAqXvlYf4m0s0631OeP.NrWvWqpautzf30-1693500108-0-AUJxSZYXznSY1XVyINUTW2SRmVzo5ZJIok/2RhQxEp3BgajU95DdohdoKzTpP+T853TpyFOe+3VxXUC3KzvQY8I=; - path=/; expires=Thu, 31-Aug-23 17:11:48 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=4f30d39edf87ebcadd84f444fe0c4a5270a3a340-1693500108; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"code":"email_verification_code_incorrect","message":"Email verification - code is incorrect."}' - http_version: - recorded_at: Thu, 31 Aug 2023 16:41:48 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml b/test/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml deleted file mode 100644 index b288ca5f..00000000 --- a/test/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/user_management/users/bad_id/email_verification/confirm - body: - encoding: UTF-8 - string: '{"code":"966451"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Thu, 31 Aug 2023 16:41:47 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 7ff6b917481c6838-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"56-2Auj80JGmZ1uWGCY950ud8v4KLQ" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 1e92992d-56ff-4cbd-b5c3-d46fa80ad644 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=HBWNGnIi1vRLIjXGSjll8e1OmwUgBMqolzrm6HX.U2U-1693500107-0-AVQrm4b4jzM89RlujwEH0Q8i8Crxh09SatSNDcbSeG6X2NOyK7q6s6xWIYhoeGHvSI3mgjOsdqWmPG0I7YY/YN0=; - path=/; expires=Thu, 31-Aug-23 17:11:47 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=c0487a301adbc3ab2d5cea66fcddff76943f422f-1693500107; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"User not found: ''bad_id''.","code":"entity_not_found","entity_id":"bad_id"}' - http_version: - recorded_at: Thu, 31 Aug 2023 16:41:47 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/user_management/verify_email/valid.yml b/test/fixtures/vcr_cassettes/user_management/verify_email/valid.yml deleted file mode 100644 index 15bcd861..00000000 --- a/test/fixtures/vcr_cassettes/user_management/verify_email/valid.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: - - request: - method: post - uri: https://api.workos.com/user_management/users/user_01H968BR1R84DSPYS9QR5PM6RZ/email_verification/confirm - body: - encoding: UTF-8 - string: '{"code":"333495"}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.0.2; arm64-darwin21; v2.16.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Thu, 31 Aug 2023 16:57:30 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - "375" - Connection: - - keep-alive - Cf-Ray: - - 7ff6d01c4853c71d-SEA - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"177-YBu4ZtIor9/cOTTWMVDcStQWgKw" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Via: - - 1.1 spaces-router (devel) - Access-Control-Allow-Credentials: - - "true" - Content-Security-Policy: - - "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' - https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src - 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - "off" - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 04bda556-68f2-4d4a-bf9a-4c062ef6a74c - X-Xss-Protection: - - "0" - Set-Cookie: - - __cf_bm=qyedAgoptBqJ5xN5lPHoIU9qwCUCQvbE3HD8c76nhUk-1693501050-0-AcNrMwoG1S+cyYFaLGGofemD2IQZEpdx4y1XWCEMFHec7s4VMppzx23C+RjWZW2swKRgz9N172Txwwh4bPatEvQ=; - path=/; expires=Thu, 31-Aug-23 17:27:30 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=682f9a6af8fd91f62014876911781063f77faebe-1693501050; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"user":{"object":"user","id":"user_01H968BR1R84DSPYS9QR5PM6RZ","email":"test@workos.com","email_verified":true,"first_name":"Adam","last_name":"Test","created_at":"2023-08-31T16:55:56.619Z","updated_at":"2023-08-31T16:57:30.574Z","user_type":"unmanaged","email_verified_at":"2023-08-31T16:57:30.628Z","google_oauth_profile_id":null,"microsoft_oauth_profile_id":null}}' - http_version: - recorded_at: Thu, 31 Aug 2023 16:57:30 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/widgets/get_token.yml b/test/fixtures/vcr_cassettes/widgets/get_token.yml deleted file mode 100644 index 1c9c42f6..00000000 --- a/test/fixtures/vcr_cassettes/widgets/get_token.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/widgets/token - body: - encoding: UTF-8 - string: '{"organization_id":"org_01JCP9G67MNAH0KC4B72XZ67M7","user_id":"user_01JCP9H4SHS4N3J6XTKDT7JNPE","scopes":["widgets:users-table:manage"]}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.3.6; arm64-darwin23; v5.8.0 - Authorization: - - Bearer - response: - status: - code: 201 - message: Created - headers: - Date: - - Thu, 14 Nov 2024 21:51:34 GMT - Content-Type: - - application/json; charset=utf-8 - Content-Length: - - '791' - Connection: - - keep-alive - Cf-Ray: - - 8e2a394198f8c9b8-IAD - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"317-Nylo8f8lWbsA0UUWqqV59mFy5jo" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - bf98d35e-d9ca-437f-b937-150e937af0f1 - X-Xss-Protection: - - '0' - Set-Cookie: - - __cf_bm=GsR9Veicl9ZRIR1pUSamJ5m95HmklSbWNwtyp_fSpB4-1731621094-1.0.1.1-VW09qjPlT4T.AGwnsHxe7p_A.Onr9Oe7YnxumCz7B9XmzqYbLz9fx7cF6Qtw3KW0PIshpAVkluIsGWSCJQ5AjQ; - path=/; expires=Thu, 14-Nov-24 22:21:34 GMT; domain=.workos.com; HttpOnly; - Secure; SameSite=None - - __cfruid=022c638e9216cb6be687ace27cb356d48cbd4256-1731621094; path=/; domain=.workos.com; - HttpOnly; Secure; SameSite=None - - _cfuvid=kczJ.JXlRroyPs5B7UjNUynSmsUjYTWP_jcLNj2iiuM-1731621094755-0.0.1.1-604800000; - path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None - Server: - - cloudflare - body: - encoding: UTF-8 - string: '{"token":"eyJhbGciOiJSUzI1NiIsImtpZCI6InNzb19vaWRjX2tleV9wYWlyXzAxSFY3SlpGWEtQOVhCQjc2NjY0TkdUQlpYIn0.eyJhdWQiOiJodHRwczovL2FwaS53b3Jrb3MuY29tIiwiaXNzIjoiaHR0cHM6Ly9hcGkud29ya29zLmNvbSIsInN1YiI6InVzZXJfMDFKQ1A5SDRTSFM0TjNKNlhUS0RUN0pOUEUiLCJqdGkiOiIwMUpDUEFKMUFHWDVESzFNM0hDQTk5MFM1SiIsIm9yZ19pZCI6Im9yZ18wMUpDUDlHNjdNTkFIMEtDNEI3MlhaNjdNNyIsInBlcm1pc3Npb25zIjpbInVzZXJzOm1hbmFnZSIsInVzZXJzOnZpZXciXSwiZXhwIjoxNzMxNjI0Njk0LCJpYXQiOjE3MzE2MjEwOTR9.CTYliFAGFjw-_Lyla-yVBOUAn1ZqU-J7aOdWhAW8fiEsNMz73Fb5nRACa0PFWBE3HK1a8waV-S5lBCGHyxgYOaew5URNnlYXVwlgpKwujHDrW47FrYpxkyxVovY9z9SqDDNRHWBqJM3mH_4Fn9jaHwAVT0SPJrJ7Q4-jxfTc0_sZMR7RVJaBIXPEU8og6Zwc84Gx-9A-mBUA3PPUXfaa8JrCr5OGc482vbD1rF5sjk0jx_FovHrlI3qRo5nkQ3_5WEi7LzdxSPviITxY1-dtm0HbeULz8IL7Ic5O4Ok4lB2c8s8XoZT1JqUMmEHfugkWyQ4juN5aHpmf6ux8cJSJWg"}' - http_version: - recorded_at: Thu, 14 Nov 2024 21:51:34 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml b/test/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml deleted file mode 100644 index 83721e1b..00000000 --- a/test/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml +++ /dev/null @@ -1,74 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/widgets/token - body: - encoding: UTF-8 - string: '{"organization_id":"bogus-id","user_id":"user_01JCP9H4SHS4N3J6XTKDT7JNPE","scopes":["widgets:users-table:manage"]}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.3.6; arm64-darwin23; v5.8.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Thu, 14 Nov 2024 22:02:40 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 8e2a49858b5a7fa2-IAD - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"62-XNhANyOqo4doKt47ORHxpVuFTYg" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 3d383216-51fe-42cd-87e2-7fee32719353 - X-Xss-Protection: - - '0' - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"Organization not found: ''bogus-id''.","code":"entity_not_found","entity_id":"bogus-id"}' - http_version: - recorded_at: Thu, 14 Nov 2024 22:02:40 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml b/test/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml deleted file mode 100644 index 8ca40c91..00000000 --- a/test/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml +++ /dev/null @@ -1,74 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.workos.com/widgets/token - body: - encoding: UTF-8 - string: '{"organization_id":"org_01JCP9G67MNAH0KC4B72XZ67M7","user_id":"bogus-id","scopes":["widgets:users-table:manage"]}' - headers: - Content-Type: - - application/json - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - User-Agent: - - WorkOS; ruby/3.3.6; arm64-darwin23; v5.8.0 - Authorization: - - Bearer - response: - status: - code: 404 - message: Not Found - headers: - Date: - - Thu, 14 Nov 2024 22:02:46 GMT - Content-Type: - - application/json; charset=utf-8 - Transfer-Encoding: - - chunked - Connection: - - keep-alive - Cf-Ray: - - 8e2a49a82b31c54f-IAD - Cf-Cache-Status: - - DYNAMIC - Etag: - - W/"5a-TOigA+IvFyAtHvUdIXFXZWRdn8I" - Strict-Transport-Security: - - max-age=15552000; includeSubDomains - Vary: - - Origin, Accept-Encoding - Access-Control-Allow-Credentials: - - 'true' - Content-Security-Policy: - - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self'' - https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src - ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests' - Expect-Ct: - - max-age=0 - Referrer-Policy: - - no-referrer - X-Content-Type-Options: - - nosniff - X-Dns-Prefetch-Control: - - 'off' - X-Download-Options: - - noopen - X-Frame-Options: - - SAMEORIGIN - X-Permitted-Cross-Domain-Policies: - - none - X-Request-Id: - - 0aeb3b90-0fd7-4de9-8d76-3d0e340ed583 - X-Xss-Protection: - - '0' - Server: - - cloudflare - body: - encoding: ASCII-8BIT - string: '{"message":"User not found: ''bogus-id''.","code":"entity_not_found","entity_id":"bogus-id"}' - http_version: - recorded_at: Thu, 14 Nov 2024 22:02:46 GMT -recorded_with: VCR 5.0.0 diff --git a/test/fixtures/webhook_payload.txt b/test/fixtures/webhook_payload.txt deleted file mode 100644 index f1afd35a..00000000 --- a/test/fixtures/webhook_payload.txt +++ /dev/null @@ -1 +0,0 @@ -{"id": "wh_123","data":{"id":"directory_user_01FAEAJCR3ZBZ30D8BD1924TVG","state":"active","emails":[{"type":"work","value":"blair@foo-corp.com","primary":true}],"idp_id":"00u1e8mutl6wlH3lL4x7","object":"directory_user","username":"blair@foo-corp.com","last_name":"Lunchford","first_name":"Blair","directory_id":"directory_01F9M7F68PZP8QXP8G7X5QRHS7","raw_attributes":{"name":{"givenName":"Blair","familyName":"Lunchford","middleName":"Elizabeth","honorificPrefix":"Ms."},"title":"Developer Success Engineer","active":true,"emails":[{"type":"work","value":"blair@foo-corp.com","primary":true}],"groups":[],"locale":"en-US","schemas":["urn:ietf:params:scim:schemas:core:2.0:User","urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"],"userName":"blair@foo-corp.com","addresses":[{"region":"CA","primary":true,"locality":"San Francisco","postalCode":"94016"}],"externalId":"00u1e8mutl6wlH3lL4x7","displayName":"Blair Lunchford","urn:ietf:params:scim:schemas:extension:enterprise:2.0:User":{"manager":{"value":"2","displayName":"Kate Chapman"},"division":"Engineering","department":"Customer Success"}}},"event":"dsync.user.created","created_at":"2021-06-25T19:07:33.155Z"} diff --git a/test/test_helper.rb b/test/test_helper.rb index d90866d4..f67d0d33 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,39 +1,20 @@ # frozen_string_literal: true -$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib") -$LOAD_PATH << File.join(File.dirname(__FILE__)) +# @oagen-ignore-file — hand-maintained runtime +$LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) require "minitest/autorun" require "webmock/minitest" +require "json" require "workos" -require "vcr" -TEST_ROOT = File.dirname(__FILE__) +module FixtureHelper + FIXTURES_DIR = File.expand_path("fixtures", __dir__) -VCR.configure do |config| - config.cassette_library_dir = "test/fixtures/vcr_cassettes" - config.filter_sensitive_data("") { WorkOS.config.key } - config.filter_sensitive_data("", :token) do |interaction| - JSON.parse(interaction.response.body)["access_token"] - end - config.filter_sensitive_data("", :token) do |interaction| - JSON.parse(interaction.response.body)["refresh_token"] - end - config.hook_into :webmock -end - -class WorkOS::TestCase < Minitest::Test - def setup - WorkOS.instance_variable_set(:@config, WorkOS.default_config) - WorkOS.config.key ||= "" - VCR.turn_on! - end + def load_fixture(name) + path = File.join(FIXTURES_DIR, name) + return {} unless File.exist?(path) - # Helper to temporarily disable VCR when using WebMock stubs directly - def with_vcr_off - VCR.turn_off! - yield - ensure - VCR.turn_on! + JSON.parse(File.read(path)) end end diff --git a/test/workos/encryptors/test_aes_gcm.rb b/test/workos/encryptors/test_aes_gcm.rb deleted file mode 100644 index f5a44359..00000000 --- a/test/workos/encryptors/test_aes_gcm.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class TestAesGcm < WorkOS::TestCase - def setup - super - @encryptor = WorkOS::Encryptors::AesGcm.new - @key = "a" * 32 - @data = {access_token: "tok_123", user: {id: "user_01"}} - end - - def test_seal_returns_a_base64_encoded_string - sealed = @encryptor.seal(@data, @key) - assert_kind_of String, sealed - Base64.decode64(sealed) # should not raise - end - - def test_seal_produces_different_output_each_time - sealed1 = @encryptor.seal(@data, @key) - sealed2 = @encryptor.seal(@data, @key) - refute_equal sealed1, sealed2 - end - - def test_unseal_round_trips_data_correctly - sealed = @encryptor.seal(@data, @key) - unsealed = @encryptor.unseal(sealed, @key) - assert_equal @data, unsealed - end - - def test_unseal_returns_hash_with_symbolized_keys - sealed = @encryptor.seal({"string_key" => "value"}, @key) - unsealed = @encryptor.unseal(sealed, @key) - assert_kind_of Symbol, unsealed.keys.first - end - - def test_unseal_raises_error_with_wrong_key - sealed = @encryptor.seal(@data, @key) - assert_raises(OpenSSL::Cipher::CipherError) do - @encryptor.unseal(sealed, "b" * 32) - end - end -end diff --git a/test/workos/test_actions.rb b/test/workos/test_actions.rb new file mode 100644 index 00000000..a87c115c --- /dev/null +++ b/test/workos/test_actions.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +require "test_helper" +require "openssl" +require "json" + +class ActionsTest < Minitest::Test + SECRET = "as_test_actions_secret" + + def setup + @client = WorkOS::Client.new(api_key: "sk_test") + @actions = @client.actions + end + + def signed(payload, ts: now_ms, secret: SECRET) + sig = OpenSSL::HMAC.hexdigest("SHA256", secret, "#{ts}.#{payload}") + "t=#{ts}, v1=#{sig}" + end + + def now_ms + (Time.now.to_f * 1000).to_i + end + + def test_actions_accessor_exists + assert_equal WorkOS::Actions, @actions + end + + def test_construct_action_returns_parsed_payload + payload = '{"object":"authentication_action_context","user":{"email":"a@b.com"}}' + action = @actions.construct_action(payload: payload, sig_header: signed(payload), secret: SECRET) + assert_equal "authentication_action_context", action["object"] + assert_equal "a@b.com", action["user"]["email"] + end + + def test_verify_header_raises_on_bad_signature + payload = '{"x":1}' + assert_raises(WorkOS::SignatureVerificationError) do + @actions.verify_header(payload: payload, sig_header: "t=#{now_ms}, v1=cafef00d", secret: SECRET) + end + end + + def test_verify_header_uses_30s_default_tolerance + payload = '{"x":1}' + old_ts = now_ms - 60_000 + sig = OpenSSL::HMAC.hexdigest("SHA256", SECRET, "#{old_ts}.#{payload}") + assert_raises(WorkOS::SignatureVerificationError) do + @actions.verify_header(payload: payload, sig_header: "t=#{old_ts}, v1=#{sig}", secret: SECRET) + end + end + + def test_sign_response_authentication_allow + resp = @actions.sign_response(action_type: "authentication", verdict: "Allow", secret: SECRET) + assert_equal "authentication_action_response", resp["object"] + assert_equal "Allow", resp["payload"]["verdict"] + refute_nil resp["payload"]["timestamp"] + refute_nil resp["signature"] + payload_json = JSON.generate(resp["payload"]) + expected = OpenSSL::HMAC.hexdigest("SHA256", SECRET, "#{resp["payload"]["timestamp"]}.#{payload_json}") + assert_equal expected, resp["signature"] + end + + def test_sign_response_user_registration_deny_with_error + resp = @actions.sign_response( + action_type: "user_registration", verdict: "Deny", + error_message: "blocked", secret: SECRET + ) + assert_equal "user_registration_action_response", resp["object"] + assert_equal "Deny", resp["payload"]["verdict"] + assert_equal "blocked", resp["payload"]["error_message"] + end + + def test_sign_response_rejects_unknown_action_type + assert_raises(ArgumentError) do + @actions.sign_response(action_type: "bogus", verdict: "Allow", secret: SECRET) + end + end +end diff --git a/test/workos/test_admin_portal.rb b/test/workos/test_admin_portal.rb new file mode 100644 index 00000000..88eb3db8 --- /dev/null +++ b/test/workos/test_admin_portal.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class AdminPortalTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_generate_link_returns_expected_result + stub_request(:post, /#{Regexp.escape("portal")}/) + .to_return(body: "{}", status: 200) + result = @client.admin_portal.generate_link(organization: "stub") + refute_nil result + end + + def test_generate_link_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("portal")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.admin_portal.generate_link(organization: "stub") + end + end +end diff --git a/test/workos/test_api_keys.rb b/test/workos/test_api_keys.rb new file mode 100644 index 00000000..6813cec9 --- /dev/null +++ b/test/workos/test_api_keys.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class ApiKeysTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_create_validation_returns_expected_result + stub_request(:post, /#{Regexp.escape("api_keys")}/) + .to_return(body: "{}", status: 200) + result = @client.api_keys.create_validation(value: "stub") + refute_nil result + end + + def test_create_validation_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("api_keys")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.api_keys.create_validation(value: "stub") + end + end + + def test_delete_api_key_returns_expected_result + stub_request(:delete, /#{Regexp.escape("api_keys")}/) + .to_return(body: "{}", status: 200) + result = @client.api_keys.delete_api_key(id: "stub") + assert_nil result if result.nil? + end + + def test_delete_api_key_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("api_keys")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.api_keys.delete_api_key(id: "stub") + end + end + + def test_list_organization_api_keys_returns_expected_result + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.api_keys.list_organization_api_keys(organization_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_organization_api_keys_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.api_keys.list_organization_api_keys(organization_id: "stub") + end + end + + def test_create_organization_api_key_returns_expected_result + stub_request(:post, /#{Regexp.escape("organizations")}/) + .to_return(body: "{}", status: 200) + result = @client.api_keys.create_organization_api_key(organization_id: "stub", name: "stub") + refute_nil result + end + + def test_create_organization_api_key_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.api_keys.create_organization_api_key(organization_id: "stub", name: "stub") + end + end +end diff --git a/test/workos/test_audit_logs.rb b/test/workos/test_audit_logs.rb index 58ba244e..a540074e 100644 --- a/test/workos/test_audit_logs.rb +++ b/test/workos/test_audit_logs.rb @@ -1,132 +1,133 @@ # frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + require "test_helper" -class TestAuditLogs < WorkOS::TestCase +class AuditLogsTest < Minitest::Test + include FixtureHelper + def setup - super - WorkOS.configure do |config| - config.key = "example_api_key" + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_get_organization_audit_logs_retention_returns_expected_result + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: "{}", status: 200) + result = @client.audit_logs.get_organization_audit_logs_retention(id: "stub") + refute_nil result + end + + def test_get_organization_audit_logs_retention_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.audit_logs.get_organization_audit_logs_retention(id: "stub") end end - def valid_event - { - action: "user.signed_in", - occurred_at: "2022-08-22T15:04:19.704Z", - actor: { - id: "user_123", - type: "user", - name: "User", - metadata: { - foo: "bar" - } - }, - targets: [{ - id: "team_123", - type: "team", - name: "Team", - metadata: { - foo: "bar" - } - }], - context: { - location: "1.1.1.1", - user_agent: "Mozilla" - } - } - end - - def test_create_event_with_idempotency_key - VCR.use_cassette "audit_logs/create_event_custom_idempotency_key", match_requests_on: %i[path body] do - response = WorkOS::AuditLogs.create_event( - organization: "org_123", - event: valid_event, - idempotency_key: "idempotency_key" - ) - - assert_equal "201", response.code + def test_update_organization_audit_logs_retention_returns_expected_result + stub_request(:put, /#{Regexp.escape("organizations")}/) + .to_return(body: "{}", status: 200) + result = @client.audit_logs.update_organization_audit_logs_retention(id: "stub", retention_period_in_days: 1) + refute_nil result + end + + def test_update_organization_audit_logs_retention_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.audit_logs.update_organization_audit_logs_retention(id: "stub", retention_period_in_days: 1) end end - def test_create_event_without_idempotency_key - VCR.use_cassette "audit_logs/create_event", match_requests_on: %i[path body] do - response = WorkOS::AuditLogs.create_event( - organization: "org_123", - event: valid_event - ) + def test_list_actions_returns_expected_result + stub_request(:get, /#{Regexp.escape("audit_logs")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.audit_logs.list_actions + assert_kind_of WorkOS::Types::ListStruct, result + end - assert_equal "201", response.code + def test_list_actions_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("audit_logs")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.audit_logs.list_actions end end - def test_create_event_with_invalid_event - VCR.use_cassette "audit_logs/create_event_invalid", match_requests_on: %i[path body] do - WorkOS::AuditLogs.create_event( - organization: "org_123", - event: valid_event - ) - rescue WorkOS::InvalidRequestError => e - assert_equal( - "Status 400, Invalid Audit Log event - request ID: 1cf9b8e7-5910-4a6d-a333-46bcf841422e", - e.message - ) - assert_equal "invalid_audit_log", e.code - assert_equal 1, e.errors.count + def test_list_action_schemas_returns_expected_result + stub_request(:get, /#{Regexp.escape("audit_logs")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.audit_logs.list_action_schemas(action_name: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_action_schemas_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("audit_logs")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.audit_logs.list_action_schemas(action_name: "stub") end end - def test_create_export_without_filters - VCR.use_cassette "audit_logs/create_export", match_requests_on: %i[path body] do - audit_log_export = WorkOS::AuditLogs.create_export( - organization: "org_123", - range_start: "2022-06-22T15:04:19.704Z", - range_end: "2022-08-22T15:04:19.704Z" - ) - - assert_equal "audit_log_export", audit_log_export.object - assert_equal "audit_log_export_123", audit_log_export.id - assert_equal "pending", audit_log_export.state - assert_nil audit_log_export.url - assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.created_at - assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.updated_at + def test_create_schema_returns_expected_result + stub_request(:post, /#{Regexp.escape("audit_logs")}/) + .to_return(body: "{}", status: 200) + result = @client.audit_logs.create_schema(action_name: "stub", targets: []) + refute_nil result + end + + def test_create_schema_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("audit_logs")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.audit_logs.create_schema(action_name: "stub", targets: []) + end + end + + def test_create_event_returns_expected_result + stub_request(:post, /#{Regexp.escape("audit_logs")}/) + .to_return(body: "{}", status: 200) + result = @client.audit_logs.create_event(organization_id: "stub", event: {}) + refute_nil result + end + + def test_create_event_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("audit_logs")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.audit_logs.create_event(organization_id: "stub", event: {}) end end - def test_create_export_with_filters - VCR.use_cassette "audit_logs/create_export_with_filters", match_requests_on: %i[path body] do - audit_log_export = WorkOS::AuditLogs.create_export( - organization: "org_123", - range_start: "2022-06-22T15:04:19.704Z", - range_end: "2022-08-22T15:04:19.704Z", - actions: ["user.signed_in"], - actors: ["Jon Smith"], - actor_names: ["Jon Smith"], - actor_ids: ["user_123"], - targets: %w[user team] - ) - - assert_equal "audit_log_export", audit_log_export.object - assert_equal "audit_log_export_123", audit_log_export.id - assert_equal "pending", audit_log_export.state - assert_nil audit_log_export.url - assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.created_at - assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.updated_at + def test_create_export_returns_expected_result + stub_request(:post, /#{Regexp.escape("audit_logs")}/) + .to_return(body: "{}", status: 200) + result = @client.audit_logs.create_export(organization_id: "stub", range_start: "stub", range_end: "stub") + refute_nil result + end + + def test_create_export_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("audit_logs")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.audit_logs.create_export(organization_id: "stub", range_start: "stub", range_end: "stub") end end - def test_get_export - VCR.use_cassette "audit_logs/get_export", match_requests_on: %i[path] do - audit_log_export = WorkOS::AuditLogs.get_export( - id: "audit_log_export_123" - ) + def test_get_export_returns_expected_result + stub_request(:get, /#{Regexp.escape("audit_logs")}/) + .to_return(body: "{}", status: 200) + result = @client.audit_logs.get_export(audit_log_export_id: "stub") + refute_nil result + end - assert_equal "audit_log_export", audit_log_export.object - assert_equal "audit_log_export_123", audit_log_export.id - assert_equal "ready", audit_log_export.state - assert_equal "https://audit-logs.com/download.csv", audit_log_export.url - assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.created_at - assert_equal "2022-08-22T15:04:19.704Z", audit_log_export.updated_at + def test_get_export_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("audit_logs")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.audit_logs.get_export(audit_log_export_id: "stub") end end end diff --git a/test/workos/test_authkit_helpers.rb b/test/workos/test_authkit_helpers.rb new file mode 100644 index 00000000..076dd533 --- /dev/null +++ b/test/workos/test_authkit_helpers.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +require "test_helper" +require "uri" + +class AuthKitHelpersTest < Minitest::Test + def setup + @client = WorkOS::Client.new(api_key: "sk_test_authkit", client_id: "client_001") + @um = @client.user_management + end + + # H09 + def test_get_authorization_url_returns_string_no_http + url = @um.get_authorization_url( + redirect_uri: "https://app.example.com/cb", + provider: "GoogleOAuth" + ) + assert_kind_of String, url + parsed = URI.parse(url) + params = URI.decode_www_form(parsed.query).to_h + assert_equal "client_001", params["client_id"] + assert_equal "https://app.example.com/cb", params["redirect_uri"] + assert_equal "code", params["response_type"] + assert_equal "GoogleOAuth", params["provider"] + assert_equal "/user_management/authorize", parsed.path + end + + def test_get_authorization_url_requires_client_id + client = WorkOS::Client.new(api_key: "k", client_id: nil) + err = assert_raises(ArgumentError) do + client.user_management.get_authorization_url(redirect_uri: "x", provider: "GoogleOAuth") + end + assert_match(/client_id is required/, err.message) + end + + def test_get_authorization_url_requires_provider_or_connection_or_org + err = assert_raises(ArgumentError) do + @um.get_authorization_url(redirect_uri: "x") + end + assert_match(/provider, connection_id, or organization_id required/, err.message) + end + + # H10 + def test_get_authorization_url_with_pkce_returns_url_verifier_state + url, verifier, state = @um.get_authorization_url_with_pkce( + redirect_uri: "https://app.example.com/cb", + provider: "GoogleOAuth" + ) + assert_kind_of String, url + assert_kind_of String, verifier + assert_kind_of String, state + parsed = URI.parse(url) + params = URI.decode_www_form(parsed.query).to_h + assert_equal "S256", params["code_challenge_method"] + expected_challenge = WorkOS::PKCE.generate_code_challenge(verifier) + assert_equal expected_challenge, params["code_challenge"] + end + + # H11 + def test_authenticate_with_code_pkce_posts_correct_body + stub = stub_request(:post, "https://api.workos.com/user_management/authenticate") + .with(body: hash_including( + "grant_type" => "authorization_code", + "client_id" => "client_001", + "code" => "auth_code_xyz", + "code_verifier" => "verifier_abc" + )) + .to_return(status: 200, body: '{"user":{"id":"u_1","email":"a@b","first_name":null,"last_name":null,"email_verified":true,"profile_picture_url":null,"created_at":"x","updated_at":"y","object":"user","external_id":null,"last_sign_in_at":null}}') + @um.authenticate_with_code_pkce(code: "auth_code_xyz", code_verifier: "verifier_abc") + assert_requested(stub) + end + + # H12 + def test_authorize_device_initiates_device_flow + stub = stub_request(:post, "https://api.workos.com/oauth2/device_authorization") + .with(body: hash_including("client_id" => "client_001")) + .to_return(status: 200, body: '{"device_code":"d_1","user_code":"ABCD","verification_uri":"u","verification_uri_complete":"uc","expires_in":600,"interval":5}') + resp = @um.authorize_device + refute_nil resp + assert_requested(stub) + end + + # H13 + def test_get_jwks_url_builds_string + url = @um.get_jwks_url + assert_equal "https://api.workos.com/sso/jwks/client_001", url + end + + def test_get_jwks_url_accepts_explicit_client_id + assert_equal "https://api.workos.com/sso/jwks/abc", @um.get_jwks_url(client_id: "abc") + end + + # get_logout_url + def test_get_logout_url_builds_url + url = @um.get_logout_url(session_id: "session_01H93ZY4F80QPBEZ1R5B2SHQG8") + parsed = URI.parse(url) + params = URI.decode_www_form(parsed.query).to_h + assert_equal "/user_management/sessions/logout", parsed.path + assert_equal "session_01H93ZY4F80QPBEZ1R5B2SHQG8", params["session_id"] + end + + def test_get_logout_url_includes_return_to + url = @um.get_logout_url(session_id: "sid_1", return_to: "https://example.com") + parsed = URI.parse(url) + params = URI.decode_www_form(parsed.query).to_h + assert_equal "https://example.com", params["return_to"] + end +end diff --git a/test/workos/test_authorization.rb b/test/workos/test_authorization.rb new file mode 100644 index 00000000..37281be9 --- /dev/null +++ b/test/workos/test_authorization.rb @@ -0,0 +1,568 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class AuthorizationTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_check_returns_expected_result + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.check(organization_membership_id: "stub", permission_slug: "stub", resource_target: {type: "by_id"}) + refute_nil result + end + + def test_check_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.check(organization_membership_id: "stub", permission_slug: "stub", resource_target: {type: "by_id"}) + end + end + + def test_list_organization_membership_resources_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_organization_membership_resources(organization_membership_id: "stub", permission_slug: "stub", parent_resource: {type: "by_id"}) + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_organization_membership_resources_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.list_organization_membership_resources(organization_membership_id: "stub", permission_slug: "stub", parent_resource: {type: "by_id"}) + end + end + + def test_list_resource_permissions_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_resource_permissions(organization_membership_id: "stub", resource_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_resource_permissions_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.list_resource_permissions(organization_membership_id: "stub", resource_id: "stub") + end + end + + def test_list_effective_permissions_by_external_id_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_effective_permissions_by_external_id(organization_membership_id: "stub", resource_type_slug: "stub", external_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_effective_permissions_by_external_id_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.list_effective_permissions_by_external_id(organization_membership_id: "stub", resource_type_slug: "stub", external_id: "stub") + end + end + + def test_list_organization_membership_role_assignments_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_organization_membership_role_assignments(organization_membership_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_organization_membership_role_assignments_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.list_organization_membership_role_assignments(organization_membership_id: "stub") + end + end + + def test_assign_role_returns_expected_result + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.assign_role(organization_membership_id: "stub", role_slug: "stub", resource_target: {type: "by_id"}) + refute_nil result + end + + def test_assign_role_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.assign_role(organization_membership_id: "stub", role_slug: "stub", resource_target: {type: "by_id"}) + end + end + + def test_remove_role_returns_expected_result + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.remove_role(organization_membership_id: "stub", role_slug: "stub", resource_target: {type: "by_id"}) + assert_nil result if result.nil? + end + + def test_remove_role_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.remove_role(organization_membership_id: "stub", role_slug: "stub", resource_target: {type: "by_id"}) + end + end + + def test_delete_organization_membership_role_assignment_returns_expected_result + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.delete_organization_membership_role_assignment(organization_membership_id: "stub", role_assignment_id: "stub") + assert_nil result if result.nil? + end + + def test_delete_organization_membership_role_assignment_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.delete_organization_membership_role_assignment(organization_membership_id: "stub", role_assignment_id: "stub") + end + end + + def test_list_organization_roles_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.list_organization_roles(organization_id: "stub") + refute_nil result + end + + def test_list_organization_roles_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.list_organization_roles(organization_id: "stub") + end + end + + def test_create_organization_role_returns_expected_result + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.create_organization_role(organization_id: "stub", name: "stub") + refute_nil result + end + + def test_create_organization_role_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.create_organization_role(organization_id: "stub", name: "stub") + end + end + + def test_get_organization_role_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.get_organization_role(organization_id: "stub", slug: "stub") + refute_nil result + end + + def test_get_organization_role_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.get_organization_role(organization_id: "stub", slug: "stub") + end + end + + def test_update_organization_role_returns_expected_result + stub_request(:patch, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.update_organization_role(organization_id: "stub", slug: "stub") + refute_nil result + end + + def test_update_organization_role_raises_authentication_error_on_401 + stub_request(:patch, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.update_organization_role(organization_id: "stub", slug: "stub") + end + end + + def test_delete_organization_role_returns_expected_result + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.delete_organization_role(organization_id: "stub", slug: "stub") + assert_nil result if result.nil? + end + + def test_delete_organization_role_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.delete_organization_role(organization_id: "stub", slug: "stub") + end + end + + def test_create_role_permission_returns_expected_result + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.create_role_permission(organization_id: "stub", slug: "stub", body_slug: "stub") + refute_nil result + end + + def test_create_role_permission_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.create_role_permission(organization_id: "stub", slug: "stub", body_slug: "stub") + end + end + + def test_update_role_permissions_returns_expected_result + stub_request(:put, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.update_role_permissions(organization_id: "stub", slug: "stub", permissions: []) + refute_nil result + end + + def test_update_role_permissions_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.update_role_permissions(organization_id: "stub", slug: "stub", permissions: []) + end + end + + def test_delete_role_permission_returns_expected_result + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.delete_role_permission(organization_id: "stub", slug: "stub", permission_slug: "stub") + assert_nil result if result.nil? + end + + def test_delete_role_permission_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.delete_role_permission(organization_id: "stub", slug: "stub", permission_slug: "stub") + end + end + + def test_get_organization_resource_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.get_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") + refute_nil result + end + + def test_get_organization_resource_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.get_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") + end + end + + def test_update_organization_resource_returns_expected_result + stub_request(:patch, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.update_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") + refute_nil result + end + + def test_update_organization_resource_raises_authentication_error_on_401 + stub_request(:patch, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.update_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") + end + end + + def test_delete_organization_resource_returns_expected_result + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.delete_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") + assert_nil result if result.nil? + end + + def test_delete_organization_resource_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.delete_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") + end + end + + def test_list_resource_organization_memberships_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_resource_organization_memberships(organization_id: "stub", resource_type_slug: "stub", external_id: "stub", permission_slug: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_resource_organization_memberships_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.list_resource_organization_memberships(organization_id: "stub", resource_type_slug: "stub", external_id: "stub", permission_slug: "stub") + end + end + + def test_list_resources_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_resources + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_resources_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.list_resources + end + end + + def test_create_resource_returns_expected_result + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.create_resource(external_id: "stub", name: "stub", resource_type_slug: "stub", organization_id: "stub") + refute_nil result + end + + def test_create_resource_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.create_resource(external_id: "stub", name: "stub", resource_type_slug: "stub", organization_id: "stub") + end + end + + def test_get_resource_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.get_resource(resource_id: "stub") + refute_nil result + end + + def test_get_resource_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.get_resource(resource_id: "stub") + end + end + + def test_update_resource_returns_expected_result + stub_request(:patch, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.update_resource(resource_id: "stub") + refute_nil result + end + + def test_update_resource_raises_authentication_error_on_401 + stub_request(:patch, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.update_resource(resource_id: "stub") + end + end + + def test_delete_resource_returns_expected_result + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.delete_resource(resource_id: "stub") + assert_nil result if result.nil? + end + + def test_delete_resource_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.delete_resource(resource_id: "stub") + end + end + + def test_list_memberships_for_resource_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_memberships_for_resource(resource_id: "stub", permission_slug: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_memberships_for_resource_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.list_memberships_for_resource(resource_id: "stub", permission_slug: "stub") + end + end + + def test_list_environment_roles_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.list_environment_roles + refute_nil result + end + + def test_list_environment_roles_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.list_environment_roles + end + end + + def test_create_environment_role_returns_expected_result + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.create_environment_role(slug: "stub", name: "stub") + refute_nil result + end + + def test_create_environment_role_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.create_environment_role(slug: "stub", name: "stub") + end + end + + def test_get_environment_role_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.get_environment_role(slug: "stub") + refute_nil result + end + + def test_get_environment_role_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.get_environment_role(slug: "stub") + end + end + + def test_update_environment_role_returns_expected_result + stub_request(:patch, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.update_environment_role(slug: "stub") + refute_nil result + end + + def test_update_environment_role_raises_authentication_error_on_401 + stub_request(:patch, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.update_environment_role(slug: "stub") + end + end + + def test_add_environment_role_permission_returns_expected_result + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.add_environment_role_permission(slug: "stub", body_slug: "stub") + refute_nil result + end + + def test_add_environment_role_permission_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.add_environment_role_permission(slug: "stub", body_slug: "stub") + end + end + + def test_set_environment_role_permissions_returns_expected_result + stub_request(:put, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.set_environment_role_permissions(slug: "stub", permissions: []) + refute_nil result + end + + def test_set_environment_role_permissions_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.set_environment_role_permissions(slug: "stub", permissions: []) + end + end + + def test_list_permissions_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_permissions + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_permissions_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.list_permissions + end + end + + def test_create_permission_returns_expected_result + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.create_permission(slug: "stub", name: "stub") + refute_nil result + end + + def test_create_permission_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.create_permission(slug: "stub", name: "stub") + end + end + + def test_get_permission_returns_expected_result + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.get_permission(slug: "stub") + refute_nil result + end + + def test_get_permission_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.get_permission(slug: "stub") + end + end + + def test_update_permission_returns_expected_result + stub_request(:patch, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.update_permission(slug: "stub") + refute_nil result + end + + def test_update_permission_raises_authentication_error_on_401 + stub_request(:patch, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.update_permission(slug: "stub") + end + end + + def test_delete_permission_returns_expected_result + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: "{}", status: 200) + result = @client.authorization.delete_permission(slug: "stub") + assert_nil result if result.nil? + end + + def test_delete_permission_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("authorization")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.delete_permission(slug: "stub") + end + end +end diff --git a/test/workos/test_base_client.rb b/test/workos/test_base_client.rb new file mode 100644 index 00000000..6d58b0cc --- /dev/null +++ b/test/workos/test_base_client.rb @@ -0,0 +1,173 @@ +# frozen_string_literal: true + +require "test_helper" + +class BaseClientTest < Minitest::Test + class RecordingClient < WorkOS::BaseClient + attr_reader :calls + + def initialize(**kwargs) + super + @calls = [] + end + + def get_request(**kwargs) + @calls << [:get, kwargs] + Net::HTTP::Get.new(kwargs[:path]) + end + + def post_request(**kwargs) + @calls << [:post, kwargs] + Net::HTTP::Post.new(kwargs[:path]) + end + + def put_request(**kwargs) + @calls << [:put, kwargs] + Net::HTTP::Put.new(kwargs[:path]) + end + + def patch_request(**kwargs) + @calls << [:patch, kwargs] + Net::HTTP::Patch.new(kwargs[:path]) + end + + def delete_request(**kwargs) + @calls << [:delete, kwargs] + Net::HTTP::Delete.new(kwargs[:path]) + end + + def execute_request(request:, request_options: nil) + [request.method, request_options] + end + end + + class CapturingLogger + attr_reader :events + + def initialize + @events = [] + end + + def debug(message) + @events << [:debug, message] + end + + def info(message) + @events << [:info, message] + end + + def warn(message) + @events << [:warn, message] + end + + def error(message) + @events << [:error, message] + end + end + + class FakeConnection + attr_reader :finished + + def initialize(started: true) + @started = started + @finished = false + end + + def started? + @started + end + + def finish + @finished = true + end + end + + def setup + @client = WorkOS::BaseClient.new(api_key: "sk_test_123", max_retries: 1) + end + + def test_request_dispatches_known_methods + client = RecordingClient.new(api_key: "sk_test_123") + + assert_equal ["GET", {timeout: 5}], client.request(method: :get, path: "/get", request_options: {timeout: 5}) + assert_equal ["POST", nil], client.request(method: :post, path: "/post", body: {ok: true}) + assert_equal ["PUT", nil], client.request(method: :put, path: "/put", body: {ok: true}) + assert_equal ["PATCH", nil], client.request(method: :patch, path: "/patch", body: {ok: true}) + assert_equal ["DELETE", nil], client.request(method: :delete, path: "/delete") + assert_equal %i[get post put patch delete], client.calls.map(&:first) + end + + def test_request_rejects_unknown_method + error = assert_raises(ArgumentError) do + @client.request(method: :trace, path: "/widgets") + end + + assert_equal "unsupported method", error.message + end + + def test_post_request_reads_idempotency_key_from_request_options + request = @client.post_request(path: "/widgets", auth: true, body: {name: "widget"}, request_options: {idempotency_key: "idem_123"}) + + assert_equal "idem_123", request["Idempotency-Key"] + end + + def test_retry_path_generates_idempotency_key_for_mutating_requests + stub_request(:post, "https://api.workos.com/widgets") + .to_return({status: 500, body: '{"message":"retry"}'}, {status: 200, body: "{}"}) + + @client.singleton_class.define_method(:sleep) { |_duration| nil } + @client.request(method: :post, path: "/widgets", body: {name: "widget"}) + + assert_requested(:post, "https://api.workos.com/widgets", times: 2) + assert_requested(:post, "https://api.workos.com/widgets", headers: {"Idempotency-Key" => /.+/}, times: 1) + end + + def test_409_idempotency_error_raises_specific_error + stub_request(:post, "https://api.workos.com/widgets") + .to_return(status: 409, body: '{"code":"idempotency_error","message":"conflict"}') + + assert_raises(WorkOS::IdempotencyError) do + @client.request(method: :post, path: "/widgets", body: {name: "widget"}) + end + end + + def test_api_error_rescues_http_errors_but_not_connection_errors + stub_request(:get, "https://api.workos.com/widgets") + .to_return(status: 401, body: '{"message":"Unauthorized"}') + + raised = assert_raises(WorkOS::APIError) do + @client.request(method: :get, path: "/widgets") + end + + assert_kind_of WorkOS::AuthenticationError, raised + refute WorkOS::APIConnectionError <= WorkOS::APIError + refute WorkOS::SignatureVerificationError <= WorkOS::APIError + end + + def test_log_level_is_a_threshold + logger = CapturingLogger.new + client = WorkOS::BaseClient.new(api_key: "sk_test_123", logger: logger, log_level: :warn) + + client.send(:log, :debug, "debug line") + client.send(:log, :info, "info line") + client.send(:log, :warn, "warn line") + client.send(:log, :error, "error line") + + assert_equal [[:warn, "warn line"], [:error, "error line"]], logger.events + end + + def test_evict_connection_removes_matching_pooled_connections + keep = FakeConnection.new + evict = FakeConnection.new + thread_connections = @client.send(:thread_connections) + thread_connections["https:api.workos.com:443:30"] = evict + thread_connections["https:other.workos.com:443:30"] = keep + + @client.send(:evict_connection, "https://api.workos.com") + + refute thread_connections.key?("https:api.workos.com:443:30") + assert thread_connections.key?("https:other.workos.com:443:30") + assert evict.finished + refute keep.finished + end +end diff --git a/test/workos/test_cache.rb b/test/workos/test_cache.rb deleted file mode 100644 index 53407174..00000000 --- a/test/workos/test_cache.rb +++ /dev/null @@ -1,87 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class TestCache < WorkOS::TestCase - def setup - super - WorkOS::Cache.clear - end - - def test_write_and_read_stores_and_retrieves_data - WorkOS::Cache.write("key", "value") - assert_equal "value", WorkOS::Cache.read("key") - end - - def test_read_returns_nil_if_key_does_not_exist - assert_nil WorkOS::Cache.read("missing") - end - - def test_fetch_returns_cached_value_when_present_and_not_expired - WorkOS::Cache.write("key", "value") - fetch_value = WorkOS::Cache.fetch("key") { "new_value" } - assert_equal "value", fetch_value - end - - def test_fetch_executes_block_and_caches_value_when_not_present - fetch_value = WorkOS::Cache.fetch("key") { "new_value" } - assert_equal "new_value", fetch_value - end - - def test_fetch_executes_block_and_caches_value_when_force_is_true - WorkOS::Cache.write("key", "value") - fetch_value = WorkOS::Cache.fetch("key", force: true) { "new_value" } - assert_equal "new_value", fetch_value - end - - def test_expires_values_after_specified_time - WorkOS::Cache.write("key", "value", expires_in: 0.1) - assert_equal "value", WorkOS::Cache.read("key") - sleep 0.2 - assert_nil WorkOS::Cache.read("key") - end - - def test_fetch_executes_block_and_caches_new_value_when_expired - WorkOS::Cache.write("key", "old_value", expires_in: 0.1) - sleep 0.2 - fetch_value = WorkOS::Cache.fetch("key") { "new_value" } - assert_equal "new_value", fetch_value - end - - def test_does_not_expire_values_when_expires_in_is_nil - WorkOS::Cache.write("key", "value", expires_in: nil) - sleep 0.2 - assert_equal "value", WorkOS::Cache.read("key") - end - - def test_exist_returns_true_if_key_exists - WorkOS::Cache.write("key", "value") - assert_equal true, WorkOS::Cache.exist?("key") - end - - def test_exist_returns_false_if_expired - WorkOS::Cache.write("key", "value", expires_in: 0.1) - sleep 0.2 - assert_equal false, WorkOS::Cache.exist?("key") - end - - def test_exist_returns_false_if_key_does_not_exist - assert_equal false, WorkOS::Cache.exist?("missing") - end - - def test_delete_removes_key - WorkOS::Cache.write("key", "value") - WorkOS::Cache.delete("key") - assert_nil WorkOS::Cache.read("key") - end - - def test_clear_removes_all_keys - WorkOS::Cache.write("key1", "value1") - WorkOS::Cache.write("key2", "value2") - - WorkOS::Cache.clear - - assert_nil WorkOS::Cache.read("key1") - assert_nil WorkOS::Cache.read("key2") - end -end diff --git a/test/workos/test_client.rb b/test/workos/test_client.rb deleted file mode 100644 index f240543c..00000000 --- a/test/workos/test_client.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class TestClient < WorkOS::TestCase - def test_returns_400_error_with_appropriate_fields - VCR.use_cassette("user_management/authenticate_with_code/invalid") do - error = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.authenticate_with_code( - code: "invalid", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end - - refute_nil error.error - refute_nil error.error_description - refute_nil error.data - end - end - - def test_returns_401_error_with_appropriate_fields - VCR.use_cassette("base/execute_request_unauthenticated") do - error = assert_raises(WorkOS::AuthenticationError) do - WorkOS::AuditLogs.create_event( - organization: "org_123", - event: {} - ) - end - - refute_nil error.message - end - end - - def test_returns_404_error_with_appropriate_fields - VCR.use_cassette("user_management/get_email_verification/invalid") do - error = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.get_email_verification( - id: "invalid" - ) - end - - refute_nil error.message - end - end - - def test_returns_422_error_with_appropriate_fields - VCR.use_cassette("user_management/create_user_invalid") do - error = assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::UserManagement.create_user( - email: "invalid" - ) - end - - refute_nil error.message - refute_nil error.errors - refute_nil error.code - end - end -end diff --git a/test/workos/test_configuration.rb b/test/workos/test_configuration.rb deleted file mode 100644 index 31cffe4e..00000000 --- a/test/workos/test_configuration.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class TestConfiguration < WorkOS::TestCase - def setup - super - WorkOS.instance_variable_set(:@config, WorkOS::Configuration.new) - end - - def test_configure_with_key_and_no_timeout - WorkOS.configure do |config| - config.key = "example_api_key" - end - - assert_equal "example_api_key", WorkOS.config.key - assert_equal 60, WorkOS.config.timeout - end - - def test_configure_with_key_and_timeout - WorkOS.configure do |config| - config.key = "example_api_key" - config.timeout = 120 - end - - assert_equal "example_api_key", WorkOS.config.key - assert_equal 120, WorkOS.config.timeout - end - - def test_key_bang_returns_the_key_when_set - WorkOS.config.key = "example_api_key" - - assert_equal "example_api_key", WorkOS.config.key! - end - - def test_key_bang_raises_error_when_key_not_set - WorkOS.config.key = nil - - err = assert_raises(RuntimeError) do - WorkOS.config.key! - end - assert_equal "`WorkOS.config.key` not set", err.message - end -end diff --git a/test/workos/test_connect.rb b/test/workos/test_connect.rb new file mode 100644 index 00000000..8a937853 --- /dev/null +++ b/test/workos/test_connect.rb @@ -0,0 +1,178 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class ConnectTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_complete_oauth2_returns_expected_result + stub_request(:post, /#{Regexp.escape("authkit")}/) + .to_return(body: "{}", status: 200) + result = @client.connect.complete_oauth2(external_auth_id: "stub", user: {}) + refute_nil result + end + + def test_complete_oauth2_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("authkit")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.complete_oauth2(external_auth_id: "stub", user: {}) + end + end + + def test_list_applications_returns_expected_result + stub_request(:get, /#{Regexp.escape("connect")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.connect.list_applications + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_applications_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("connect")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.list_applications + end + end + + def test_create_application_returns_expected_result + stub_request(:post, /#{Regexp.escape("connect")}/) + .to_return(body: "{}", status: 200) + result = @client.connect.create_application(name: "stub", application_type: "oauth", is_first_party: true) + refute_nil result + end + + def test_create_application_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("connect")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.create_application(name: "stub", application_type: "oauth", is_first_party: true) + end + end + + def test_create_oauth_application_returns_expected_result + stub_request(:post, /#{Regexp.escape("connect")}/) + .to_return(body: "{}", status: 200) + result = @client.connect.create_oauth_application(name: "stub", is_first_party: true) + refute_nil result + end + + def test_create_oauth_application_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("connect")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.create_oauth_application(name: "stub", is_first_party: true) + end + end + + def test_create_m2m_application_returns_expected_result + stub_request(:post, /#{Regexp.escape("connect")}/) + .to_return(body: "{}", status: 200) + result = @client.connect.create_m2m_application(name: "stub", organization_id: "stub") + refute_nil result + end + + def test_create_m2m_application_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("connect")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.create_m2m_application(name: "stub", organization_id: "stub") + end + end + + def test_get_application_returns_expected_result + stub_request(:get, /#{Regexp.escape("connect")}/) + .to_return(body: "{}", status: 200) + result = @client.connect.get_application(id: "stub") + refute_nil result + end + + def test_get_application_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("connect")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.get_application(id: "stub") + end + end + + def test_update_application_returns_expected_result + stub_request(:put, /#{Regexp.escape("connect")}/) + .to_return(body: "{}", status: 200) + result = @client.connect.update_application(id: "stub") + refute_nil result + end + + def test_update_application_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("connect")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.update_application(id: "stub") + end + end + + def test_delete_application_returns_expected_result + stub_request(:delete, /#{Regexp.escape("connect")}/) + .to_return(body: "{}", status: 200) + result = @client.connect.delete_application(id: "stub") + assert_nil result if result.nil? + end + + def test_delete_application_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("connect")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.delete_application(id: "stub") + end + end + + def test_list_application_client_secrets_returns_expected_result + stub_request(:get, /#{Regexp.escape("connect")}/) + .to_return(body: "{}", status: 200) + result = @client.connect.list_application_client_secrets(id: "stub") + refute_nil result + end + + def test_list_application_client_secrets_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("connect")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.list_application_client_secrets(id: "stub") + end + end + + def test_create_application_client_secret_returns_expected_result + stub_request(:post, /#{Regexp.escape("connect")}/) + .to_return(body: "{}", status: 200) + result = @client.connect.create_application_client_secret(id: "stub") + refute_nil result + end + + def test_create_application_client_secret_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("connect")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.create_application_client_secret(id: "stub") + end + end + + def test_delete_client_secret_returns_expected_result + stub_request(:delete, /#{Regexp.escape("connect")}/) + .to_return(body: "{}", status: 200) + result = @client.connect.delete_client_secret(id: "stub") + assert_nil result if result.nil? + end + + def test_delete_client_secret_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("connect")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.delete_client_secret(id: "stub") + end + end +end diff --git a/test/workos/test_directory_sync.rb b/test/workos/test_directory_sync.rb index 71578c42..96105d7c 100644 --- a/test/workos/test_directory_sync.rb +++ b/test/workos/test_directory_sync.rb @@ -1,261 +1,118 @@ # frozen_string_literal: true -require "test_helper" - -class TestDirectorySync < WorkOS::TestCase - def test_list_directories_with_no_options - expected_metadata = { - "after" => nil, - "before" => "before-id" - } - - VCR.use_cassette "directory_sync/list_directories/with_no_options" do - directories = WorkOS::DirectorySync.list_directories - - assert_equal 10, directories.data.size - assert_equal expected_metadata, directories.list_metadata - end - end - - def test_list_directories_with_search - VCR.use_cassette "directory_sync/list_directories/with_search" do - directories = WorkOS::DirectorySync.list_directories( - search: "Testing" - ) - - assert_equal 2, directories.data.size - assert directories.data[0].name.include?("Testing") - end - end - - def test_list_directories_with_before - VCR.use_cassette "directory_sync/list_directories/with_before" do - directories = WorkOS::DirectorySync.list_directories( - before: "directory_01FGCPNV312FHFRCX0BYWHVSE1" - ) - - assert_equal 6, directories.data.size - end - end +# This file is auto-generated by oagen. Do not edit. - def test_list_directories_with_after - VCR.use_cassette "directory_sync/list_directories/with_after" do - directories = WorkOS::DirectorySync.list_directories( - after: "directory_01FGCPNV312FHFRCX0BYWHVSE1" - ) - - assert_equal 4, directories.data.size - end - end - - def test_list_directories_with_limit - VCR.use_cassette "directory_sync/list_directories/with_limit" do - directories = WorkOS::DirectorySync.list_directories(limit: 2) - - assert_equal 2, directories.data.size - end - end - - def test_delete_directory - VCR.use_cassette("directory_sync/delete_directory") do - response = WorkOS::DirectorySync.delete_directory( - "directory_01F2T098SKN5PCTVSJ7CWP70N5" - ) - - assert_equal true, response - end - end - - def test_get_directory_with_valid_id - VCR.use_cassette("directory_sync/get_directory_with_valid_id") do - directory = WorkOS::DirectorySync.get_directory( - id: "directory_01FK17DWRHH7APAFXT5B52PV0W" - ) - - assert_equal "directory_01FK17DWRHH7APAFXT5B52PV0W", directory.id - assert_equal "Testing Active Attribute", directory.name - assert_equal "example.me", directory.domain - assert_equal "azure scim v2.0", directory.type - assert_equal "linked", directory.state - assert_equal "org_01F6Q6TFP7RD2PF6J03ANNWDKV", directory.organization_id - end - end +require "test_helper" - def test_get_directory_with_invalid_id - VCR.use_cassette("directory_sync/get_directory_with_invalid_id") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::DirectorySync.get_directory(id: "invalid") - end - assert_equal "Status 404, Directory not found: 'invalid'. - request ID: ", err.message - end - end +class DirectorySyncTest < Minitest::Test + include FixtureHelper - def test_list_groups_with_no_options_raises_error - VCR.use_cassette("directory_sync/list_groups/with_no_options") do - assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::DirectorySync.list_groups - end - end + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") end - def test_list_groups_with_directory - VCR.use_cassette "directory_sync/list_groups/with_directory" do - groups = WorkOS::DirectorySync.list_groups( - directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" - ) - - assert_equal 10, groups.data.size - assert_equal groups.data[0]["name"], groups.data[0].name - end + def test_list_directories_returns_expected_result + stub_request(:get, /#{Regexp.escape("directories")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.directory_sync.list_directories + assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_groups_with_user - VCR.use_cassette "directory_sync/list_groups/with_user" do - groups = WorkOS::DirectorySync.list_groups( - user: "directory_user_01G2Z8D4FDB28ZNSRRBVCF2E0P" - ) - - assert_equal 3, groups.data.size + def test_list_directories_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("directories")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.directory_sync.list_directories end end - def test_list_groups_with_before - VCR.use_cassette "directory_sync/list_groups/with_before" do - groups = WorkOS::DirectorySync.list_groups( - before: "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG", - directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" - ) - - assert_equal 10, groups.data.size - end + def test_get_directory_returns_expected_result + stub_request(:get, /#{Regexp.escape("directories")}/) + .to_return(body: "{}", status: 200) + result = @client.directory_sync.get_directory(id: "stub") + refute_nil result end - def test_list_groups_with_after - VCR.use_cassette "directory_sync/list_groups/with_after" do - groups = WorkOS::DirectorySync.list_groups( - after: "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG", - directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" - ) - - assert_equal 9, groups.data.size + def test_get_directory_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("directories")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.directory_sync.get_directory(id: "stub") end end - def test_list_groups_with_limit - VCR.use_cassette "directory_sync/list_groups/with_limit" do - groups = WorkOS::DirectorySync.list_groups( - limit: 2, - directory: "directory_01G2Z8ADK5NPMVTWF48MVVE4HT" - ) - - assert_equal 2, groups.data.size - end + def test_delete_directory_returns_expected_result + stub_request(:delete, /#{Regexp.escape("directories")}/) + .to_return(body: "{}", status: 200) + result = @client.directory_sync.delete_directory(id: "stub") + assert_nil result if result.nil? end - def test_list_users_with_no_options_raises_error - VCR.use_cassette("directory_sync/list_users/with_no_options") do - assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::DirectorySync.list_users - end + def test_delete_directory_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("directories")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.directory_sync.delete_directory(id: "stub") end end - def test_list_users_with_directory - VCR.use_cassette "directory_sync/list_users/with_directory" do - users = WorkOS::DirectorySync.list_users( - directory: "directory_01FAZYMST676QMTFN1DDJZZX87" - ) - - assert_equal 4, users.data.size - assert_equal users.data[0]["first_name"], users.data[0].first_name - end + def test_list_groups_returns_expected_result + stub_request(:get, /#{Regexp.escape("directory_groups")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.directory_sync.list_groups + assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_users_with_group - VCR.use_cassette "directory_sync/list_users/with_group" do - users = WorkOS::DirectorySync.list_users( - group: "directory_group_01FBXGP79EJAYKW0WS9JCK1V6E" - ) - - assert_equal 1, users.data.size + def test_list_groups_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("directory_groups")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.directory_sync.list_groups end end - def test_list_users_with_before - VCR.use_cassette "directory_sync/list_users/with_before" do - users = WorkOS::DirectorySync.list_users( - before: "directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF", - directory: "directory_01FAZYMST676QMTFN1DDJZZX87" - ) - - assert_equal 2, users.data.size - end + def test_get_group_returns_expected_result + stub_request(:get, /#{Regexp.escape("directory_groups")}/) + .to_return(body: "{}", status: 200) + result = @client.directory_sync.get_group(id: "stub") + refute_nil result end - def test_list_users_with_after - VCR.use_cassette "directory_sync/list_users/with_after" do - users = WorkOS::DirectorySync.list_users( - after: "directory_user_01FAZYNPC8TJBP7Y2ERT51MGDF", - directory: "directory_01FAZYMST676QMTFN1DDJZZX87" - ) - - assert_equal 1, users.data.size + def test_get_group_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("directory_groups")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.directory_sync.get_group(id: "stub") end end - def test_list_users_with_limit - VCR.use_cassette "directory_sync/list_users/with_limit" do - users = WorkOS::DirectorySync.list_users( - limit: 2, - directory: "directory_01FAZYMST676QMTFN1DDJZZX87" - ) - - assert_equal 2, users.data.size - end + def test_list_users_returns_expected_result + stub_request(:get, /#{Regexp.escape("directory_users")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.directory_sync.list_users + assert_kind_of WorkOS::Types::ListStruct, result end - def test_get_group_with_valid_id - VCR.use_cassette("directory_sync/get_group") do - group = WorkOS::DirectorySync.get_group( - "directory_group_01G2Z8D4ZR8RJ03Y1W7P9K8NMG" - ) - - assert_equal "directory_01G2Z8ADK5NPMVTWF48MVVE4HT", group["directory_id"] - assert_equal "org_01EGS4P7QR31EZ4YWD1Z1XA176", group["organization_id"] - assert_equal "01jlao4614two3d", group["idp_id"] - assert_equal "Sales", group["name"] - assert_equal "Sales", group.name - assert_equal "2022-05-13T17:45:31.732Z", group["created_at"] - assert_equal "2022-07-13T17:45:42.618Z", group["updated_at"] - end - end - - def test_get_group_with_invalid_id - VCR.use_cassette("directory_sync/get_group_with_invalid_id") do - assert_raises(WorkOS::NotFoundError) do - WorkOS::DirectorySync.get_group("invalid") - end + def test_list_users_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("directory_users")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.directory_sync.list_users end end - def test_get_user_with_valid_id - VCR.use_cassette("directory_sync/get_user") do - user = WorkOS::DirectorySync.get_user( - "directory_user_01FAZYNPC8M0HRYTKFP2GNX852" - ) - - assert_equal "Bob", user["first_name"] - assert_equal "directory_01FAZYMST676QMTFN1DDJZZX87", user.directory_id - assert_equal "org_01FAZWCWR03DVWA83NCJYKKD54", user.organization_id - assert_equal "Bob", user.first_name - end + def test_get_user_returns_expected_result + stub_request(:get, /#{Regexp.escape("directory_users")}/) + .to_return(body: "{}", status: 200) + result = @client.directory_sync.get_user(id: "stub") + refute_nil result end - def test_get_user_with_invalid_id - VCR.use_cassette("directory_sync/get_user_with_invalid_id") do - assert_raises(WorkOS::NotFoundError) do - WorkOS::DirectorySync.get_user("invalid") - end + def test_get_user_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("directory_users")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.directory_sync.get_user(id: "stub") end end end diff --git a/test/workos/test_directory_user.rb b/test/workos/test_directory_user.rb deleted file mode 100644 index cd489327..00000000 --- a/test/workos/test_directory_user.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class TestDirectoryUser < WorkOS::TestCase - # rubocop:disable Layout/LineLength - def test_primary_email_with_one_primary_email - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - assert_equal "bob.fakename@workos.com", user.primary_email - end - - def test_primary_email_with_multiple_primary_emails - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":true,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - assert_equal "bob.fakename@workos.com", user.primary_email - end - - def test_primary_email_with_no_primary_emails - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":false,"value":"Bob@gmail.com"}],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-07-13T17:45:42.618Z"}') - assert_nil user.primary_email - end - - def test_primary_email_with_empty_email_array - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[],"first_name":"Bob","last_name":"Fakename","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z","updated_at":"2022-07-13T17:45:42.618Z"}') - assert_nil user.primary_email - end - - def test_role_with_no_role - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - assert_nil user.role - assert_nil user.roles - end - - def test_role_with_single_role - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"role":{"slug":"member"},"roles":[{"slug":"member"}],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - assert_equal({slug: "member"}, user.role) - assert_equal [{slug: "member"}], user.roles - end - - def test_role_with_multiple_roles - user = WorkOS::DirectoryUser.new('{"object":"directory_user","id":"directory_user_01FAZYNPC8M0HRYTKFP2GNX852","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","idp_id":"6092c280a3f1e19ef6d8cef8","username":"bob.fakename@workos.com","emails":[{"primary":true,"value":"bob.fakename@workos.com"}, {"primary":false,"value":"bob.fakename@gmail.com"}],"first_name":"Bob","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{},"custom_attributes":{},"groups":[],"role":{"slug":"admin"},"roles":[{"slug":"member"}, {"slug":"admin"}],"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - assert_equal({slug: "admin"}, user.role) - assert_equal [{slug: "member"}, {slug: "admin"}], user.roles - end - # rubocop:enable Layout/LineLength -end diff --git a/test/workos/test_encryptors_aes_gcm.rb b/test/workos/test_encryptors_aes_gcm.rb new file mode 100644 index 00000000..1a90413f --- /dev/null +++ b/test/workos/test_encryptors_aes_gcm.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +require "test_helper" +require "base64" + +class EncryptorsAesGcmTest < Minitest::Test + PASSWORD = "test-cookie-password-at-least-32" + + def setup + @enc = WorkOS::Encryptors::AesGcm.new + end + + def test_seal_unseal_round_trip_hash + data = {"access_token" => "tok_abc", "refresh_token" => "ref_xyz"} + sealed = @enc.seal(data, PASSWORD) + assert_instance_of String, sealed + assert_equal data, @enc.unseal(sealed, PASSWORD) + end + + def test_seal_unseal_round_trip_string + sealed = @enc.seal("hello world", PASSWORD) + assert_equal "hello world", @enc.unseal(sealed, PASSWORD) + end + + def test_unseal_with_wrong_key_raises + sealed = @enc.seal({"x" => 1}, PASSWORD) + assert_raises(OpenSSL::Cipher::CipherError) do + @enc.unseal(sealed, "wrong-password") + end + end + + def test_unseal_rejects_short_payload + assert_raises(ArgumentError) do + @enc.unseal(Base64.strict_encode64("short"), PASSWORD) + end + end + + def test_unseal_rejects_unknown_version + sealed = @enc.seal("data", PASSWORD) + raw = Base64.decode64(sealed) + tampered = Base64.strict_encode64("\x99".b + raw.b[1..]) + assert_raises(ArgumentError) do + @enc.unseal(tampered, PASSWORD) + end + end + + def test_each_seal_produces_unique_output + data = {"key" => "value"} + sealed1 = @enc.seal(data, PASSWORD) + sealed2 = @enc.seal(data, PASSWORD) + refute_equal sealed1, sealed2 + end +end diff --git a/test/workos/test_event.rb b/test/workos/test_event.rb deleted file mode 100644 index 90d0aa0d..00000000 --- a/test/workos/test_event.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class TestEvent < WorkOS::TestCase - def test_list_events_with_no_options_raises_argument_error - VCR.use_cassette "events/list_events_with_no_options" do - assert_raises(ArgumentError) do - WorkOS::Events.list_events - end - end - end - - def test_list_events_with_event - VCR.use_cassette "events/list_events_with_event" do - events = WorkOS::Events.list_events( - events: ["connection.activated"] - ) - - assert_equal 1, events.data.size - end - end - - def test_list_events_with_after - VCR.use_cassette "events/list_events_with_after" do - events = WorkOS::Events.list_events( - after: "event_01FGCPNV312FHFRCX0BYWHVSE1", - events: ["dsync.user.created"] - ) - - assert_equal 1, events.data.size - end - end - - def test_list_events_with_range_start_and_range_end - VCR.use_cassette "events/list_events_with_range" do - events = WorkOS::Events.list_events( - events: ["dsync.user.created"], - range_start: "2023-01-01T00:00:00Z", - range_end: "2023-01-03T00:00:00Z" - ) - - assert_equal 1, events.data.size - end - end - - def test_list_events_with_organization_id - VCR.use_cassette "events/list_events_with_organization_id" do - events = WorkOS::Events.list_events( - events: ["dsync.user.created"], - organization_id: "org_1234" - ) - - assert_equal 1, events.data.size - end - end -end diff --git a/test/workos/test_events.rb b/test/workos/test_events.rb new file mode 100644 index 00000000..af71a303 --- /dev/null +++ b/test/workos/test_events.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class EventsTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_list_events_returns_expected_result + stub_request(:get, /#{Regexp.escape("events")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.events.list_events + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_events_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("events")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.events.list_events + end + end +end diff --git a/test/workos/test_feature_flags.rb b/test/workos/test_feature_flags.rb new file mode 100644 index 00000000..3d9a1fd5 --- /dev/null +++ b/test/workos/test_feature_flags.rb @@ -0,0 +1,133 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class FeatureFlagsTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_list_feature_flags_returns_expected_result + stub_request(:get, /#{Regexp.escape("feature-flags")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.feature_flags.list_feature_flags + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_feature_flags_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("feature-flags")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.feature_flags.list_feature_flags + end + end + + def test_get_feature_flag_returns_expected_result + stub_request(:get, /#{Regexp.escape("feature-flags")}/) + .to_return(body: "{}", status: 200) + result = @client.feature_flags.get_feature_flag(slug: "stub") + refute_nil result + end + + def test_get_feature_flag_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("feature-flags")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.feature_flags.get_feature_flag(slug: "stub") + end + end + + def test_disable_feature_flag_returns_expected_result + stub_request(:put, /#{Regexp.escape("feature-flags")}/) + .to_return(body: "{}", status: 200) + result = @client.feature_flags.disable_feature_flag(slug: "stub") + refute_nil result + end + + def test_disable_feature_flag_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("feature-flags")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.feature_flags.disable_feature_flag(slug: "stub") + end + end + + def test_enable_feature_flag_returns_expected_result + stub_request(:put, /#{Regexp.escape("feature-flags")}/) + .to_return(body: "{}", status: 200) + result = @client.feature_flags.enable_feature_flag(slug: "stub") + refute_nil result + end + + def test_enable_feature_flag_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("feature-flags")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.feature_flags.enable_feature_flag(slug: "stub") + end + end + + def test_add_flag_target_returns_expected_result + stub_request(:post, /#{Regexp.escape("feature-flags")}/) + .to_return(body: "{}", status: 200) + result = @client.feature_flags.add_flag_target(resource_id: "stub", slug: "stub") + assert_nil result if result.nil? + end + + def test_add_flag_target_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("feature-flags")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.feature_flags.add_flag_target(resource_id: "stub", slug: "stub") + end + end + + def test_remove_flag_target_returns_expected_result + stub_request(:delete, /#{Regexp.escape("feature-flags")}/) + .to_return(body: "{}", status: 200) + result = @client.feature_flags.remove_flag_target(resource_id: "stub", slug: "stub") + assert_nil result if result.nil? + end + + def test_remove_flag_target_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("feature-flags")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.feature_flags.remove_flag_target(resource_id: "stub", slug: "stub") + end + end + + def test_list_organization_feature_flags_returns_expected_result + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.feature_flags.list_organization_feature_flags(organization_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_organization_feature_flags_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.feature_flags.list_organization_feature_flags(organization_id: "stub") + end + end + + def test_list_user_feature_flags_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.feature_flags.list_user_feature_flags(user_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_user_feature_flags_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.feature_flags.list_user_feature_flags(user_id: "stub") + end + end +end diff --git a/test/workos/test_list_struct.rb b/test/workos/test_list_struct.rb new file mode 100644 index 00000000..dd12d2a9 --- /dev/null +++ b/test/workos/test_list_struct.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require "test_helper" + +class ListStructTest < Minitest::Test + def test_next_page_uses_after_cursor + next_page = WorkOS::Types::ListStruct.new(data: [2], list_metadata: {}) + list = WorkOS::Types::ListStruct.new( + data: [1], + list_metadata: {"after" => "cursor_after"}, + fetch_next: lambda { |cursor| + assert_equal "cursor_after", cursor + next_page + } + ) + + assert_same next_page, list.next_page + end + + def test_previous_page_uses_before_cursor + previous_page = WorkOS::Types::ListStruct.new(data: [0], list_metadata: {}) + list = WorkOS::Types::ListStruct.new( + data: [1], + list_metadata: {"before" => "cursor_before"}, + fetch_previous: lambda { |cursor| + assert_equal "cursor_before", cursor + previous_page + } + ) + + assert_same previous_page, list.previous_page + end + + def test_next_page_returns_nil_without_cursor + list = WorkOS::Types::ListStruct.new(data: [1], list_metadata: {}, fetch_next: lambda { |_cursor| flunk("should not fetch") }) + + assert_nil list.next_page + end +end diff --git a/test/workos/test_mfa.rb b/test/workos/test_mfa.rb deleted file mode 100644 index 82fe41db..00000000 --- a/test/workos/test_mfa.rb +++ /dev/null @@ -1,216 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class TestMFA < WorkOS::TestCase - def test_enroll_factor_generic_valid - VCR.use_cassette "mfa/enroll_factor_generic_valid" do - factor = WorkOS::MFA.enroll_factor( - type: "generic_otp" - ) - assert_equal "generic_otp", factor.type - end - end - - def test_enroll_factor_totp_valid - VCR.use_cassette "mfa/enroll_factor_totp_valid" do - factor = WorkOS::MFA.enroll_factor( - type: "totp", - totp_issuer: "WorkOS", - totp_user: "some_user" - ) - assert_kind_of Hash, factor.totp - end - end - - def test_enroll_factor_sms_valid - VCR.use_cassette "mfa/enroll_factor_sms_valid" do - factor = WorkOS::MFA.enroll_factor( - type: "sms", - phone_number: "55555555555" - ) - assert_kind_of Hash, factor.sms - end - end - - def test_enroll_factor_with_invalid_type_raises_error - err = assert_raises(ArgumentError) do - WorkOS::MFA.enroll_factor( - type: "invalid", - phone_number: "+15005550006" - ) - end - assert_equal "Type argument must be either 'sms' or 'totp'", err.message - end - - def test_enroll_factor_totp_missing_arguments_raises_error - err = assert_raises(ArgumentError) do - WorkOS::MFA.enroll_factor( - type: "totp", - totp_issuer: "WorkOS" - ) - end - assert_equal "Incomplete arguments. Need to specify both totp_issuer and totp_user when type is totp", err.message - end - - def test_enroll_factor_sms_missing_phone_number_raises_error - err = assert_raises(ArgumentError) do - WorkOS::MFA.enroll_factor( - type: "sms" - ) - end - assert_equal "Incomplete arguments. Need to specify phone_number when type is sms", err.message - end - - def test_challenge_factor_totp - VCR.use_cassette "mfa/challenge_factor_totp_valid" do - challenge_factor = WorkOS::MFA.challenge_factor( - authentication_factor_id: "auth_factor_01FZ4TS0MWPZR7GATS7KCXANQZ" - ) - assert_kind_of String, challenge_factor.authentication_factor_id - end - end - - def test_challenge_factor_sms - VCR.use_cassette "mfa/challenge_factor_sms_valid" do - challenge_factor = WorkOS::MFA.challenge_factor( - authentication_factor_id: "auth_factor_01FZ4TS14D1PHFNZ9GF6YD8M1F", - sms_template: "Your code is {{code}}" - ) - assert_kind_of String, challenge_factor.authentication_factor_id - end - end - - def test_challenge_factor_generic - VCR.use_cassette "mfa/challenge_factor_generic_valid" do - challenge_factor = WorkOS::MFA.challenge_factor( - authentication_factor_id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" - ) - assert_kind_of String, challenge_factor.code - end - end - - def test_challenge_factor_missing_authentication_factor_id_raises_error - err = assert_raises(ArgumentError) do - WorkOS::MFA.challenge_factor - end - assert_equal "Incomplete arguments: 'authentication_factor_id' is a required argument", err.message - end - - def test_verify_factor_throws_deprecation_warning - VCR.use_cassette "mfa/verify_challenge_generic_valid" do - _, err = capture_io do - WorkOS::MFA.verify_factor( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - end - assert_match(/\[DEPRECATION\] `verify_factor` is deprecated. Please use `verify_challenge` instead./, err) - end - end - - def test_verify_factor_calls_verify_challenge - VCR.use_cassette "mfa/verify_challenge_generic_valid" do - verify_factor = WorkOS::MFA.verify_factor( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - assert_equal true, verify_factor.valid - end - end - - def test_verify_challenge_generic_valid_returns_true - VCR.use_cassette "mfa/verify_challenge_generic_valid" do - verify_challenge = WorkOS::MFA.verify_challenge( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - assert_equal true, verify_challenge.valid - end - end - - def test_verify_challenge_generic_valid_returns_false - VCR.use_cassette "mfa/verify_challenge_generic_valid_is_false" do - verify_challenge = WorkOS::MFA.verify_challenge( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - assert_equal false, verify_challenge.valid - end - end - - def test_verify_challenge_already_verified_raises_error - VCR.use_cassette "mfa/verify_challenge_generic_invalid" do - assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::MFA.verify_challenge( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - end - end - end - - def test_verify_challenge_expired_raises_error - VCR.use_cassette "mfa/verify_challenge_generic_expired" do - assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::MFA.verify_challenge( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J", - code: "897792" - ) - end - end - end - - def test_verify_challenge_missing_code_raises_error - err = assert_raises(ArgumentError) do - WorkOS::MFA.verify_challenge( - authentication_challenge_id: "auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J" - ) - end - assert_equal "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments", err.message - end - - def test_verify_challenge_missing_authentication_challenge_id_raises_error - err = assert_raises(ArgumentError) do - WorkOS::MFA.verify_challenge( - code: "897792" - ) - end - assert_equal "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments", err.message - end - - def test_verify_challenge_missing_all_arguments_raises_error - err = assert_raises(ArgumentError) do - WorkOS::MFA.verify_challenge - end - assert_equal "Incomplete arguments: 'authentication_challenge_id' and 'code' are required arguments", err.message - end - - def test_get_factor_with_valid_id - VCR.use_cassette "mfa/get_factor_valid" do - factor = WorkOS::MFA.get_factor( - id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" - ) - assert_kind_of String, factor.id - end - end - - def test_get_factor_with_invalid_id - VCR.use_cassette "mfa/get_factor_invalid" do - assert_raises(WorkOS::NotFoundError) do - WorkOS::MFA.get_factor( - id: "auth_factor_invalid" - ) - end - end - end - - def test_delete_factor - VCR.use_cassette "mfa/delete_factor" do - response = WorkOS::MFA.delete_factor( - id: "auth_factor_01FZ4WMXXA09XF6NK1XMKNWB3M" - ) - assert_equal true, response - end - end -end diff --git a/test/workos/test_model_round_trip.rb b/test/workos/test_model_round_trip.rb new file mode 100644 index 00000000..796384a0 --- /dev/null +++ b/test/workos/test_model_round_trip.rb @@ -0,0 +1,6572 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class ModelRoundTripTest < Minitest::Test + def test_user_object_round_trip + fixture = { + "id" => "stub", + "email" => "stub", + "first_name" => "stub", + "last_name" => "stub", + "metadata" => {} + } + model = WorkOS::UserObject.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["email"], json[:email] + end + + def test_user_consent_option_round_trip + fixture = { + "claim" => "stub", + "type" => "enum", + "label" => "stub", + "choices" => [] + } + model = WorkOS::UserConsentOption.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["claim"], json[:claim] + assert_equal fixture["label"], json[:label] + end + + def test_user_management_login_request_round_trip + fixture = { + "external_auth_id" => "stub", + "user" => {}, + "user_consent_options" => [] + } + model = WorkOS::UserManagementLoginRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["external_auth_id"], json[:external_auth_id] + end + + def test_validate_api_key_round_trip + fixture = { + "value" => "stub" + } + model = WorkOS::ValidateApiKey.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["value"], json[:value] + end + + def test_redirect_uri_input_round_trip + fixture = { + "uri" => "stub", + "default" => nil + } + model = WorkOS::RedirectUriInput.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["uri"], json[:uri] + end + + def test_create_oauth_application_round_trip + fixture = { + "name" => "stub", + "application_type" => "oauth", + "description" => nil, + "scopes" => nil, + "redirect_uris" => nil, + "uses_pkce" => nil, + "is_first_party" => true, + "organization_id" => nil + } + model = WorkOS::CreateOAuthApplication.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["name"], json[:name] + assert_equal fixture["is_first_party"], json[:is_first_party] + end + + def test_create_m2m_application_round_trip + fixture = { + "name" => "stub", + "application_type" => "m2m", + "description" => nil, + "scopes" => nil, + "organization_id" => "stub" + } + model = WorkOS::CreateM2MApplication.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["name"], json[:name] + assert_equal fixture["organization_id"], json[:organization_id] + end + + def test_update_oauth_application_round_trip + fixture = { + "name" => "stub", + "description" => nil, + "scopes" => nil, + "redirect_uris" => nil + } + model = WorkOS::UpdateOAuthApplication.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_create_application_secret_round_trip + model = WorkOS::CreateApplicationSecret.new("{}") + json = model.to_h + assert_kind_of Hash, json + end + + def test_audit_log_event_actor_round_trip + fixture = { + "id" => "stub", + "type" => "stub", + "name" => "stub", + "metadata" => {} + } + model = WorkOS::AuditLogEventActor.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["type"], json[:type] + end + + def test_audit_log_event_target_round_trip + fixture = { + "id" => "stub", + "type" => "stub", + "name" => "stub", + "metadata" => {} + } + model = WorkOS::AuditLogEventTarget.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["type"], json[:type] + end + + def test_audit_log_event_context_round_trip + fixture = { + "location" => "stub", + "user_agent" => "stub" + } + model = WorkOS::AuditLogEventContext.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["location"], json[:location] + end + + def test_audit_log_event_round_trip + fixture = { + "action" => "stub", + "occurred_at" => "stub", + "actor" => {}, + "targets" => [], + "context" => {}, + "metadata" => {}, + "version" => 1 + } + model = WorkOS::AuditLogEvent.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["action"], json[:action] + assert_equal fixture["occurred_at"], json[:occurred_at] + end + + def test_audit_log_event_ingestion_round_trip + fixture = { + "organization_id" => "stub", + "event" => {} + } + model = WorkOS::AuditLogEventIngestion.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["organization_id"], json[:organization_id] + end + + def test_audit_log_export_creation_round_trip + fixture = { + "organization_id" => "stub", + "range_start" => "stub", + "range_end" => "stub", + "actions" => [], + "actors" => [], + "actor_names" => [], + "actor_ids" => [], + "targets" => [] + } + model = WorkOS::AuditLogExportCreation.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["range_start"], json[:range_start] + assert_equal fixture["range_end"], json[:range_end] + end + + def test_update_audit_logs_retention_round_trip + fixture = { + "retention_period_in_days" => 1 + } + model = WorkOS::UpdateAuditLogsRetention.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["retention_period_in_days"], json[:retention_period_in_days] + end + + def test_audit_log_schema_actor_round_trip + fixture = { + "metadata" => {} + } + model = WorkOS::AuditLogSchemaActor.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_audit_log_schema_target_round_trip + fixture = { + "type" => "stub", + "metadata" => {} + } + model = WorkOS::AuditLogSchemaTarget.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["type"], json[:type] + end + + def test_audit_log_schema_round_trip + fixture = { + "actor" => {}, + "targets" => [], + "metadata" => {} + } + model = WorkOS::AuditLogSchema.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_challenge_authentication_factor_round_trip + fixture = { + "sms_template" => "stub" + } + model = WorkOS::ChallengeAuthenticationFactor.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_check_authorization_round_trip + fixture = { + "permission_slug" => "stub", + "resource_id" => "stub", + "resource_external_id" => "stub", + "resource_type_slug" => "stub" + } + model = WorkOS::CheckAuthorization.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["permission_slug"], json[:permission_slug] + end + + def test_assign_role_round_trip + fixture = { + "role_slug" => "stub", + "resource_id" => "stub", + "resource_external_id" => "stub", + "resource_type_slug" => "stub" + } + model = WorkOS::AssignRole.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["role_slug"], json[:role_slug] + end + + def test_remove_role_round_trip + fixture = { + "role_slug" => "stub", + "resource_id" => "stub", + "resource_external_id" => "stub", + "resource_type_slug" => "stub" + } + model = WorkOS::RemoveRole.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["role_slug"], json[:role_slug] + end + + def test_set_role_permissions_round_trip + fixture = { + "permissions" => [] + } + model = WorkOS::SetRolePermissions.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_add_role_permission_round_trip + fixture = { + "slug" => "stub" + } + model = WorkOS::AddRolePermission.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["slug"], json[:slug] + end + + def test_create_organization_role_round_trip + fixture = { + "slug" => "stub", + "name" => "stub", + "description" => nil, + "resource_type_slug" => "stub" + } + model = WorkOS::CreateOrganizationRole.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["name"], json[:name] + end + + def test_update_organization_role_round_trip + fixture = { + "name" => "stub", + "description" => nil + } + model = WorkOS::UpdateOrganizationRole.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_create_authorization_permission_round_trip + fixture = { + "slug" => "stub", + "name" => "stub", + "description" => nil, + "resource_type_slug" => "stub" + } + model = WorkOS::CreateAuthorizationPermission.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + end + + def test_update_authorization_permission_round_trip + fixture = { + "name" => "stub", + "description" => nil + } + model = WorkOS::UpdateAuthorizationPermission.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_create_role_round_trip + fixture = { + "slug" => "stub", + "name" => "stub", + "description" => nil, + "resource_type_slug" => "stub" + } + model = WorkOS::CreateRole.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + end + + def test_update_role_round_trip + fixture = { + "name" => "stub", + "description" => nil + } + model = WorkOS::UpdateRole.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_update_authorization_resource_round_trip + fixture = { + "name" => "stub", + "description" => nil, + "parent_resource_id" => "stub", + "parent_resource_external_id" => "stub", + "parent_resource_type_slug" => "stub" + } + model = WorkOS::UpdateAuthorizationResource.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_create_authorization_resource_round_trip + fixture = { + "external_id" => "stub", + "name" => "stub", + "description" => nil, + "resource_type_slug" => "stub", + "organization_id" => "stub", + "parent_resource_id" => nil, + "parent_resource_external_id" => "stub", + "parent_resource_type_slug" => "stub" + } + model = WorkOS::CreateAuthorizationResource.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["external_id"], json[:external_id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + assert_equal fixture["organization_id"], json[:organization_id] + end + + def test_create_cors_origin_round_trip + fixture = { + "origin" => "stub" + } + model = WorkOS::CreateCORSOrigin.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["origin"], json[:origin] + end + + def test_update_jwt_template_round_trip + fixture = { + "content" => "stub" + } + model = WorkOS::UpdateJWTTemplate.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["content"], json[:content] + end + + def test_create_organization_domain_round_trip + fixture = { + "domain" => "stub", + "organization_id" => "stub" + } + model = WorkOS::CreateOrganizationDomain.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["domain"], json[:domain] + assert_equal fixture["organization_id"], json[:organization_id] + end + + def test_create_organization_api_key_round_trip + fixture = { + "name" => "stub", + "permissions" => [] + } + model = WorkOS::CreateOrganizationApiKey.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["name"], json[:name] + end + + def test_organization_domain_data_round_trip + fixture = { + "domain" => "stub", + "state" => "stub" + } + model = WorkOS::OrganizationDomainData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["domain"], json[:domain] + end + + def test_organization_input_round_trip + fixture = { + "name" => "stub", + "allow_profiles_outside_organization" => true, + "domains" => [], + "domain_data" => [], + "metadata" => nil, + "external_id" => nil + } + model = WorkOS::OrganizationInput.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["name"], json[:name] + end + + def test_update_organization_round_trip + fixture = { + "name" => "stub", + "allow_profiles_outside_organization" => true, + "domains" => [], + "domain_data" => [], + "stripe_customer_id" => "stub", + "metadata" => nil, + "external_id" => nil + } + model = WorkOS::UpdateOrganization.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_sso_intent_options_round_trip + fixture = { + "bookmark_slug" => "stub", + "provider_type" => "GoogleSAML" + } + model = WorkOS::SSOIntentOptions.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_intent_options_round_trip + fixture = { + "sso" => {} + } + model = WorkOS::IntentOptions.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_generate_link_round_trip + fixture = { + "return_url" => "stub", + "success_url" => "stub", + "organization" => "stub", + "intent" => "stub", + "intent_options" => {}, + "admin_emails" => [] + } + model = WorkOS::GenerateLink.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["organization"], json[:organization] + end + + def test_create_redirect_uri_round_trip + fixture = { + "uri" => "stub" + } + model = WorkOS::CreateRedirectUri.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["uri"], json[:uri] + end + + def test_enroll_user_authentication_factor_round_trip + fixture = { + "type" => "totp", + "totp_issuer" => "stub", + "totp_user" => "stub", + "totp_secret" => "stub" + } + model = WorkOS::EnrollUserAuthenticationFactor.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_create_magic_code_and_return_round_trip + fixture = { + "email" => "stub", + "invitation_token" => "stub" + } + model = WorkOS::CreateMagicCodeAndReturn.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + end + + def test_create_user_invite_options_round_trip + fixture = { + "email" => "stub", + "organization_id" => "stub", + "role_slug" => "stub", + "expires_in_days" => 1, + "inviter_user_id" => "stub", + "locale" => "stub" + } + model = WorkOS::CreateUserInviteOptions.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + end + + def test_resend_user_invite_options_round_trip + fixture = { + "locale" => "stub" + } + model = WorkOS::ResendUserInviteOptions.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_create_user_organization_membership_round_trip + fixture = { + "user_id" => "stub", + "organization_id" => "stub", + "role_slug" => "stub", + "role_slugs" => [] + } + model = WorkOS::CreateUserOrganizationMembership.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["organization_id"], json[:organization_id] + end + + def test_update_user_organization_membership_round_trip + fixture = { + "role_slug" => "stub", + "role_slugs" => [] + } + model = WorkOS::UpdateUserOrganizationMembership.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_create_user_round_trip + fixture = { + "email" => "stub", + "first_name" => nil, + "last_name" => nil, + "email_verified" => nil, + "metadata" => nil, + "external_id" => nil, + "password" => nil, + "password_hash" => "stub", + "password_hash_type" => "stub" + } + model = WorkOS::CreateUser.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + end + + def test_update_user_round_trip + fixture = { + "email" => "stub", + "first_name" => "stub", + "last_name" => "stub", + "email_verified" => true, + "metadata" => nil, + "external_id" => nil, + "locale" => nil, + "password" => "stub", + "password_hash" => "stub", + "password_hash_type" => "stub" + } + model = WorkOS::UpdateUser.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_verify_email_address_round_trip + fixture = { + "code" => "stub" + } + model = WorkOS::VerifyEmailAddress.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["code"], json[:code] + end + + def test_create_password_reset_token_round_trip + fixture = { + "email" => "stub" + } + model = WorkOS::CreatePasswordResetToken.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + end + + def test_create_password_reset_round_trip + fixture = { + "token" => "stub", + "new_password" => "stub" + } + model = WorkOS::CreatePasswordReset.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["token"], json[:token] + assert_equal fixture["new_password"], json[:new_password] + end + + def test_send_email_change_round_trip + fixture = { + "new_email" => "stub" + } + model = WorkOS::SendEmailChange.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["new_email"], json[:new_email] + end + + def test_confirm_email_change_round_trip + fixture = { + "code" => "stub" + } + model = WorkOS::ConfirmEmailChange.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["code"], json[:code] + end + + def test_revoke_session_round_trip + fixture = { + "session_id" => "stub", + "return_to" => "stub" + } + model = WorkOS::RevokeSession.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["session_id"], json[:session_id] + end + + def test_create_webhook_endpoint_round_trip + fixture = { + "endpoint_url" => "stub", + "events" => [] + } + model = WorkOS::CreateWebhookEndpoint.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["endpoint_url"], json[:endpoint_url] + end + + def test_update_webhook_endpoint_round_trip + fixture = { + "endpoint_url" => "stub", + "status" => "stub", + "events" => [] + } + model = WorkOS::UpdateWebhookEndpoint.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_widget_session_token_round_trip + fixture = { + "organization_id" => "stub", + "user_id" => "stub", + "scopes" => [] + } + model = WorkOS::WidgetSessionToken.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["organization_id"], json[:organization_id] + end + + def test_token_query_round_trip + fixture = { + "client_id" => "stub", + "client_secret" => "stub", + "code" => "stub", + "grant_type" => "authorization_code" + } + model = WorkOS::TokenQuery.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + assert_equal fixture["client_secret"], json[:client_secret] + assert_equal fixture["code"], json[:code] + end + + def test_external_auth_complete_response_round_trip + fixture = { + "redirect_uri" => "stub" + } + model = WorkOS::ExternalAuthCompleteResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["redirect_uri"], json[:redirect_uri] + end + + def test_api_key_round_trip + fixture = { + "object" => "api_key", + "id" => "stub", + "owner" => {}, + "name" => "stub", + "obfuscated_value" => "stub", + "last_used_at" => nil, + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::ApiKey.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["obfuscated_value"], json[:obfuscated_value] + assert_nil json[:last_used_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_api_key_validation_response_round_trip + fixture = { + "api_key" => nil + } + model = WorkOS::ApiKeyValidationResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_connect_application_round_trip + fixture = { + "object" => "connect_application", + "id" => "stub", + "client_id" => "stub", + "description" => nil, + "name" => "stub", + "scopes" => [], + "created_at" => "stub", + "updated_at" => "stub", + "application_type" => "m2m", + "organization_id" => "stub" + } + model = WorkOS::ConnectApplication.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["client_id"], json[:client_id] + assert_nil json[:description] + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_new_connect_application_secret_round_trip + fixture = { + "object" => "connect_application_secret", + "id" => "stub", + "secret_hint" => "stub", + "last_used_at" => nil, + "created_at" => "stub", + "updated_at" => "stub", + "secret" => "stub" + } + model = WorkOS::NewConnectApplicationSecret.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["secret_hint"], json[:secret_hint] + assert_nil json[:last_used_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_equal fixture["secret"], json[:secret] + end + + def test_audit_log_event_create_response_round_trip + fixture = { + "success" => true + } + model = WorkOS::AuditLogEventCreateResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["success"], json[:success] + end + + def test_audit_log_export_round_trip + fixture = { + "object" => "audit_log_export", + "id" => "stub", + "state" => "stub", + "url" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::AuditLogExport.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_audit_logs_retention_round_trip + fixture = { + "retention_period_in_days" => nil + } + model = WorkOS::AuditLogsRetention.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:retention_period_in_days] + end + + def test_audit_log_action_round_trip + fixture = { + "object" => "audit_log_action", + "name" => "stub", + "schema" => {}, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::AuditLogAction.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_authentication_challenge_round_trip + fixture = { + "object" => "authentication_challenge", + "id" => "stub", + "expires_at" => "stub", + "code" => "stub", + "authentication_factor_id" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::AuthenticationChallenge.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["authentication_factor_id"], json[:authentication_factor_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_authentication_challenge_verify_response_round_trip + fixture = { + "challenge" => {}, + "valid" => true + } + model = WorkOS::AuthenticationChallengeVerifyResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["valid"], json[:valid] + end + + def test_authentication_factor_enrolled_round_trip + fixture = { + "object" => "authentication_factor", + "id" => "stub", + "type" => "stub", + "user_id" => "stub", + "sms" => {}, + "totp" => {}, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::AuthenticationFactorEnrolled.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_authentication_factor_round_trip + fixture = { + "object" => "authentication_factor", + "id" => "stub", + "type" => "stub", + "user_id" => "stub", + "sms" => {}, + "totp" => {}, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::AuthenticationFactor.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_authorization_check_round_trip + fixture = { + "authorized" => true + } + model = WorkOS::AuthorizationCheck.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["authorized"], json[:authorized] + end + + def test_authorization_resource_round_trip + fixture = { + "object" => "authorization_resource", + "name" => "stub", + "description" => nil, + "organization_id" => "stub", + "parent_resource_id" => nil, + "id" => "stub", + "external_id" => "stub", + "resource_type_slug" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::AuthorizationResource.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["organization_id"], json[:organization_id] + assert_nil json[:parent_resource_id] + assert_equal fixture["id"], json[:id] + assert_equal fixture["external_id"], json[:external_id] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_authorization_permission_round_trip + fixture = { + "object" => "permission", + "id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "system" => true, + "resource_type_slug" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::AuthorizationPermission.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["system"], json[:system] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_slim_role_round_trip + fixture = { + "slug" => "stub" + } + model = WorkOS::SlimRole.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["slug"], json[:slug] + end + + def test_role_assignment_round_trip + fixture = { + "object" => "role_assignment", + "id" => "stub", + "role" => {}, + "resource" => {}, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::RoleAssignment.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_role_round_trip + fixture = { + "slug" => "stub", + "object" => "role", + "id" => "stub", + "name" => "stub", + "description" => nil, + "type" => "stub", + "resource_type_slug" => "stub", + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::Role.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_role_list_round_trip + fixture = { + "object" => "list", + "data" => [] + } + model = WorkOS::RoleList.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_connection_round_trip + fixture = { + "object" => "connection", + "id" => "stub", + "organization_id" => "stub", + "connection_type" => "stub", + "name" => "stub", + "state" => "stub", + "status" => "stub", + "domains" => [], + "options" => {}, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::Connection.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_cors_origin_response_round_trip + fixture = { + "object" => "cors_origin", + "id" => "stub", + "origin" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::CORSOriginResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["origin"], json[:origin] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_directory_round_trip + fixture = { + "object" => "directory", + "id" => "stub", + "organization_id" => "stub", + "external_key" => "stub", + "type" => "stub", + "state" => "stub", + "name" => "stub", + "domain" => "stub", + "metadata" => {}, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::Directory.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["external_key"], json[:external_key] + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_directory_group_round_trip + fixture = { + "object" => "directory_group", + "id" => "stub", + "idp_id" => "stub", + "directory_id" => "stub", + "organization_id" => "stub", + "name" => "stub", + "raw_attributes" => {}, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::DirectoryGroup.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["idp_id"], json[:idp_id] + assert_equal fixture["directory_id"], json[:directory_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_directory_user_with_groups_round_trip + fixture = { + "object" => "directory_user", + "id" => "stub", + "directory_id" => "stub", + "organization_id" => "stub", + "idp_id" => "stub", + "email" => nil, + "first_name" => nil, + "last_name" => nil, + "emails" => [], + "job_title" => nil, + "username" => nil, + "state" => "stub", + "raw_attributes" => {}, + "custom_attributes" => {}, + "role" => {}, + "roles" => [], + "created_at" => "stub", + "updated_at" => "stub", + "groups" => [] + } + model = WorkOS::DirectoryUserWithGroups.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["directory_id"], json[:directory_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["idp_id"], json[:idp_id] + assert_nil json[:email] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_event_context_actor_round_trip + fixture = { + "id" => "stub", + "source" => "stub", + "name" => nil + } + model = WorkOS::EventContextActor.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:name] + end + + def test_event_context_round_trip + fixture = { + "google_analytics_client_id" => "stub", + "google_analytics_sessions" => [], + "ajs_anonymous_id" => "stub", + "client_id" => "stub", + "actor" => {}, + "previous_attributes" => {} + } + model = WorkOS::EventContext.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_directory_user_round_trip + fixture = { + "object" => "directory_user", + "id" => "stub", + "directory_id" => "stub", + "organization_id" => "stub", + "idp_id" => "stub", + "email" => nil, + "first_name" => nil, + "last_name" => nil, + "emails" => [], + "job_title" => nil, + "username" => nil, + "state" => "stub", + "raw_attributes" => {}, + "custom_attributes" => {}, + "role" => {}, + "roles" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::DirectoryUser.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["directory_id"], json[:directory_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["idp_id"], json[:idp_id] + assert_nil json[:email] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_group_round_trip + fixture = { + "object" => "group", + "id" => "stub", + "organization_id" => "stub", + "name" => "stub", + "description" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::Group.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_user_round_trip + fixture = { + "object" => "user", + "id" => "stub", + "first_name" => nil, + "last_name" => nil, + "profile_picture_url" => nil, + "email" => "stub", + "email_verified" => true, + "external_id" => nil, + "metadata" => {}, + "last_sign_in_at" => nil, + "locale" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::User.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:first_name] + assert_nil json[:last_name] + assert_nil json[:profile_picture_url] + assert_equal fixture["email"], json[:email] + assert_equal fixture["email_verified"], json[:email_verified] + assert_nil json[:external_id] + assert_nil json[:last_sign_in_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_event_schema_round_trip + fixture = { + "object" => "event", + "id" => "stub", + "event" => "stub", + "data" => {}, + "created_at" => "stub", + "context" => {} + } + model = WorkOS::EventSchema.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["event"], json[:event] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_action_authentication_denied_round_trip + fixture = { + "id" => "stub", + "event" => "action.authentication.denied", + "data" => {}, + "context" => {}, + "created_at" => "stub", + "object" => "event" + } + model = WorkOS::ActionAuthenticationDenied.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_action_authentication_denied_data_round_trip + fixture = { + "action_endpoint_id" => "stub", + "action_execution_id" => "stub", + "type" => "authentication", + "verdict" => "Deny", + "user_id" => "stub", + "organization_id" => nil, + "email" => "stub", + "ip_address" => nil, + "user_agent" => nil + } + model = WorkOS::ActionAuthenticationDeniedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["action_endpoint_id"], json[:action_endpoint_id] + assert_equal fixture["action_execution_id"], json[:action_execution_id] + assert_equal fixture["user_id"], json[:user_id] + assert_nil json[:organization_id] + assert_equal fixture["email"], json[:email] + assert_nil json[:ip_address] + assert_nil json[:user_agent] + end + + def test_action_user_registration_denied_round_trip + fixture = { + "id" => "stub", + "event" => "action.user_registration.denied", + "data" => {}, + "context" => {}, + "created_at" => "stub", + "object" => "event" + } + model = WorkOS::ActionUserRegistrationDenied.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_action_user_registration_denied_data_round_trip + fixture = { + "action_endpoint_id" => "stub", + "action_execution_id" => "stub", + "type" => "user_registration", + "verdict" => "Deny", + "organization_id" => nil, + "email" => "stub", + "ip_address" => nil, + "user_agent" => nil + } + model = WorkOS::ActionUserRegistrationDeniedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["action_endpoint_id"], json[:action_endpoint_id] + assert_equal fixture["action_execution_id"], json[:action_execution_id] + assert_nil json[:organization_id] + assert_equal fixture["email"], json[:email] + assert_nil json[:ip_address] + assert_nil json[:user_agent] + end + + def test_api_key_created_round_trip + fixture = { + "id" => "stub", + "event" => "api_key.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::ApiKeyCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_api_key_created_data_round_trip + fixture = { + "object" => "api_key", + "id" => "stub", + "owner" => {}, + "name" => "stub", + "obfuscated_value" => "stub", + "last_used_at" => nil, + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::ApiKeyCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["obfuscated_value"], json[:obfuscated_value] + assert_nil json[:last_used_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_api_key_created_data_owner_round_trip + fixture = { + "type" => "organization", + "id" => "stub" + } + model = WorkOS::ApiKeyCreatedDataOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + end + + def test_api_key_revoked_round_trip + fixture = { + "id" => "stub", + "event" => "api_key.revoked", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::ApiKeyRevoked.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_api_key_revoked_data_round_trip + fixture = { + "object" => "api_key", + "id" => "stub", + "owner" => {}, + "name" => "stub", + "obfuscated_value" => "stub", + "last_used_at" => nil, + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::ApiKeyRevokedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["obfuscated_value"], json[:obfuscated_value] + assert_nil json[:last_used_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_api_key_revoked_data_owner_round_trip + fixture = { + "type" => "organization", + "id" => "stub" + } + model = WorkOS::ApiKeyRevokedDataOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + end + + def test_authentication_email_verification_failed_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.email_verification_failed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationEmailVerificationFailed.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_email_verification_failed_data_round_trip + fixture = { + "type" => "email_verification", + "status" => "failed", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => nil, + "email" => nil, + "error" => {} + } + model = WorkOS::AuthenticationEmailVerificationFailedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_nil json[:user_id] + assert_nil json[:email] + end + + def test_authentication_email_verification_failed_data_error_round_trip + fixture = { + "code" => "stub", + "message" => "stub" + } + model = WorkOS::AuthenticationEmailVerificationFailedDataError.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["code"], json[:code] + assert_equal fixture["message"], json[:message] + end + + def test_authentication_email_verification_succeeded_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.email_verification_succeeded", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationEmailVerificationSucceeded.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_email_verification_succeeded_data_round_trip + fixture = { + "type" => "email_verification", + "status" => "succeeded", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => "stub", + "email" => "stub" + } + model = WorkOS::AuthenticationEmailVerificationSucceededData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + end + + def test_authentication_magic_auth_failed_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.magic_auth_failed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationMagicAuthFailed.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_magic_auth_failed_data_round_trip + fixture = { + "type" => "magic_auth", + "status" => "failed", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => nil, + "email" => nil, + "error" => {} + } + model = WorkOS::AuthenticationMagicAuthFailedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_nil json[:user_id] + assert_nil json[:email] + end + + def test_authentication_magic_auth_failed_data_error_round_trip + fixture = { + "code" => "stub", + "message" => "stub" + } + model = WorkOS::AuthenticationMagicAuthFailedDataError.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["code"], json[:code] + assert_equal fixture["message"], json[:message] + end + + def test_authentication_magic_auth_succeeded_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.magic_auth_succeeded", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationMagicAuthSucceeded.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_magic_auth_succeeded_data_round_trip + fixture = { + "type" => "magic_auth", + "status" => "succeeded", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => "stub", + "email" => "stub" + } + model = WorkOS::AuthenticationMagicAuthSucceededData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + end + + def test_authentication_mfa_failed_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.mfa_failed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationMFAFailed.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_mfa_failed_data_round_trip + fixture = { + "type" => "mfa", + "status" => "failed", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => nil, + "email" => nil, + "error" => {} + } + model = WorkOS::AuthenticationMFAFailedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_nil json[:user_id] + assert_nil json[:email] + end + + def test_authentication_mfa_failed_data_error_round_trip + fixture = { + "code" => "stub", + "message" => "stub" + } + model = WorkOS::AuthenticationMFAFailedDataError.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["code"], json[:code] + assert_equal fixture["message"], json[:message] + end + + def test_authentication_mfa_succeeded_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.mfa_succeeded", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationMFASucceeded.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_mfa_succeeded_data_round_trip + fixture = { + "type" => "mfa", + "status" => "succeeded", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => "stub", + "email" => "stub" + } + model = WorkOS::AuthenticationMFASucceededData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + end + + def test_authentication_oauth_failed_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.oauth_failed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationOAuthFailed.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_oauth_failed_data_round_trip + fixture = { + "type" => "oauth", + "status" => "failed", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => nil, + "email" => nil, + "error" => {} + } + model = WorkOS::AuthenticationOAuthFailedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_nil json[:user_id] + assert_nil json[:email] + end + + def test_authentication_oauth_failed_data_error_round_trip + fixture = { + "code" => "stub", + "message" => "stub" + } + model = WorkOS::AuthenticationOAuthFailedDataError.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["code"], json[:code] + assert_equal fixture["message"], json[:message] + end + + def test_authentication_oauth_succeeded_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.oauth_succeeded", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationOAuthSucceeded.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_oauth_succeeded_data_round_trip + fixture = { + "type" => "oauth", + "status" => "succeeded", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => nil, + "email" => "stub" + } + model = WorkOS::AuthenticationOAuthSucceededData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_nil json[:user_id] + assert_equal fixture["email"], json[:email] + end + + def test_authentication_passkey_failed_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.passkey_failed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationPasskeyFailed.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_passkey_failed_data_round_trip + fixture = { + "type" => "passkey", + "status" => "failed", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => nil, + "email" => nil, + "error" => {} + } + model = WorkOS::AuthenticationPasskeyFailedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_nil json[:user_id] + assert_nil json[:email] + end + + def test_authentication_passkey_failed_data_error_round_trip + fixture = { + "code" => "stub", + "message" => "stub" + } + model = WorkOS::AuthenticationPasskeyFailedDataError.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["code"], json[:code] + assert_equal fixture["message"], json[:message] + end + + def test_authentication_passkey_succeeded_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.passkey_succeeded", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationPasskeySucceeded.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_passkey_succeeded_data_round_trip + fixture = { + "type" => "passkey", + "status" => "succeeded", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => "stub", + "email" => "stub" + } + model = WorkOS::AuthenticationPasskeySucceededData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + end + + def test_authentication_password_failed_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.password_failed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationPasswordFailed.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_password_failed_data_round_trip + fixture = { + "type" => "password", + "status" => "failed", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => nil, + "email" => nil, + "error" => {} + } + model = WorkOS::AuthenticationPasswordFailedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_nil json[:user_id] + assert_nil json[:email] + end + + def test_authentication_password_failed_data_error_round_trip + fixture = { + "code" => "stub", + "message" => "stub" + } + model = WorkOS::AuthenticationPasswordFailedDataError.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["code"], json[:code] + assert_equal fixture["message"], json[:message] + end + + def test_authentication_password_succeeded_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.password_succeeded", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationPasswordSucceeded.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_password_succeeded_data_round_trip + fixture = { + "type" => "password", + "status" => "succeeded", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => "stub", + "email" => "stub" + } + model = WorkOS::AuthenticationPasswordSucceededData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + end + + def test_authentication_radar_risk_detected_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.radar_risk_detected", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationRadarRiskDetected.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_radar_risk_detected_data_round_trip + fixture = { + "auth_method" => "stub", + "action" => "stub", + "control" => nil, + "blocklist_type" => nil, + "ip_address" => nil, + "user_agent" => nil, + "user_id" => "stub", + "email" => "stub" + } + model = WorkOS::AuthenticationRadarRiskDetectedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["auth_method"], json[:auth_method] + assert_nil json[:control] + assert_nil json[:blocklist_type] + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + end + + def test_authentication_sso_failed_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.sso_failed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationSSOFailed.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_sso_failed_data_round_trip + fixture = { + "type" => "sso", + "status" => "failed", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => nil, + "email" => nil, + "sso" => {}, + "error" => {} + } + model = WorkOS::AuthenticationSSOFailedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_nil json[:user_id] + assert_nil json[:email] + end + + def test_authentication_sso_failed_data_sso_round_trip + fixture = { + "organization_id" => nil, + "connection_id" => nil, + "session_id" => nil + } + model = WorkOS::AuthenticationSSOFailedDataSSO.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:organization_id] + assert_nil json[:connection_id] + assert_nil json[:session_id] + end + + def test_authentication_sso_failed_data_error_round_trip + fixture = { + "code" => "stub", + "message" => "stub" + } + model = WorkOS::AuthenticationSSOFailedDataError.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["code"], json[:code] + assert_equal fixture["message"], json[:message] + end + + def test_authentication_sso_started_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.sso_started", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationSSOStarted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_sso_started_data_round_trip + fixture = { + "type" => "sso", + "status" => "started", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => nil, + "email" => nil, + "sso" => {} + } + model = WorkOS::AuthenticationSSOStartedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_nil json[:user_id] + assert_nil json[:email] + end + + def test_authentication_sso_started_data_sso_round_trip + fixture = { + "organization_id" => nil, + "connection_id" => nil, + "session_id" => nil + } + model = WorkOS::AuthenticationSSOStartedDataSSO.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:organization_id] + assert_nil json[:connection_id] + assert_nil json[:session_id] + end + + def test_authentication_sso_succeeded_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.sso_succeeded", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationSSOSucceeded.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_sso_succeeded_data_round_trip + fixture = { + "type" => "sso", + "status" => "succeeded", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => nil, + "email" => "stub", + "sso" => {} + } + model = WorkOS::AuthenticationSSOSucceededData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_nil json[:user_id] + assert_equal fixture["email"], json[:email] + end + + def test_authentication_sso_succeeded_data_sso_round_trip + fixture = { + "organization_id" => nil, + "connection_id" => nil, + "session_id" => nil + } + model = WorkOS::AuthenticationSSOSucceededDataSSO.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:organization_id] + assert_nil json[:connection_id] + assert_nil json[:session_id] + end + + def test_authentication_sso_timed_out_round_trip + fixture = { + "id" => "stub", + "event" => "authentication.sso_timed_out", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::AuthenticationSSOTimedOut.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authentication_sso_timed_out_data_round_trip + fixture = { + "type" => "sso", + "status" => "timed_out", + "ip_address" => nil, + "user_agent" => nil, + "user_id" => nil, + "email" => nil, + "sso" => {}, + "error" => {} + } + model = WorkOS::AuthenticationSSOTimedOutData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_nil json[:user_id] + assert_nil json[:email] + end + + def test_authentication_sso_timed_out_data_sso_round_trip + fixture = { + "organization_id" => nil, + "connection_id" => nil, + "session_id" => nil + } + model = WorkOS::AuthenticationSSOTimedOutDataSSO.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:organization_id] + assert_nil json[:connection_id] + assert_nil json[:session_id] + end + + def test_authentication_sso_timed_out_data_error_round_trip + fixture = { + "code" => "stub", + "message" => "stub" + } + model = WorkOS::AuthenticationSSOTimedOutDataError.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["code"], json[:code] + assert_equal fixture["message"], json[:message] + end + + def test_connection_activated_round_trip + fixture = { + "id" => "stub", + "event" => "connection.activated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::ConnectionActivated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_connection_activated_data_round_trip + fixture = { + "object" => "connection", + "id" => "stub", + "state" => "stub", + "name" => "stub", + "connection_type" => "stub", + "organization_id" => "stub", + "created_at" => "stub", + "updated_at" => "stub", + "external_key" => "stub", + "status" => "stub", + "domains" => [] + } + model = WorkOS::ConnectionActivatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_equal fixture["external_key"], json[:external_key] + end + + def test_connection_activated_data_domain_round_trip + fixture = { + "object" => "connection_domain", + "id" => "stub", + "domain" => "stub" + } + model = WorkOS::ConnectionActivatedDataDomain.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["domain"], json[:domain] + end + + def test_connection_deactivated_round_trip + fixture = { + "id" => "stub", + "event" => "connection.deactivated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::ConnectionDeactivated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_connection_deactivated_data_round_trip + fixture = { + "object" => "connection", + "id" => "stub", + "state" => "stub", + "name" => "stub", + "connection_type" => "stub", + "organization_id" => "stub", + "created_at" => "stub", + "updated_at" => "stub", + "external_key" => "stub", + "status" => "stub", + "domains" => [] + } + model = WorkOS::ConnectionDeactivatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_equal fixture["external_key"], json[:external_key] + end + + def test_connection_deactivated_data_domain_round_trip + fixture = { + "object" => "connection_domain", + "id" => "stub", + "domain" => "stub" + } + model = WorkOS::ConnectionDeactivatedDataDomain.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["domain"], json[:domain] + end + + def test_connection_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "connection.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::ConnectionDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_connection_deleted_data_round_trip + fixture = { + "object" => "connection", + "id" => "stub", + "state" => "stub", + "name" => "stub", + "connection_type" => "stub", + "organization_id" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::ConnectionDeletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_connection_saml_certificate_renewal_required_round_trip + fixture = { + "id" => "stub", + "event" => "connection.saml_certificate_renewal_required", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::ConnectionSAMLCertificateRenewalRequired.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_connection_saml_certificate_renewal_required_data_round_trip + fixture = { + "connection" => {}, + "certificate" => {}, + "days_until_expiry" => 1 + } + model = WorkOS::ConnectionSAMLCertificateRenewalRequiredData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["days_until_expiry"], json[:days_until_expiry] + end + + def test_connection_saml_certificate_renewal_required_data_connection_round_trip + fixture = { + "id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::ConnectionSAMLCertificateRenewalRequiredDataConnection.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + end + + def test_connection_saml_certificate_renewal_required_data_certificate_round_trip + fixture = { + "certificate_type" => "stub", + "expiry_date" => "stub", + "is_expired" => true + } + model = WorkOS::ConnectionSAMLCertificateRenewalRequiredDataCertificate.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["expiry_date"], json[:expiry_date] + assert_equal fixture["is_expired"], json[:is_expired] + end + + def test_connection_saml_certificate_renewed_round_trip + fixture = { + "id" => "stub", + "event" => "connection.saml_certificate_renewed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::ConnectionSAMLCertificateRenewed.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_connection_saml_certificate_renewed_data_round_trip + fixture = { + "connection" => {}, + "certificate" => {}, + "renewed_at" => "stub" + } + model = WorkOS::ConnectionSAMLCertificateRenewedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["renewed_at"], json[:renewed_at] + end + + def test_connection_saml_certificate_renewed_data_connection_round_trip + fixture = { + "id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::ConnectionSAMLCertificateRenewedDataConnection.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + end + + def test_connection_saml_certificate_renewed_data_certificate_round_trip + fixture = { + "certificate_type" => "stub", + "expiry_date" => "stub" + } + model = WorkOS::ConnectionSAMLCertificateRenewedDataCertificate.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["expiry_date"], json[:expiry_date] + end + + def test_dsync_activated_round_trip + fixture = { + "id" => "stub", + "event" => "dsync.activated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::DsyncActivated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_dsync_activated_data_round_trip + fixture = { + "object" => "directory", + "id" => "stub", + "organization_id" => "stub", + "type" => "stub", + "state" => "stub", + "name" => "stub", + "created_at" => "stub", + "updated_at" => "stub", + "external_key" => "stub", + "domains" => [] + } + model = WorkOS::DsyncActivatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_equal fixture["external_key"], json[:external_key] + end + + def test_dsync_activated_data_domain_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "domain" => "stub" + } + model = WorkOS::DsyncActivatedDataDomain.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["domain"], json[:domain] + end + + def test_dsync_deactivated_round_trip + fixture = { + "id" => "stub", + "event" => "dsync.deactivated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::DsyncDeactivated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_dsync_deactivated_data_round_trip + fixture = { + "object" => "directory", + "id" => "stub", + "organization_id" => "stub", + "type" => "stub", + "state" => "stub", + "name" => "stub", + "created_at" => "stub", + "updated_at" => "stub", + "external_key" => "stub", + "domains" => [] + } + model = WorkOS::DsyncDeactivatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_equal fixture["external_key"], json[:external_key] + end + + def test_dsync_deactivated_data_domain_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "domain" => "stub" + } + model = WorkOS::DsyncDeactivatedDataDomain.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["domain"], json[:domain] + end + + def test_dsync_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "dsync.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::DsyncDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_dsync_deleted_data_round_trip + fixture = { + "object" => "directory", + "id" => "stub", + "organization_id" => "stub", + "type" => "stub", + "state" => "stub", + "name" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::DsyncDeletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_dsync_group_created_round_trip + fixture = { + "id" => "stub", + "event" => "dsync.group.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::DsyncGroupCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_dsync_group_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "dsync.group.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::DsyncGroupDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_dsync_group_updated_round_trip + fixture = { + "id" => "stub", + "event" => "dsync.group.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::DsyncGroupUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_dsync_group_updated_data_round_trip + fixture = { + "object" => "directory_group", + "id" => "stub", + "idp_id" => "stub", + "directory_id" => "stub", + "organization_id" => "stub", + "name" => "stub", + "raw_attributes" => {}, + "created_at" => "stub", + "updated_at" => "stub", + "previous_attributes" => {} + } + model = WorkOS::DsyncGroupUpdatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["idp_id"], json[:idp_id] + assert_equal fixture["directory_id"], json[:directory_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_dsync_group_user_added_round_trip + fixture = { + "id" => "stub", + "event" => "dsync.group.user_added", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::DsyncGroupUserAdded.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_dsync_group_user_added_data_round_trip + fixture = { + "directory_id" => "stub", + "user" => {}, + "group" => {} + } + model = WorkOS::DsyncGroupUserAddedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["directory_id"], json[:directory_id] + end + + def test_dsync_user_created_round_trip + fixture = { + "id" => "stub", + "event" => "dsync.user.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::DsyncUserCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_dsync_user_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "dsync.user.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::DsyncUserDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_dsync_group_user_removed_round_trip + fixture = { + "id" => "stub", + "event" => "dsync.group.user_removed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::DsyncGroupUserRemoved.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_dsync_group_user_removed_data_round_trip + fixture = { + "directory_id" => "stub", + "user" => {}, + "group" => {} + } + model = WorkOS::DsyncGroupUserRemovedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["directory_id"], json[:directory_id] + end + + def test_dsync_user_updated_round_trip + fixture = { + "id" => "stub", + "event" => "dsync.user.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::DsyncUserUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_dsync_user_updated_data_round_trip + fixture = { + "object" => "directory_user", + "id" => "stub", + "directory_id" => "stub", + "organization_id" => "stub", + "idp_id" => "stub", + "email" => nil, + "first_name" => nil, + "last_name" => nil, + "emails" => [], + "job_title" => nil, + "username" => nil, + "state" => "stub", + "raw_attributes" => {}, + "custom_attributes" => {}, + "role" => {}, + "roles" => [], + "created_at" => "stub", + "updated_at" => "stub", + "previous_attributes" => {} + } + model = WorkOS::DsyncUserUpdatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["directory_id"], json[:directory_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["idp_id"], json[:idp_id] + assert_nil json[:email] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_dsync_user_updated_data_email_round_trip + fixture = { + "primary" => true, + "type" => "stub", + "value" => nil + } + model = WorkOS::DsyncUserUpdatedDataEmail.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_email_verification_created_round_trip + fixture = { + "id" => "stub", + "event" => "email_verification.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::EmailVerificationCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_email_verification_created_data_round_trip + fixture = { + "object" => "email_verification", + "id" => "stub", + "user_id" => "stub", + "email" => "stub", + "expires_at" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::EmailVerificationCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + assert_equal fixture["expires_at"], json[:expires_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_flag_created_round_trip + fixture = { + "id" => "stub", + "event" => "flag.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::FlagCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_flag_created_data_round_trip + fixture = { + "object" => "feature_flag", + "id" => "stub", + "environment_id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "owner" => nil, + "tags" => [], + "enabled" => true, + "default_value" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::FlagCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["environment_id"], json[:environment_id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["enabled"], json[:enabled] + assert_equal fixture["default_value"], json[:default_value] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_flag_created_data_owner_round_trip + fixture = { + "email" => "stub", + "first_name" => nil, + "last_name" => nil + } + model = WorkOS::FlagCreatedDataOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + assert_nil json[:first_name] + assert_nil json[:last_name] + end + + def test_flag_created_context_round_trip + fixture = { + "client_id" => "stub", + "actor" => {} + } + model = WorkOS::FlagCreatedContext.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + end + + def test_flag_created_context_actor_round_trip + fixture = { + "id" => "stub", + "source" => "stub", + "name" => nil + } + model = WorkOS::FlagCreatedContextActor.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:name] + end + + def test_flag_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "flag.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::FlagDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_flag_deleted_data_round_trip + fixture = { + "object" => "feature_flag", + "id" => "stub", + "environment_id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "owner" => nil, + "tags" => [], + "enabled" => true, + "default_value" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::FlagDeletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["environment_id"], json[:environment_id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["enabled"], json[:enabled] + assert_equal fixture["default_value"], json[:default_value] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_flag_deleted_data_owner_round_trip + fixture = { + "email" => "stub", + "first_name" => nil, + "last_name" => nil + } + model = WorkOS::FlagDeletedDataOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + assert_nil json[:first_name] + assert_nil json[:last_name] + end + + def test_flag_deleted_context_round_trip + fixture = { + "client_id" => "stub", + "actor" => {} + } + model = WorkOS::FlagDeletedContext.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + end + + def test_flag_deleted_context_actor_round_trip + fixture = { + "id" => "stub", + "source" => "stub", + "name" => nil + } + model = WorkOS::FlagDeletedContextActor.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:name] + end + + def test_flag_rule_updated_round_trip + fixture = { + "id" => "stub", + "event" => "flag.rule_updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::FlagRuleUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_flag_rule_updated_data_round_trip + fixture = { + "object" => "feature_flag", + "id" => "stub", + "environment_id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "owner" => nil, + "tags" => [], + "enabled" => true, + "default_value" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::FlagRuleUpdatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["environment_id"], json[:environment_id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["enabled"], json[:enabled] + assert_equal fixture["default_value"], json[:default_value] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_flag_rule_updated_data_owner_round_trip + fixture = { + "email" => "stub", + "first_name" => nil, + "last_name" => nil + } + model = WorkOS::FlagRuleUpdatedDataOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + assert_nil json[:first_name] + assert_nil json[:last_name] + end + + def test_flag_rule_updated_context_round_trip + fixture = { + "client_id" => "stub", + "actor" => {}, + "access_type" => "stub", + "configured_targets" => {}, + "previous_attributes" => {} + } + model = WorkOS::FlagRuleUpdatedContext.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + end + + def test_flag_rule_updated_context_actor_round_trip + fixture = { + "id" => "stub", + "source" => "stub", + "name" => nil + } + model = WorkOS::FlagRuleUpdatedContextActor.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:name] + end + + def test_flag_rule_updated_context_configured_target_round_trip + fixture = { + "organizations" => [], + "users" => [] + } + model = WorkOS::FlagRuleUpdatedContextConfiguredTarget.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_flag_rule_updated_context_configured_target_organization_round_trip + fixture = { + "id" => "stub", + "name" => "stub" + } + model = WorkOS::FlagRuleUpdatedContextConfiguredTargetOrganization.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + end + + def test_flag_rule_updated_context_configured_target_user_round_trip + fixture = { + "id" => "stub", + "email" => "stub" + } + model = WorkOS::FlagRuleUpdatedContextConfiguredTargetUser.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["email"], json[:email] + end + + def test_flag_rule_updated_context_previous_attribute_round_trip + fixture = { + "data" => {}, + "context" => {} + } + model = WorkOS::FlagRuleUpdatedContextPreviousAttribute.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_flag_rule_updated_context_previous_attribute_data_round_trip + fixture = { + "enabled" => true, + "default_value" => true + } + model = WorkOS::FlagRuleUpdatedContextPreviousAttributeData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_flag_rule_updated_context_previous_attribute_context_round_trip + fixture = { + "access_type" => "stub", + "configured_targets" => {} + } + model = WorkOS::FlagRuleUpdatedContextPreviousAttributeContext.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_flag_rule_updated_context_previous_attribute_context_configured_target_round_trip + fixture = { + "organizations" => [], + "users" => [] + } + model = WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_flag_rule_updated_context_previous_attribute_context_configured_target_organization_round_trip + fixture = { + "id" => "stub", + "name" => "stub" + } + model = WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetOrganization.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + end + + def test_flag_rule_updated_context_previous_attribute_context_configured_target_user_round_trip + fixture = { + "id" => "stub", + "email" => "stub" + } + model = WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTargetUser.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["email"], json[:email] + end + + def test_flag_updated_round_trip + fixture = { + "id" => "stub", + "event" => "flag.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::FlagUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_flag_updated_data_round_trip + fixture = { + "object" => "feature_flag", + "id" => "stub", + "environment_id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "owner" => nil, + "tags" => [], + "enabled" => true, + "default_value" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::FlagUpdatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["environment_id"], json[:environment_id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["enabled"], json[:enabled] + assert_equal fixture["default_value"], json[:default_value] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_flag_updated_data_owner_round_trip + fixture = { + "email" => "stub", + "first_name" => nil, + "last_name" => nil + } + model = WorkOS::FlagUpdatedDataOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + assert_nil json[:first_name] + assert_nil json[:last_name] + end + + def test_flag_updated_context_round_trip + fixture = { + "client_id" => "stub", + "actor" => {}, + "previous_attributes" => {} + } + model = WorkOS::FlagUpdatedContext.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + end + + def test_flag_updated_context_actor_round_trip + fixture = { + "id" => "stub", + "source" => "stub", + "name" => nil + } + model = WorkOS::FlagUpdatedContextActor.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:name] + end + + def test_flag_updated_context_previous_attribute_round_trip + fixture = { + "data" => {} + } + model = WorkOS::FlagUpdatedContextPreviousAttribute.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_flag_updated_context_previous_attribute_data_round_trip + fixture = { + "name" => "stub", + "description" => nil, + "tags" => [], + "enabled" => true, + "default_value" => true + } + model = WorkOS::FlagUpdatedContextPreviousAttributeData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_group_created_round_trip + fixture = { + "id" => "stub", + "event" => "group.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::GroupCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_group_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "group.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::GroupDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_group_member_added_round_trip + fixture = { + "id" => "stub", + "event" => "group.member_added", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::GroupMemberAdded.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_group_member_added_data_round_trip + fixture = { + "group_id" => "stub", + "organization_membership_id" => "stub" + } + model = WorkOS::GroupMemberAddedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["group_id"], json[:group_id] + assert_equal fixture["organization_membership_id"], json[:organization_membership_id] + end + + def test_group_member_removed_round_trip + fixture = { + "id" => "stub", + "event" => "group.member_removed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::GroupMemberRemoved.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_group_member_removed_data_round_trip + fixture = { + "group_id" => "stub", + "organization_membership_id" => "stub" + } + model = WorkOS::GroupMemberRemovedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["group_id"], json[:group_id] + assert_equal fixture["organization_membership_id"], json[:organization_membership_id] + end + + def test_group_updated_round_trip + fixture = { + "id" => "stub", + "event" => "group.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::GroupUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_invitation_accepted_round_trip + fixture = { + "id" => "stub", + "event" => "invitation.accepted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::InvitationAccepted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_invitation_accepted_data_round_trip + fixture = { + "object" => "invitation", + "id" => "stub", + "email" => "stub", + "state" => "stub", + "accepted_at" => nil, + "revoked_at" => nil, + "expires_at" => "stub", + "organization_id" => nil, + "inviter_user_id" => nil, + "accepted_user_id" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::InvitationAcceptedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["email"], json[:email] + assert_nil json[:accepted_at] + assert_nil json[:revoked_at] + assert_equal fixture["expires_at"], json[:expires_at] + assert_nil json[:organization_id] + assert_nil json[:inviter_user_id] + assert_nil json[:accepted_user_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_invitation_created_round_trip + fixture = { + "id" => "stub", + "event" => "invitation.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::InvitationCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_invitation_created_data_round_trip + fixture = { + "object" => "invitation", + "id" => "stub", + "email" => "stub", + "state" => "stub", + "accepted_at" => nil, + "revoked_at" => nil, + "expires_at" => "stub", + "organization_id" => nil, + "inviter_user_id" => nil, + "accepted_user_id" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::InvitationCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["email"], json[:email] + assert_nil json[:accepted_at] + assert_nil json[:revoked_at] + assert_equal fixture["expires_at"], json[:expires_at] + assert_nil json[:organization_id] + assert_nil json[:inviter_user_id] + assert_nil json[:accepted_user_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_invitation_resent_round_trip + fixture = { + "id" => "stub", + "event" => "invitation.resent", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::InvitationResent.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_invitation_resent_data_round_trip + fixture = { + "object" => "invitation", + "id" => "stub", + "email" => "stub", + "state" => "stub", + "accepted_at" => nil, + "revoked_at" => nil, + "expires_at" => "stub", + "organization_id" => nil, + "inviter_user_id" => nil, + "accepted_user_id" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::InvitationResentData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["email"], json[:email] + assert_nil json[:accepted_at] + assert_nil json[:revoked_at] + assert_equal fixture["expires_at"], json[:expires_at] + assert_nil json[:organization_id] + assert_nil json[:inviter_user_id] + assert_nil json[:accepted_user_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_invitation_revoked_round_trip + fixture = { + "id" => "stub", + "event" => "invitation.revoked", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::InvitationRevoked.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_invitation_revoked_data_round_trip + fixture = { + "object" => "invitation", + "id" => "stub", + "email" => "stub", + "state" => "stub", + "accepted_at" => nil, + "revoked_at" => nil, + "expires_at" => "stub", + "organization_id" => nil, + "inviter_user_id" => nil, + "accepted_user_id" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::InvitationRevokedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["email"], json[:email] + assert_nil json[:accepted_at] + assert_nil json[:revoked_at] + assert_equal fixture["expires_at"], json[:expires_at] + assert_nil json[:organization_id] + assert_nil json[:inviter_user_id] + assert_nil json[:accepted_user_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_magic_auth_created_round_trip + fixture = { + "id" => "stub", + "event" => "magic_auth.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::MagicAuthCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_magic_auth_created_data_round_trip + fixture = { + "object" => "magic_auth", + "id" => "stub", + "user_id" => "stub", + "email" => "stub", + "expires_at" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::MagicAuthCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + assert_equal fixture["expires_at"], json[:expires_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_created_round_trip + fixture = { + "id" => "stub", + "event" => "organization.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_created_data_round_trip + fixture = { + "object" => "organization", + "id" => "stub", + "name" => "stub", + "domains" => [], + "metadata" => {}, + "external_id" => nil, + "stripe_customer_id" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_nil json[:external_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_created_data_domain_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "organization_id" => "stub", + "domain" => "stub", + "state" => "stub", + "verification_prefix" => "stub", + "verification_token" => "stub", + "verification_strategy" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationCreatedDataDomain.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["domain"], json[:domain] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "organization.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_deleted_data_round_trip + fixture = { + "object" => "organization", + "id" => "stub", + "name" => "stub", + "domains" => [], + "metadata" => {}, + "external_id" => nil, + "stripe_customer_id" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationDeletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_nil json[:external_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_deleted_data_domain_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "organization_id" => "stub", + "domain" => "stub", + "state" => "stub", + "verification_prefix" => "stub", + "verification_token" => "stub", + "verification_strategy" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationDeletedDataDomain.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["domain"], json[:domain] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_domain_created_round_trip + fixture = { + "id" => "stub", + "event" => "organization_domain.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationDomainCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_domain_created_data_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "organization_id" => "stub", + "domain" => "stub", + "state" => "stub", + "verification_prefix" => "stub", + "verification_token" => "stub", + "verification_strategy" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationDomainCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["domain"], json[:domain] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_domain_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "organization_domain.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationDomainDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_domain_deleted_data_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "organization_id" => "stub", + "domain" => "stub", + "state" => "stub", + "verification_prefix" => "stub", + "verification_token" => "stub", + "verification_strategy" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationDomainDeletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["domain"], json[:domain] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_domain_updated_round_trip + fixture = { + "id" => "stub", + "event" => "organization_domain.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationDomainUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_domain_updated_data_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "organization_id" => "stub", + "domain" => "stub", + "state" => "stub", + "verification_prefix" => "stub", + "verification_token" => "stub", + "verification_strategy" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationDomainUpdatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["domain"], json[:domain] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_domain_verification_failed_round_trip + fixture = { + "id" => "stub", + "event" => "organization_domain.verification_failed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationDomainVerificationFailed.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_domain_verification_failed_data_round_trip + fixture = { + "reason" => "stub", + "organization_domain" => {} + } + model = WorkOS::OrganizationDomainVerificationFailedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_organization_domain_verification_failed_data_organization_domain_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "organization_id" => "stub", + "domain" => "stub", + "state" => "stub", + "verification_prefix" => "stub", + "verification_token" => "stub", + "verification_strategy" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationDomainVerificationFailedDataOrganizationDomain.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["domain"], json[:domain] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_domain_verified_round_trip + fixture = { + "id" => "stub", + "event" => "organization_domain.verified", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationDomainVerified.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_domain_verified_data_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "organization_id" => "stub", + "domain" => "stub", + "state" => "stub", + "verification_prefix" => "stub", + "verification_token" => "stub", + "verification_strategy" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationDomainVerifiedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["domain"], json[:domain] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_membership_created_round_trip + fixture = { + "id" => "stub", + "event" => "organization_membership.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationMembershipCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_membership_created_data_round_trip + fixture = { + "object" => "organization_membership", + "id" => "stub", + "user_id" => "stub", + "organization_id" => "stub", + "status" => "stub", + "role" => {}, + "roles" => [], + "custom_attributes" => {}, + "directory_managed" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationMembershipCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["directory_managed"], json[:directory_managed] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_membership_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "organization_membership.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationMembershipDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_membership_deleted_data_round_trip + fixture = { + "object" => "organization_membership", + "id" => "stub", + "user_id" => "stub", + "organization_id" => "stub", + "status" => "stub", + "role" => {}, + "roles" => [], + "custom_attributes" => {}, + "directory_managed" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationMembershipDeletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["directory_managed"], json[:directory_managed] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_membership_updated_round_trip + fixture = { + "id" => "stub", + "event" => "organization_membership.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationMembershipUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_membership_updated_data_round_trip + fixture = { + "object" => "organization_membership", + "id" => "stub", + "user_id" => "stub", + "organization_id" => "stub", + "status" => "stub", + "role" => {}, + "roles" => [], + "custom_attributes" => {}, + "directory_managed" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationMembershipUpdatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["directory_managed"], json[:directory_managed] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_role_created_round_trip + fixture = { + "id" => "stub", + "event" => "organization_role.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationRoleCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_role_created_data_round_trip + fixture = { + "object" => "organization_role", + "organization_id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "resource_type_slug" => "stub", + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationRoleCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_role_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "organization_role.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationRoleDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_role_deleted_data_round_trip + fixture = { + "object" => "organization_role", + "organization_id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "resource_type_slug" => "stub", + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationRoleDeletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_role_updated_round_trip + fixture = { + "id" => "stub", + "event" => "organization_role.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationRoleUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_role_updated_data_round_trip + fixture = { + "object" => "organization_role", + "organization_id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "resource_type_slug" => "stub", + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationRoleUpdatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_updated_round_trip + fixture = { + "id" => "stub", + "event" => "organization.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::OrganizationUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_updated_data_round_trip + fixture = { + "object" => "organization", + "id" => "stub", + "name" => "stub", + "domains" => [], + "metadata" => {}, + "external_id" => nil, + "stripe_customer_id" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationUpdatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_nil json[:external_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_updated_data_domain_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "organization_id" => "stub", + "domain" => "stub", + "state" => "stub", + "verification_prefix" => "stub", + "verification_token" => "stub", + "verification_strategy" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationUpdatedDataDomain.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["domain"], json[:domain] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_password_reset_created_round_trip + fixture = { + "id" => "stub", + "event" => "password_reset.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::PasswordResetCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_password_reset_created_data_round_trip + fixture = { + "object" => "password_reset", + "id" => "stub", + "user_id" => "stub", + "email" => "stub", + "expires_at" => "stub", + "created_at" => "stub" + } + model = WorkOS::PasswordResetCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + assert_equal fixture["expires_at"], json[:expires_at] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_password_reset_succeeded_round_trip + fixture = { + "id" => "stub", + "event" => "password_reset.succeeded", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::PasswordResetSucceeded.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_password_reset_succeeded_data_round_trip + fixture = { + "object" => "password_reset", + "id" => "stub", + "user_id" => "stub", + "email" => "stub", + "expires_at" => "stub", + "created_at" => "stub" + } + model = WorkOS::PasswordResetSucceededData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + assert_equal fixture["expires_at"], json[:expires_at] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_permission_created_round_trip + fixture = { + "id" => "stub", + "event" => "permission.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::PermissionCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_permission_created_data_round_trip + fixture = { + "object" => "permission", + "id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "system" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::PermissionCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["system"], json[:system] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_permission_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "permission.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::PermissionDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_permission_deleted_data_round_trip + fixture = { + "object" => "permission", + "id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "system" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::PermissionDeletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["system"], json[:system] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_permission_updated_round_trip + fixture = { + "id" => "stub", + "event" => "permission.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::PermissionUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_permission_updated_data_round_trip + fixture = { + "object" => "permission", + "id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "system" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::PermissionUpdatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["system"], json[:system] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_role_created_round_trip + fixture = { + "id" => "stub", + "event" => "role.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::RoleCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_role_created_data_round_trip + fixture = { + "object" => "role", + "slug" => "stub", + "resource_type_slug" => "stub", + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::RoleCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_role_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "role.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::RoleDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_role_deleted_data_round_trip + fixture = { + "object" => "role", + "slug" => "stub", + "resource_type_slug" => "stub", + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::RoleDeletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_role_updated_round_trip + fixture = { + "id" => "stub", + "event" => "role.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::RoleUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_role_updated_data_round_trip + fixture = { + "object" => "role", + "slug" => "stub", + "resource_type_slug" => "stub", + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::RoleUpdatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_session_created_round_trip + fixture = { + "id" => "stub", + "event" => "session.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::SessionCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_session_created_data_round_trip + fixture = { + "object" => "session", + "id" => "stub", + "impersonator" => {}, + "ip_address" => nil, + "organization_id" => "stub", + "user_agent" => nil, + "user_id" => "stub", + "auth_method" => "stub", + "status" => "stub", + "expires_at" => "stub", + "ended_at" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::SessionCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["expires_at"], json[:expires_at] + assert_nil json[:ended_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_session_created_data_impersonator_round_trip + fixture = { + "email" => "stub", + "reason" => nil + } + model = WorkOS::SessionCreatedDataImpersonator.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + assert_nil json[:reason] + end + + def test_session_revoked_round_trip + fixture = { + "id" => "stub", + "event" => "session.revoked", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::SessionRevoked.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_session_revoked_data_round_trip + fixture = { + "object" => "session", + "id" => "stub", + "impersonator" => {}, + "ip_address" => nil, + "organization_id" => "stub", + "user_agent" => nil, + "user_id" => "stub", + "auth_method" => "stub", + "status" => "stub", + "expires_at" => "stub", + "ended_at" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::SessionRevokedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["expires_at"], json[:expires_at] + assert_nil json[:ended_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_session_revoked_data_impersonator_round_trip + fixture = { + "email" => "stub", + "reason" => nil + } + model = WorkOS::SessionRevokedDataImpersonator.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + assert_nil json[:reason] + end + + def test_user_created_round_trip + fixture = { + "id" => "stub", + "event" => "user.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::UserCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_user_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "user.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::UserDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_user_updated_round_trip + fixture = { + "id" => "stub", + "event" => "user.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::UserUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_vault_byok_key_verification_completed_round_trip + fixture = { + "id" => "stub", + "event" => "vault.byok_key.verification_completed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultByokKeyVerificationCompleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_vault_byok_key_verification_completed_data_round_trip + fixture = { + "organization_id" => "stub", + "key_provider" => "stub", + "verified" => true + } + model = WorkOS::VaultByokKeyVerificationCompletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["verified"], json[:verified] + end + + def test_vault_data_created_round_trip + fixture = { + "id" => "stub", + "event" => "vault.data.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultDataCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_vault_data_created_data_round_trip + fixture = { + "actor_id" => "stub", + "actor_source" => "stub", + "actor_name" => "stub", + "kv_name" => "stub", + "key_id" => "stub", + "key_context" => {} + } + model = WorkOS::VaultDataCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["actor_id"], json[:actor_id] + assert_equal fixture["actor_name"], json[:actor_name] + assert_equal fixture["kv_name"], json[:kv_name] + assert_equal fixture["key_id"], json[:key_id] + end + + def test_vault_data_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "vault.data.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultDataDeleted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_vault_data_deleted_data_round_trip + fixture = { + "actor_id" => "stub", + "actor_source" => "stub", + "actor_name" => "stub", + "kv_name" => "stub" + } + model = WorkOS::VaultDataDeletedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["actor_id"], json[:actor_id] + assert_equal fixture["actor_name"], json[:actor_name] + assert_equal fixture["kv_name"], json[:kv_name] + end + + def test_vault_data_read_round_trip + fixture = { + "id" => "stub", + "event" => "vault.data.read", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultDataRead.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_vault_data_read_data_round_trip + fixture = { + "actor_id" => "stub", + "actor_source" => "stub", + "actor_name" => "stub", + "kv_name" => "stub", + "key_id" => "stub" + } + model = WorkOS::VaultDataReadData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["actor_id"], json[:actor_id] + assert_equal fixture["actor_name"], json[:actor_name] + assert_equal fixture["kv_name"], json[:kv_name] + assert_equal fixture["key_id"], json[:key_id] + end + + def test_vault_data_updated_round_trip + fixture = { + "id" => "stub", + "event" => "vault.data.updated", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultDataUpdated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_vault_data_updated_data_round_trip + fixture = { + "actor_id" => "stub", + "actor_source" => "stub", + "actor_name" => "stub", + "kv_name" => "stub", + "key_id" => "stub", + "key_context" => {} + } + model = WorkOS::VaultDataUpdatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["actor_id"], json[:actor_id] + assert_equal fixture["actor_name"], json[:actor_name] + assert_equal fixture["kv_name"], json[:kv_name] + assert_equal fixture["key_id"], json[:key_id] + end + + def test_vault_dek_decrypted_round_trip + fixture = { + "id" => "stub", + "event" => "vault.dek.decrypted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultDekDecrypted.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_vault_dek_decrypted_data_round_trip + fixture = { + "actor_id" => "stub", + "actor_source" => "stub", + "actor_name" => "stub", + "key_id" => "stub" + } + model = WorkOS::VaultDekDecryptedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["actor_id"], json[:actor_id] + assert_equal fixture["actor_name"], json[:actor_name] + assert_equal fixture["key_id"], json[:key_id] + end + + def test_vault_dek_read_round_trip + fixture = { + "id" => "stub", + "event" => "vault.dek.read", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultDekRead.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_vault_dek_read_data_round_trip + fixture = { + "actor_id" => "stub", + "actor_source" => "stub", + "actor_name" => "stub", + "key_ids" => [], + "key_context" => {} + } + model = WorkOS::VaultDekReadData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["actor_id"], json[:actor_id] + assert_equal fixture["actor_name"], json[:actor_name] + end + + def test_vault_kek_created_round_trip + fixture = { + "id" => "stub", + "event" => "vault.kek.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultKekCreated.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_vault_kek_created_data_round_trip + fixture = { + "actor_id" => "stub", + "actor_source" => "stub", + "actor_name" => "stub", + "key_name" => "stub", + "key_id" => "stub" + } + model = WorkOS::VaultKekCreatedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["actor_id"], json[:actor_id] + assert_equal fixture["actor_name"], json[:actor_name] + assert_equal fixture["key_name"], json[:key_name] + assert_equal fixture["key_id"], json[:key_id] + end + + def test_vault_metadata_read_round_trip + fixture = { + "id" => "stub", + "event" => "vault.metadata.read", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultMetadataRead.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_vault_metadata_read_data_round_trip + fixture = { + "actor_id" => "stub", + "actor_source" => "stub", + "actor_name" => "stub", + "kv_name" => "stub" + } + model = WorkOS::VaultMetadataReadData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["actor_id"], json[:actor_id] + assert_equal fixture["actor_name"], json[:actor_name] + assert_equal fixture["kv_name"], json[:kv_name] + end + + def test_vault_names_listed_round_trip + fixture = { + "id" => "stub", + "event" => "vault.names.listed", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultNamesListed.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_vault_names_listed_data_round_trip + fixture = { + "actor_id" => "stub", + "actor_source" => "stub", + "actor_name" => "stub" + } + model = WorkOS::VaultNamesListedData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["actor_id"], json[:actor_id] + assert_equal fixture["actor_name"], json[:actor_name] + end + + def test_jwt_template_response_round_trip + fixture = { + "object" => "jwt_template", + "content" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::JWTTemplateResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["content"], json[:content] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_organization_domain_stand_alone_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "organization_id" => "stub", + "domain" => "stub", + "state" => "stub", + "verification_prefix" => "stub", + "verification_token" => "stub", + "verification_strategy" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationDomainStandAlone.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["domain"], json[:domain] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_flag_round_trip + fixture = { + "object" => "feature_flag", + "id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "owner" => nil, + "tags" => [], + "enabled" => true, + "default_value" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::Flag.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["enabled"], json[:enabled] + assert_equal fixture["default_value"], json[:default_value] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_api_key_with_value_round_trip + fixture = { + "object" => "api_key", + "id" => "stub", + "owner" => {}, + "name" => "stub", + "obfuscated_value" => "stub", + "last_used_at" => nil, + "permissions" => [], + "created_at" => "stub", + "updated_at" => "stub", + "value" => "stub" + } + model = WorkOS::ApiKeyWithValue.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_equal fixture["obfuscated_value"], json[:obfuscated_value] + assert_nil json[:last_used_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_equal fixture["value"], json[:value] + end + + def test_organization_round_trip + fixture = { + "object" => "organization", + "id" => "stub", + "name" => "stub", + "domains" => [], + "metadata" => {}, + "external_id" => nil, + "stripe_customer_id" => "stub", + "created_at" => "stub", + "updated_at" => "stub", + "allow_profiles_outside_organization" => true + } + model = WorkOS::Organization.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_nil json[:external_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_audit_log_configuration_round_trip + fixture = { + "organization_id" => "stub", + "retention_period_in_days" => 1, + "state" => "stub", + "log_stream" => {} + } + model = WorkOS::AuditLogConfiguration.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["retention_period_in_days"], json[:retention_period_in_days] + end + + def test_data_integration_authorize_url_response_round_trip + fixture = { + "url" => "stub" + } + model = WorkOS::DataIntegrationAuthorizeUrlResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["url"], json[:url] + end + + def test_data_integration_access_token_response_round_trip + fixture = { + "active" => true, + "access_token" => {}, + "error" => "stub" + } + model = WorkOS::DataIntegrationAccessTokenResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_connected_account_round_trip + fixture = { + "object" => "connected_account", + "id" => "stub", + "user_id" => nil, + "organization_id" => nil, + "scopes" => [], + "state" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::ConnectedAccount.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:user_id] + assert_nil json[:organization_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_data_integrations_list_response_round_trip + fixture = { + "object" => "list", + "data" => [] + } + model = WorkOS::DataIntegrationsListResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_portal_link_response_round_trip + fixture = { + "link" => "stub" + } + model = WorkOS::PortalLinkResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["link"], json[:link] + end + + def test_radar_standalone_response_round_trip + fixture = { + "verdict" => "stub", + "reason" => "stub", + "attempt_id" => "stub", + "control" => "stub", + "blocklist_type" => "stub" + } + model = WorkOS::RadarStandaloneResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["reason"], json[:reason] + assert_equal fixture["attempt_id"], json[:attempt_id] + end + + def test_radar_list_entry_already_present_response_round_trip + fixture = { + "message" => "stub" + } + model = WorkOS::RadarListEntryAlreadyPresentResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["message"], json[:message] + end + + def test_redirect_uri_round_trip + fixture = { + "object" => "redirect_uri", + "id" => "stub", + "uri" => "stub", + "default" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::RedirectUri.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["uri"], json[:uri] + assert_equal fixture["default"], json[:default] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_user_authentication_factor_enroll_response_round_trip + fixture = { + "authentication_factor" => {}, + "authentication_challenge" => {} + } + model = WorkOS::UserAuthenticationFactorEnrollResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_magic_auth_round_trip + fixture = { + "object" => "magic_auth", + "id" => "stub", + "user_id" => "stub", + "email" => "stub", + "expires_at" => "stub", + "created_at" => "stub", + "updated_at" => "stub", + "code" => "stub" + } + model = WorkOS::MagicAuth.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + assert_equal fixture["expires_at"], json[:expires_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_equal fixture["code"], json[:code] + end + + def test_user_invite_round_trip + fixture = { + "object" => "invitation", + "id" => "stub", + "email" => "stub", + "state" => "stub", + "accepted_at" => nil, + "revoked_at" => nil, + "expires_at" => "stub", + "organization_id" => nil, + "inviter_user_id" => nil, + "accepted_user_id" => nil, + "created_at" => "stub", + "updated_at" => "stub", + "token" => "stub", + "accept_invitation_url" => "stub" + } + model = WorkOS::UserInvite.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["email"], json[:email] + assert_nil json[:accepted_at] + assert_nil json[:revoked_at] + assert_equal fixture["expires_at"], json[:expires_at] + assert_nil json[:organization_id] + assert_nil json[:inviter_user_id] + assert_nil json[:accepted_user_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_equal fixture["token"], json[:token] + assert_equal fixture["accept_invitation_url"], json[:accept_invitation_url] + end + + def test_user_organization_membership_round_trip + fixture = { + "object" => "organization_membership", + "id" => "stub", + "user_id" => "stub", + "organization_id" => "stub", + "status" => "stub", + "directory_managed" => true, + "organization_name" => "stub", + "custom_attributes" => {}, + "created_at" => "stub", + "updated_at" => "stub", + "role" => {} + } + model = WorkOS::UserOrganizationMembership.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["directory_managed"], json[:directory_managed] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_email_verification_round_trip + fixture = { + "object" => "email_verification", + "id" => "stub", + "user_id" => "stub", + "email" => "stub", + "expires_at" => "stub", + "created_at" => "stub", + "updated_at" => "stub", + "code" => "stub" + } + model = WorkOS::EmailVerification.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + assert_equal fixture["expires_at"], json[:expires_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_equal fixture["code"], json[:code] + end + + def test_send_verification_email_response_round_trip + fixture = { + "user" => {} + } + model = WorkOS::SendVerificationEmailResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_verify_email_response_round_trip + fixture = { + "user" => {} + } + model = WorkOS::VerifyEmailResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_password_reset_round_trip + fixture = { + "object" => "password_reset", + "id" => "stub", + "user_id" => "stub", + "email" => "stub", + "expires_at" => "stub", + "created_at" => "stub", + "password_reset_token" => "stub", + "password_reset_url" => "stub" + } + model = WorkOS::PasswordReset.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["email"], json[:email] + assert_equal fixture["expires_at"], json[:expires_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["password_reset_token"], json[:password_reset_token] + assert_equal fixture["password_reset_url"], json[:password_reset_url] + end + + def test_reset_password_response_round_trip + fixture = { + "user" => {} + } + model = WorkOS::ResetPasswordResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_email_change_round_trip + fixture = { + "object" => "email_change", + "user" => {}, + "new_email" => "stub", + "expires_at" => "stub", + "created_at" => "stub" + } + model = WorkOS::EmailChange.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["new_email"], json[:new_email] + assert_equal fixture["expires_at"], json[:expires_at] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_authenticate_response_round_trip + fixture = { + "user" => {}, + "organization_id" => "stub", + "authkit_authorization_code" => "stub", + "access_token" => "stub", + "refresh_token" => "stub", + "authentication_method" => "stub", + "impersonator" => {}, + "oauth_tokens" => {} + } + model = WorkOS::AuthenticateResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["access_token"], json[:access_token] + assert_equal fixture["refresh_token"], json[:refresh_token] + end + + def test_device_authorization_response_round_trip + fixture = { + "device_code" => "stub", + "user_code" => "stub", + "verification_uri" => "stub", + "verification_uri_complete" => "stub", + "expires_in" => 1.0, + "interval" => 1.0 + } + model = WorkOS::DeviceAuthorizationResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["device_code"], json[:device_code] + assert_equal fixture["user_code"], json[:user_code] + assert_equal fixture["verification_uri"], json[:verification_uri] + assert_equal fixture["expires_in"], json[:expires_in] + end + + def test_webhook_endpoint_round_trip + fixture = { + "object" => "webhook_endpoint", + "id" => "stub", + "endpoint_url" => "stub", + "secret" => "stub", + "status" => "stub", + "events" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::WebhookEndpoint.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["endpoint_url"], json[:endpoint_url] + assert_equal fixture["secret"], json[:secret] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_widget_session_token_response_round_trip + fixture = { + "token" => "stub" + } + model = WorkOS::WidgetSessionTokenResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["token"], json[:token] + end + + def test_sso_authorize_url_response_round_trip + fixture = { + "url" => "stub" + } + model = WorkOS::SSOAuthorizeUrlResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["url"], json[:url] + end + + def test_profile_round_trip + fixture = { + "object" => "profile", + "id" => "stub", + "organization_id" => nil, + "connection_id" => "stub", + "connection_type" => "stub", + "idp_id" => "stub", + "email" => "stub", + "first_name" => nil, + "last_name" => nil, + "role" => nil, + "roles" => nil, + "groups" => [], + "custom_attributes" => {}, + "raw_attributes" => {} + } + model = WorkOS::Profile.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:organization_id] + assert_equal fixture["connection_id"], json[:connection_id] + assert_equal fixture["idp_id"], json[:idp_id] + assert_equal fixture["email"], json[:email] + assert_nil json[:first_name] + assert_nil json[:last_name] + end + + def test_sso_token_response_round_trip + fixture = { + "token_type" => "Bearer", + "access_token" => "stub", + "expires_in" => 1, + "profile" => {}, + "oauth_tokens" => {} + } + model = WorkOS::SSOTokenResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["access_token"], json[:access_token] + assert_equal fixture["expires_in"], json[:expires_in] + end + + def test_sso_logout_authorize_response_round_trip + fixture = { + "logout_url" => "stub", + "logout_token" => "stub" + } + model = WorkOS::SSOLogoutAuthorizeResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["logout_url"], json[:logout_url] + assert_equal fixture["logout_token"], json[:logout_token] + end + + def test_jwks_response_round_trip + fixture = { + "keys" => [] + } + model = WorkOS::JwksResponse.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_jwks_response_keys_round_trip + fixture = { + "alg" => "RS256", + "kty" => "RSA", + "use" => "sig", + "x5c" => [], + "n" => "stub", + "e" => "stub", + "kid" => "stub", + "x5t#S256" => "stub" + } + model = WorkOS::JwksResponseKeys.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["n"], json[:n] + assert_equal fixture["e"], json[:e] + assert_equal fixture["kid"], json[:kid] + assert_equal fixture["x5t#S256"], json["x5t#S256"] + end + + def test_sso_token_response_oauth_token_round_trip + fixture = { + "provider" => "stub", + "refresh_token" => "stub", + "access_token" => "stub", + "expires_at" => 1, + "scopes" => [] + } + model = WorkOS::SSOTokenResponseOAuthToken.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["provider"], json[:provider] + assert_equal fixture["refresh_token"], json[:refresh_token] + assert_equal fixture["access_token"], json[:access_token] + assert_equal fixture["expires_at"], json[:expires_at] + end + + def test_authenticate_response_impersonator_round_trip + fixture = { + "email" => "stub", + "reason" => nil + } + model = WorkOS::AuthenticateResponseImpersonator.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + assert_nil json[:reason] + end + + def test_authenticate_response_oauth_token_round_trip + fixture = { + "provider" => "stub", + "refresh_token" => "stub", + "access_token" => "stub", + "expires_at" => 1, + "scopes" => [] + } + model = WorkOS::AuthenticateResponseOAuthToken.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["provider"], json[:provider] + assert_equal fixture["refresh_token"], json[:refresh_token] + assert_equal fixture["access_token"], json[:access_token] + assert_equal fixture["expires_at"], json[:expires_at] + end + + def test_data_integrations_list_response_data_round_trip + fixture = { + "object" => "data_provider", + "id" => "stub", + "name" => "stub", + "description" => nil, + "slug" => "stub", + "integration_type" => "stub", + "credentials_type" => "stub", + "scopes" => nil, + "ownership" => "stub", + "created_at" => "stub", + "updated_at" => "stub", + "connected_account" => nil + } + model = WorkOS::DataIntegrationsListResponseData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["integration_type"], json[:integration_type] + assert_equal fixture["credentials_type"], json[:credentials_type] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_data_integration_access_token_response_access_token_round_trip + fixture = { + "object" => "access_token", + "access_token" => "stub", + "expires_at" => nil, + "scopes" => [], + "missing_scopes" => [] + } + model = WorkOS::DataIntegrationAccessTokenResponseAccessToken.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["access_token"], json[:access_token] + assert_nil json[:expires_at] + end + + def test_audit_log_configuration_log_stream_round_trip + fixture = { + "id" => "stub", + "type" => "stub", + "state" => "stub", + "last_synced_at" => nil, + "created_at" => "stub" + } + model = WorkOS::AuditLogConfigurationLogStream.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:last_synced_at] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_organization_domain_round_trip + fixture = { + "object" => "organization_domain", + "id" => "stub", + "organization_id" => "stub", + "domain" => "stub", + "state" => "stub", + "verification_prefix" => "stub", + "verification_token" => "stub", + "verification_strategy" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::OrganizationDomain.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["domain"], json[:domain] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_api_key_with_value_owner_round_trip + fixture = { + "type" => "organization", + "id" => "stub" + } + model = WorkOS::ApiKeyWithValueOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + end + + def test_flag_owner_round_trip + fixture = { + "email" => "stub", + "first_name" => nil, + "last_name" => nil + } + model = WorkOS::FlagOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + assert_nil json[:first_name] + assert_nil json[:last_name] + end + + def test_event_list_list_metadata_round_trip + fixture = { + "after" => nil + } + model = WorkOS::EventListListMetadata.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:after] + end + + def test_directory_user_email_round_trip + fixture = { + "primary" => true, + "type" => "stub", + "value" => nil + } + model = WorkOS::DirectoryUserEmail.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_event_context_google_analytics_session_round_trip + fixture = { + "containerId" => "stub", + "sessionId" => "stub", + "sessionNumber" => "stub" + } + model = WorkOS::EventContextGoogleAnalyticsSession.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["containerId"], json[:containerId] + end + + def test_directory_user_with_groups_email_round_trip + fixture = { + "primary" => true, + "type" => "stub", + "value" => nil + } + model = WorkOS::DirectoryUserWithGroupsEmail.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_directory_metadata_round_trip + fixture = { + "users" => {}, + "groups" => 1 + } + model = WorkOS::DirectoryMetadata.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["groups"], json[:groups] + end + + def test_connection_domain_round_trip + fixture = { + "id" => "stub", + "object" => "connection_domain", + "domain" => "stub" + } + model = WorkOS::ConnectionDomain.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["domain"], json[:domain] + end + + def test_connection_option_round_trip + fixture = { + "signing_cert" => nil + } + model = WorkOS::ConnectionOption.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_nil json[:signing_cert] + end + + def test_user_organization_membership_base_list_data_round_trip + fixture = { + "object" => "organization_membership", + "id" => "stub", + "user_id" => "stub", + "organization_id" => "stub", + "status" => "stub", + "directory_managed" => true, + "organization_name" => "stub", + "custom_attributes" => {}, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::UserOrganizationMembershipBaseListData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["directory_managed"], json[:directory_managed] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_role_assignment_resource_round_trip + fixture = { + "id" => "stub", + "external_id" => "stub", + "resource_type_slug" => "stub" + } + model = WorkOS::RoleAssignmentResource.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["external_id"], json[:external_id] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + end + + def test_authentication_factor_sms_round_trip + fixture = { + "phone_number" => "stub" + } + model = WorkOS::AuthenticationFactorSms.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["phone_number"], json[:phone_number] + end + + def test_authentication_factor_totp_round_trip + fixture = { + "issuer" => "stub", + "user" => "stub" + } + model = WorkOS::AuthenticationFactorTotp.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["issuer"], json[:issuer] + assert_equal fixture["user"], json[:user] + end + + def test_authentication_factor_enrolled_sms_round_trip + fixture = { + "phone_number" => "stub" + } + model = WorkOS::AuthenticationFactorEnrolledSms.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["phone_number"], json[:phone_number] + end + + def test_authentication_factor_enrolled_totp_round_trip + fixture = { + "issuer" => "stub", + "user" => "stub", + "secret" => "stub", + "qr_code" => "stub", + "uri" => "stub" + } + model = WorkOS::AuthenticationFactorEnrolledTotp.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["issuer"], json[:issuer] + assert_equal fixture["user"], json[:user] + assert_equal fixture["secret"], json[:secret] + assert_equal fixture["qr_code"], json[:qr_code] + assert_equal fixture["uri"], json[:uri] + end + + def test_authorized_connect_application_list_data_round_trip + fixture = { + "object" => "authorized_connect_application", + "id" => "stub", + "granted_scopes" => [], + "oauth_resource" => "stub", + "application" => {} + } + model = WorkOS::AuthorizedConnectApplicationListData.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + end + + def test_api_key_owner_round_trip + fixture = { + "type" => "organization", + "id" => "stub" + } + model = WorkOS::ApiKeyOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + end + + def test_user_consent_option_choice_round_trip + fixture = { + "value" => "stub", + "label" => "stub" + } + model = WorkOS::UserConsentOptionChoice.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_authentication_challenges_verify_request_round_trip + fixture = { + "code" => "stub" + } + model = WorkOS::AuthenticationChallengesVerifyRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["code"], json[:code] + end + + def test_authentication_factors_create_request_round_trip + fixture = { + "type" => "stub", + "phone_number" => "stub", + "totp_issuer" => "stub", + "totp_user" => "stub", + "user_id" => "stub" + } + model = WorkOS::AuthenticationFactorsCreateRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_permission_round_trip + fixture = { + "object" => "permission", + "id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "system" => true, + "resource_type_slug" => "stub", + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::Permission.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["system"], json[:system] + assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_application_credentials_list_item_round_trip + fixture = { + "object" => "connect_application_secret", + "id" => "stub", + "secret_hint" => "stub", + "last_used_at" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::ApplicationCredentialsListItem.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["secret_hint"], json[:secret_hint] + assert_nil json[:last_used_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_data_integrations_get_data_integration_authorize_url_request_round_trip + fixture = { + "user_id" => "stub", + "organization_id" => "stub", + "return_to" => "stub" + } + model = WorkOS::DataIntegrationsGetDataIntegrationAuthorizeUrlRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["user_id"], json[:user_id] + end + + def test_data_integrations_get_user_token_request_round_trip + fixture = { + "user_id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::DataIntegrationsGetUserTokenRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["user_id"], json[:user_id] + end + + def test_feature_flag_round_trip + fixture = { + "object" => "feature_flag", + "id" => "stub", + "slug" => "stub", + "name" => "stub", + "description" => nil, + "owner" => nil, + "tags" => [], + "enabled" => true, + "default_value" => true, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::FeatureFlag.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["slug"], json[:slug] + assert_equal fixture["name"], json[:name] + assert_nil json[:description] + assert_equal fixture["enabled"], json[:enabled] + assert_equal fixture["default_value"], json[:default_value] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_feature_flag_owner_round_trip + fixture = { + "email" => "stub", + "first_name" => nil, + "last_name" => nil + } + model = WorkOS::FeatureFlagOwner.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + assert_nil json[:first_name] + assert_nil json[:last_name] + end + + def test_radar_standalone_assess_request_round_trip + fixture = { + "ip_address" => "stub", + "user_agent" => "stub", + "email" => "stub", + "auth_method" => "stub", + "action" => "stub", + "device_fingerprint" => "stub", + "bot_score" => "stub" + } + model = WorkOS::RadarStandaloneAssessRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["ip_address"], json[:ip_address] + assert_equal fixture["user_agent"], json[:user_agent] + assert_equal fixture["email"], json[:email] + end + + def test_radar_standalone_update_radar_attempt_request_round_trip + fixture = { + "challenge_status" => "success", + "attempt_status" => "success" + } + model = WorkOS::RadarStandaloneUpdateRadarAttemptRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_radar_standalone_update_radar_list_request_round_trip + fixture = { + "entry" => "stub" + } + model = WorkOS::RadarStandaloneUpdateRadarListRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["entry"], json[:entry] + end + + def test_radar_standalone_delete_radar_list_entry_request_round_trip + fixture = { + "entry" => "stub" + } + model = WorkOS::RadarStandaloneDeleteRadarListEntryRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["entry"], json[:entry] + end + + def test_sso_logout_authorize_request_round_trip + fixture = { + "profile_id" => "stub" + } + model = WorkOS::SSOLogoutAuthorizeRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["profile_id"], json[:profile_id] + end + + def test_authorization_code_session_authenticate_request_round_trip + fixture = { + "client_id" => "stub", + "client_secret" => "stub", + "grant_type" => "authorization_code", + "code" => "stub", + "code_verifier" => "stub", + "invitation_token" => "stub", + "ip_address" => "stub", + "device_id" => "stub", + "user_agent" => "stub" + } + model = WorkOS::AuthorizationCodeSessionAuthenticateRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + assert_equal fixture["client_secret"], json[:client_secret] + assert_equal fixture["code"], json[:code] + end + + def test_password_session_authenticate_request_round_trip + fixture = { + "client_id" => "stub", + "client_secret" => "stub", + "grant_type" => "password", + "email" => "stub", + "password" => "stub", + "invitation_token" => "stub", + "ip_address" => "stub", + "device_id" => "stub", + "user_agent" => "stub" + } + model = WorkOS::PasswordSessionAuthenticateRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + assert_equal fixture["client_secret"], json[:client_secret] + assert_equal fixture["email"], json[:email] + assert_equal fixture["password"], json[:password] + end + + def test_refresh_token_session_authenticate_request_round_trip + fixture = { + "client_id" => "stub", + "client_secret" => "stub", + "grant_type" => "refresh_token", + "refresh_token" => "stub", + "organization_id" => "stub", + "ip_address" => "stub", + "device_id" => "stub", + "user_agent" => "stub" + } + model = WorkOS::RefreshTokenSessionAuthenticateRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + assert_equal fixture["client_secret"], json[:client_secret] + assert_equal fixture["refresh_token"], json[:refresh_token] + end + + def test_magic_auth_code_session_authenticate_request_round_trip + fixture = { + "client_id" => "stub", + "client_secret" => "stub", + "grant_type" => "urn:workos:oauth:grant-type:magic-auth:code", + "code" => "stub", + "email" => "stub", + "invitation_token" => "stub", + "ip_address" => "stub", + "device_id" => "stub", + "user_agent" => "stub" + } + model = WorkOS::MagicAuthCodeSessionAuthenticateRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + assert_equal fixture["client_secret"], json[:client_secret] + assert_equal fixture["code"], json[:code] + assert_equal fixture["email"], json[:email] + end + + def test_email_verification_code_session_authenticate_request_round_trip + fixture = { + "client_id" => "stub", + "client_secret" => "stub", + "grant_type" => "urn:workos:oauth:grant-type:email-verification:code", + "code" => "stub", + "pending_authentication_token" => "stub", + "ip_address" => "stub", + "device_id" => "stub", + "user_agent" => "stub" + } + model = WorkOS::EmailVerificationCodeSessionAuthenticateRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + assert_equal fixture["client_secret"], json[:client_secret] + assert_equal fixture["code"], json[:code] + assert_equal fixture["pending_authentication_token"], json[:pending_authentication_token] + end + + def test_mfa_totp_session_authenticate_request_round_trip + fixture = { + "client_id" => "stub", + "client_secret" => "stub", + "grant_type" => "urn:workos:oauth:grant-type:mfa-totp", + "code" => "stub", + "pending_authentication_token" => "stub", + "authentication_challenge_id" => "stub", + "ip_address" => "stub", + "device_id" => "stub", + "user_agent" => "stub" + } + model = WorkOS::MFATotpSessionAuthenticateRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + assert_equal fixture["client_secret"], json[:client_secret] + assert_equal fixture["code"], json[:code] + assert_equal fixture["pending_authentication_token"], json[:pending_authentication_token] + assert_equal fixture["authentication_challenge_id"], json[:authentication_challenge_id] + end + + def test_organization_selection_session_authenticate_request_round_trip + fixture = { + "client_id" => "stub", + "client_secret" => "stub", + "grant_type" => "urn:workos:oauth:grant-type:organization-selection", + "pending_authentication_token" => "stub", + "organization_id" => "stub", + "ip_address" => "stub", + "device_id" => "stub", + "user_agent" => "stub" + } + model = WorkOS::OrganizationSelectionSessionAuthenticateRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + assert_equal fixture["client_secret"], json[:client_secret] + assert_equal fixture["pending_authentication_token"], json[:pending_authentication_token] + assert_equal fixture["organization_id"], json[:organization_id] + end + + def test_device_code_session_authenticate_request_round_trip + fixture = { + "client_id" => "stub", + "grant_type" => "urn:ietf:params:oauth:grant-type:device_code", + "device_code" => "stub", + "ip_address" => "stub", + "device_id" => "stub", + "user_agent" => "stub" + } + model = WorkOS::DeviceCodeSessionAuthenticateRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + assert_equal fixture["device_code"], json[:device_code] + end + + def test_sso_device_authorization_request_round_trip + fixture = { + "client_id" => "stub" + } + model = WorkOS::SSODeviceAuthorizationRequest.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["client_id"], json[:client_id] + end + + def test_invitation_round_trip + fixture = { + "object" => "invitation", + "id" => "stub", + "email" => "stub", + "state" => "stub", + "accepted_at" => nil, + "revoked_at" => nil, + "expires_at" => "stub", + "organization_id" => nil, + "inviter_user_id" => nil, + "accepted_user_id" => nil, + "created_at" => "stub", + "updated_at" => "stub", + "token" => "stub", + "accept_invitation_url" => "stub" + } + model = WorkOS::Invitation.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["email"], json[:email] + assert_nil json[:accepted_at] + assert_nil json[:revoked_at] + assert_equal fixture["expires_at"], json[:expires_at] + assert_nil json[:organization_id] + assert_nil json[:inviter_user_id] + assert_nil json[:accepted_user_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_equal fixture["token"], json[:token] + assert_equal fixture["accept_invitation_url"], json[:accept_invitation_url] + end + + def test_organization_membership_round_trip + fixture = { + "object" => "organization_membership", + "id" => "stub", + "user_id" => "stub", + "organization_id" => "stub", + "status" => "stub", + "directory_managed" => true, + "organization_name" => "stub", + "custom_attributes" => {}, + "created_at" => "stub", + "updated_at" => "stub", + "role" => {} + } + model = WorkOS::OrganizationMembership.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["organization_id"], json[:organization_id] + assert_equal fixture["directory_managed"], json[:directory_managed] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_email_change_confirmation_round_trip + fixture = { + "object" => "email_change_confirmation", + "user" => {} + } + model = WorkOS::EmailChangeConfirmation.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_email_change_confirmation_user_round_trip + fixture = { + "object" => "user", + "id" => "stub", + "first_name" => nil, + "last_name" => nil, + "profile_picture_url" => nil, + "email" => "stub", + "email_verified" => true, + "external_id" => nil, + "metadata" => {}, + "last_sign_in_at" => nil, + "locale" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::EmailChangeConfirmationUser.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:first_name] + assert_nil json[:last_name] + assert_nil json[:profile_picture_url] + assert_equal fixture["email"], json[:email] + assert_equal fixture["email_verified"], json[:email_verified] + assert_nil json[:external_id] + assert_nil json[:last_sign_in_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_user_identities_get_item_round_trip + fixture = { + "idp_id" => "stub", + "type" => "OAuth", + "provider" => "stub" + } + model = WorkOS::UserIdentitiesGetItem.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["idp_id"], json[:idp_id] + end + + def test_user_sessions_list_item_round_trip + fixture = { + "object" => "session", + "id" => "stub", + "impersonator" => {}, + "ip_address" => nil, + "organization_id" => "stub", + "user_agent" => nil, + "user_id" => "stub", + "auth_method" => "stub", + "status" => "stub", + "expires_at" => "stub", + "ended_at" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::UserSessionsListItem.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:ip_address] + assert_nil json[:user_agent] + assert_equal fixture["user_id"], json[:user_id] + assert_equal fixture["expires_at"], json[:expires_at] + assert_nil json[:ended_at] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + end + + def test_user_sessions_impersonator_round_trip + fixture = { + "email" => "stub", + "reason" => nil + } + model = WorkOS::UserSessionsImpersonator.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["email"], json[:email] + assert_nil json[:reason] + end + + def test_directory_metadata_user_round_trip + fixture = { + "active" => 1, + "inactive" => 1 + } + model = WorkOS::DirectoryMetadataUser.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["active"], json[:active] + assert_equal fixture["inactive"], json[:inactive] + end + + def test_data_integrations_list_response_data_connected_account_round_trip + fixture = { + "object" => "connected_account", + "id" => "stub", + "user_id" => nil, + "organization_id" => nil, + "scopes" => [], + "state" => "stub", + "created_at" => "stub", + "updated_at" => "stub", + "userlandUserId" => nil + } + model = WorkOS::DataIntegrationsListResponseDataConnectedAccount.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["id"], json[:id] + assert_nil json[:user_id] + assert_nil json[:organization_id] + assert_equal fixture["created_at"], json[:created_at] + assert_equal fixture["updated_at"], json[:updated_at] + assert_nil json[:userlandUserId] + end +end diff --git a/test/workos/test_multi_factor_auth.rb b/test/workos/test_multi_factor_auth.rb new file mode 100644 index 00000000..71a506a6 --- /dev/null +++ b/test/workos/test_multi_factor_auth.rb @@ -0,0 +1,118 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class MultiFactorAuthTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_verify_challenge_returns_expected_result + stub_request(:post, /#{Regexp.escape("auth")}/) + .to_return(body: "{}", status: 200) + result = @client.multi_factor_auth.verify_challenge(id: "stub", code: "stub") + refute_nil result + end + + def test_verify_challenge_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("auth")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.multi_factor_auth.verify_challenge(id: "stub", code: "stub") + end + end + + def test_enroll_factor_returns_expected_result + stub_request(:post, /#{Regexp.escape("auth")}/) + .to_return(body: "{}", status: 200) + result = @client.multi_factor_auth.enroll_factor(type: "stub") + refute_nil result + end + + def test_enroll_factor_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("auth")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.multi_factor_auth.enroll_factor(type: "stub") + end + end + + def test_get_factor_returns_expected_result + stub_request(:get, /#{Regexp.escape("auth")}/) + .to_return(body: "{}", status: 200) + result = @client.multi_factor_auth.get_factor(id: "stub") + refute_nil result + end + + def test_get_factor_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("auth")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.multi_factor_auth.get_factor(id: "stub") + end + end + + def test_delete_factor_returns_expected_result + stub_request(:delete, /#{Regexp.escape("auth")}/) + .to_return(body: "{}", status: 200) + result = @client.multi_factor_auth.delete_factor(id: "stub") + assert_nil result if result.nil? + end + + def test_delete_factor_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("auth")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.multi_factor_auth.delete_factor(id: "stub") + end + end + + def test_challenge_factor_returns_expected_result + stub_request(:post, /#{Regexp.escape("auth")}/) + .to_return(body: "{}", status: 200) + result = @client.multi_factor_auth.challenge_factor(id: "stub") + refute_nil result + end + + def test_challenge_factor_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("auth")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.multi_factor_auth.challenge_factor(id: "stub") + end + end + + def test_list_user_auth_factors_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.multi_factor_auth.list_user_auth_factors(userland_user_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_user_auth_factors_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.multi_factor_auth.list_user_auth_factors(userland_user_id: "stub") + end + end + + def test_create_user_auth_factor_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.multi_factor_auth.create_user_auth_factor(userland_user_id: "stub", type: "totp") + refute_nil result + end + + def test_create_user_auth_factor_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.multi_factor_auth.create_user_auth_factor(userland_user_id: "stub", type: "totp") + end + end +end diff --git a/test/workos/test_organization_domains.rb b/test/workos/test_organization_domains.rb new file mode 100644 index 00000000..0f807681 --- /dev/null +++ b/test/workos/test_organization_domains.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class OrganizationDomainsTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_create_organization_domain_returns_expected_result + stub_request(:post, /#{Regexp.escape("organization_domains")}/) + .to_return(body: "{}", status: 200) + result = @client.organization_domains.create_organization_domain(domain: "stub", organization_id: "stub") + refute_nil result + end + + def test_create_organization_domain_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("organization_domains")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organization_domains.create_organization_domain(domain: "stub", organization_id: "stub") + end + end + + def test_get_organization_domain_returns_expected_result + stub_request(:get, /#{Regexp.escape("organization_domains")}/) + .to_return(body: "{}", status: 200) + result = @client.organization_domains.get_organization_domain(id: "stub") + refute_nil result + end + + def test_get_organization_domain_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("organization_domains")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organization_domains.get_organization_domain(id: "stub") + end + end + + def test_delete_organization_domain_returns_expected_result + stub_request(:delete, /#{Regexp.escape("organization_domains")}/) + .to_return(body: "{}", status: 200) + result = @client.organization_domains.delete_organization_domain(id: "stub") + assert_nil result if result.nil? + end + + def test_delete_organization_domain_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("organization_domains")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organization_domains.delete_organization_domain(id: "stub") + end + end + + def test_verify_organization_domain_returns_expected_result + stub_request(:post, /#{Regexp.escape("organization_domains")}/) + .to_return(body: "{}", status: 200) + result = @client.organization_domains.verify_organization_domain(id: "stub") + refute_nil result + end + + def test_verify_organization_domain_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("organization_domains")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organization_domains.verify_organization_domain(id: "stub") + end + end +end diff --git a/test/workos/test_organizations.rb b/test/workos/test_organizations.rb index 3ddc31a1..a4884218 100644 --- a/test/workos/test_organizations.rb +++ b/test/workos/test_organizations.rb @@ -1,406 +1,118 @@ # frozen_string_literal: true -require "test_helper" - -class TestOrganizations < WorkOS::TestCase - def test_create_organization - VCR.use_cassette "organization/create" do - organization = WorkOS::Organizations.create_organization( - domains: ["example.io"], - name: "Test Organization" - ) - - assert_equal "org_01FCPEJXEZR4DSBA625YMGQT9N", organization.id - assert_equal "Test Organization", organization.name - assert_equal "example.io", organization.domains.first[:domain] - end - end - - def test_create_organization_without_domains - VCR.use_cassette "organization/create_without_domains" do - organization = WorkOS::Organizations.create_organization( - name: "Test Organization" - ) +# This file is auto-generated by oagen. Do not edit. - assert organization.id.start_with?("org_") - assert_equal "Test Organization", organization.name - assert organization.domains.empty? - end - end - - def test_create_organization_with_external_id - VCR.use_cassette "organization/create_with_external_id" do - organization = WorkOS::Organizations.create_organization( - name: "Test Organization with External ID", - external_id: "ext_org_123" - ) - - assert organization.id.start_with?("org_") - assert_equal "Test Organization with External ID", organization.name - assert_equal "ext_org_123", organization.external_id - end - end - - def test_create_organization_with_domains_warns_deprecation - VCR.use_cassette "organization/create_with_domains" do - _, err = capture_io do - organization = WorkOS::Organizations.create_organization( - domains: ["example.io"], - name: "Test Organization" - ) - - assert organization.id.start_with?("org_") - assert_equal "Test Organization", organization.name - assert_equal "example.io", organization.domains.first[:domain] - end - assert_match(/\[DEPRECATION\] `domains` is deprecated. Use `domain_data` instead./, err) - end - end - - def test_create_organization_with_domain_data - VCR.use_cassette "organization/create_with_domain_data" do - organization = WorkOS::Organizations.create_organization( - domain_data: [{domain: "example.io", state: "verified"}], - name: "Test Organization" - ) - - assert organization.id.start_with?("org_") - assert_equal "Test Organization", organization.name - assert_equal "example.io", organization.domains.first[:domain] - assert_equal "verified", organization.domains.first[:state] - end - end - - def test_create_organization_with_idempotency_key - VCR.use_cassette "organization/create_with_idempotency_key" do - organization = WorkOS::Organizations.create_organization( - domains: ["example.io"], - name: "Test Organization", - idempotency_key: "key" - ) - - assert_equal "Test Organization", organization.name - assert_equal "example.io", organization.domains.first[:domain] - end - end - - def test_create_organization_with_duplicate_idempotency_key_and_payload - VCR.use_cassette "organization/create_with_duplicate_idempotency_key_and_payload" do - organization1 = WorkOS::Organizations.create_organization( - domains: ["example.com"], - name: "Test Organization", - idempotency_key: "foo" - ) - - organization2 = WorkOS::Organizations.create_organization( - domains: ["example.com"], - name: "Test Organization", - idempotency_key: "foo" - ) - - assert_equal organization1.id, organization2.id - end - end - - def test_create_organization_with_duplicate_idempotency_key_and_different_payload - VCR.use_cassette "organization/create_with_duplicate_idempotency_key_and_different_payload" do - WorkOS::Organizations.create_organization( - domains: ["example.me"], - name: "Test Organization", - idempotency_key: "bar" - ) - - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::Organizations.create_organization( - domains: ["example.me"], - name: "Organization Test", - idempotency_key: "bar" - ) - end - assert_match(/Status 400, Another idempotency key \(bar\) with different request parameters was found. Please use a different idempotency key./, err.message) - end - end - - def test_create_organization_with_invalid_payload - VCR.use_cassette "organization/create_invalid" do - err = assert_raises(WorkOS::APIError) do - WorkOS::Organizations.create_organization( - domains: ["example.com"], - name: "Test Organization 2" - ) - end - assert_match(/An Organization with the domain example.com already exists/, err.message) - end - end - - def test_list_organizations_with_no_options - expected_metadata = { - "after" => nil, - "before" => "before-id" - } - - VCR.use_cassette "organization/list" do - organizations = WorkOS::Organizations.list_organizations - - assert_equal 6, organizations.data.size - assert_equal expected_metadata, organizations.list_metadata - end - end - - def test_list_organizations_with_before - VCR.use_cassette "organization/list", match_requests_on: [:path] do - organizations = WorkOS::Organizations.list_organizations( - before: "before-id" - ) - - assert_equal 6, organizations.data.size - end - end - - def test_list_organizations_with_after - VCR.use_cassette "organization/list", match_requests_on: [:path] do - organizations = WorkOS::Organizations.list_organizations(after: "after-id") - - assert_equal 6, organizations.data.size - end - end - - def test_list_organizations_with_limit - VCR.use_cassette "organization/list", match_requests_on: [:path] do - organizations = WorkOS::Organizations.list_organizations(limit: 10) - - assert_equal 6, organizations.data.size - end - end - - def test_get_organization_with_valid_id - VCR.use_cassette("organization/get") do - organization = WorkOS::Organizations.get_organization( - id: "org_01F9293WD2PDEEV4Y625XPZVG7" - ) - - assert_equal "org_01F9293WD2PDEEV4Y625XPZVG7", organization.id - assert_equal "Foo Corp", organization.name - assert_equal "foo-corp.com", organization.domains.first[:domain] - end - end - - def test_get_organization_with_invalid_id - VCR.use_cassette("organization/get_invalid") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::Organizations.get_organization(id: "invalid") - end - assert_equal "Status 404, Not Found - request ID: ", err.message - end - end - - def test_update_organization - VCR.use_cassette "organization/update" do - organization = WorkOS::Organizations.update_organization( - organization: "org_01F6Q6TFP7RD2PF6J03ANNWDKV", - domains: ["example.me"], - name: "Test Organization" - ) - - assert_equal "org_01F6Q6TFP7RD2PF6J03ANNWDKV", organization.id - assert_equal "Test Organization", organization.name - assert_equal "example.me", organization.domains.first[:domain] - end - end +require "test_helper" - def test_update_organization_without_name - VCR.use_cassette "organization/update_without_name" do - organization = WorkOS::Organizations.update_organization( - organization: "org_01F6Q6TFP7RD2PF6J03ANNWDKV", - domains: ["example.me"] - ) +class OrganizationsTest < Minitest::Test + include FixtureHelper - assert_equal "org_01F6Q6TFP7RD2PF6J03ANNWDKV", organization.id - assert_equal "Test Organization", organization.name - assert_equal "example.me", organization.domains.first[:domain] - end + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") end - def test_update_organization_with_stripe_customer_id - VCR.use_cassette "organization/update_with_stripe_customer_id" do - organization = WorkOS::Organizations.update_organization( - organization: "org_01JJ5H14CAA2SQ5G9HNN6TBZ05", - name: "Test Organization", - stripe_customer_id: "cus_123" - ) - - assert_equal "org_01JJ5H14CAA2SQ5G9HNN6TBZ05", organization.id - assert_equal "Test Organization", organization.name - assert_equal "cus_123", organization.stripe_customer_id - end + def test_list_organizations_returns_expected_result + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.organizations.list_organizations + assert_kind_of WorkOS::Types::ListStruct, result end - def test_update_organization_with_external_id - VCR.use_cassette "organization/update_with_external_id" do - organization = WorkOS::Organizations.update_organization( - organization: "org_01K0SQV0S6EPWK2ZDEFD1CP1JC", - name: "Test Organization", - external_id: "ext_org_456" - ) - - assert_equal "org_01K0SQV0S6EPWK2ZDEFD1CP1JC", organization.id - assert_equal "Test Organization", organization.name - assert_equal "ext_org_456", organization.external_id + def test_list_organizations_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organizations.list_organizations end end - def test_update_organization_with_external_id_null - VCR.use_cassette "organization/update_with_external_id_null" do - organization = WorkOS::Organizations.update_organization( - organization: "org_01K0SQV0S6EPWK2ZDEFD1CP1JC", - name: "Test Organization", - external_id: nil - ) - - assert_nil organization.external_id - end + def test_create_organization_returns_expected_result + stub_request(:post, /#{Regexp.escape("organizations")}/) + .to_return(body: "{}", status: 200) + result = @client.organizations.create_organization(name: "stub") + refute_nil result end - def test_delete_organization_with_valid_id - VCR.use_cassette("organization/delete") do - response = WorkOS::Organizations.delete_organization( - id: "org_01F4A8TD0B4N1Y9SJ8SH635HDB" - ) - - assert_equal true, response + def test_create_organization_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organizations.create_organization(name: "stub") end end - def test_delete_organization_with_invalid_id - VCR.use_cassette("organization/delete_invalid") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::Organizations.delete_organization(id: "invalid") - end - assert_equal "Status 404, Not Found - request ID: ", err.message - end + def test_get_organization_by_external_id_returns_expected_result + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: "{}", status: 200) + result = @client.organizations.get_organization_by_external_id(external_id: "stub") + refute_nil result end - def test_list_organization_roles - expected_metadata = { - after: nil, - before: nil - } - - VCR.use_cassette "organization/list_organization_roles" do - roles = WorkOS::Organizations.list_organization_roles( - organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE" - ) - - assert_equal 7, roles.data.size - assert_equal expected_metadata, roles.list_metadata + def test_get_organization_by_external_id_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organizations.get_organization_by_external_id(external_id: "stub") end end - def test_list_organization_roles_returns_properly_initialized_role_objects - VCR.use_cassette "organization/list_organization_roles" do - roles = WorkOS::Organizations.list_organization_roles( - organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE" - ) - - first_role = roles.data.first - assert_kind_of WorkOS::Role, first_role - assert_equal "role_01HS1C7GRJE08PBR3M6Y0ZYGDZ", first_role.id - assert_equal "Admin", first_role.name - assert_equal "admin", first_role.slug - assert_equal "Write access to every resource available", first_role.description - assert_equal ["admin:all", "read:users", "write:users", "manage:roles"], first_role.permissions - assert_equal "EnvironmentRole", first_role.type - assert_equal "2024-03-15T15:38:29.521Z", first_role.created_at - assert_equal "2024-11-14T17:08:00.556Z", first_role.updated_at - end + def test_get_organization_returns_expected_result + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: "{}", status: 200) + result = @client.organizations.get_organization(id: "stub") + refute_nil result end - def test_list_organization_roles_handles_empty_permissions - VCR.use_cassette "organization/list_organization_roles" do - roles = WorkOS::Organizations.list_organization_roles( - organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE" - ) - - platform_manager_role = roles.data.find { |role| role.slug == "org-platform-manager" } - assert_kind_of WorkOS::Role, platform_manager_role - assert_equal [], platform_manager_role.permissions + def test_get_organization_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organizations.get_organization(id: "stub") end end - def test_list_organization_roles_serializes_including_permissions - VCR.use_cassette "organization/list_organization_roles" do - roles = WorkOS::Organizations.list_organization_roles( - organization_id: "org_01JEXP6Z3X7HE4CB6WQSH9ZAFE" - ) - - billing_role = roles.data.find { |role| role.slug == "billing" } - serialized = billing_role.to_json - - assert_equal "role_01JA8GJZRDSZEB9289DQXJ3N9Z", serialized[:id] - assert_equal "Billing Manager", serialized[:name] - assert_equal "billing", serialized[:slug] - assert_equal ["read:billing", "write:billing"], serialized[:permissions] - assert_equal "EnvironmentRole", serialized[:type] - end + def test_update_organization_returns_expected_result + stub_request(:put, /#{Regexp.escape("organizations")}/) + .to_return(body: "{}", status: 200) + result = @client.organizations.update_organization(id: "stub") + refute_nil result end - def test_list_organization_feature_flags - expected_metadata = { - after: nil, - before: nil - } - - VCR.use_cassette "organization/list_organization_feature_flags" do - feature_flags = WorkOS::Organizations.list_organization_feature_flags( - organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529" - ) - - assert_equal 2, feature_flags.data.size - assert_equal expected_metadata, feature_flags.list_metadata + def test_update_organization_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organizations.update_organization(id: "stub") end end - def test_list_organization_feature_flags_with_before - VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do - feature_flags = WorkOS::Organizations.list_organization_feature_flags( - organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", - options: {before: "before-id"} - ) - - assert_equal 2, feature_flags.data.size - end + def test_delete_organization_returns_expected_result + stub_request(:delete, /#{Regexp.escape("organizations")}/) + .to_return(body: "{}", status: 200) + result = @client.organizations.delete_organization(id: "stub") + assert_nil result if result.nil? end - def test_list_organization_feature_flags_with_after - VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do - feature_flags = WorkOS::Organizations.list_organization_feature_flags( - organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", - options: {after: "after-id"} - ) - - assert_equal 2, feature_flags.data.size + def test_delete_organization_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organizations.delete_organization(id: "stub") end end - def test_list_organization_feature_flags_with_limit - VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do - feature_flags = WorkOS::Organizations.list_organization_feature_flags( - organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", - options: {limit: 10} - ) - - assert_equal 2, feature_flags.data.size - end + def test_get_audit_log_configuration_returns_expected_result + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: "{}", status: 200) + result = @client.organizations.get_audit_log_configuration(id: "stub") + refute_nil result end - def test_list_organization_feature_flags_with_multiple_pagination_options - VCR.use_cassette "organization/list_organization_feature_flags", match_requests_on: [:path] do - feature_flags = WorkOS::Organizations.list_organization_feature_flags( - organization_id: "org_01HX7Q7R12H1JMAKN75SH2G529", - options: {after: "after-id", limit: 5, order: "asc"} - ) - - assert_equal 2, feature_flags.data.size + def test_get_audit_log_configuration_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("organizations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organizations.get_audit_log_configuration(id: "stub") end end end diff --git a/test/workos/test_passwordless.rb b/test/workos/test_passwordless.rb index c502b02e..aa4fd5b2 100644 --- a/test/workos/test_passwordless.rb +++ b/test/workos/test_passwordless.rb @@ -1,51 +1,59 @@ # frozen_string_literal: true +# @oagen-ignore-file require "test_helper" -class TestPasswordless < WorkOS::TestCase - def test_create_session_with_valid_options - VCR.use_cassette("passwordless/create_session") do - response = WorkOS::Passwordless.create_session( - email: "demo@workos-okta.com", - type: "MagicLink", - redirect_uri: "foo.com/auth/callback" - ) - - assert_equal "demo@workos-okta.com", response.email - end +class PasswordlessTest < Minitest::Test + def setup + @client = WorkOS::Client.new(api_key: "sk_test_passwordless") end - def test_create_session_with_invalid_options - VCR.use_cassette("passwordless/create_session_invalid") do - err = assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::Passwordless.create_session({}) - end - assert_match( - /Status 422, Validation failed \(email: email must be a string; type: type must be a valid enum value\)/, - err.message - ) - end + def test_passwordless_accessor_exists + assert_kind_of WorkOS::Passwordless, @client.passwordless end - def test_send_session_with_valid_session_id - VCR.use_cassette("passwordless/send_session") do - response = WorkOS::Passwordless.send_session( - "passwordless_session_01EJC0F4KH42T11Y2DHPEB09BM" - ) + def test_create_session_returns_passwordless_session_struct + payload = { + id: "passwordless_session_01", + email: "user@example.com", + expires_at: "2026-04-15T12:00:00Z", + link: "https://workos.com/magic/abc", + object: "passwordless_session" + } + stub_request(:post, "https://api.workos.com/passwordless/sessions") + .with(body: hash_including("email" => "user@example.com", "type" => "MagicLink")) + .to_return(status: 200, body: payload.to_json) - assert_equal true, response["success"] - end + result = @client.passwordless.create_session(email: "user@example.com") + assert_equal "passwordless_session_01", result.id + assert_equal "user@example.com", result.email + assert_equal "https://workos.com/magic/abc", result.link + assert_equal "passwordless_session", result.object end - def test_send_session_with_invalid_session_id - VCR.use_cassette("passwordless/send_session_invalid") do - err = assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::Passwordless.send_session("session_123") - end - assert_match( - /Status 422, The passwordless session 'session_123' has expired or is invalid./, - err.message - ) - end + def test_create_session_forwards_optional_params + stub_request(:post, "https://api.workos.com/passwordless/sessions") + .with(body: hash_including( + "email" => "user@example.com", + "redirect_uri" => "https://app.example.com/cb", + "state" => "xyz", + "connection" => "conn_123" + )) + .to_return(status: 200, body: '{"id":"s","email":"user@example.com","expires_at":"x","link":"y"}') + + @client.passwordless.create_session( + email: "user@example.com", + redirect_uri: "https://app.example.com/cb", + state: "xyz", + connection: "conn_123" + ) + end + + def test_send_session_posts_to_send_endpoint + stub_request(:post, "https://api.workos.com/passwordless/sessions/sess_42/send") + .to_return(status: 200, body: '{"success":true}') + + result = @client.passwordless.send_session("sess_42") + assert_equal({"success" => true}, result) end end diff --git a/test/workos/test_pipes.rb b/test/workos/test_pipes.rb new file mode 100644 index 00000000..71b55e49 --- /dev/null +++ b/test/workos/test_pipes.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class PipesTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_authorize_data_integration_returns_expected_result + stub_request(:post, /#{Regexp.escape("data-integrations")}/) + .to_return(body: "{}", status: 200) + result = @client.pipes.authorize_data_integration(slug: "stub", user_id: "stub") + refute_nil result + end + + def test_authorize_data_integration_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("data-integrations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.pipes.authorize_data_integration(slug: "stub", user_id: "stub") + end + end + + def test_create_data_integration_token_returns_expected_result + stub_request(:post, /#{Regexp.escape("data-integrations")}/) + .to_return(body: "{}", status: 200) + result = @client.pipes.create_data_integration_token(slug: "stub", user_id: "stub") + refute_nil result + end + + def test_create_data_integration_token_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("data-integrations")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.pipes.create_data_integration_token(slug: "stub", user_id: "stub") + end + end + + def test_get_user_connected_account_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.pipes.get_user_connected_account(user_id: "stub", slug: "stub") + refute_nil result + end + + def test_get_user_connected_account_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.pipes.get_user_connected_account(user_id: "stub", slug: "stub") + end + end + + def test_delete_user_connected_account_returns_expected_result + stub_request(:delete, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.pipes.delete_user_connected_account(user_id: "stub", slug: "stub") + assert_nil result if result.nil? + end + + def test_delete_user_connected_account_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.pipes.delete_user_connected_account(user_id: "stub", slug: "stub") + end + end + + def test_list_user_data_providers_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.pipes.list_user_data_providers(user_id: "stub") + refute_nil result + end + + def test_list_user_data_providers_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.pipes.list_user_data_providers(user_id: "stub") + end + end +end diff --git a/test/workos/test_pkce.rb b/test/workos/test_pkce.rb new file mode 100644 index 00000000..90ef3e44 --- /dev/null +++ b/test/workos/test_pkce.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +require "test_helper" +require "base64" +require "digest" + +class PKCETest < Minitest::Test + def test_module_accessible_from_client + client = WorkOS::Client.new(api_key: "k") + assert_equal WorkOS::PKCE, client.pkce + end + + def test_generate_code_verifier_meets_rfc7636_minimum + v = WorkOS::PKCE.generate_code_verifier + assert v.length >= 43, "verifier too short: #{v.length}" + assert v.length <= 128, "verifier too long: #{v.length}" + assert_match(/\A[A-Za-z0-9_-]+\z/, v, "verifier must be base64url unreserved chars") + end + + def test_generate_code_verifier_is_random + refute_equal WorkOS::PKCE.generate_code_verifier, WorkOS::PKCE.generate_code_verifier + end + + def test_generate_code_challenge_is_s256_of_verifier + verifier = WorkOS::PKCE.generate_code_verifier + expected = Base64.urlsafe_encode64(Digest::SHA256.digest(verifier), padding: false) + assert_equal expected, WorkOS::PKCE.generate_code_challenge(verifier) + end + + def test_generate_pair_is_self_consistent + pair = WorkOS::PKCE.generate_pair + expected = WorkOS::PKCE.generate_code_challenge(pair[:code_verifier]) + assert_equal expected, pair[:code_challenge] + end + + def test_generate_pair_is_unique_per_call + refute_equal WorkOS::PKCE.generate_pair[:code_verifier], WorkOS::PKCE.generate_pair[:code_verifier] + end +end diff --git a/test/workos/test_portal.rb b/test/workos/test_portal.rb deleted file mode 100644 index db25b19a..00000000 --- a/test/workos/test_portal.rb +++ /dev/null @@ -1,87 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class TestPortal < WorkOS::TestCase - def setup - super - @organization = "org_01EHQMYV6MBK39QC5PZXHY59C3" - end - - def test_generate_link_with_sso_intent - VCR.use_cassette "portal/generate_link_sso" do - portal_link = WorkOS::Portal.generate_link( - intent: "sso", - organization: @organization - ) - - assert_equal "https://id.workos.com/portal/launch?secret=secret", portal_link - end - end - - def test_generate_link_with_dsync_intent - VCR.use_cassette "portal/generate_link_dsync" do - portal_link = WorkOS::Portal.generate_link( - intent: "dsync", - organization: @organization - ) - - assert_equal "https://id.workos.com/portal/launch?secret=secret", portal_link - end - end - - def test_generate_link_with_audit_logs_intent - VCR.use_cassette "portal/generate_link_audit_logs", match_requests_on: %i[path body] do - portal_link = WorkOS::Portal.generate_link( - intent: "audit_logs", - organization: @organization - ) - - assert_equal "https://id.workos.com/portal/launch?secret=secret", portal_link - end - end - - def test_generate_link_with_certificate_renewal_intent - VCR.use_cassette "portal/generate_link_certificate_renewal", match_requests_on: %i[path body] do - portal_link = WorkOS::Portal.generate_link( - intent: "certificate_renewal", - organization: @organization - ) - - assert_equal "https://id.workos.com/portal/launch?secret=secret", portal_link - end - end - - def test_generate_link_with_domain_verification_intent - VCR.use_cassette "portal/generate_link_domain_verification", match_requests_on: %i[path body] do - portal_link = WorkOS::Portal.generate_link( - intent: "domain_verification", - organization: @organization - ) - - assert_equal "https://id.workos.com/portal/launch?secret=secret", portal_link - end - end - - def test_generate_link_with_invalid_organization - VCR.use_cassette "portal/generate_link_invalid" do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::Portal.generate_link( - intent: "sso", - organization: "bogus-id" - ) - end - assert_match(/Could not find an organization with the id, bogus-id/, err.message) - end - end - - def test_generate_link_with_invalid_intent - err = assert_raises(ArgumentError) do - WorkOS::Portal.generate_link( - intent: "bogus-intent", - organization: @organization - ) - end - assert_match(/bogus-intent is not a valid value/, err.message) - end -end diff --git a/test/workos/test_public_client.rb b/test/workos/test_public_client.rb new file mode 100644 index 00000000..a08a6cbf --- /dev/null +++ b/test/workos/test_public_client.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +require "test_helper" + +class PublicClientTest < Minitest::Test + def test_create_returns_workos_client_with_no_api_key + client = WorkOS::PublicClient.create(client_id: "client_001") + assert_kind_of WorkOS::Client, client + assert_equal "client_001", client.client_id + assert_nil client.api_key + end + + def test_create_requires_client_id + assert_raises(ArgumentError) { WorkOS::PublicClient.create(client_id: nil) } + assert_raises(ArgumentError) { WorkOS::PublicClient.create(client_id: "") } + end + + def test_public_client_request_omits_authorization_header + client = WorkOS::PublicClient.create(client_id: "client_001") + stub = stub_request(:post, "https://api.workos.com/oauth2/device_authorization") + .with { |req| !req.headers.key?("Authorization") } + .to_return(status: 200, body: '{"device_code":"d","user_code":"u","verification_uri":"v","verification_uri_complete":"vc","expires_in":10,"interval":5}') + client.user_management.authorize_device + assert_requested(stub) + end + + def test_public_client_can_build_pkce_authorization_url + client = WorkOS::PublicClient.create(client_id: "client_001") + url, verifier, _state = client.user_management.get_authorization_url_with_pkce( + redirect_uri: "https://app/cb", + provider: "GoogleOAuth" + ) + assert_match %r{client_id=client_001}, url + assert_match %r{code_challenge_method=S256}, url + assert verifier.length >= 43 + end +end diff --git a/test/workos/test_radar.rb b/test/workos/test_radar.rb new file mode 100644 index 00000000..86114494 --- /dev/null +++ b/test/workos/test_radar.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class RadarTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_create_attempt_returns_expected_result + stub_request(:post, /#{Regexp.escape("radar")}/) + .to_return(body: "{}", status: 200) + result = @client.radar.create_attempt(ip_address: "stub", user_agent: "stub", email: "stub", auth_method: "stub", action: "stub") + refute_nil result + end + + def test_create_attempt_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("radar")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.radar.create_attempt(ip_address: "stub", user_agent: "stub", email: "stub", auth_method: "stub", action: "stub") + end + end + + def test_update_attempt_returns_expected_result + stub_request(:put, /#{Regexp.escape("radar")}/) + .to_return(body: "{}", status: 200) + result = @client.radar.update_attempt(id: "stub") + assert_nil result if result.nil? + end + + def test_update_attempt_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("radar")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.radar.update_attempt(id: "stub") + end + end + + def test_add_list_entry_returns_expected_result + stub_request(:post, /#{Regexp.escape("radar")}/) + .to_return(body: "{}", status: 200) + result = @client.radar.add_list_entry(type: "stub", action: "stub", entry: "stub") + refute_nil result + end + + def test_add_list_entry_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("radar")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.radar.add_list_entry(type: "stub", action: "stub", entry: "stub") + end + end + + def test_remove_list_entry_returns_expected_result + stub_request(:delete, /#{Regexp.escape("radar")}/) + .to_return(body: "{}", status: 200) + result = @client.radar.remove_list_entry(type: "stub", action: "stub", entry: "stub") + assert_nil result if result.nil? + end + + def test_remove_list_entry_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("radar")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.radar.remove_list_entry(type: "stub", action: "stub", entry: "stub") + end + end +end diff --git a/test/workos/test_role.rb b/test/workos/test_role.rb deleted file mode 100644 index ceb9f29d..00000000 --- a/test/workos/test_role.rb +++ /dev/null @@ -1,128 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class TestRole < WorkOS::TestCase - def test_initialize_with_full_role_data_including_permissions - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "Admin", - slug: "admin", - description: "Administrator role with full access", - permissions: ["read:users", "write:users", "admin:all"], - type: "system", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = WorkOS::Role.new(role_json) - - assert_equal "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", role.id - assert_equal "Admin", role.name - assert_equal "admin", role.slug - assert_equal "Administrator role with full access", role.description - assert_equal ["read:users", "write:users", "admin:all"], role.permissions - assert_equal "system", role.type - assert_equal "2022-05-13T17:45:31.732Z", role.created_at - assert_equal "2022-07-13T17:45:42.618Z", role.updated_at - end - - def test_initialize_without_permissions - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "User", - slug: "user", - description: "Basic user role", - type: "custom", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = WorkOS::Role.new(role_json) - - assert_equal "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", role.id - assert_equal "User", role.name - assert_equal "user", role.slug - assert_equal "Basic user role", role.description - assert_equal [], role.permissions - assert_equal "custom", role.type - assert_equal "2022-05-13T17:45:31.732Z", role.created_at - assert_equal "2022-07-13T17:45:42.618Z", role.updated_at - end - - def test_initialize_with_null_permissions - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "User", - slug: "user", - description: "Basic user role", - permissions: nil, - type: "custom", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = WorkOS::Role.new(role_json) - - assert_equal [], role.permissions - end - - def test_initialize_with_empty_permissions_array - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "User", - slug: "user", - description: "Basic user role", - permissions: [], - type: "custom", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = WorkOS::Role.new(role_json) - - assert_equal [], role.permissions - end - - def test_to_json_with_permissions - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "Admin", - slug: "admin", - description: "Administrator role", - permissions: ["read:all", "write:all"], - type: "system", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = WorkOS::Role.new(role_json) - serialized = role.to_json - - assert_equal "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", serialized[:id] - assert_equal "Admin", serialized[:name] - assert_equal "admin", serialized[:slug] - assert_equal "Administrator role", serialized[:description] - assert_equal ["read:all", "write:all"], serialized[:permissions] - assert_equal "system", serialized[:type] - assert_equal "2022-05-13T17:45:31.732Z", serialized[:created_at] - assert_equal "2022-07-13T17:45:42.618Z", serialized[:updated_at] - end - - def test_to_json_without_permissions - role_json = { - id: "role_01FAEAJCJ3P1Z6WP5Y9VQPN2XY", - name: "User", - slug: "user", - description: "Basic user role", - type: "custom", - created_at: "2022-05-13T17:45:31.732Z", - updated_at: "2022-07-13T17:45:42.618Z" - }.to_json - - role = WorkOS::Role.new(role_json) - serialized = role.to_json - - assert_equal [], serialized[:permissions] - end -end diff --git a/test/workos/test_session.rb b/test/workos/test_session.rb index 670b55e8..c45636a6 100644 --- a/test/workos/test_session.rb +++ b/test/workos/test_session.rb @@ -1,472 +1,231 @@ # frozen_string_literal: true +# @oagen-ignore-file require "test_helper" +require "json" require "openssl" require "jwt" +require "base64" -class TestSession < WorkOS::TestCase - # Simple mock object that responds to methods based on keyword args. - # Replacement for OpenStruct which is not in Ruby 4 default gems. - class MockObj - def initialize(**kwargs) - @attrs = kwargs - kwargs.each do |key, value| - define_singleton_method(key) { value } - end - end - end +class SessionTest < Minitest::Test + PASSWORD = "very-long-cookie-password-secret" def setup - super - WorkOS::Cache.clear - @client_id = "test_client_id" - @cookie_password = "test_very_long_cookie_password__" - @session_data = "test_session_data" - @jwk = JWT::JWK.new(OpenSSL::PKey::RSA.new(2048), {kid: "sso_oidc_key_pair_123", use: "sig", alg: "RS256"}) - @jwks_hash = {keys: [@jwk.export]}.to_json - @jwks_url = "https://api.workos.com/sso/jwks/client_123" - @user_management = Minitest::Mock.new + @client = WorkOS::Client.new(api_key: "sk_test_session", client_id: "client_001") + @sm = @client.session_manager end - # Helper to build a session with the mock user_management and Net::HTTP stubbed - def build_session(session_data: @session_data, cookie_password: @cookie_password, encryptor: nil) - args = { - user_management: @user_management, - client_id: @client_id, - session_data: session_data, - cookie_password: cookie_password - } - args[:encryptor] = encryptor if encryptor - WorkOS::Session.new(**args) + # --- H06 raw seal/unseal round-trip --------------------------------------- + + def test_seal_then_unseal_round_trip_hash + sealed = @sm.seal_data({"a" => 1, "b" => "two"}, PASSWORD) + refute_equal "a", sealed + assert_equal({"a" => 1, "b" => "two"}, @sm.unseal_data(sealed, PASSWORD)) end - def with_mocked_jwks - @user_management.expect(:get_jwks_url, @jwks_url, [@client_id]) - Net::HTTP.stub(:get, @jwks_hash) do - yield + def test_unseal_with_wrong_key_raises + sealed = @sm.seal_data({"x" => 1}, PASSWORD) + assert_raises(OpenSSL::Cipher::CipherError) do + @sm.unseal_data(sealed, "wrong-password") end end - # --- initialize --- - - def test_jwks_caching - WorkOS::Cache.clear - - # First session fetches from remote - @user_management.expect(:get_jwks_url, @jwks_url, [@client_id]) - session1 = nil - session2 = nil - - Net::HTTP.stub(:get, @jwks_hash) do - session1 = build_session - - # Second session should use cache (no additional Net::HTTP.get call needed) - @user_management.expect(:get_jwks_url, @jwks_url, [@client_id]) - session2 = build_session + def test_unseal_rejects_short_payload + assert_raises(ArgumentError) do + @sm.unseal_data(Base64.strict_encode64("short"), PASSWORD) end - - assert_equal session1.jwks.map(&:export), session2.jwks.map(&:export) end - def test_jwks_fetches_from_remote_when_cache_expired - WorkOS::Cache.clear + # --- H07 seal_session_from_auth_response ---------------------------------- - session1 = nil - session2 = nil - - @user_management.expect(:get_jwks_url, @jwks_url, [@client_id]) - Net::HTTP.stub(:get, @jwks_hash) do - session1 = build_session - end + def test_seal_session_from_auth_response_is_unsealable + sealed = @sm.seal_session_from_auth_response( + access_token: "access_xyz", + refresh_token: "refresh_xyz", + cookie_password: PASSWORD, + user: {"id" => "u_1", "email" => "a@b.com"} + ) + payload = @sm.unseal_data(sealed, PASSWORD) + assert_equal "access_xyz", payload["access_token"] + assert_equal "refresh_xyz", payload["refresh_token"] + assert_equal "u_1", payload["user"]["id"] + end - # Simulate cache expiration by advancing time - @user_management.expect(:get_jwks_url, @jwks_url, [@client_id]) - Time.stub(:now, Time.now + 301) do - Net::HTTP.stub(:get, @jwks_hash) do - session2 = build_session - end - end + # --- H04 Session#authenticate with stubbed JWKS --------------------------- - assert_equal session1.jwks.map(&:export), session2.jwks.map(&:export) + def signing_key_pair + rsa = OpenSSL::PKey::RSA.generate(2048) + [rsa, rsa.public_key] end - def test_raises_error_if_cookie_password_is_nil - with_mocked_jwks do - err = assert_raises(ArgumentError) do - build_session(cookie_password: nil) - end - assert_equal "cookiePassword is required", err.message - end + def make_jwt(claims, rsa, kid: "test-key") + JWT.encode(claims, rsa, "RS256", {kid: kid}) end - def test_raises_error_if_cookie_password_is_empty - with_mocked_jwks do - err = assert_raises(ArgumentError) do - build_session(cookie_password: "") - end - assert_equal "cookiePassword is required", err.message - end + def jwks_payload(public_key, kid: "test-key") + n = Base64.urlsafe_encode64(public_key.n.to_s(2), padding: false) + e = Base64.urlsafe_encode64(public_key.e.to_s(2), padding: false) + {"keys" => [{"kty" => "RSA", "alg" => "RS256", "use" => "sig", "kid" => kid, "n" => n, "e" => e}]} end - def test_initializes_with_valid_parameters - with_mocked_jwks do - session = build_session - assert_equal @user_management.object_id, session.user_management.object_id - assert_equal @client_id, session.client_id - assert_equal @session_data, session.session_data - assert_equal @cookie_password, session.cookie_password - assert_equal JSON.parse(@jwks_hash, symbolize_names: true)[:keys], session.jwks.map(&:export) - assert_equal ["RS256"], session.jwks_algorithms - end - end + def test_authenticate_returns_success_with_decoded_claims + rsa, pub = signing_key_pair + access_token = make_jwt({"sid" => "session_42", "org_id" => "org_1", "exp" => Time.now.to_i + 60}, rsa) + sealed = @sm.seal_data({"access_token" => access_token, "user" => {"id" => "u_1"}}, PASSWORD) - # --- .authenticate --- - - def make_payload(overrides = {}) - { - sid: "session_id", - org_id: "org_id", - role: "role", - roles: ["role"], - permissions: ["read"], - exp: Time.now.to_i + 3600 - }.merge(overrides) - end + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) - def make_session_data(payload = nil, cookie_password: @cookie_password) - payload ||= make_payload - valid_access_token = JWT.encode(payload, @jwk.signing_key, @jwk[:alg], {kid: @jwk[:kid]}) - WorkOS::Session.seal_data({ - access_token: valid_access_token, - user: "user", - impersonator: "impersonator" - }, cookie_password) + result = @sm.authenticate(seal_data: sealed, cookie_password: PASSWORD) + assert_kind_of WorkOS::SessionManager::AuthSuccess, result + assert result.authenticated + assert_equal "session_42", result.session_id + assert_equal "org_1", result.organization_id + assert_equal "u_1", result.user["id"] end - def test_authenticate_returns_no_session_cookie_provided_when_nil - with_mocked_jwks do - session = build_session(session_data: nil) - result = session.authenticate - assert_equal false, result[:authenticated] - assert_equal "NO_SESSION_COOKIE_PROVIDED", result[:reason] - end - end + def test_authenticate_merges_custom_claims_from_block + rsa, pub = signing_key_pair + access_token = make_jwt( + { + "sid" => "session_custom", + "org_id" => "org_custom", + "custom_claim" => "custom_value", + "another_claim" => 123, + "exp" => Time.now.to_i + 60 + }, + rsa + ) + sealed = @sm.seal_data({"access_token" => access_token, "user" => {"id" => "u_2"}}, PASSWORD) - def test_authenticate_returns_invalid_session_cookie_when_invalid - with_mocked_jwks do - session = build_session(session_data: "invalid_data") - result = session.authenticate - assert_equal false, result[:authenticated] - assert_equal "INVALID_SESSION_COOKIE", result[:reason] - end - end + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) - def test_authenticate_returns_invalid_jwt_when_access_token_invalid - with_mocked_jwks do - invalid_session_data = WorkOS::Session.seal_data({access_token: "invalid_token"}, @cookie_password) - session = build_session(session_data: invalid_session_data) - result = session.authenticate - assert_equal false, result[:authenticated] - assert_equal "INVALID_JWT", result[:reason] + result = @sm.authenticate(seal_data: sealed, cookie_password: PASSWORD) do |jwt| + { + my_custom_claim: jwt["custom_claim"], + my_other_claim: jwt["another_claim"] + } end - end - def test_authenticate_returns_invalid_jwt_when_session_expired - sealed = make_session_data - with_mocked_jwks do - session = build_session(session_data: sealed) - - # Monkey-patch JWT::Decode to skip signature verification - original_verify = JWT::Decode.instance_method(:verify_signature) - JWT::Decode.define_method(:verify_signature) { true } - begin - Time.stub(:now, Time.at(9_999_999_999)) do - result = session.authenticate - assert_equal false, result[:authenticated] - assert_equal "INVALID_JWT", result[:reason] - end - ensure - JWT::Decode.define_method(:verify_signature, original_verify) - end - end + assert_kind_of WorkOS::SessionManager::AuthSuccess, result + assert_equal "custom_value", result[:my_custom_claim] + assert_equal 123, result[:my_other_claim] + assert_equal "custom_value", result.my_custom_claim + assert_equal "custom_value", result.to_h[:my_custom_claim] end - def test_authenticate_returns_invalid_jwt_with_full_token_data_when_expired_and_include_expired - sealed = make_session_data - with_mocked_jwks do - session = build_session(session_data: sealed) - - original_verify = JWT::Decode.instance_method(:verify_signature) - JWT::Decode.define_method(:verify_signature) { true } - begin - Time.stub(:now, Time.at(9_999_999_999)) do - result = session.authenticate(include_expired: true) - assert_equal false, result[:authenticated] - assert_equal "session_id", result[:session_id] - assert_equal "org_id", result[:organization_id] - assert_equal "role", result[:role] - assert_equal ["role"], result[:roles] - assert_equal ["read"], result[:permissions] - assert_nil result[:feature_flags] - assert_nil result[:entitlements] - assert_equal "user", result[:user] - assert_equal "impersonator", result[:impersonator] - assert_equal "INVALID_JWT", result[:reason] - end - ensure - JWT::Decode.define_method(:verify_signature, original_verify) - end - end - end + def test_authenticate_rejects_custom_claims_that_overwrite_reserved_keys + rsa, pub = signing_key_pair + access_token = make_jwt({"sid" => "session_reserved", "exp" => Time.now.to_i + 60}, rsa) + sealed = @sm.seal_data({"access_token" => access_token}, PASSWORD) - def test_authenticate_successfully_with_valid_session_data - sealed = make_session_data - with_mocked_jwks do - session = build_session(session_data: sealed) - - original_verify = JWT::Decode.instance_method(:verify_signature) - JWT::Decode.define_method(:verify_signature) { true } - begin - result = session.authenticate - assert_equal true, result[:authenticated] - assert_equal "session_id", result[:session_id] - assert_equal "org_id", result[:organization_id] - assert_equal "role", result[:role] - assert_equal ["role"], result[:roles] - assert_equal ["read"], result[:permissions] - assert_nil result[:feature_flags] - assert_nil result[:entitlements] - assert_equal "user", result[:user] - assert_equal "impersonator", result[:impersonator] - assert_nil result[:reason] - ensure - JWT::Decode.define_method(:verify_signature, original_verify) - end - end - end + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) - def test_authenticate_merges_custom_claims_from_claim_extractor - custom_payload = make_payload(custom_claim: "custom_value", another_claim: 123) - custom_access_token = JWT.encode(custom_payload, @jwk.signing_key, @jwk[:alg], {kid: @jwk[:kid]}) - custom_session_data = WorkOS::Session.seal_data({ - access_token: custom_access_token, - user: "user", - impersonator: "impersonator" - }, @cookie_password) - - with_mocked_jwks do - session = build_session(session_data: custom_session_data) - - original_verify = JWT::Decode.instance_method(:verify_signature) - JWT::Decode.define_method(:verify_signature) { true } - begin - result = session.authenticate do |jwt| - {my_custom_claim: jwt["custom_claim"], my_other_claim: jwt["another_claim"]} - end - assert_equal true, result[:authenticated] - assert_equal "custom_value", result[:my_custom_claim] - assert_equal 123, result[:my_other_claim] - ensure - JWT::Decode.define_method(:verify_signature, original_verify) + error = assert_raises(ArgumentError) do + @sm.authenticate(seal_data: sealed, cookie_password: PASSWORD) do + {authenticated: false} end end - end - def test_authenticate_with_entitlements - payload = make_payload(entitlements: ["billing"]) - sealed = make_session_data(payload) - - with_mocked_jwks do - session = build_session(session_data: sealed) - - original_verify = JWT::Decode.instance_method(:verify_signature) - JWT::Decode.define_method(:verify_signature) { true } - begin - result = session.authenticate - assert_equal true, result[:authenticated] - assert_equal "session_id", result[:session_id] - assert_equal "org_id", result[:organization_id] - assert_equal "role", result[:role] - assert_equal ["role"], result[:roles] - assert_equal ["read"], result[:permissions] - assert_equal ["billing"], result[:entitlements] - assert_nil result[:feature_flags] - assert_equal "user", result[:user] - assert_equal "impersonator", result[:impersonator] - assert_nil result[:reason] - ensure - JWT::Decode.define_method(:verify_signature, original_verify) - end - end + assert_match(/reserved key/, error.message) end - def test_authenticate_with_feature_flags - payload = make_payload(feature_flags: ["new_feature_enabled"]) - sealed = make_session_data(payload) - - with_mocked_jwks do - session = build_session(session_data: sealed) - - original_verify = JWT::Decode.instance_method(:verify_signature) - JWT::Decode.define_method(:verify_signature) { true } - begin - result = session.authenticate - assert_equal true, result[:authenticated] - assert_equal "session_id", result[:session_id] - assert_equal "org_id", result[:organization_id] - assert_equal "role", result[:role] - assert_equal ["role"], result[:roles] - assert_equal ["read"], result[:permissions] - assert_nil result[:entitlements] - assert_equal ["new_feature_enabled"], result[:feature_flags] - assert_equal "user", result[:user] - assert_equal "impersonator", result[:impersonator] - assert_nil result[:reason] - ensure - JWT::Decode.define_method(:verify_signature, original_verify) - end - end + def test_authenticate_returns_no_session_cookie_when_blank + result = @sm.authenticate(seal_data: "", cookie_password: PASSWORD) + assert_kind_of WorkOS::SessionManager::AuthError, result + refute result.authenticated + assert_equal WorkOS::SessionManager::NO_SESSION_COOKIE_PROVIDED, result.reason end - # --- .refresh --- - - def test_refresh_returns_invalid_session_cookie_when_invalid - with_mocked_jwks do - session = build_session(session_data: "invalid_data") - result = session.refresh - assert_equal false, result[:authenticated] - assert_equal "INVALID_SESSION_COOKIE", result[:reason] - end + def test_authenticate_returns_invalid_session_cookie_on_garbage + result = @sm.authenticate(seal_data: "garbage", cookie_password: PASSWORD) + assert_equal WorkOS::SessionManager::INVALID_SESSION_COOKIE, result.reason end - def test_refresh_successfully_with_valid_session_data - refresh_token = "test_refresh_token" - sealed = WorkOS::Session.seal_data({refresh_token: refresh_token, user: "user"}, @cookie_password) - auth_response = MockObj.new(sealed_session: "new_sealed_session") - - # Build a custom mock that accepts any kwargs for authenticate_with_refresh_token - um_mock = Object.new - um_mock.define_singleton_method(:get_jwks_url) { |_client_id| @jwks_url } - um_mock.instance_variable_set(:@jwks_url, @jwks_url) - um_mock.define_singleton_method(:authenticate_with_refresh_token) { |**_kwargs| auth_response } - - Net::HTTP.stub(:get, @jwks_hash) do - session = WorkOS::Session.new( - user_management: um_mock, - client_id: @client_id, - session_data: sealed, - cookie_password: @cookie_password - ) - result = session.refresh - assert_equal true, result[:authenticated] - assert_equal "new_sealed_session", result[:sealed_session] - assert_equal auth_response, result[:session] - assert_nil result[:reason] - end - end + def test_authenticate_returns_invalid_jwt_on_bad_signature + rsa, _pub = signing_key_pair + other = OpenSSL::PKey::RSA.generate(2048) + access_token = make_jwt({"sid" => "s", "exp" => Time.now.to_i + 60}, other) + sealed = @sm.seal_data({"access_token" => access_token}, PASSWORD) - # --- .get_logout_url --- - - def test_get_logout_url_when_authenticated - Net::HTTP.stub(:get, @jwks_hash) do - session = WorkOS::Session.new( - user_management: WorkOS::UserManagement, - client_id: @client_id, - session_data: @session_data, - cookie_password: @cookie_password - ) - - session.stub(:authenticate, {authenticated: true, session_id: "session_123abc", reason: nil}) do - assert_equal( - "https://api.workos.com/user_management/sessions/logout?session_id=session_123abc", - session.get_logout_url - ) - end - end - end + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(rsa.public_key).to_json) - def test_get_logout_url_with_return_to - Net::HTTP.stub(:get, @jwks_hash) do - session = WorkOS::Session.new( - user_management: WorkOS::UserManagement, - client_id: @client_id, - session_data: @session_data, - cookie_password: @cookie_password - ) - - session.stub(:authenticate, {authenticated: true, session_id: "session_123abc", reason: nil}) do - assert_equal( - "https://api.workos.com/user_management/sessions/logout?session_id=session_123abc&return_to=https%3A%2F%2Fexample.com%2Fsigned-out", - session.get_logout_url(return_to: "https://example.com/signed-out") - ) - end - end + result = @sm.authenticate(seal_data: sealed, cookie_password: PASSWORD) + assert_equal WorkOS::SessionManager::INVALID_JWT, result.reason end - def test_get_logout_url_raises_error_when_authentication_fails - Net::HTTP.stub(:get, @jwks_hash) do - session = WorkOS::Session.new( - user_management: WorkOS::UserManagement, - client_id: @client_id, - session_data: @session_data, - cookie_password: @cookie_password - ) - - session.stub(:authenticate, {authenticated: false, reason: "Invalid session"}) do - err = assert_raises(RuntimeError) do - session.get_logout_url - end - assert_equal "Failed to extract session ID for logout URL: Invalid session", err.message - end - end - end + # --- get_logout_url ------------------------------------------------------- - # --- custom encryptor --- + def test_get_logout_url_includes_session_id_from_authenticate + rsa, pub = signing_key_pair + access_token = make_jwt({"sid" => "session_logout", "exp" => Time.now.to_i + 60}, rsa) + sealed = @sm.seal_data({"access_token" => access_token}, PASSWORD) - def custom_encryptor - @custom_encryptor ||= Class.new do - def seal(data, _key) - "CUSTOM:#{JSON.generate(data)}" - end + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) - def unseal(sealed_data, _key) - json = sealed_data.sub("CUSTOM:", "") - JSON.parse(json, symbolize_names: true) - end - end.new + session = @sm.load(seal_data: sealed, cookie_password: PASSWORD) + url = session.get_logout_url(return_to: "https://app/cb") + parsed = URI.parse(url) + assert_equal "/user_management/sessions/logout", parsed.path + params = URI.decode_www_form(parsed.query).to_h + assert_equal "session_logout", params["session_id"] + assert_equal "https://app/cb", params["return_to"] end - def test_custom_encryptor_seal_data - sealed = WorkOS::Session.seal_data({foo: "bar"}, "key", encryptor: custom_encryptor) - assert sealed.start_with?("CUSTOM:") - end + # --- Session constructor validation --------------------------------------- - def test_custom_encryptor_unseal_data - sealed = 'CUSTOM:{"foo":"bar"}' - unsealed = WorkOS::Session.unseal_data(sealed, "key", encryptor: custom_encryptor) - assert_equal({foo: "bar"}, unsealed) + def test_session_load_requires_cookie_password + assert_raises(ArgumentError) { @sm.load(seal_data: "x", cookie_password: nil) } + assert_raises(ArgumentError) { @sm.load(seal_data: "x", cookie_password: "") } end - def test_accepts_custom_encryptor_in_initialize - with_mocked_jwks do - session = build_session(encryptor: custom_encryptor) - assert_equal custom_encryptor, session.encryptor + # --- BYO encryptor --------------------------------------------------------- + + def test_custom_encryptor_is_used_for_seal_and_unseal + custom = Object.new + def custom.seal(data, _key) + Base64.strict_encode64(JSON.generate(data)) end - end - def test_defaults_to_aes_gcm_encryptor - with_mocked_jwks do - session = build_session - assert_kind_of WorkOS::Encryptors::AesGcm, session.encryptor + def custom.unseal(sealed, _key) + JSON.parse(Base64.decode64(sealed)) end + + sm = WorkOS::Client.new(api_key: "sk_test_enc", client_id: "client_enc") + .session_manager(encryptor: custom) + + sealed = sm.seal_data({"a" => 1}, PASSWORD) + assert_equal({"a" => 1}, JSON.parse(Base64.decode64(sealed))) + assert_equal({"a" => 1}, sm.unseal_data(sealed, PASSWORD)) end - def test_raises_argument_error_for_invalid_encryptor - with_mocked_jwks do - err = assert_raises(ArgumentError) do - build_session(encryptor: Object.new) - end - assert_match(/must respond to/, err.message) + def test_custom_encryptor_authenticate_round_trip + custom = Object.new + + def custom.seal(data, _key) + Base64.strict_encode64(data.is_a?(String) ? data : JSON.generate(data)) + end + + def custom.unseal(sealed, _key) + JSON.parse(Base64.decode64(sealed)) end + + sm = WorkOS::Client.new(api_key: "sk_test_enc2", client_id: "client_enc2") + .session_manager(encryptor: custom) + + rsa, pub = signing_key_pair + access_token = make_jwt({"sid" => "s_custom", "org_id" => "org_c", "exp" => Time.now.to_i + 60}, rsa) + sealed = sm.seal_data({"access_token" => access_token, "user" => {"id" => "u_c"}}, PASSWORD) + + stub_request(:get, "https://api.workos.com/sso/jwks/client_enc2") + .to_return(status: 200, body: jwks_payload(pub).to_json) + + result = sm.authenticate(seal_data: sealed, cookie_password: PASSWORD) + assert_kind_of WorkOS::SessionManager::AuthSuccess, result + assert_equal "s_custom", result.session_id end end diff --git a/test/workos/test_sso.rb b/test/workos/test_sso.rb index 732d4acf..8a542a05 100644 --- a/test/workos/test_sso.rb +++ b/test/workos/test_sso.rb @@ -1,657 +1,103 @@ # frozen_string_literal: true -require "test_helper" -require "securerandom" - -class TestSSO < WorkOS::TestCase - def domain_args - { - domain: "foo.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - } - end - - def provider_args - { - provider: "GoogleOAuth", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - } - end - - def connection_args - { - connection: "connection_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - } - end - - def domain_hint_args - { - connection: "connection_123", - domain_hint: "foo.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - } - end - - def login_hint_args - { - connection: "connection_123", - login_hint: "foo@workos.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - } - end - - def organization_args - { - organization: "org_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - } - end - - # authorization_url with a domain - - def test_authorization_url_with_domain_returns_valid_url - authorization_url = WorkOS::SSO.authorization_url(**domain_args) - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_domain_returns_expected_hostname - authorization_url = WorkOS::SSO.authorization_url(**domain_args) - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_domain_returns_expected_query_string - authorization_url = WorkOS::SSO.authorization_url(**domain_args) - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&domain=foo.com", - URI.parse(authorization_url).query - ) - end - - # authorization_url with a provider - - def test_authorization_url_with_provider_returns_valid_url - authorization_url = WorkOS::SSO.authorization_url(**provider_args) - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_provider_returns_expected_hostname - authorization_url = WorkOS::SSO.authorization_url(**provider_args) - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_provider_returns_expected_query_string - authorization_url = WorkOS::SSO.authorization_url(**provider_args) - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&provider=GoogleOAuth", - URI.parse(authorization_url).query - ) - end - - # authorization_url with a connection - - def test_authorization_url_with_connection_returns_valid_url - authorization_url = WorkOS::SSO.authorization_url(**connection_args) - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_connection_returns_expected_hostname - authorization_url = WorkOS::SSO.authorization_url(**connection_args) - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_connection_returns_expected_query_string - authorization_url = WorkOS::SSO.authorization_url(**connection_args) - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&connection=connection_123", - URI.parse(authorization_url).query - ) - end - - # authorization_url with a domain_hint - - def test_authorization_url_with_domain_hint_returns_valid_url - authorization_url = WorkOS::SSO.authorization_url(**domain_hint_args) - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_domain_hint_returns_expected_hostname - authorization_url = WorkOS::SSO.authorization_url(**domain_hint_args) - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_domain_hint_returns_expected_query_string - authorization_url = WorkOS::SSO.authorization_url(**domain_hint_args) - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&domain_hint=foo.com&connection=connection_123", - URI.parse(authorization_url).query - ) - end - - # authorization_url with a login_hint - - def test_authorization_url_with_login_hint_returns_valid_url - authorization_url = WorkOS::SSO.authorization_url(**login_hint_args) - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_login_hint_returns_expected_hostname - authorization_url = WorkOS::SSO.authorization_url(**login_hint_args) - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_login_hint_returns_expected_query_string - authorization_url = WorkOS::SSO.authorization_url(**login_hint_args) - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&login_hint=foo%40workos.com&connection=connection_123", - URI.parse(authorization_url).query - ) - end - - # authorization_url with an organization - - def test_authorization_url_with_organization_returns_valid_url - authorization_url = WorkOS::SSO.authorization_url(**organization_args) - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_organization_returns_expected_hostname - authorization_url = WorkOS::SSO.authorization_url(**organization_args) - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_organization_returns_expected_query_string - authorization_url = WorkOS::SSO.authorization_url(**organization_args) - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2Fedit%22%7D&organization=org_123", - URI.parse(authorization_url).query - ) - end - - # authorization_url without connection, domain, provider, or organization - - def test_authorization_url_without_connection_domain_provider_or_organization_raises_error - args = { - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - } - err = assert_raises(ArgumentError) do - WorkOS::SSO.authorization_url(**args) - end - assert_equal "Either connection, domain, provider, or organization is required.", err.message - end - - # authorization_url with an invalid provider - - def test_authorization_url_with_invalid_provider_raises_error - args = { - provider: "Okta", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - } - err = assert_raises(ArgumentError) do - WorkOS::SSO.authorization_url(**args) - end - assert_equal( - "Okta is not a valid value. `provider` must be in " \ - '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth"]', - err.message - ) - end - - # get_profile - - def test_get_profile_returns_a_profile - VCR.use_cassette "sso/profile" do - profile = WorkOS::SSO.get_profile(access_token: "access_token") - - expectation = { - connection_id: "conn_01E83FVYZHY7DM4S9503JHV0R5", - connection_type: "GoogleOAuth", - email: "bob.loblaw@workos.com", - first_name: "Bob", - id: "prof_01EEJTY9SZ1R350RB7B73SNBKF", - idp_id: "116485463307139932699", - last_name: "Loblaw", - role: { - slug: "member" - }, - roles: [{ - slug: "member" - }], - groups: nil, - organization_id: "org_01FG53X8636WSNW2WEKB2C31ZB", - custom_attributes: {}, - raw_attributes: { - email: "bob.loblaw@workos.com", - family_name: "Loblaw", - given_name: "Bob", - hd: "workos.com", - id: "116485463307139932699", - locale: "en", - name: "Bob Loblaw", - picture: "https://lh3.googleusercontent.com/a-/AOh14GyO2hLlgZvteDQ3Ldi3_-RteZLya0hWH7247Cam=s96-c", - verified_email: true - } - } - assert_equal expectation, profile.to_json - end - end +# This file is auto-generated by oagen. Do not edit. - # profile_and_token - successful response - - def profile_and_token_args - @profile_and_token_args ||= { - code: SecureRandom.hex(10), - client_id: "workos-proj-123" - } - end - - def profile_and_token_request_body - { - client_id: profile_and_token_args[:client_id], - client_secret: WorkOS.config.key, - code: profile_and_token_args[:code], - grant_type: "authorization_code" - } - end - - def test_profile_and_token_includes_sdk_version_header - with_vcr_off do - user_agent = "user-agent-string" - response_body = File.read("#{TEST_ROOT}/fixtures/profile.txt") - headers = {"User-Agent" => user_agent} - - WorkOS::SSO.stub(:user_agent, user_agent) do - stub_request(:post, "https://api.workos.com/sso/token") - .with(headers: headers, body: profile_and_token_request_body) - .to_return(status: 200, body: response_body) - - WorkOS::SSO.profile_and_token(**profile_and_token_args) - - assert_requested(:post, "https://api.workos.com/sso/token", - headers: headers, body: profile_and_token_request_body) - end - end - end - - def test_profile_and_token_returns_profile_and_token - with_vcr_off do - user_agent = "user-agent-string" - response_body = File.read("#{TEST_ROOT}/fixtures/profile.txt") - headers = {"User-Agent" => user_agent} - - WorkOS::SSO.stub(:user_agent, user_agent) do - stub_request(:post, "https://api.workos.com/sso/token") - .with(headers: headers, body: profile_and_token_request_body) - .to_return(status: 200, body: response_body) - - profile_and_token = WorkOS::SSO.profile_and_token(**profile_and_token_args) - assert_kind_of WorkOS::ProfileAndToken, profile_and_token - - expectation = { - connection_id: "conn_01EMH8WAK20T42N2NBMNBCYHAG", - connection_type: "OktaSAML", - email: "demo@workos-okta.com", - first_name: "WorkOS", - id: "prof_01DRA1XNSJDZ19A31F183ECQW5", - idp_id: "00u1klkowm8EGah2H357", - last_name: "Demo", - role: { - slug: "admin" - }, - roles: [{ - slug: "admin" - }], - groups: %w[Admins Developers], - organization_id: "org_01FG53X8636WSNW2WEKB2C31ZB", - custom_attributes: { - license: "professional" - }, - raw_attributes: { - email: "demo@workos-okta.com", - first_name: "WorkOS", - id: "prof_01DRA1XNSJDZ19A31F183ECQW5", - idp_id: "00u1klkowm8EGah2H357", - last_name: "Demo", - groups: %w[Admins Developers], - license: "professional" - } - } - - assert_equal "01DVX6QBS3EG6FHY2ESAA5Q65X", profile_and_token.access_token - assert_equal expectation, profile_and_token.profile.to_json - end - end - end - - # profile_and_token - unprocessable request - - def test_profile_and_token_unprocessable_raises_exception_with_request_id - with_vcr_off do - user_agent = "user-agent-string" - headers = {"User-Agent" => user_agent} - - WorkOS::SSO.stub(:user_agent, user_agent) do - stub_request(:post, "https://api.workos.com/sso/token") - .with(headers: headers, body: profile_and_token_request_body) - .to_return( - headers: {"X-Request-ID" => "request-id"}, - status: 422, - body: {error: "some error", error_description: "some error description"}.to_json - ) - - err = assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::SSO.profile_and_token(**profile_and_token_args) - end - assert_equal "Status 422, some error - request ID: request-id", err.message - end - end - end - - def test_profile_and_token_unprocessable_has_proper_error_attributes - with_vcr_off do - user_agent = "user-agent-string" - headers = {"User-Agent" => user_agent} - - WorkOS::SSO.stub(:user_agent, user_agent) do - stub_request(:post, "https://api.workos.com/sso/token") - .with(headers: headers, body: profile_and_token_request_body) - .to_return( - headers: {"X-Request-ID" => "request-id"}, - status: 422, - body: {error: "some error", error_description: "some error description"}.to_json - ) - - error = begin - WorkOS::SSO.profile_and_token(**profile_and_token_args) - rescue WorkOS::UnprocessableEntityError => e - e - end - - assert_equal 422, error.http_status - assert_equal "request-id", error.request_id - assert_equal "some error", error.error - assert error.message.include?("some error") - end - end - end - - # profile_and_token - detailed field validation errors - - def test_profile_and_token_detailed_field_errors_raises_exception - with_vcr_off do - user_agent = "user-agent-string" - headers = {"User-Agent" => user_agent} - - WorkOS::SSO.stub(:user_agent, user_agent) do - stub_request(:post, "https://api.workos.com/sso/token") - .with(headers: headers, body: profile_and_token_request_body) - .to_return( - headers: {"X-Request-ID" => "request-id"}, - status: 422, - body: { - message: "Validation failed", - code: "invalid_request_parameters", - errors: [ - { - field: "code", - code: "missing_required_parameter", - message: "The code parameter is required" - } - ] - }.to_json - ) - - assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::SSO.profile_and_token(**profile_and_token_args) - end - end - end - end - - def test_profile_and_token_detailed_field_errors_has_proper_attributes - with_vcr_off do - user_agent = "user-agent-string" - headers = {"User-Agent" => user_agent} - - WorkOS::SSO.stub(:user_agent, user_agent) do - stub_request(:post, "https://api.workos.com/sso/token") - .with(headers: headers, body: profile_and_token_request_body) - .to_return( - headers: {"X-Request-ID" => "request-id"}, - status: 422, - body: { - message: "Validation failed", - code: "invalid_request_parameters", - errors: [ - { - field: "code", - code: "missing_required_parameter", - message: "The code parameter is required" - } - ] - }.to_json - ) +require "test_helper" - error = begin - WorkOS::SSO.profile_and_token(**profile_and_token_args) - rescue WorkOS::UnprocessableEntityError => e - e - end +class SSOTest < Minitest::Test + include FixtureHelper - assert_equal 422, error.http_status - assert_equal "request-id", error.request_id - assert_equal "invalid_request_parameters", error.code - refute_nil error.errors - assert error.errors.include?("code: missing_required_parameter") - assert error.message.include?("Validation failed") - assert error.message.include?("(code: missing_required_parameter)") - end - end + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") end - # profile_and_token - expired code - - def test_profile_and_token_expired_code_raises_exception - with_vcr_off do - user_agent = "user-agent-string" - - WorkOS::SSO.stub(:user_agent, user_agent) do - stub_request(:post, "https://api.workos.com/sso/token") - .with(body: profile_and_token_request_body) - .to_return( - status: 400, - headers: {"X-Request-ID" => "request-id"}, - body: { - error: "invalid_grant", - error_description: "The code '01DVX3C5Z367SFHR8QNDMK7V24' has expired or is invalid." - }.to_json - ) - - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::SSO.profile_and_token(**profile_and_token_args) - end - assert_equal( - "Status 400, error: invalid_grant, error_description: The code '01DVX3C5Z367SFHR8QNDMK7V24'" \ - " has expired or is invalid. - request ID: request-id", - err.message - ) - end - end + def test_list_connections_returns_expected_result + stub_request(:get, /#{Regexp.escape("connections")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.sso.list_connections + assert_kind_of WorkOS::Types::ListStruct, result end - def test_profile_and_token_expired_code_has_proper_error_attributes - with_vcr_off do - user_agent = "user-agent-string" - - WorkOS::SSO.stub(:user_agent, user_agent) do - stub_request(:post, "https://api.workos.com/sso/token") - .with(body: profile_and_token_request_body) - .to_return( - status: 400, - headers: {"X-Request-ID" => "request-id"}, - body: { - error: "invalid_grant", - error_description: "The code '01DVX3C5Z367SFHR8QNDMK7V24' has expired or is invalid." - }.to_json - ) - - error = begin - WorkOS::SSO.profile_and_token(**profile_and_token_args) - rescue WorkOS::InvalidRequestError => e - e - end - - assert_equal 400, error.http_status - assert_equal "request-id", error.request_id - assert_equal "invalid_grant", error.error - assert_equal "The code '01DVX3C5Z367SFHR8QNDMK7V24' has expired or is invalid.", error.error_description - assert error.message.include?("invalid_grant") - end + def test_list_connections_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("connections")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.sso.list_connections end end - # list_connections - - def test_list_connections_with_no_options - VCR.use_cassette "sso/list_connections/with_no_options" do - connections = WorkOS::SSO.list_connections - - expected_metadata = { - "after" => nil, - "before" => "before_id" - } - - assert_equal 6, connections.data.size - assert_equal expected_metadata, connections.list_metadata - end + def test_get_connection_returns_expected_result + stub_request(:get, /#{Regexp.escape("connections")}/) + .to_return(body: "{}", status: 200) + result = @client.sso.get_connection(id: "stub") + refute_nil result end - def test_list_connections_with_connection_type - VCR.use_cassette "sso/list_connections/with_connection_type" do - connections = WorkOS::SSO.list_connections( - connection_type: "OktaSAML" - ) - - assert_equal 10, connections.data.size - assert_equal "OktaSAML", connections.data.first.connection_type + def test_get_connection_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("connections")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.sso.get_connection(id: "stub") end end - def test_list_connections_with_domain - VCR.use_cassette "sso/list_connections/with_domain" do - connections = WorkOS::SSO.list_connections( - domain: "foo-corp.com" - ) - - assert_equal 1, connections.data.size - end - end - - def test_list_connections_with_organization_id - VCR.use_cassette "sso/list_connections/with_organization_id" do - connections = WorkOS::SSO.list_connections( - organization_id: "org_01F9293WD2PDEEV4Y625XPZVG7" - ) - - assert_equal 1, connections.data.size - assert_equal "org_01F9293WD2PDEEV4Y625XPZVG7", connections.data.first.organization_id - end + def test_delete_connection_returns_expected_result + stub_request(:delete, /#{Regexp.escape("connections")}/) + .to_return(body: "{}", status: 200) + result = @client.sso.delete_connection(id: "stub") + assert_nil result if result.nil? end - def test_list_connections_with_limit - VCR.use_cassette "sso/list_connections/with_limit" do - connections = WorkOS::SSO.list_connections( - limit: 2 - ) - - assert_equal 2, connections.data.size + def test_delete_connection_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("connections")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.sso.delete_connection(id: "stub") end end - def test_list_connections_with_before - VCR.use_cassette "sso/list_connections/with_before" do - connections = WorkOS::SSO.list_connections( - before: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" - ) - - assert_equal 3, connections.data.size - end + def test_authorize_logout_returns_expected_result + stub_request(:post, /#{Regexp.escape("sso")}/) + .to_return(body: "{}", status: 200) + result = @client.sso.authorize_logout(profile_id: "stub") + refute_nil result end - def test_list_connections_with_after - VCR.use_cassette "sso/list_connections/with_after" do - connections = WorkOS::SSO.list_connections( - after: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" - ) - - assert_equal 2, connections.data.size + def test_authorize_logout_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("sso")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.sso.authorize_logout(profile_id: "stub") end end - # get_connection - - def test_get_connection_with_valid_id - VCR.use_cassette("sso/get_connection_with_valid_id") do - connection = WorkOS::SSO.get_connection( - id: "conn_01FA3WGCWPCCY1V2FGES2FDNP7" - ) - - assert_equal "conn_01FA3WGCWPCCY1V2FGES2FDNP7", connection.id - assert_equal "OktaSAML", connection.connection_type - assert_equal "Foo Corp", connection.name - assert_equal "foo-corp.com", connection.domains.first[:domain] - end + def test_get_profile_returns_expected_result + stub_request(:get, /#{Regexp.escape("sso")}/) + .to_return(body: "{}", status: 200) + result = @client.sso.get_profile + refute_nil result end - def test_get_connection_with_invalid_id - VCR.use_cassette("sso/get_connection_with_invalid_id") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::SSO.get_connection(id: "invalid") - end - assert_equal "Status 404, Not Found - request ID: ", err.message + def test_get_profile_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("sso")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.sso.get_profile end end - # delete_connection - - def test_delete_connection_with_valid_id - VCR.use_cassette("sso/delete_connection_with_valid_id") do - response = WorkOS::SSO.delete_connection( - id: "conn_01EX55FRVN1V2PCA9YWTMZQMMQ" - ) - - assert_equal true, response - end + def test_get_profile_and_token_returns_expected_result + stub_request(:post, /#{Regexp.escape("sso")}/) + .to_return(body: "{}", status: 200) + result = @client.sso.get_profile_and_token(code: "stub") + refute_nil result end - def test_delete_connection_with_invalid_id - VCR.use_cassette("sso/delete_connection_with_invalid_id") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::SSO.delete_connection(id: "invalid") - end - assert_equal "Status 404, Not Found - request ID: ", err.message + def test_get_profile_and_token_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("sso")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.sso.get_profile_and_token(code: "stub") end end end diff --git a/test/workos/test_sso_helpers.rb b/test/workos/test_sso_helpers.rb new file mode 100644 index 00000000..35395a4b --- /dev/null +++ b/test/workos/test_sso_helpers.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +require "test_helper" +require "uri" + +class SSOHelpersTest < Minitest::Test + def setup + @client = WorkOS::Client.new(api_key: "sk_test_sso", client_id: "client_001") + @sso = @client.sso + end + + # H14 + def test_get_authorization_url_returns_string + url = @sso.get_authorization_url( + redirect_uri: "https://app.example.com/cb", + connection: "conn_001" + ) + parsed = URI.parse(url) + params = URI.decode_www_form(parsed.query).to_h + assert_equal "/sso/authorize", parsed.path + assert_equal "client_001", params["client_id"] + assert_equal "conn_001", params["connection"] + assert_equal "code", params["response_type"] + end + + def test_get_authorization_url_serializes_provider_scopes_csv + url = @sso.get_authorization_url( + redirect_uri: "x", + provider: "GoogleOAuth", + provider_scopes: ["openid", "email"] + ) + params = URI.decode_www_form(URI.parse(url).query).to_h + assert_equal "openid,email", params["provider_scopes"] + end + + def test_get_authorization_url_serializes_provider_query_params_json + url = @sso.get_authorization_url( + redirect_uri: "x", + provider: "GoogleOAuth", + provider_query_params: {"hd" => "example.com"} + ) + params = URI.decode_www_form(URI.parse(url).query).to_h + assert_equal({"hd" => "example.com"}, JSON.parse(params["provider_query_params"])) + end + + # H15 + def test_get_authorization_url_with_pkce_appends_challenge + url, verifier, state = @sso.get_authorization_url_with_pkce( + redirect_uri: "x", + connection: "conn_001" + ) + params = URI.decode_www_form(URI.parse(url).query).to_h + assert_equal "S256", params["code_challenge_method"] + assert_equal WorkOS::PKCE.generate_code_challenge(verifier), params["code_challenge"] + assert_equal state, params["state"] + end + + # H16 + def test_get_profile_and_token_with_pkce_posts_pkce_grant + stub = stub_request(:post, "https://api.workos.com/sso/token") + .with(body: hash_including( + "grant_type" => "authorization_code", + "client_id" => "client_001", + "code" => "code_xyz", + "code_verifier" => "v_abc" + )) + .to_return(status: 200, body: '{"profile":{"id":"prof_1","connection_id":"c","connection_type":"OktaSAML","email":"x@y","first_name":null,"last_name":null,"groups":null,"organization_id":null,"raw_attributes":null,"role":null,"custom_attributes":null,"object":"profile","idp_id":null},"access_token":"a","oauth_tokens":null,"impersonator":null}') + @sso.get_profile_and_token_with_pkce(code: "code_xyz", code_verifier: "v_abc") + assert_requested(stub) + end + + # H17 + def test_build_logout_url_returns_string_no_http + url = @sso.build_logout_url(token: "tok_xyz") + parsed = URI.parse(url) + assert_equal "/sso/logout", parsed.path + assert_equal "tok_xyz", URI.decode_www_form(parsed.query).to_h["token"] + end +end diff --git a/test/workos/test_sso_runtime.rb b/test/workos/test_sso_runtime.rb new file mode 100644 index 00000000..f9050c61 --- /dev/null +++ b/test/workos/test_sso_runtime.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +require "test_helper" + +class SSORuntimeTest < Minitest::Test + def setup + @client = WorkOS::Client.new(api_key: "sk_test_sso", client_id: "client_001") + end + + def test_get_profile_and_token_posts_code_in_body_only + stub = stub_request(:post, "https://api.workos.com/sso/token") + .with( + query: {}, + body: hash_including( + "grant_type" => "authorization_code", + "client_id" => "client_001", + "client_secret" => "sk_test_sso", + "code" => "code_123" + ) + ) + .to_return(status: 200, body: "{}") + + @client.sso.get_profile_and_token(code: "code_123") + + assert_requested(stub) + end + + def test_get_profile_and_token_uses_request_option_credentials + stub = stub_request(:post, "https://api.workos.com/sso/token") + .with( + body: hash_including( + "client_id" => "client_override", + "client_secret" => "sk_override" + ) + ) + .to_return(status: 200, body: "{}") + + @client.sso.get_profile_and_token( + code: "code_123", + request_options: {api_key: "sk_override", client_id: "client_override"} + ) + + assert_requested(stub) + end +end diff --git a/test/workos/test_user_management.rb b/test/workos/test_user_management.rb index e8ab99bd..674cde65 100644 --- a/test/workos/test_user_management.rb +++ b/test/workos/test_user_management.rb @@ -1,1820 +1,748 @@ # frozen_string_literal: true +# This file is auto-generated by oagen. Do not edit. + require "test_helper" -class TestUserManagement < WorkOS::TestCase - # Simple mock object that responds to methods based on keyword args. - # Replacement for OpenStruct which is not in Ruby 4 default gems. - class MockObj - def initialize(**kwargs) - @attrs = kwargs - kwargs.each do |key, value| - define_singleton_method(key) { value } - end - end - end +class UserManagementTest < Minitest::Test + include FixtureHelper def setup - super - WorkOS.configure do |config| - config.key = "example_api_key" - end - end - - # --- .authorization_url --- - - def test_authorization_url_with_provider_returns_valid_url - authorization_url = WorkOS::UserManagement.authorization_url( - provider: "authkit", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_provider_returns_expected_hostname - authorization_url = WorkOS::UserManagement.authorization_url( - provider: "authkit", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_provider_returns_expected_query_string - authorization_url = WorkOS::UserManagement.authorization_url( - provider: "authkit", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ - "edit%22%7D&provider=authkit", - URI.parse(authorization_url).query - ) - end - - def test_authorization_url_with_provider_scopes - url = WorkOS::UserManagement.authorization_url( - provider: "GoogleOAuth", - provider_scopes: %w[custom-scope-1 custom-scope-2], - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal( - "https://api.workos.com/user_management/authorize?" \ - "client_id=workos-proj-123" \ - "&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code" \ - "&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ - "edit%22%7D" \ - "&provider=GoogleOAuth" \ - "&provider_scopes=custom-scope-1" \ - "&provider_scopes=custom-scope-2", - url - ) - end - - def test_authorization_url_with_connection_selector_returns_valid_url - authorization_url = WorkOS::UserManagement.authorization_url( - connection_id: "connection_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_connection_selector_returns_expected_hostname - authorization_url = WorkOS::UserManagement.authorization_url( - connection_id: "connection_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_connection_selector_returns_expected_query_string - authorization_url = WorkOS::UserManagement.authorization_url( - connection_id: "connection_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ - "edit%22%7D&connection_id=connection_123", - URI.parse(authorization_url).query - ) - end - - def test_authorization_url_with_organization_selector_returns_valid_url - authorization_url = WorkOS::UserManagement.authorization_url( - organization_id: "org_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_organization_selector_returns_expected_hostname - authorization_url = WorkOS::UserManagement.authorization_url( - organization_id: "org_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_organization_selector_returns_expected_query_string - authorization_url = WorkOS::UserManagement.authorization_url( - organization_id: "org_123", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ - "edit%22%7D&organization_id=org_123", - URI.parse(authorization_url).query - ) - end - - def test_authorization_url_with_domain_hint_returns_valid_url - authorization_url = WorkOS::UserManagement.authorization_url( - connection_id: "connection_123", - domain_hint: "foo.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_domain_hint_returns_expected_hostname - authorization_url = WorkOS::UserManagement.authorization_url( - connection_id: "connection_123", - domain_hint: "foo.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_domain_hint_returns_expected_query_string - authorization_url = WorkOS::UserManagement.authorization_url( - connection_id: "connection_123", - domain_hint: "foo.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ - "edit%22%7D&domain_hint=foo.com&connection_id=connection_123", - URI.parse(authorization_url).query - ) - end - - def test_authorization_url_with_login_hint_returns_valid_url - authorization_url = WorkOS::UserManagement.authorization_url( - connection_id: "connection_123", - login_hint: "foo@workos.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_login_hint_returns_expected_hostname - authorization_url = WorkOS::UserManagement.authorization_url( - connection_id: "connection_123", - login_hint: "foo@workos.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_login_hint_returns_expected_query_string - authorization_url = WorkOS::UserManagement.authorization_url( - connection_id: "connection_123", - login_hint: "foo@workos.com", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ - "edit%22%7D&login_hint=foo%40workos.com&connection_id=connection_123", - URI.parse(authorization_url).query - ) - end - - def test_authorization_url_with_screen_hint_returns_valid_url - authorization_url = WorkOS::UserManagement.authorization_url( - provider: "authkit", - screen_hint: "sign_up", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_kind_of URI, URI.parse(authorization_url) - end - - def test_authorization_url_with_screen_hint_returns_expected_hostname - authorization_url = WorkOS::UserManagement.authorization_url( - provider: "authkit", - screen_hint: "sign_up", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal WorkOS.config.api_hostname, URI.parse(authorization_url).host - end - - def test_authorization_url_with_screen_hint_returns_expected_query_string - authorization_url = WorkOS::UserManagement.authorization_url( - provider: "authkit", - screen_hint: "sign_up", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - - assert_equal( - "client_id=workos-proj-123&redirect_uri=foo.com%2Fauth%2Fcallback" \ - "&response_type=code&state=%7Bnext_page%3A+%22%2Fdashboard%2F" \ - "edit%22%7D&screen_hint=sign_up&provider=authkit", - URI.parse(authorization_url).query - ) - end - - def test_authorization_url_without_connection_organization_or_provider_raises_error - err = assert_raises(ArgumentError) do - WorkOS::UserManagement.authorization_url( - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - end - - assert_equal "Either connection ID, organization ID, or provider is required.", err.message - end - - def test_authorization_url_with_invalid_provider_raises_error - err = assert_raises(ArgumentError) do - WorkOS::UserManagement.authorization_url( - provider: "Okta", - client_id: "workos-proj-123", - redirect_uri: "foo.com/auth/callback", - state: '{next_page: "/dashboard/edit"}' - ) - end - - assert_equal( - "Okta is not a valid value. `provider` must be in " \ - '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth", "authkit"]', - err.message - ) - end - - # --- .get_user --- - - def test_get_user_with_valid_id - VCR.use_cassette "user_management/get_user" do - user = WorkOS::UserManagement.get_user( - id: "user_01HP0B4ZV2FWWVY0BF16GFDAER" - ) - - assert user.id.instance_of?(String) - assert user.instance_of?(WorkOS::User) - assert_equal "Bob", user.first_name - assert_equal "Loblaw", user.last_name - assert_equal "bob@example.com", user.email - assert_equal false, user.email_verified - assert_nil user.profile_picture_url - assert_equal "2024-02-06T23:13:18.137Z", user.last_sign_in_at - end - end - - # NOTE: The original spec had `.to raise_error` chained on get_user (not on the - # expect block), so it never actually tested the error. This is a faithful conversion. - def test_get_user_with_invalid_id - # Original spec was effectively a no-op due to incorrect chaining - end - - # --- .list_users --- - - def test_list_users_with_no_options - expected_metadata = { - "after" => nil, - "before" => "before-id" - } - - VCR.use_cassette "user_management/list_users/no_options" do - users = WorkOS::UserManagement.list_users - - assert_equal 2, users.data.size - assert_equal expected_metadata, users.list_metadata - end - end - - def test_list_users_with_options - request_args = [ - "/user_management/users?email=lucy.lawless%40example.com&" \ - "order=desc&" \ - "limit=5", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - Net::HTTP::Get.stub(:new, expected_request) do - VCR.use_cassette "user_management/list_users/with_options" do - users = WorkOS::UserManagement.list_users( - email: "lucy.lawless@example.com", - order: "desc", - limit: "5" - ) - - assert_equal 1, users.data.size - assert_equal "lucy.lawless@example.com", users.data[0].email - end - end - end - - # --- .create_user --- - - def test_create_user_with_valid_payload - VCR.use_cassette "user_management/create_user_valid" do - user = WorkOS::UserManagement.create_user( - email: "foo@example.com", - first_name: "Foo", - last_name: "Bar", - email_verified: true - ) - - assert_equal "Foo", user.first_name - assert_equal "Bar", user.last_name - assert_equal "foo@example.com", user.email - end + @client = WorkOS::Client.new(api_key: "sk_test_123") end - def test_create_user_only_sends_non_nil_values - called_with = nil - stub_post = ->(**kwargs) { - called_with = kwargs - MockObj.new - } - - WorkOS::UserManagement.stub(:post_request, stub_post) do - WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"id": "test_user", "email": "test@example.com"}')) do - WorkOS::UserManagement.create_user( - email: "test@example.com", - first_name: "John" - ) - end - end - - assert_equal({email: "test@example.com", first_name: "John"}, called_with[:body]) - refute called_with[:body].key?(:last_name) - refute called_with[:body].key?(:email_verified) + def test_get_jwks_returns_expected_result + stub_request(:get, /#{Regexp.escape("sso")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.get_jwks(client_id: "stub") + refute_nil result end - def test_create_user_with_external_id - VCR.use_cassette "user_management/create_user_with_external_id" do - user = WorkOS::UserManagement.create_user( - email: "external@example.com", - first_name: "External", - last_name: "User", - external_id: "ext_user_123" - ) - - assert_equal "External", user.first_name - assert_equal "User", user.last_name - assert_equal "external@example.com", user.email - assert_equal "ext_user_123", user.external_id + def test_get_jwks_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("sso")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.get_jwks(client_id: "stub") end end - def test_create_user_with_invalid_payload - VCR.use_cassette "user_management/create_user_invalid" do - err = assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::UserManagement.create_user(email: "") - end - assert_match(/email_string_required/, err.message) - end + def test_create_authenticate_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.create_authenticate(client_id: "stub", client_secret: "stub", grant_type: "authorization_code", code: "stub") + refute_nil result end - # --- .update_user --- - - def test_update_user_with_valid_payload - VCR.use_cassette "user_management/update_user/valid" do - user = WorkOS::UserManagement.update_user( - id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - first_name: "Jane", - last_name: "Doe", - email_verified: false, - external_id: "123" - ) - assert_equal "Jane", user.first_name - assert_equal "Doe", user.last_name - assert_equal false, user.email_verified - assert_equal "123", user.external_id + def test_create_authenticate_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.create_authenticate(client_id: "stub", client_secret: "stub", grant_type: "authorization_code", code: "stub") end end - def test_update_user_locale - VCR.use_cassette "user_management/update_user/locale" do - user = WorkOS::UserManagement.update_user( - id: "user_01K78B3ZB5B7119MYEXTQE5KNE", - locale: "en-US" - ) - assert_equal "en-US", user.locale - end + def test_authenticate_with_password_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.authenticate_with_password(email: "stub", password: "stub") + refute_nil result end - def test_update_user_email - VCR.use_cassette "user_management/update_user/email" do - user = WorkOS::UserManagement.update_user( - id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - email: "jane@example.com" - ) - assert_equal "jane@example.com", user.email - assert_equal false, user.email_verified + def test_authenticate_with_password_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.authenticate_with_password(email: "stub", password: "stub") end end - def test_update_user_only_sends_non_nil_values - called_with = nil - stub_put = ->(**kwargs) { - called_with = kwargs - MockObj.new - } - - WorkOS::UserManagement.stub(:put_request, stub_put) do - WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"id": "test_user", "email_verified": true}')) do - WorkOS::UserManagement.update_user( - id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - email_verified: true - ) - end - end - - assert_equal({email_verified: true}, called_with[:body]) - refute called_with[:body].key?(:first_name) - refute called_with[:body].key?(:last_name) - refute called_with[:body].key?(:email) - refute called_with[:body].key?(:locale) - end - - def test_update_user_can_set_external_id_to_null - called_with = nil - original_put = WorkOS::UserManagement.method(:put_request) - capturing_put = ->(**kwargs) { - called_with = kwargs - original_put.call(**kwargs) - } - - WorkOS::UserManagement.stub(:put_request, capturing_put) do - VCR.use_cassette "user_management/update_user_external_id_null" do - WorkOS::UserManagement.update_user( - id: "user_01K0SR53HJ58M957MYAB6TDZ9X", - first_name: "John", - external_id: nil - ) - end - end - - assert_nil called_with[:body][:external_id] - assert called_with[:body].key?(:external_id) + def test_authenticate_with_code_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.authenticate_with_code(code: "stub") + refute_nil result end - def test_update_user_with_invalid_payload - VCR.use_cassette "user_management/update_user/invalid" do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.update_user(id: "invalid") - end - assert_match(/User not found/, err.message) + def test_authenticate_with_code_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.authenticate_with_code(code: "stub") end end - # --- .delete_user --- - - def test_delete_user_with_valid_id - VCR.use_cassette("user_management/delete_user/valid") do - response = WorkOS::UserManagement.delete_user( - id: "user_01H7WRJBPAAHX1BYRQHEK7QC4A" - ) - - assert_equal true, response - end + def test_authenticate_with_refresh_token_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.authenticate_with_refresh_token(refresh_token: "stub") + refute_nil result end - def test_delete_user_with_invalid_id - VCR.use_cassette("user_management/delete_user/invalid") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.delete_user(id: "invalid") - end - assert_match(/User not found/, err.message) + def test_authenticate_with_refresh_token_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.authenticate_with_refresh_token(refresh_token: "stub") end end - # --- .authenticate_with_password --- - - def test_authenticate_with_password_valid - VCR.use_cassette("user_management/authenticate_with_password/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_password( - email: "test@workos.app", - password: "7YtYic00VWcXatPb", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - assert_equal "user_01H7TVSKS45SDHN5V9XPSM6H44", authentication_response.user.id - end + def test_authenticate_with_magic_auth_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.authenticate_with_magic_auth(code: "stub", email: "stub") + refute_nil result end - def test_authenticate_with_password_invalid_user - VCR.use_cassette("user_management/authenticate_with_password/invalid") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.authenticate_with_password( - email: "invalid@workos.app", - password: "invalid", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end - assert_match(/User not found/, err.message) + def test_authenticate_with_magic_auth_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.authenticate_with_magic_auth(code: "stub", email: "stub") end end - def test_authenticate_with_password_unverified_user - VCR.use_cassette("user_management/authenticate_with_password/unverified") do - err = assert_raises(WorkOS::ForbiddenRequestError) do - WorkOS::UserManagement.authenticate_with_password( - email: "unverified@workos.app", - password: "7YtYic00VWcXatPb", - client_id: "client_123" - ) - end - assert_match(/Email ownership must be verified before authentication/, err.message) - end + def test_authenticate_with_email_verification_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.authenticate_with_email_verification(code: "stub", pending_authentication_token: "stub") + refute_nil result end - def test_authenticate_with_password_includes_invitation_token - called_with = nil - stub_post = ->(**kwargs) { - called_with = kwargs - MockObj.new - } - - WorkOS::UserManagement.stub(:post_request, stub_post) do - WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}')) do - WorkOS::UserManagement.authenticate_with_password( - email: "test@workos.app", - password: "password123", - client_id: "client_123", - invitation_token: "invitation_token_123" - ) - end + def test_authenticate_with_email_verification_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.authenticate_with_email_verification(code: "stub", pending_authentication_token: "stub") end - - assert_equal "invitation_token_123", called_with[:body][:invitation_token] end - # --- .authenticate_with_code --- - - def test_authenticate_with_code_valid - VCR.use_cassette("user_management/authenticate_with_code/valid") do - authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - assert_equal "user_01H93ZY4F80YZRRS6N59Z2HFVS", authentication_response.user.id - assert_equal "", authentication_response.access_token - assert_equal "", authentication_response.refresh_token - end + def test_authenticate_with_totp_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.authenticate_with_totp(code: "stub", pending_authentication_token: "stub", authentication_challenge_id: "stub") + refute_nil result end - def test_authenticate_with_code_valid_with_oauth_tokens - VCR.use_cassette("user_management/authenticate_with_code/valid_with_oauth_tokens") do - authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - - assert_kind_of WorkOS::OAuthTokens, authentication_response.oauth_tokens - assert_equal "oauth_access_token", authentication_response.oauth_tokens.access_token - assert_equal "oauth_refresh_token", authentication_response.oauth_tokens.refresh_token - assert_equal %w[read write], authentication_response.oauth_tokens.scopes - assert_equal 1_234_567_890, authentication_response.oauth_tokens.expires_at + def test_authenticate_with_totp_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.authenticate_with_totp(code: "stub", pending_authentication_token: "stub", authentication_challenge_id: "stub") end end - def test_authenticate_with_code_nil_oauth_tokens_when_not_present - VCR.use_cassette("user_management/authenticate_with_code/valid") do - authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - - assert_nil authentication_response.oauth_tokens - end + def test_authenticate_with_organization_selection_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.authenticate_with_organization_selection(pending_authentication_token: "stub", organization_id: "stub") + refute_nil result end - def test_authenticate_with_code_with_impersonator - VCR.use_cassette("user_management/authenticate_with_code/valid_with_impersonator") do - authentication_response = WorkOS::UserManagement.authenticate_with_code( - code: "01HRX85ATQB2MN40K4FZ9C2HFR", - client_id: "client_01GS91XFB2YPR1C0NR5SH758Q0" - ) - - assert_equal "admin@foocorp.com", authentication_response.impersonator.email - assert_equal "For testing.", authentication_response.impersonator.reason + def test_authenticate_with_organization_selection_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.authenticate_with_organization_selection(pending_authentication_token: "stub", organization_id: "stub") end end - def test_authenticate_with_code_invalid - VCR.use_cassette("user_management/authenticate_with_code/invalid") do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.authenticate_with_code( - code: "invalid", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end - assert_match(/Status 400/, err.message) - end + def test_authenticate_with_device_code_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.authenticate_with_device_code(device_code: "stub") + refute_nil result end - def test_authenticate_with_code_includes_invitation_token - called_with = nil - stub_post = ->(**kwargs) { - called_with = kwargs - MockObj.new - } - - WorkOS::UserManagement.stub(:post_request, stub_post) do - WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}')) do - WorkOS::UserManagement.authenticate_with_code( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - invitation_token: "invitation_token_123" - ) - end + def test_authenticate_with_device_code_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.authenticate_with_device_code(device_code: "stub") end - - assert_equal "invitation_token_123", called_with[:body][:invitation_token] end - # --- .authenticate_with_refresh_token --- - - def test_authenticate_with_refresh_token_valid - VCR.use_cassette("user_management/authenticate_with_refresh_token/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_refresh_token( - refresh_token: "some_refresh_token", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - assert_equal "", authentication_response.access_token - assert_equal "", authentication_response.refresh_token - assert_equal "user_01H93WD0R0KWF8Q7BK02C0RPYJ", authentication_response.user.id - end + def test_create_device_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.create_device(client_id: "stub") + refute_nil result end - def test_authenticate_with_refresh_token_invalid - VCR.use_cassette("user_management/authenticate_with_refresh_code/invalid", tag: :token) do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.authenticate_with_refresh_token( - refresh_token: "invalid", - client_id: "client_123", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end - assert_match(/Status 400/, err.message) + def test_create_device_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.create_device(client_id: "stub") end end - # --- .authenticate_with_magic_auth --- - - def test_authenticate_with_magic_auth_valid - VCR.use_cassette("user_management/authenticate_with_magic_auth/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_magic_auth( - code: "452079", - client_id: "project_01EGKAEB7G5N88E83MF99J785F", - email: "test@workos.com", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - assert_equal "user_01H93WD0R0KWF8Q7BK02C0RPYJ", authentication_response.user.id - end + def test_revoke_session_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.revoke_session(session_id: "stub") + assert_nil result if result.nil? end - def test_authenticate_with_magic_auth_invalid - VCR.use_cassette("user_management/authenticate_with_magic_auth/invalid", tag: :token) do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.authenticate_with_magic_auth( - code: "invalid", - client_id: "client_123", - email: "test@workos.com" - ) - end - assert_match(/User not found/, err.message) + def test_revoke_session_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.revoke_session(session_id: "stub") end end - def test_authenticate_with_magic_auth_includes_invitation_token - called_with = nil - stub_post = ->(**kwargs) { - called_with = kwargs - MockObj.new - } - - WorkOS::UserManagement.stub(:post_request, stub_post) do - WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"user": {"id": "user_123"}, "access_token": "token", "refresh_token": "refresh"}')) do - WorkOS::UserManagement.authenticate_with_magic_auth( - code: "452079", - client_id: "client_123", - email: "test@workos.com", - invitation_token: "invitation_token_123" - ) - end - end - - assert_equal "invitation_token_123", called_with[:body][:invitation_token] + def test_create_cors_origin_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.create_cors_origin(origin: "stub") + refute_nil result end - # --- .authenticate_with_organization_selection --- - - def test_authenticate_with_organization_selection_valid - VCR.use_cassette("user_management/authenticate_with_organization_selection/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_organization_selection( - client_id: "project_01EGKAEB7G5N88E83MF99J785F", - organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", - pending_authentication_token: "pending_authentication_token_1234", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - assert_equal "user_01H93WD0R0KWF8Q7BK02C0RPYJ", authentication_response.user.id - assert_equal "org_01H5JQDV7R7ATEYZDEG0W5PRYS", authentication_response.organization_id + def test_create_cors_origin_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.create_cors_origin(origin: "stub") end end - def test_authenticate_with_organization_selection_invalid - VCR.use_cassette("user_management/authenticate_with_organization_selection/invalid", tag: :token) do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.authenticate_with_organization_selection( - organization_id: "invalid_org_id", - client_id: "project_01EGKAEB7G5N88E83MF99J785F", - pending_authentication_token: "pending_authentication_token_1234" - ) - end - assert_match(/Status 400/, err.message) - end + def test_get_email_verification_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.get_email_verification(id: "stub") + refute_nil result end - # --- .authenticate_with_totp --- - - def test_authenticate_with_totp_valid - VCR.use_cassette("user_management/authenticate_with_totp/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_totp( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - pending_authentication_token: "pending_authentication_token_1234", - authentication_challenge_id: "authentication_challenge_id", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - assert_equal "user_01H93ZY4F80YZRRS6N59Z2HFVS", authentication_response.user.id + def test_get_email_verification_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.get_email_verification(id: "stub") end end - def test_authenticate_with_totp_invalid - VCR.use_cassette("user_management/authenticate_with_totp/invalid", tag: :token) do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.authenticate_with_totp( - code: "invalid", - client_id: "client_123", - pending_authentication_token: "pending_authentication_token_1234", - authentication_challenge_id: "authentication_challenge_id", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end - assert_match(/Status 400/, err.message) - end + def test_reset_password_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.reset_password(email: "stub") + refute_nil result end - # --- .authenticate_with_email_verification --- - - def test_authenticate_with_email_verification_valid - VCR.use_cassette("user_management/authenticate_with_email_verification/valid", tag: :token) do - authentication_response = WorkOS::UserManagement.authenticate_with_email_verification( - code: "01H93ZZHA0JBHFJH9RR11S83YN", - client_id: "client_123", - pending_authentication_token: "pending_authentication_token_1234", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - assert_equal "user_01H93ZY4F80YZRRS6N59Z2HFVS", authentication_response.user.id + def test_reset_password_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.reset_password(email: "stub") end end - def test_authenticate_with_email_verification_invalid - VCR.use_cassette("user_management/authenticate_with_email_verification/invalid", tag: :token) do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.authenticate_with_email_verification( - code: "invalid", - client_id: "client_123", - pending_authentication_token: "pending_authentication_token_1234", - ip_address: "200.240.210.16", - user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/108.0.0.0 Safari/537.36" - ) - end - assert_match(/Status 400/, err.message) - end + def test_confirm_password_reset_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.confirm_password_reset(token: "stub", new_password: "stub") + refute_nil result end - # --- .get_magic_auth --- - - def test_get_magic_auth_with_valid_id - VCR.use_cassette "user_management/get_magic_auth/valid" do - magic_auth = WorkOS::UserManagement.get_magic_auth( - id: "magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9" - ) - - assert magic_auth.id.instance_of?(String) - assert magic_auth.instance_of?(WorkOS::MagicAuth) + def test_confirm_password_reset_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.confirm_password_reset(token: "stub", new_password: "stub") end end - def test_get_magic_auth_with_invalid_id - VCR.use_cassette("user_management/get_magic_auth/invalid") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.get_magic_auth(id: "invalid") - end - assert_match(/MagicAuth not found/, err.message) - end + def test_get_password_reset_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.get_password_reset(id: "stub") + refute_nil result end - # --- .create_magic_auth --- - - def test_create_magic_auth_with_valid_payload - VCR.use_cassette "user_management/create_magic_auth/valid" do - magic_auth = WorkOS::UserManagement.create_magic_auth( - email: "test@workos.com" - ) - - assert_equal "magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9", magic_auth.id - assert_equal "test@workos.com", magic_auth.email + def test_get_password_reset_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.get_password_reset(id: "stub") end end - # --- .send_magic_auth_code --- - - def test_send_magic_auth_code_with_valid_parameters - VCR.use_cassette "user_management/send_magic_auth_code/valid" do - WorkOS::UserManagement.send_magic_auth_code( - email: "test@gmail.com" - ) - end + def test_list_users_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.user_management.list_users + assert_kind_of WorkOS::Types::ListStruct, result end - # --- .enroll_auth_factor --- - - def test_enroll_auth_factor_with_valid_user_id_and_type - VCR.use_cassette("user_management/enroll_auth_factor/valid") do - authentication_response = WorkOS::UserManagement.enroll_auth_factor( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - type: "totp", - totp_secret: "secret-test" - ) - - assert_equal "auth_factor_01H96FETXENNY99ARX0GRC804C", authentication_response.authentication_factor.id - assert_equal "auth_challenge_01H96FETXGTW1QMBSBT2T36PW0", authentication_response.authentication_challenge.id + def test_list_users_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.list_users end end - def test_enroll_auth_factor_only_sends_non_nil_values - called_with = nil - stub_post = ->(**kwargs) { - called_with = kwargs - MockObj.new - } - - WorkOS::UserManagement.stub(:post_request, stub_post) do - WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"authentication_factor": {"id": "test"}, "authentication_challenge": {"id": "test"}}')) do - WorkOS::UserManagement.enroll_auth_factor( - user_id: "user_123", - type: "totp", - totp_issuer: "Test App" - ) - end - end - - assert_equal({type: "totp", totp_issuer: "Test App"}, called_with[:body]) - refute called_with[:body].key?(:totp_user) - refute called_with[:body].key?(:totp_secret) + def test_create_user_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.create_user(email: "stub") + refute_nil result end - def test_enroll_auth_factor_with_incorrect_user_id - VCR.use_cassette("user_management/enroll_auth_factor/invalid") do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.enroll_auth_factor( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - type: "totp" - ) - end - assert_match(/Status 400/, err.message) + def test_create_user_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.create_user(email: "stub") end end - def test_enroll_auth_factor_with_invalid_type - err = assert_raises(ArgumentError) do - WorkOS::UserManagement.enroll_auth_factor( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44", - type: "invalid-factor" - ) - end - assert_equal 'invalid-factor is not a valid value. `type` must be in ["totp"]', err.message + def test_get_user_by_external_id_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.get_user_by_external_id(external_id: "stub") + refute_nil result end - # --- .list_auth_factors --- - - def test_list_auth_factors_with_valid_user_id - VCR.use_cassette("user_management/list_auth_factors/valid") do - authentication_response = WorkOS::UserManagement.list_auth_factors( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" - ) - - assert_equal "auth_factor_01H96FETXENNY99ARX0GRC804C", authentication_response.data.first.id + def test_get_user_by_external_id_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.get_user_by_external_id(external_id: "stub") end end - def test_list_auth_factors_with_incorrect_user_id - VCR.use_cassette("user_management/list_auth_factors/invalid") do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.list_auth_factors( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" - ) - end - assert_match(/Status 400/, err.message) - end + def test_get_user_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.get_user(id: "stub") + refute_nil result end - # --- .get_email_verification --- - - def test_get_email_verification_with_valid_id - VCR.use_cassette "user_management/get_email_verification/valid" do - email_verification = WorkOS::UserManagement.get_email_verification( - id: "email_verification_01HYK9VKNJQ0MJDXEXQP0DA1VK" - ) - - assert email_verification.id.instance_of?(String) - assert email_verification.instance_of?(WorkOS::EmailVerification) + def test_get_user_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.get_user(id: "stub") end end - def test_get_email_verification_with_invalid_id - VCR.use_cassette("user_management/get_email_verification/invalid") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.get_email_verification(id: "invalid") - end - assert_match(/Email Verification not found/, err.message) - end + def test_update_user_returns_expected_result + stub_request(:put, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.update_user(id: "stub") + refute_nil result end - # --- .send_verification_email --- - - def test_send_verification_email_with_valid_parameters - VCR.use_cassette "user_management/send_verification_email/valid" do - verification_response = WorkOS::UserManagement.send_verification_email( - user_id: "user_01H93WD0R0KWF8Q7BK02C0RPYJ" - ) - assert_equal "user_01H93WD0R0KWF8Q7BK02C0RPYJ", verification_response.user.id + def test_update_user_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.update_user(id: "stub") end end - def test_send_verification_email_when_user_does_not_exist - VCR.use_cassette "user_management/send_verification_email/invalid" do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.send_verification_email( - user_id: "bad_id" - ) - end - assert_match(/User not found/, err.message) - end + def test_delete_user_returns_expected_result + stub_request(:delete, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.delete_user(id: "stub") + assert_nil result if result.nil? end - # --- .verify_email --- - - def test_verify_email_with_valid_parameters - VCR.use_cassette "user_management/verify_email/valid" do - verify_response = WorkOS::UserManagement.verify_email( - code: "333495", - user_id: "user_01H968BR1R84DSPYS9QR5PM6RZ" - ) - - assert_equal "user_01H968BR1R84DSPYS9QR5PM6RZ", verify_response.user.id + def test_delete_user_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.delete_user(id: "stub") end end - def test_verify_email_with_invalid_id - VCR.use_cassette "user_management/verify_email/invalid_magic_auth_challenge" do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.verify_email( - code: "659770", - user_id: "bad_id" - ) - end - assert_match(/User not found/, err.message) - end + def test_confirm_email_change_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.confirm_email_change(id: "stub", code: "stub") + refute_nil result end - def test_verify_email_with_incorrect_code - VCR.use_cassette "user_management/verify_email/invalid_code" do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.verify_email( - code: "000000", - user_id: "user_01H93WD0R0KWF8Q7BK02C0RPYJ" - ) - end - assert_match(/Email verification code is incorrect/, err.message) + def test_confirm_email_change_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.confirm_email_change(id: "stub", code: "stub") end end - # --- .get_password_reset --- - - def test_get_password_reset_with_valid_id - VCR.use_cassette "user_management/get_password_reset/valid" do - password_reset = WorkOS::UserManagement.get_password_reset( - id: "password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT" - ) - - assert password_reset.id.instance_of?(String) - assert password_reset.instance_of?(WorkOS::PasswordReset) - end + def test_send_email_change_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.send_email_change(id: "stub", new_email: "stub") + refute_nil result end - def test_get_password_reset_with_invalid_id - VCR.use_cassette("user_management/get_password_reset/invalid") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.get_password_reset(id: "invalid") - end - assert_match(/Password Reset not found/, err.message) + def test_send_email_change_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.send_email_change(id: "stub", new_email: "stub") end end - # --- .create_password_reset --- - - def test_create_password_reset_with_valid_payload - VCR.use_cassette "user_management/create_password_reset/valid" do - password_reset = WorkOS::UserManagement.create_password_reset( - email: "test@workos.com" - ) - - assert_equal "password_reset_01HYKA8DTF8TW5YD30MF0ZXZKT", password_reset.id - assert_equal "test@workos.com", password_reset.email - end + def test_verify_email_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.verify_email(id: "stub", code: "stub") + refute_nil result end - # --- .send_password_reset_email --- - - def test_send_password_reset_email_with_valid_payload - VCR.use_cassette "user_management/send_password_reset_email/valid" do - response = WorkOS::UserManagement.send_password_reset_email( - email: "lucy.lawless@example.com", - password_reset_url: "https://example.com/reset" - ) - - assert_equal true, response + def test_verify_email_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.verify_email(id: "stub", code: "stub") end end - def test_send_password_reset_email_with_invalid_payload - VCR.use_cassette "user_management/send_password_reset_email/invalid" do - err = assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::UserManagement.send_password_reset_email( - email: "foo@bar.com", - password_reset_url: "" - ) - end - assert_match(/password_reset_url_string_required/, err.message) - end + def test_send_verification_email_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.send_verification_email(id: "stub") + refute_nil result end - # --- .reset_password --- - - def test_reset_password_with_valid_payload - VCR.use_cassette "user_management/reset_password/valid" do - user = WorkOS::UserManagement.reset_password( - token: "eEgAgvAE0blvU1zWV3yWVAD22", - new_password: "very_cool_new_pa$$word" - ) - - assert_equal "lucy.lawless@example.com", user.email + def test_send_verification_email_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.send_verification_email(id: "stub") end end - def test_reset_password_with_invalid_payload - VCR.use_cassette "user_management/reset_password/invalid" do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.reset_password( - token: "bogus_token", - new_password: "new_password" - ) - end - assert_match(/Could not locate user with provided token/, err.message) - end + def test_get_user_identities_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.get_user_identities(id: "stub") + refute_nil result end - # --- .get_organization_membership --- - - def test_get_organization_membership_with_valid_id - VCR.use_cassette "user_management/get_organization_membership" do - organization_membership = WorkOS::UserManagement.get_organization_membership( - id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - assert organization_membership.id.instance_of?(String) - assert organization_membership.instance_of?(WorkOS::OrganizationMembership) + def test_get_user_identities_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.get_user_identities(id: "stub") end end - # NOTE: The original spec had `.to raise_error` chained on get_organization_membership - # (not on the expect block), so it never actually tested the error. This is a faithful conversion. - def test_get_organization_membership_with_invalid_id - # Original spec was effectively a no-op due to incorrect chaining + def test_list_sessions_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.user_management.list_sessions(id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result end - # --- .list_organization_memberships --- - - def test_list_organization_memberships_with_no_options - expected_metadata = { - "after" => nil, - "before" => "before-id" - } - - VCR.use_cassette "user_management/list_organization_memberships/no_options" do - organization_memberships = WorkOS::UserManagement.list_organization_memberships - - assert_equal 2, organization_memberships.data.size - assert_equal expected_metadata, organization_memberships.list_metadata + def test_list_sessions_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.list_sessions(id: "stub") end end - def test_list_organization_memberships_with_options - request_args = [ - "/user_management/organization_memberships?user_id=user_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ - "order=desc&limit=5", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - Net::HTTP::Get.stub(:new, expected_request) do - VCR.use_cassette "user_management/list_organization_memberships/with_options" do - organization_memberships = WorkOS::UserManagement.list_organization_memberships( - user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", - order: "desc", - limit: "5" - ) - - assert_equal 1, organization_memberships.data.size - assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_memberships.data[0].user_id - end - end + def test_list_invitations_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.user_management.list_invitations + assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_organization_memberships_with_statuses_option - request_args = [ - "/user_management/organization_memberships?user_id=user_01HXYSZBKQE2N3NHBKZHDP1X5X&" \ - "statuses=active&statuses=inactive&order=desc&limit=5", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - Net::HTTP::Get.stub(:new, expected_request) do - VCR.use_cassette "user_management/list_organization_memberships/with_statuses_option" do - organization_memberships = WorkOS::UserManagement.list_organization_memberships( - user_id: "user_01HXYSZBKQE2N3NHBKZHDP1X5X", - statuses: %w[active inactive], - order: "desc", - limit: "5" - ) - - assert_equal 1, organization_memberships.data.size - assert_equal "user_01HXYSZBKQE2N3NHBKZHDP1X5X", organization_memberships.data[0].user_id - end + def test_list_invitations_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.list_invitations end end - # --- .create_organization_membership --- - - def test_create_organization_membership_with_valid_payload - VCR.use_cassette "user_management/create_organization_membership/valid" do - organization_membership = WorkOS::UserManagement.create_organization_membership( - user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", - organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - assert_equal "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.organization_id - assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.user_id - assert_equal({slug: "member"}, organization_membership.role) - end + def test_send_invitation_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.send_invitation(email: "stub") + refute_nil result end - def test_create_organization_membership_with_invalid_payload - VCR.use_cassette "user_management/create_organization_membership/invalid" do - err = assert_raises(WorkOS::UnprocessableEntityError) do - WorkOS::UserManagement.create_organization_membership(user_id: "", organization_id: "") - end - assert_match(/user_id_string_required/, err.message) + def test_send_invitation_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.send_invitation(email: "stub") end end - def test_create_organization_membership_with_role_slug - VCR.use_cassette "user_management/create_organization_membership/valid" do - organization_membership = WorkOS::UserManagement.create_organization_membership( - user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", - organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", - role_slug: "member" - ) - - assert_equal "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.organization_id - assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.user_id - assert_equal({slug: "member"}, organization_membership.role) - end + def test_find_invitation_by_token_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.find_invitation_by_token(token: "stub") + refute_nil result end - def test_create_organization_membership_with_role_slugs - VCR.use_cassette "user_management/create_organization_membership/valid_multiple_roles" do - organization_membership = WorkOS::UserManagement.create_organization_membership( - user_id: "user_01H5JQDV7R7ATEYZDEG0W5PRYS", - organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS", - role_slugs: %w[admin member] - ) - - assert_equal "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.organization_id - assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.user_id - assert_kind_of Array, organization_membership.roles - assert_equal 2, organization_membership.roles.length + def test_find_invitation_by_token_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.find_invitation_by_token(token: "stub") end end - # --- .update_organization_membership --- - - def test_update_organization_membership_with_valid_id - VCR.use_cassette("user_management/update_organization_membership/valid") do - organization_membership = WorkOS::UserManagement.update_organization_membership( - id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS", - role_slug: "admin" - ) - - assert_equal "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.organization_id - assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.user_id - assert_equal({slug: "admin"}, organization_membership.role) - end + def test_get_invitation_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.get_invitation(id: "stub") + refute_nil result end - def test_update_organization_membership_with_invalid_id - VCR.use_cassette("user_management/update_organization_membership/invalid") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.update_organization_membership(id: "invalid", role_slug: "admin") - end - assert_match(/Organization Membership not found/, err.message) + def test_get_invitation_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.get_invitation(id: "stub") end end - def test_update_organization_membership_with_role_slugs - VCR.use_cassette("user_management/update_organization_membership/valid_multiple_roles") do - organization_membership = WorkOS::UserManagement.update_organization_membership( - id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS", - role_slugs: %w[admin editor] - ) - - assert_equal "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.organization_id - assert_equal "user_01H5JQDV7R7ATEYZDEG0W5PRYS", organization_membership.user_id - assert_kind_of Array, organization_membership.roles - assert_equal 2, organization_membership.roles.length - end + def test_accept_invitation_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.accept_invitation(id: "stub") + refute_nil result end - # --- .delete_organization_membership --- - - def test_delete_organization_membership_with_valid_id - VCR.use_cassette("user_management/delete_organization_membership/valid") do - response = WorkOS::UserManagement.delete_organization_membership( - id: "om_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - assert_equal true, response + def test_accept_invitation_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.accept_invitation(id: "stub") end end - def test_delete_organization_membership_with_invalid_id - VCR.use_cassette("user_management/delete_organization_membership/invalid") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.delete_organization_membership(id: "invalid") - end - assert_match(/Organization Membership not found/, err.message) - end + def test_resend_invitation_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.resend_invitation(id: "stub") + refute_nil result end - # --- .deactivate_organization_membership --- - - def test_deactivate_organization_membership_with_valid_id - VCR.use_cassette "user_management/deactivate_organization_membership" do - organization_membership = WorkOS::UserManagement.deactivate_organization_membership( - id: "om_01HXYT0G3H5QG9YTSHSHFZQE6D" - ) - - assert organization_membership.id.instance_of?(String) - assert organization_membership.instance_of?(WorkOS::OrganizationMembership) + def test_resend_invitation_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.resend_invitation(id: "stub") end end - # NOTE: The original spec had `.to raise_error` chained on deactivate_organization_membership - # (not on the expect block), so it never actually tested the error. This is a faithful conversion. - def test_deactivate_organization_membership_with_invalid_id - # Original spec was effectively a no-op due to incorrect chaining + def test_revoke_invitation_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.revoke_invitation(id: "stub") + refute_nil result end - # --- .reactivate_organization_membership --- - - def test_reactivate_organization_membership_with_valid_id - VCR.use_cassette "user_management/reactivate_organization_membership" do - organization_membership = WorkOS::UserManagement.reactivate_organization_membership( - id: "om_01HXYT0G3H5QG9YTSHSHFZQE6D" - ) - - assert organization_membership.id.instance_of?(String) - assert organization_membership.instance_of?(WorkOS::OrganizationMembership) + def test_revoke_invitation_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.revoke_invitation(id: "stub") end end - # NOTE: The original spec had `.to raise_error` chained on reactivate_organization_membership - # (not on the expect block), so it never actually tested the error. This is a faithful conversion. - def test_reactivate_organization_membership_with_invalid_id - # Original spec was effectively a no-op due to incorrect chaining + def test_update_jwt_template_returns_expected_result + stub_request(:put, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.update_jwt_template(content: "stub") + refute_nil result end - # --- .get_invitation --- - - def test_get_invitation_with_valid_id - VCR.use_cassette "user_management/get_invitation/valid" do - invitation = WorkOS::UserManagement.get_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - assert invitation.id.instance_of?(String) - assert invitation.instance_of?(WorkOS::Invitation) - end - end - - def test_get_invitation_with_invalid_id - VCR.use_cassette("user_management/get_invitation/invalid") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.get_invitation(id: "invalid") - end - assert_match(/Invitation not found/, err.message) + def test_update_jwt_template_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.update_jwt_template(content: "stub") end end - # --- .find_invitation_by_token --- - - def test_find_invitation_by_token_with_valid_token - VCR.use_cassette "user_management/find_invitation_by_token/valid" do - invitation = WorkOS::UserManagement.find_invitation_by_token( - token: "iUV3XbYajpJlbpw1Qt3ZKlaKx" - ) - - assert invitation.id.instance_of?(String) - assert invitation.instance_of?(WorkOS::Invitation) - end + def test_create_magic_auth_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.create_magic_auth(email: "stub") + refute_nil result end - def test_find_invitation_by_token_with_invalid_token - VCR.use_cassette("user_management/find_invitation_by_token/invalid") do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.find_invitation_by_token(token: "invalid") - end - assert_match(/Invitation not found/, err.message) + def test_create_magic_auth_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.create_magic_auth(email: "stub") end end - # --- .list_invitations --- - - def test_list_invitations_with_no_options - expected_metadata = { - "after" => nil, - "before" => "before_id" - } - - VCR.use_cassette "user_management/list_invitations/with_no_options" do - invitations = WorkOS::UserManagement.list_invitations - - assert_equal 5, invitations.data.size - assert_equal expected_metadata, invitations.list_metadata - end + def test_get_magic_auth_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.get_magic_auth(id: "stub") + refute_nil result end - def test_list_invitations_with_organization_id - request_args = [ - "/user_management/invitations?organization_id=org_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - Net::HTTP::Get.stub(:new, expected_request) do - VCR.use_cassette "user_management/list_invitations/with_organization_id" do - invitations = WorkOS::UserManagement.list_invitations( - organization_id: "org_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - assert_equal 1, invitations.data.size - assert_equal( - "org_01H5JQDV7R7ATEYZDEG0W5PRYS", - invitations.data.first.organization_id - ) - end + def test_get_magic_auth_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.get_magic_auth(id: "stub") end end - def test_list_invitations_with_limit - request_args = [ - "/user_management/invitations?limit=2&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - Net::HTTP::Get.stub(:new, expected_request) do - VCR.use_cassette "user_management/list_invitations/with_limit" do - invitations = WorkOS::UserManagement.list_invitations( - limit: 2 - ) - - assert_equal 3, invitations.data.size - end - end + def test_list_organization_memberships_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.user_management.list_organization_memberships + assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_invitations_with_before - request_args = [ - "/user_management/invitations?before=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - Net::HTTP::Get.stub(:new, expected_request) do - VCR.use_cassette "user_management/list_invitations/with_before" do - invitations = WorkOS::UserManagement.list_invitations( - before: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - assert_equal 2, invitations.data.size - end + def test_list_organization_memberships_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.list_organization_memberships end end - def test_list_invitations_with_after - request_args = [ - "/user_management/invitations?after=invitation_01H5JQDV7R7ATEYZDEG0W5PRYS&" \ - "order=desc", - "Content-Type" => "application/json" - ] - - expected_request = Net::HTTP::Get.new(*request_args) - - Net::HTTP::Get.stub(:new, expected_request) do - VCR.use_cassette "user_management/list_invitations/with_after" do - invitations = WorkOS::UserManagement.list_invitations( - after: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - assert_equal 2, invitations.data.size - end - end + def test_create_organization_membership_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.create_organization_membership(user_id: "stub", organization_id: "stub") + refute_nil result end - # --- .send_invitation --- - - def test_send_invitation_with_valid_payload - VCR.use_cassette "user_management/send_invitation/valid" do - invitation = WorkOS::UserManagement.send_invitation( - email: "test@workos.com" - ) - - assert_equal "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS", invitation.id - assert_equal "test@workos.com", invitation.email + def test_create_organization_membership_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.create_organization_membership(user_id: "stub", organization_id: "stub") end end - def test_send_invitation_only_sends_non_nil_values - called_with = nil - stub_post = ->(**kwargs) { - called_with = kwargs - MockObj.new - } - - WorkOS::UserManagement.stub(:post_request, stub_post) do - WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: '{"id": "test_invitation"}')) do - WorkOS::UserManagement.send_invitation( - email: "test@workos.com", - organization_id: "org_123" - ) - end - end - - assert_equal({email: "test@workos.com", organization_id: "org_123"}, called_with[:body]) - refute called_with[:body].key?(:expires_in_days) - refute called_with[:body].key?(:inviter_user_id) - refute called_with[:body].key?(:role_slug) + def test_get_organization_membership_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.get_organization_membership(id: "stub") + refute_nil result end - def test_send_invitation_with_invalid_payload - VCR.use_cassette "user_management/send_invitation/invalid" do - err = assert_raises(WorkOS::APIError) do - WorkOS::UserManagement.send_invitation( - email: "invalid@workos.com" - ) - end - assert_match(/An Invitation with the email invalid@workos.com already exists/, err.message) + def test_get_organization_membership_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.get_organization_membership(id: "stub") end end - # --- .accept_invitation --- - - def test_accept_invitation_with_valid_id - called_with = nil - stub_post = ->(**kwargs) { - called_with = kwargs - MockObj.new - } - - response_body = { - id: "invitation_123", - email: "test@workos.com", - state: "accepted" - }.to_json - - WorkOS::UserManagement.stub(:post_request, stub_post) do - WorkOS::UserManagement.stub(:execute_request, MockObj.new(body: response_body)) do - invitation = WorkOS::UserManagement.accept_invitation( - id: "invitation_123" - ) - - assert_equal "invitation_123", invitation.id - assert_equal "test@workos.com", invitation.email - assert_equal "accepted", invitation.state - end - end - - assert_equal "/user_management/invitations/invitation_123/accept", called_with[:path] - assert_equal true, called_with[:auth] + def test_update_organization_membership_returns_expected_result + stub_request(:put, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.update_organization_membership(id: "stub") + refute_nil result end - def test_accept_invitation_with_invalid_id - stub_post = ->(**kwargs) { MockObj.new } - - WorkOS::UserManagement.stub(:post_request, stub_post) do - WorkOS::UserManagement.stub(:execute_request, ->(_) { raise WorkOS::NotFoundError.new(message: "Invitation not found") }) do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.accept_invitation(id: "invalid_id") - end - assert_match(/Invitation not found/, err.message) - end + def test_update_organization_membership_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.update_organization_membership(id: "stub") end end - def test_accept_invitation_already_accepted - stub_post = ->(**kwargs) { MockObj.new } - - WorkOS::UserManagement.stub(:post_request, stub_post) do - WorkOS::UserManagement.stub(:execute_request, ->(_) { raise WorkOS::InvalidRequestError.new(message: "Invite has already been accepted") }) do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.accept_invitation(id: "invitation_123") - end - assert_match(/Invite has already been accepted/, err.message) - end - end + def test_delete_organization_membership_returns_expected_result + stub_request(:delete, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.delete_organization_membership(id: "stub") + assert_nil result if result.nil? end - # --- .revoke_invitation --- - - def test_revoke_invitation_with_valid_payload - VCR.use_cassette "user_management/revoke_invitation/valid" do - invitation = WorkOS::UserManagement.revoke_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - assert_equal "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS", invitation.id - assert_equal "test@workos.com", invitation.email + def test_delete_organization_membership_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.delete_organization_membership(id: "stub") end end - def test_revoke_invitation_with_invalid_payload - VCR.use_cassette "user_management/revoke_invitation/invalid" do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.revoke_invitation( - id: "invalid_id" - ) - end - assert_match(/Invitation not found/, err.message) - end + def test_deactivate_organization_membership_returns_expected_result + stub_request(:put, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.deactivate_organization_membership(id: "stub") + refute_nil result end - # --- .resend_invitation --- - - def test_resend_invitation_with_valid_payload - VCR.use_cassette "user_management/resend_invitation/valid" do - invitation = WorkOS::UserManagement.resend_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - - assert_equal "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS", invitation.id - assert_equal "test@workos.com", invitation.email + def test_deactivate_organization_membership_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.deactivate_organization_membership(id: "stub") end end - def test_resend_invitation_with_invalid_id - VCR.use_cassette "user_management/resend_invitation/invalid" do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.resend_invitation( - id: "invalid_id" - ) - end - assert_match(/Invitation not found/, err.message) - end + def test_reactivate_organization_membership_returns_expected_result + stub_request(:put, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.reactivate_organization_membership(id: "stub") + refute_nil result end - def test_resend_invitation_when_expired - VCR.use_cassette "user_management/resend_invitation/expired" do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.resend_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - end - assert_match(/Invite has expired/, err.message) + def test_reactivate_organization_membership_raises_authentication_error_on_401 + stub_request(:put, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.reactivate_organization_membership(id: "stub") end end - def test_resend_invitation_when_revoked - VCR.use_cassette "user_management/resend_invitation/revoked" do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.resend_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - end - assert_match(/Invite has been revoked/, err.message) - end + def test_create_redirect_uri_returns_expected_result + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.create_redirect_uri(uri: "stub") + refute_nil result end - def test_resend_invitation_when_already_accepted - VCR.use_cassette "user_management/resend_invitation/accepted" do - err = assert_raises(WorkOS::InvalidRequestError) do - WorkOS::UserManagement.resend_invitation( - id: "invitation_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - end - assert_match(/Invite has already been accepted/, err.message) + def test_create_redirect_uri_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.create_redirect_uri(uri: "stub") end end - # --- .revoke_session --- - - def test_revoke_session_with_valid_payload - VCR.use_cassette "user_management/revoke_session/valid" do - result = WorkOS::UserManagement.revoke_session( - session_id: "session_01HRX85ATNADY1GQ053AHRFFN6" - ) - - assert_equal true, result - end + def test_list_user_authorized_applications_returns_expected_result + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.user_management.list_user_authorized_applications(user_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result end - def test_revoke_session_with_non_existent_session - VCR.use_cassette "user_management/revoke_session/not_found" do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::UserManagement.revoke_session( - session_id: "session_01H5JQDV7R7ATEYZDEG0W5PRYS" - ) - end - assert_match(/Session not found/, err.message) + def test_list_user_authorized_applications_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.list_user_authorized_applications(user_id: "stub") end end - # --- .list_sessions --- - - def test_list_sessions_with_valid_user_id - VCR.use_cassette("user_management/list_sessions/valid") do - result = WorkOS::UserManagement.list_sessions( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" - ) - - assert_kind_of Array, result.data - assert_kind_of WorkOS::UserManagement::Session, result.data.first - assert_equal "session_01H96FETXGTW2S0V5V9XPSM6H44", result.data.first.id - assert_equal "active", result.data.first.status - assert_equal "password", result.data.first.auth_method - end + def test_delete_user_authorized_application_returns_expected_result + stub_request(:delete, /#{Regexp.escape("user_management")}/) + .to_return(body: "{}", status: 200) + result = @client.user_management.delete_user_authorized_application(application_id: "stub", user_id: "stub") + assert_nil result if result.nil? end - def test_list_sessions_returns_sessions_that_can_be_revoked - called_with = nil - stub_post = ->(**kwargs) { - called_with = kwargs - MockObj.new - } - - VCR.use_cassette("user_management/list_sessions/valid") do - result = WorkOS::UserManagement.list_sessions( - user_id: "user_01H7TVSKS45SDHN5V9XPSM6H44" - ) - session = result.data.first - - # Create a mock response that returns true for is_a?(Net::HTTPSuccess) - mock_response = Net::HTTPSuccess.allocate - WorkOS::UserManagement.stub(:post_request, stub_post) do - WorkOS::UserManagement.stub(:execute_request, mock_response) do - assert_equal true, session.revoke - end - end + def test_delete_user_authorized_application_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("user_management")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.delete_user_authorized_application(application_id: "stub", user_id: "stub") end - - assert_equal "/user_management/sessions/revoke", called_with[:path] - assert_equal({session_id: "session_01H96FETXGTW2S0V5V9XPSM6H44"}, called_with[:body]) - assert_equal true, called_with[:auth] - end - - # --- .get_logout_url --- - - def test_get_logout_url - result = WorkOS::UserManagement.get_logout_url( - session_id: "session_01HRX85ATNADY1GQ053AHRFFN6" - ) - - assert_equal "https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6", result - end - - def test_get_logout_url_with_return_to - result = WorkOS::UserManagement.get_logout_url( - session_id: "session_01HRX85ATNADY1GQ053AHRFFN6", - return_to: "https://example.com/signed-out" - ) - - assert_equal "https://api.workos.com/user_management/sessions/logout?session_id=session_01HRX85ATNADY1GQ053AHRFFN6&return_to=https%3A%2F%2Fexample.com%2Fsigned-out", result end end diff --git a/test/workos/test_vault.rb b/test/workos/test_vault.rb new file mode 100644 index 00000000..b5249465 --- /dev/null +++ b/test/workos/test_vault.rb @@ -0,0 +1,151 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +require "test_helper" +require "base64" + +class VaultTest < Minitest::Test + def setup + @client = WorkOS::Client.new(api_key: "sk_test_vault") + end + + def test_vault_accessor_exists + assert_kind_of WorkOS::Vault, @client.vault + end + + def test_create_object_returns_metadata + body = { + "id" => "obj_01", "key_id" => "key_01", "version_id" => "v1", + "context" => {"tenant" => "t1"}, "environment_id" => "env_1", + "updated_at" => "2026-04-15T00:00:00Z", + "updated_by" => {"id" => "u1", "name" => "alice"} + } + stub_request(:post, "https://api.workos.com/vault/v1/kv") + .with(body: hash_including("name" => "secret", "value" => "hello")) + .to_return(status: 200, body: body.to_json) + + meta = @client.vault.create_object(name: "secret", value: "hello", key_context: {"tenant" => "t1"}) + assert_equal "obj_01", meta.id + assert_equal "v1", meta.version_id + assert_equal "alice", meta.updated_by.name + end + + def test_read_object_returns_decrypted_value + body = { + "id" => "obj_01", "name" => "secret", "value" => "hello", + "metadata" => { + "id" => "obj_01", "key_id" => "k", "version_id" => "v", + "context" => {}, "environment_id" => "env", + "updated_at" => "x", "updated_by" => {"id" => "u", "name" => "n"} + } + } + stub_request(:get, "https://api.workos.com/vault/v1/kv/obj_01") + .to_return(status: 200, body: body.to_json) + + obj = @client.vault.read_object(object_id: "obj_01") + assert_equal "hello", obj.value + assert_equal "secret", obj.name + end + + def test_list_objects_returns_digests + body = {"data" => [{"id" => "o1", "name" => "a", "updated_at" => "x"}, {"id" => "o2", "name" => "b", "updated_at" => "y"}]} + stub_request(:get, /vault\/v1\/kv\?/).to_return(status: 200, body: body.to_json) + + digests = @client.vault.list_objects(limit: 10) + assert_equal 2, digests.size + assert_equal "o1", digests.first.id + end + + def test_list_object_versions + body = {"data" => [{"id" => "v1", "created_at" => "x", "current_version" => true}]} + stub_request(:get, "https://api.workos.com/vault/v1/kv/obj_1/versions").to_return(status: 200, body: body.to_json) + + versions = @client.vault.list_object_versions(object_id: "obj_1") + assert_equal 1, versions.size + assert versions.first.current_version + end + + def test_get_object_metadata + body = {"id" => "obj_1", "name" => "n", "metadata" => { + "id" => "obj_1", "key_id" => "k", "version_id" => "v", + "context" => {}, "environment_id" => "env", + "updated_at" => "x", "updated_by" => {"id" => "u", "name" => "n"} + }} + stub_request(:get, "https://api.workos.com/vault/v1/kv/obj_1/metadata").to_return(status: 200, body: body.to_json) + + obj = @client.vault.get_object_metadata(object_id: "obj_1") + assert_nil obj.value + assert_equal "obj_1", obj.metadata.id + end + + def test_delete_object_returns_nil + stub_request(:delete, "https://api.workos.com/vault/v1/kv/obj_1").to_return(status: 200, body: "") + assert_nil @client.vault.delete_object(object_id: "obj_1") + end + + def test_update_object_with_version_check + body = {"id" => "obj_1", "name" => "n", "value" => "newval", "metadata" => nil} + stub_request(:put, "https://api.workos.com/vault/v1/kv/obj_1") + .with(body: hash_including("value" => "newval", "version_check" => "v1")) + .to_return(status: 200, body: body.to_json) + + obj = @client.vault.update_object(object_id: "obj_1", value: "newval", version_check: "v1") + assert_equal "newval", obj.value + end + + def test_create_data_key + body = {"context" => {"t" => "1"}, "id" => "dek_1", "data_key" => Base64.strict_encode64("k" * 32), "encrypted_keys" => Base64.strict_encode64("blob")} + stub_request(:post, "https://api.workos.com/vault/v1/keys/data-key") + .with(body: hash_including("context" => {"t" => "1"})) + .to_return(status: 200, body: body.to_json) + + pair = @client.vault.create_data_key(key_context: {"t" => "1"}) + assert_equal "dek_1", pair.data_key.id + assert_equal "blob", Base64.decode64(pair.encrypted_keys) + end + + def test_decrypt_data_key + body = {"id" => "dek_1", "data_key" => Base64.strict_encode64("k" * 32)} + stub_request(:post, "https://api.workos.com/vault/v1/keys/decrypt") + .with(body: hash_including("keys" => "abc")) + .to_return(status: 200, body: body.to_json) + + dk = @client.vault.decrypt_data_key(keys: "abc") + assert_equal "dek_1", dk.id + end + + def test_local_encrypt_then_decrypt_roundtrip + plaintext_key = "k" * 32 + create_resp = {"context" => {"t" => "1"}, "id" => "dek_1", + "data_key" => Base64.strict_encode64(plaintext_key), + "encrypted_keys" => Base64.strict_encode64("ENCRYPTED_BLOB")} + decrypt_resp = {"id" => "dek_1", "data_key" => Base64.strict_encode64(plaintext_key)} + + stub_request(:post, "https://api.workos.com/vault/v1/keys/data-key").to_return(status: 200, body: create_resp.to_json) + stub_request(:post, "https://api.workos.com/vault/v1/keys/decrypt").to_return(status: 200, body: decrypt_resp.to_json) + + payload = "the quick brown fox" + encrypted = @client.vault.encrypt(data: payload, key_context: {"t" => "1"}) + refute_equal payload, encrypted + + plaintext = @client.vault.decrypt(encrypted_data: encrypted) + assert_equal payload, plaintext + end + + def test_local_encrypt_with_associated_data + plaintext_key = "k" * 32 + create_resp = {"context" => {}, "id" => "dek", "data_key" => Base64.strict_encode64(plaintext_key), "encrypted_keys" => Base64.strict_encode64("BLOB")} + decrypt_resp = {"id" => "dek", "data_key" => Base64.strict_encode64(plaintext_key)} + + stub_request(:post, "https://api.workos.com/vault/v1/keys/data-key").to_return(status: 200, body: create_resp.to_json) + stub_request(:post, "https://api.workos.com/vault/v1/keys/decrypt").to_return(status: 200, body: decrypt_resp.to_json) + + encrypted = @client.vault.encrypt(data: "secret", key_context: {}, associated_data: "tenant=42") + plaintext = @client.vault.decrypt(encrypted_data: encrypted, associated_data: "tenant=42") + assert_equal "secret", plaintext + + assert_raises(OpenSSL::Cipher::CipherError) do + @client.vault.decrypt(encrypted_data: encrypted, associated_data: "wrong") + end + end +end diff --git a/test/workos/test_webhook_verify.rb b/test/workos/test_webhook_verify.rb new file mode 100644 index 00000000..e273b87a --- /dev/null +++ b/test/workos/test_webhook_verify.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +require "test_helper" +require "openssl" + +class WebhookVerifyTest < Minitest::Test + SECRET = "whsec_test_secret" + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_webhook") + @webhooks = @client.webhooks + end + + def signed(payload, ts: now_ms, secret: SECRET) + sig = OpenSSL::HMAC.hexdigest("SHA256", secret, "#{ts}.#{payload}") + "t=#{ts}, v1=#{sig}" + end + + def now_ms + (Time.now.to_f * 1000).to_i + end + + def test_verify_methods_exist + assert_respond_to @webhooks, :verify_event + assert_respond_to @webhooks, :verify_header + assert_respond_to @webhooks, :compute_signature + assert_respond_to @webhooks, :parse_signature_header + end + + def test_verify_event_returns_parsed_payload + payload = '{"id":"evt_1","event":"user.created"}' + sig_header = signed(payload) + event = @webhooks.verify_event(payload: payload, sig_header: sig_header, secret: SECRET) + assert_equal "evt_1", event["id"] + assert_equal "user.created", event["event"] + end + + def test_verify_header_passes_for_valid_signature + payload = '{"x":1}' + assert @webhooks.verify_header(payload: payload, sig_header: signed(payload), secret: SECRET) + end + + def test_verify_header_raises_on_bad_signature + payload = '{"x":1}' + bad = "t=#{now_ms}, v1=deadbeef" + assert_raises(WorkOS::SignatureVerificationError) do + @webhooks.verify_header(payload: payload, sig_header: bad, secret: SECRET) + end + end + + def test_verify_header_raises_on_stale_timestamp + payload = '{"x":1}' + old_ts = now_ms - (10 * 60 * 1000) # 10 minutes old + sig = OpenSSL::HMAC.hexdigest("SHA256", SECRET, "#{old_ts}.#{payload}") + header = "t=#{old_ts}, v1=#{sig}" + err = assert_raises(WorkOS::SignatureVerificationError) do + @webhooks.verify_header(payload: payload, sig_header: header, secret: SECRET, tolerance: 60) + end + assert_match(/Timestamp outside the tolerance zone/, err.message) + end + + def test_verify_header_raises_on_malformed_header + assert_raises(WorkOS::SignatureVerificationError) do + @webhooks.verify_header(payload: "{}", sig_header: "garbage", secret: SECRET) + end + assert_raises(WorkOS::SignatureVerificationError) do + @webhooks.verify_header(payload: "{}", sig_header: nil, secret: SECRET) + end + end + + def test_compute_signature_matches_manual_hmac + payload = "hello" + ts = "1700000000000" + expected = OpenSSL::HMAC.hexdigest("SHA256", SECRET, "#{ts}.#{payload}") + assert_equal expected, @webhooks.compute_signature(payload: payload, timestamp: ts, secret: SECRET) + end + + def test_parse_signature_header + ts, sig = @webhooks.parse_signature_header("t=12345, v1=abcdef") + assert_equal "12345", ts + assert_equal "abcdef", sig + end +end diff --git a/test/workos/test_webhooks.rb b/test/workos/test_webhooks.rb index 31d3c9be..d8ac200f 100644 --- a/test/workos/test_webhooks.rb +++ b/test/workos/test_webhooks.rb @@ -1,403 +1,73 @@ # frozen_string_literal: true -require "test_helper" -require "json" -require "openssl" - -class TestWebhooks < WorkOS::TestCase - def setup - super - @payload = File.read("#{TEST_ROOT}/fixtures/webhook_payload.txt") - @secret = "secret" - @timestamp = Time.at(Time.now.to_i * 1000) - unhashed_string = "#{@timestamp.to_i}.#{@payload}" - digest = OpenSSL::Digest.new("sha256") - @signature_hash = OpenSSL::HMAC.hexdigest(digest, @secret, unhashed_string) - @expectation = { - id: "directory_user_01FAEAJCR3ZBZ30D8BD1924TVG", - state: "active", - emails: [{ - type: "work", - value: "blair@foo-corp.com", - primary: true - }], - idp_id: "00u1e8mutl6wlH3lL4x7", - object: "directory_user", - username: "blair@foo-corp.com", - last_name: "Lunchford", - first_name: "Blair", - directory_id: "directory_01F9M7F68PZP8QXP8G7X5QRHS7", - raw_attributes: { - name: { - givenName: "Blair", - familyName: "Lunchford", - middleName: "Elizabeth", - honorificPrefix: "Ms." - }, - title: "Developer Success Engineer", - active: true, - emails: [{ - type: "work", - value: "blair@foo-corp.com", - primary: true - }], - groups: [], - locale: "en-US", - schemas: [ - "urn:ietf:params:scim:schemas:core:2.0:User", - "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" - ], - userName: "blair@foo-corp.com", - addresses: [{ - region: "CA", - primary: true, - locality: "San Francisco", - postalCode: "94016" - }], - externalId: "00u1e8mutl6wlH3lL4x7", - displayName: "Blair Lunchford", - "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": { - manager: { - value: "2", - displayName: "Kate Chapman" - }, - division: "Engineering", - department: "Customer Success" - } - } - } - end - - # ---- construct_event: signature header failures ---- - - def test_construct_event_with_empty_header - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "", - secret: @secret - ) - end - assert_equal "Unable to extract timestamp and signature hash from header", err.message - end - - def test_construct_event_with_empty_signature_hash - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=", - secret: @secret - ) - end - assert_equal "No signature hash found with expected scheme v1", err.message - end - - def test_construct_event_with_incorrect_signature_hash - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=99999", - secret: @secret - ) - end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message - end - - def test_construct_event_with_incorrect_payload - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: "invalid", - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret - ) - end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message - end - - def test_construct_event_with_incorrect_webhook_secret - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: "invalid" - ) - end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message - end - - def test_construct_event_with_timestamp_outside_tolerance - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i - (200 * 1000)}, v1=#{@signature_hash}", - secret: @secret - ) - end - assert_equal "Timestamp outside the tolerance zone", err.message - end - - # ---- construct_event: success cases ---- - - def test_construct_event_with_correct_payload_sig_header_and_secret - webhook = WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret - ) - - assert_equal @expectation, webhook.data - assert_equal "dsync.user.created", webhook.event - assert_equal "wh_123", webhook.id - end - - def test_construct_event_with_correct_payload_sig_header_secret_and_tolerance - webhook = WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret, - tolerance: 300 - ) - - assert_equal @expectation, webhook.data - assert_equal "dsync.user.created", webhook.event - assert_equal "wh_123", webhook.id - end - - # ---- verify_header: signature header failures ---- - - def test_verify_header_with_empty_header - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.verify_header( - payload: @payload, - sig_header: "", - secret: @secret - ) - end - assert_equal "Unable to extract timestamp and signature hash from header", err.message - end - - def test_verify_header_with_empty_signature_hash - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.verify_header( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=", - secret: @secret - ) - end - assert_equal "No signature hash found with expected scheme v1", err.message - end - - def test_verify_header_with_incorrect_signature_hash - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.verify_header( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=99999", - secret: @secret - ) - end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message - end - - def test_verify_header_with_incorrect_payload - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.verify_header( - payload: "invalid", - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret - ) - end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message - end +# This file is auto-generated by oagen. Do not edit. - def test_verify_header_with_incorrect_webhook_secret - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.verify_header( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: "invalid" - ) - end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message - end - - def test_verify_header_with_timestamp_outside_tolerance - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.verify_header( - payload: @payload, - sig_header: "t=#{@timestamp.to_i - (200 * 1000)}, v1=#{@signature_hash}", - secret: @secret - ) - end - assert_equal "Timestamp outside the tolerance zone", err.message - end - - # ---- verify_header: success ---- - - def test_verify_header_returns_true_when_signature_is_valid - WorkOS::Webhooks.verify_header( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret - ) - end - - # ---- get_timestamp_and_signature_hash: signature header failures ---- - - def test_get_timestamp_and_signature_hash_with_empty_header - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "", - secret: @secret - ) - end - assert_equal "Unable to extract timestamp and signature hash from header", err.message - end - - def test_get_timestamp_and_signature_hash_with_empty_signature_hash - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=", - secret: @secret - ) - end - assert_equal "No signature hash found with expected scheme v1", err.message - end +require "test_helper" - def test_get_timestamp_and_signature_hash_with_incorrect_signature_hash - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=99999", - secret: @secret - ) - end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message - end +class WebhooksTest < Minitest::Test + include FixtureHelper - def test_get_timestamp_and_signature_hash_with_incorrect_payload - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: "invalid", - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret - ) - end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") end - def test_get_timestamp_and_signature_hash_with_incorrect_webhook_secret - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: "invalid" - ) - end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message + def test_list_webhook_endpoints_returns_expected_result + stub_request(:get, /#{Regexp.escape("webhook_endpoints")}/) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.webhooks.list_webhook_endpoints + assert_kind_of WorkOS::Types::ListStruct, result end - def test_get_timestamp_and_signature_hash_with_timestamp_outside_tolerance - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i - (200 * 1000)}, v1=#{@signature_hash}", - secret: @secret - ) + def test_list_webhook_endpoints_raises_authentication_error_on_401 + stub_request(:get, /#{Regexp.escape("webhook_endpoints")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.webhooks.list_webhook_endpoints end - assert_equal "Timestamp outside the tolerance zone", err.message end - # ---- get_timestamp_and_signature_hash: success ---- - - def test_get_timestamp_and_signature_hash_returns_timestamp_and_signature - timestamp_int = @timestamp.to_i - timestamp_and_signature = WorkOS::Webhooks.get_timestamp_and_signature_hash( - sig_header: "t=#{timestamp_int}, v1=#{@signature_hash}" - ) - - assert_equal [timestamp_int.to_s, @signature_hash], timestamp_and_signature + def test_create_webhook_endpoint_returns_expected_result + stub_request(:post, /#{Regexp.escape("webhook_endpoints")}/) + .to_return(body: "{}", status: 200) + result = @client.webhooks.create_webhook_endpoint(endpoint_url: "stub", events: []) + refute_nil result end - # ---- compute_signature: signature header failures ---- - - def test_compute_signature_with_empty_header - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "", - secret: @secret - ) + def test_create_webhook_endpoint_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("webhook_endpoints")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.webhooks.create_webhook_endpoint(endpoint_url: "stub", events: []) end - assert_equal "Unable to extract timestamp and signature hash from header", err.message end - def test_compute_signature_with_empty_signature_hash - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=", - secret: @secret - ) - end - assert_equal "No signature hash found with expected scheme v1", err.message + def test_update_webhook_endpoint_returns_expected_result + stub_request(:patch, /#{Regexp.escape("webhook_endpoints")}/) + .to_return(body: "{}", status: 200) + result = @client.webhooks.update_webhook_endpoint(id: "stub") + refute_nil result end - def test_compute_signature_with_incorrect_signature_hash - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=99999", - secret: @secret - ) + def test_update_webhook_endpoint_raises_authentication_error_on_401 + stub_request(:patch, /#{Regexp.escape("webhook_endpoints")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.webhooks.update_webhook_endpoint(id: "stub") end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message end - def test_compute_signature_with_incorrect_payload - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: "invalid", - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: @secret - ) - end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message - end - - def test_compute_signature_with_incorrect_webhook_secret - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i}, v1=#{@signature_hash}", - secret: "invalid" - ) - end - assert_equal "Signature hash does not match the expected signature hash for payload", err.message + def test_delete_webhook_endpoint_returns_expected_result + stub_request(:delete, /#{Regexp.escape("webhook_endpoints")}/) + .to_return(body: "{}", status: 200) + result = @client.webhooks.delete_webhook_endpoint(id: "stub") + assert_nil result if result.nil? end - def test_compute_signature_with_timestamp_outside_tolerance - err = assert_raises(WorkOS::SignatureVerificationError) do - WorkOS::Webhooks.construct_event( - payload: @payload, - sig_header: "t=#{@timestamp.to_i - (200 * 1000)}, v1=#{@signature_hash}", - secret: @secret - ) + def test_delete_webhook_endpoint_raises_authentication_error_on_401 + stub_request(:delete, /#{Regexp.escape("webhook_endpoints")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.webhooks.delete_webhook_endpoint(id: "stub") end - assert_equal "Timestamp outside the tolerance zone", err.message - end - - # ---- compute_signature: success ---- - - def test_compute_signature_returns_computed_signature - timestamp_int = @timestamp.to_i - signature = WorkOS::Webhooks.compute_signature( - timestamp: timestamp_int.to_s, - payload: @payload, - secret: @secret - ) - - assert_equal @signature_hash, signature end end diff --git a/test/workos/test_widgets.rb b/test/workos/test_widgets.rb index 7f3d830e..662baa81 100644 --- a/test/workos/test_widgets.rb +++ b/test/workos/test_widgets.rb @@ -1,60 +1,28 @@ # frozen_string_literal: true -require "test_helper" +# This file is auto-generated by oagen. Do not edit. -class TestWidgets < WorkOS::TestCase - def setup - super - @organization_id = "org_01JCP9G67MNAH0KC4B72XZ67M7" - @user_id = "user_01JCP9H4SHS4N3J6XTKDT7JNPE" - end - - def test_get_token_with_valid_params - VCR.use_cassette "widgets/get_token" do - token = WorkOS::Widgets.get_token( - organization_id: @organization_id, - user_id: @user_id, - scopes: ["widgets:users-table:manage"] - ) +require "test_helper" - assert token.start_with?("eyJhbGciOiJSUzI1NiIsImtpZ") - end - end +class WidgetsTest < Minitest::Test + include FixtureHelper - def test_get_token_with_invalid_organization_id - VCR.use_cassette "widgets/get_token_invalid_organization_id" do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::Widgets.get_token( - organization_id: "bogus-id", - user_id: @user_id, - scopes: ["widgets:users-table:manage"] - ) - end - assert_match(/Organization not found: 'bogus-id'/, err.message) - end + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") end - def test_get_token_with_invalid_user_id - VCR.use_cassette "widgets/get_token_invalid_user_id" do - err = assert_raises(WorkOS::NotFoundError) do - WorkOS::Widgets.get_token( - organization_id: @organization_id, - user_id: "bogus-id", - scopes: ["widgets:users-table:manage"] - ) - end - assert_match(/User not found: 'bogus-id'/, err.message) - end + def test_create_token_returns_expected_result + stub_request(:post, /#{Regexp.escape("widgets")}/) + .to_return(body: "{}", status: 200) + result = @client.widgets.create_token(organization_id: "stub") + refute_nil result end - def test_get_token_with_invalid_scopes - err = assert_raises(ArgumentError) do - WorkOS::Widgets.get_token( - organization_id: @organization_id, - user_id: @user_id, - scopes: ["bogus-scope"] - ) + def test_create_token_raises_authentication_error_on_401 + stub_request(:post, /#{Regexp.escape("widgets")}/) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.widgets.create_token(organization_id: "stub") end - assert_match(/scopes contains an invalid value/, err.message) end end diff --git a/workos.gemspec b/workos.gemspec index a9c51286..88a611fd 100644 --- a/workos.gemspec +++ b/workos.gemspec @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "English" + lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "workos/version" @@ -11,7 +13,7 @@ Gem::Specification.new do |spec| spec.email = ["support@workos.com"] spec.description = "API client for WorkOS" spec.summary = "API client for WorkOS" - spec.homepage = "https://github.com/workos-inc/workos-ruby" + spec.homepage = "https://github.com/workos/workos-ruby" spec.license = "MIT" spec.metadata = { "documentation_uri" => "https://docs.workos.com/sdk/ruby" @@ -20,15 +22,15 @@ Gem::Specification.new do |spec| spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) spec.require_paths = ["lib"] - spec.add_dependency "encryptor", "~> 3.0" spec.add_dependency "jwt", "~> 3.1" + spec.add_dependency "logger", "~> 1.7" + spec.add_dependency "zeitwerk", "~> 2.6" spec.add_development_dependency "bundler", ">= 2.0.1" + spec.add_development_dependency "minitest", "~> 6.0" spec.add_development_dependency "rake" - spec.add_development_dependency "minitest", "~> 5.25" spec.add_development_dependency "standard", "~> 1.49" - spec.add_development_dependency "vcr", "~> 6.0" - spec.add_development_dependency "webmock" + spec.add_development_dependency "webmock", "~> 3.26" spec.required_ruby_version = ">= 3.3" end From cb872c566400d6548fbb27a60f19985663b980c7 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 17:28:21 -0500 Subject: [PATCH 05/12] docs: Document removal of Hash inheritance from response models (#458) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: garen.torikian --- docs/V7_MIGRATION_GUIDE.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/V7_MIGRATION_GUIDE.md b/docs/V7_MIGRATION_GUIDE.md index 28c603d7..a6275f92 100644 --- a/docs/V7_MIGRATION_GUIDE.md +++ b/docs/V7_MIGRATION_GUIDE.md @@ -323,6 +323,40 @@ Examples: If your code imports, type-checks, or pattern matches on these classes, update those references. +#### Response models no longer inherit from `Hash` + +In v6, `WorkOS::DirectoryUser`, `WorkOS::DirectoryGroup`, and other models inherited from an internal `DeprecatedHashWrapper < Hash`. That meant an instance was simultaneously a model and a `Hash`, which produced confusing behavior like this (see [#316](https://github.com/workos/workos-ruby/issues/316)): + +```ruby +user.is_a?(WorkOS::DirectoryUser) # => true +user.is_a?(Hash) # => true (v6) +user.to_hash.is_a?(WorkOS::DirectoryUser) # => true (v6 — returned self) +user.to_h # => "{...}" (v6 — returned a JSON string) +user[:id] # => "user_123" with a deprecation warning +``` + +In v7, models are plain classes that `include WorkOS::HashProvider`. They are no longer `Hash` instances: + +```ruby +user.is_a?(WorkOS::DirectoryUser) # => true +user.is_a?(Hash) # => false +user.to_h # => { id: "user_123", email: "...", ... } (real Hash) +user.to_h.is_a?(Hash) # => true +user.to_json # => '{"id":"user_123",...}' +user[:id] # => NoMethodError +user.to_hash # => NoMethodError +``` + +Update call sites accordingly: + +- Replace `user[:attr]` with the accessor method (`user.attr`). +- Replace `user.to_hash` with `user.to_h`. +- If you relied on passing a model into `**splat` or `Hash#merge` (which used the implicit `to_hash` coercion), call `.to_h` explicitly: `merge(user.to_h)`, `some_method(**user.to_h)`. +- If you called `.to_h` and expected a JSON string, use `.to_json` instead. +- Any `rescue`/log/assertion that inspects a model with `is_a?(Hash)` needs to be updated. + +The `DeprecatedHashWrapper` class and its deprecation warnings have been removed. + ### Error handling #### Error classes are still typed, but the base class contract changed From 6323b255b3719fcfd9d908ee312ecff587957791 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Sun, 19 Apr 2026 19:41:49 -0500 Subject: [PATCH 06/12] restore `include_expired` --- lib/workos/session.rb | 20 +++++++++++++++----- lib/workos/session_manager.rb | 23 +++++++++-------------- test/workos/test_session.rb | 30 ++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/lib/workos/session.rb b/lib/workos/session.rb index 92b4b1a2..a705480b 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -1,13 +1,14 @@ # frozen_string_literal: true # @oagen-ignore-file -# Hand-maintained Session object (H04). Constructed by SessionManager#load. +# Hand-maintained Session object. Constructed by SessionManager#load. require "json" require "jwt" require "openssl" require "uri" module WorkOS + # The Session class provides helper methods for working with WorkOS sessions class Session def initialize(manager, seal_data:, cookie_password:) raise ArgumentError, "cookie_password is required" if cookie_password.nil? || cookie_password.empty? @@ -19,7 +20,11 @@ def initialize(manager, seal_data:, cookie_password:) attr_reader :seal_data, :cookie_password - def authenticate(&claim_extractor) + # Authenticates the user based on the session data + # @param include_expired [Boolean] If true, returns decoded token data even when expired (default: false) + # @param block [Proc] Optional block to call to extract additional claims from the decoded JWT + # @return [Hash] A hash containing the authentication response and a reason if the authentication failed + def authenticate(include_expired: false, &claim_extractor) return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::NO_SESSION_COOKIE_PROVIDED) if @seal_data.nil? || @seal_data.empty? session = begin @@ -30,13 +35,18 @@ def authenticate(&claim_extractor) return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::INVALID_SESSION_COOKIE) unless session.is_a?(Hash) && session["access_token"] decoded = begin - @manager.decode_jwt(session["access_token"]) - rescue JWT::DecodeError, JWT::ExpiredSignature + @manager.decode_jwt(session["access_token"], verify_expiration: !include_expired) + rescue JWT::ExpiredSignature + return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::EXPIRED_JWT) + rescue JWT::DecodeError return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::INVALID_JWT) end + is_expired = decoded["exp"] && decoded["exp"] < Time.now.to_i + SessionManager::AuthSuccess.new( - authenticated: true, + authenticated: !is_expired, + reason: is_expired ? SessionManager::EXPIRED_JWT : nil, session_id: decoded["sid"], organization_id: decoded["org_id"], role: decoded["role"], diff --git a/lib/workos/session_manager.rb b/lib/workos/session_manager.rb index b60c2d87..5fd81fa9 100644 --- a/lib/workos/session_manager.rb +++ b/lib/workos/session_manager.rb @@ -25,7 +25,7 @@ class SessionManager # H04 success / failure shapes — kept minimal & frozen. class AuthSuccess RESERVED_KEYS = [ - :authenticated, :session_id, :organization_id, :role, :roles, + :authenticated, :reason, :session_id, :organization_id, :role, :roles, :permissions, :entitlements, :user, :impersonator, :feature_flags ].freeze @@ -33,18 +33,11 @@ class AuthSuccess def initialize( authenticated:, - session_id:, - organization_id:, - role:, - roles:, - permissions:, - entitlements:, - user:, - impersonator:, - feature_flags:, + session_id:, organization_id:, role:, roles:, permissions:, entitlements:, user:, impersonator:, feature_flags:, reason: nil, custom_claims: nil ) @authenticated = authenticated + @reason = reason @session_id = session_id @organization_id = organization_id @role = role @@ -108,6 +101,7 @@ def normalize_custom_claims(custom_claims) NO_SESSION_COOKIE_PROVIDED = "no_session_cookie_provided" INVALID_SESSION_COOKIE = "invalid_session_cookie" INVALID_JWT = "invalid_jwt" + EXPIRED_JWT = "expired_jwt" # @param client [WorkOS::Client] # @param encryptor [#seal, #unseal] Optional custom encryptor. Defaults to @@ -129,8 +123,8 @@ def load(seal_data:, cookie_password:) end # H05 — Inline convenience: authenticate without manual Session construction. - def authenticate(seal_data:, cookie_password:, &claim_extractor) - load(seal_data: seal_data, cookie_password: cookie_password).authenticate(&claim_extractor) + def authenticate(seal_data:, cookie_password:, include_expired: false, &claim_extractor) + load(seal_data: seal_data, cookie_password: cookie_password).authenticate(include_expired: include_expired, &claim_extractor) end # H05 — Inline convenience: refresh without manual Session construction. @@ -161,7 +155,7 @@ def seal_session_from_auth_response(access_token:, refresh_token:, cookie_passwo # Verify an access-token JWT against the WorkOS JWKS for this client. # Used by Session#authenticate; exposed publicly for advanced cases. - def decode_jwt(access_token) + def decode_jwt(access_token, verify_expiration: true) jwks = fetch_jwks JWT.decode( access_token, @@ -169,7 +163,8 @@ def decode_jwt(access_token) true, algorithms: JWK_ALGORITHMS, jwks: jwks, - verify_aud: false + verify_aud: false, + verify_expiration: verify_expiration ).first end diff --git a/test/workos/test_session.rb b/test/workos/test_session.rb index c45636a6..669063ea 100644 --- a/test/workos/test_session.rb +++ b/test/workos/test_session.rb @@ -157,6 +157,36 @@ def test_authenticate_returns_invalid_jwt_on_bad_signature assert_equal WorkOS::SessionManager::INVALID_JWT, result.reason end + def test_authenticate_returns_expired_jwt_when_expired_and_include_expired_is_false + rsa, pub = signing_key_pair + # Token expired 60 seconds ago + access_token = make_jwt({"sid" => "session_expired", "exp" => Time.now.to_i - 60}, rsa) + sealed = @sm.seal_data({"access_token" => access_token}, PASSWORD) + + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) + + result = @sm.authenticate(seal_data: sealed, cookie_password: PASSWORD, include_expired: false) + assert_equal WorkOS::SessionManager::EXPIRED_JWT, result.reason + refute result.authenticated + end + + def test_authenticate_returns_auth_success_with_authenticated_false_when_expired_and_include_expired_is_true + rsa, pub = signing_key_pair + # Token expired 60 seconds ago + access_token = make_jwt({"sid" => "session_expired", "exp" => Time.now.to_i - 60}, rsa) + sealed = @sm.seal_data({"access_token" => access_token}, PASSWORD) + + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) + + result = @sm.authenticate(seal_data: sealed, cookie_password: PASSWORD, include_expired: true) + assert_kind_of WorkOS::SessionManager::AuthSuccess, result + refute result.authenticated + assert_equal WorkOS::SessionManager::EXPIRED_JWT, result.reason + assert_equal "session_expired", result.session_id + end + # --- get_logout_url ------------------------------------------------------- def test_get_logout_url_includes_session_id_from_authenticate From bd0ba7dfc25c9963f4a65cde72cc881f83db8640 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Sun, 19 Apr 2026 19:42:28 -0500 Subject: [PATCH 07/12] bulk up migration guide around sessions --- docs/V7_MIGRATION_GUIDE.md | 209 ++++++++++++++++++++++++++++++++++++- 1 file changed, 204 insertions(+), 5 deletions(-) diff --git a/docs/V7_MIGRATION_GUIDE.md b/docs/V7_MIGRATION_GUIDE.md index a6275f92..cde8d445 100644 --- a/docs/V7_MIGRATION_GUIDE.md +++ b/docs/V7_MIGRATION_GUIDE.md @@ -421,7 +421,50 @@ This is mostly an improvement, but if you implemented your own pagination assump ### AuthKit sessions and cookies -#### Session management moved out of `UserManagement` and into `SessionManager` +Session management was one of the largest refactors in v7. The old `WorkOS::Session`, the `session:` kwarg on `authenticate_with_*`, and the class-level `seal_data` / `unseal_data` helpers were all replaced by a dedicated `WorkOS::SessionManager` on the client. The behavior is similar, but the surface area, return types, parameter names, and reason strings all changed. + +If your application seals session cookies, refreshes access tokens, or decodes the access-token JWT, every one of these call sites needs to be updated. + +#### Sealing a cookie from an authentication response + +In v6, you asked `authenticate_with_*` to seal the cookie for you: + +```ruby +response = WorkOS::UserManagement.authenticate_with_code( + code: code, + client_id: client_id, + session: { seal_session: true, cookie_password: cookie_password } +) + +response.sealed_session # => "..." +``` + +In v7, the `session:` kwarg has been removed from **every** `authenticate_with_*` helper. Seal the cookie yourself after the authenticate call: + +```ruby +response = client.user_management.authenticate_with_code(code: code) + +sealed = client.session_manager.seal_session_from_auth_response( + access_token: response.access_token, + refresh_token: response.refresh_token, + cookie_password: cookie_password, + user: response.user, + impersonator: response.impersonator +) +``` + +This applies to all of: + +- `authenticate_with_code` +- `authenticate_with_password` +- `authenticate_with_refresh_token` +- `authenticate_with_magic_auth` +- `authenticate_with_email_verification` +- `authenticate_with_totp` +- `authenticate_with_organization_selection` +- `authenticate_with_device_code` + +#### Loading a session from a sealed cookie Before: @@ -429,7 +472,8 @@ Before: session = WorkOS::UserManagement.load_sealed_session( client_id: client_id, session_data: session_data, - cookie_password: cookie_password + cookie_password: cookie_password, + encryptor: custom_encryptor # optional ) ``` @@ -442,11 +486,166 @@ session = client.session_manager.load( ) ``` -Refresh and authenticate helpers also moved: +Notable changes: + +- The kwarg is renamed from `session_data:` to `seal_data:`. +- `client_id` is no longer passed per-call; it is read from the client instance. +- A custom `encryptor:` is now supplied when the manager is created, not on `load`: + + ```ruby + client.session_manager(encryptor: custom_encryptor) + # or, for full control: + WorkOS::SessionManager.new(client, encryptor: custom_encryptor) + ``` + +#### Authenticating a loaded session + +The return type changed from a `Hash` to a typed result object. **Any code that reads `result[:authenticated]` or `result[:reason]` needs to be updated.** + +Before: + +```ruby +result = session.authenticate + +result[:authenticated] # => true / false +result[:reason] # => 'INVALID_SESSION_COOKIE' (uppercase string) +result[:session_id] +result[:feature_flags] +``` + +After: ```ruby -client.session_manager.authenticate(...) -client.session_manager.refresh(...) +result = session.authenticate + +case result +when WorkOS::SessionManager::AuthSuccess + result.authenticated # => true + result.session_id + result.organization_id + result.role + result.roles + result.permissions + result.entitlements + result.feature_flags + result.user + result.impersonator +when WorkOS::SessionManager::AuthError + result.authenticated # => false + result.reason # => "invalid_session_cookie" (lowercase string) +end ``` +Additional behavioral changes: + +- **Reason strings are now lowercase.** `'NO_SESSION_COOKIE_PROVIDED'` → `"no_session_cookie_provided"`, `'INVALID_SESSION_COOKIE'` → `"invalid_session_cookie"`, `'INVALID_JWT'` → `"invalid_jwt"`. These are exposed as constants on `WorkOS::SessionManager` (`NO_SESSION_COOKIE_PROVIDED`, `INVALID_SESSION_COOKIE`, `INVALID_JWT`) — prefer the constants over string literals. +- **`claim_extractor` semantics changed.** In v6 the block's returned Hash was merged flat into the result Hash. In v7 the returned Hash is stored as `custom_claims` on `AuthSuccess` and accessed via `#[]` or via dynamic readers: + + ```ruby + result = session.authenticate do |decoded_jwt| + { tenant_id: decoded_jwt["tenant_id"] } + end + + result[:tenant_id] # => "tnt_123" + result.tenant_id # => "tnt_123" + result.to_h[:tenant_id] + ``` + + The extractor **must** return a Hash and **must not** overwrite reserved keys (`authenticated`, `session_id`, `organization_id`, `role`, `roles`, `permissions`, `entitlements`, `user`, `impersonator`, `feature_flags`); doing either raises `ArgumentError`. + +#### Refreshing a loaded session + +The return shape was flattened and the option-hash parameter style was replaced with keyword arguments. + +Before: + +```ruby +result = session.refresh( + cookie_password: cookie_password, + organization_id: "org_123" +) + +result[:authenticated] +result[:sealed_session] +result[:session].user # nested AuthenticationResponse +result[:session].sealed_session +result[:reason] +``` + +After: + +```ruby +result = session.refresh( + organization_id: "org_123", + cookie_password: cookie_password # optional; defaults to the password used at load +) + +case result +when WorkOS::SessionManager::RefreshSuccess + result.sealed_session # new sealed cookie to write back to the browser + result.session_id + result.organization_id + result.role + result.roles + result.permissions + result.entitlements + result.user + result.impersonator + result.feature_flags +when WorkOS::SessionManager::RefreshError + result.authenticated # => false + result.reason +end +``` + +The nested `result[:session]` field is gone; the fields that used to live on that inner `AuthenticationResponse` are now exposed directly on `RefreshSuccess`. `session.refresh` also updates the `Session`'s internal `seal_data` / `cookie_password` in place, so a subsequent `session.authenticate` will use the refreshed token without reconstructing the `Session`. + +For call sites that don't need a long-lived `Session` object, `SessionManager` also exposes inline helpers: + +```ruby +client.session_manager.authenticate(seal_data: session_data, cookie_password: cookie_password) +client.session_manager.refresh(seal_data: session_data, cookie_password: cookie_password) +``` + +#### Building a logout URL + +Before: + +```ruby +url = session.get_logout_url(return_to: "https://example.com") +# or, if you only had the session_id: +url = WorkOS::UserManagement.get_logout_url(session_id: sid) +``` + +After: + +```ruby +url = session.get_logout_url(return_to: "https://example.com") +# or, via the UserManagement service: +url = client.user_management.get_logout_url(session_id: sid, return_to: "https://example.com") +``` + +`Session#get_logout_url` now calls `authenticate` internally to extract the `session_id` and raises `WorkOS::Error` (instead of a plain `RuntimeError`) if authentication fails. + +#### Raw seal / unseal helpers + +The class methods `WorkOS::Session.seal_data` and `WorkOS::Session.unseal_data` were removed. Use the instance methods on `SessionManager` instead: + +```ruby +# Before +sealed = WorkOS::Session.seal_data(payload, key) +WorkOS::Session.unseal_data(sealed, key) + +# After +sealed = client.session_manager.seal_data(payload, key) +client.session_manager.unseal_data(sealed, key) +``` + +A custom encryptor passed to `client.session_manager(encryptor: ...)` is used by these helpers as well. + +#### Deprecations to clean up + +- `WorkOS::SessionManager::SEAL_VERSION` is deprecated in favor of `WorkOS::Encryptors::AesGcm::SEAL_VERSION`. Update any code reading the constant off the manager. +- `WorkOS::Session.new(...)` is still callable but its constructor signature changed (`Session.new(manager, seal_data:, cookie_password:)`). Prefer `client.session_manager.load(...)` — direct instantiation is no longer part of the public contract. + If your app relies on session sealing or cookie refresh behavior, verify those flows carefully in integration tests. From 82dca953b9573c6111380f0672601dafd948da95 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Mon, 20 Apr 2026 04:04:23 -0400 Subject: [PATCH 08/12] updates --- .oagen-manifest.json | 28 +- lib/workos/admin_portal.rb | 5 +- lib/workos/api_keys.rb | 58 +- lib/workos/audit_logs.rb | 133 ++-- .../audit_logs/audit_log_action_json.rb | 36 ++ .../audit_logs/audit_log_export_creation.rb | 2 +- .../audit_logs/audit_log_export_json.rb | 39 ++ lib/workos/audit_logs/audit_log_schema.rb | 13 +- .../audit_logs/audit_log_schema_json.rb | 39 ++ .../audit_logs/audit_log_schema_json_actor.rb | 7 + .../audit_log_schema_json_target.rb | 27 + .../audit_logs/audit_log_schema_target.rb | 22 +- lib/workos/authorization.rb | 540 ++++++++-------- lib/workos/connect.rb | 121 ++-- lib/workos/directory_sync.rb | 161 +++-- lib/workos/directory_sync/directory_user.rb | 8 +- .../directory_user_with_groups.rb | 8 +- .../directory_sync/dsync_user_updated_data.rb | 8 +- lib/workos/events.rb | 52 +- lib/workos/feature_flags.rb | 151 ++--- lib/workos/multi_factor_auth.rb | 73 ++- lib/workos/organization_domains.rb | 20 +- lib/workos/organizations.rb | 76 ++- .../audit_logs_retention_json.rb | 23 + lib/workos/organizations/organization.rb | 2 +- .../organizations/update_organization.rb | 2 +- lib/workos/pipes.rb | 25 +- ...ns_list_response_data_connected_account.rb | 4 +- lib/workos/radar.rb | 20 +- .../event_context_google_analytics_session.rb | 6 +- lib/workos/sso.rb | 84 +-- lib/workos/sso/connection.rb | 2 +- lib/workos/types/applications_order.rb | 7 +- .../types/audit_log_export_json_state.rb | 14 + lib/workos/types/audit_logs_order.rb | 2 +- .../authentication_factor_enrolled_type.rb | 8 +- .../types/authentication_factor_type.rb | 8 +- lib/workos/types/authorization_order.rb | 2 +- ...nnection_activated_data_connection_type.rb | 54 +- .../types/connection_activated_data_state.rb | 9 +- .../types/connection_activated_data_status.rb | 6 +- ...ection_deactivated_data_connection_type.rb | 2 +- .../connection_deactivated_data_state.rb | 2 +- .../connection_deactivated_data_status.rb | 2 +- ...connection_deleted_data_connection_type.rb | 54 +- .../types/connection_deleted_data_state.rb | 9 +- ...uired_data_certificate_certificate_type.rb | 7 +- ...newed_data_certificate_certificate_type.rb | 7 +- lib/workos/types/connection_status.rb | 6 +- lib/workos/types/connections_order.rb | 2 +- lib/workos/types/directories_order.rb | 2 +- lib/workos/types/directory_groups_order.rb | 2 +- lib/workos/types/directory_users_order.rb | 2 +- .../types/dsync_activated_data_state.rb | 9 +- lib/workos/types/dsync_activated_data_type.rb | 27 +- .../types/dsync_deactivated_data_state.rb | 2 +- .../types/dsync_deactivated_data_type.rb | 2 +- lib/workos/types/dsync_deleted_data_state.rb | 9 +- lib/workos/types/dsync_deleted_data_type.rb | 27 +- lib/workos/types/events_order.rb | 7 +- lib/workos/types/feature_flags_order.rb | 2 +- .../types/invitation_accepted_data_state.rb | 8 +- .../types/invitation_created_data_state.rb | 2 +- .../types/invitation_resent_data_state.rb | 2 +- .../types/invitation_revoked_data_state.rb | 2 +- lib/workos/types/invitation_state.rb | 8 +- .../organization_created_data_domain_state.rb | 9 +- ...eated_data_domain_verification_strategy.rb | 6 +- .../organization_deleted_data_domain_state.rb | 2 +- ...leted_data_domain_verification_strategy.rb | 2 +- .../organization_domain_created_data_state.rb | 2 +- ...main_created_data_verification_strategy.rb | 2 +- .../organization_domain_deleted_data_state.rb | 2 +- ...main_deleted_data_verification_strategy.rb | 2 +- .../organization_domain_stand_alone_state.rb | 2 +- ...omain_stand_alone_verification_strategy.rb | 2 +- lib/workos/types/organization_domain_state.rb | 9 +- .../organization_domain_updated_data_state.rb | 2 +- ...main_updated_data_verification_strategy.rb | 2 +- ...n_failed_data_organization_domain_state.rb | 2 +- ...ganization_domain_verification_strategy.rb | 2 +- ...ganization_domain_verification_strategy.rb | 6 +- ...organization_domain_verified_data_state.rb | 2 +- ...ain_verified_data_verification_strategy.rb | 2 +- ...nization_membership_created_data_status.rb | 7 +- ...nization_membership_deleted_data_status.rb | 2 +- .../types/organization_membership_status.rb | 7 +- ...nization_membership_updated_data_status.rb | 2 +- .../organization_updated_data_domain_state.rb | 2 +- ...dated_data_domain_verification_strategy.rb | 2 +- .../types/organizations_api_keys_order.rb | 2 +- .../organizations_feature_flags_order.rb | 2 +- lib/workos/types/organizations_order.rb | 2 +- lib/workos/types/permissions_order.rb | 2 +- ...adar_standalone_response_blocklist_type.rb | 11 +- lib/workos/types/radar_type.rb | 11 +- .../types/session_created_data_auth_method.rb | 14 +- .../types/session_created_data_status.rb | 7 +- .../types/session_revoked_data_auth_method.rb | 2 +- .../types/session_revoked_data_status.rb | 2 +- .../types/update_webhook_endpoint_status.rb | 6 +- lib/workos/types/user_invite_state.rb | 2 +- .../user_management_invitations_order.rb | 2 +- ...ement_multi_factor_authentication_order.rb | 2 +- ...anagement_organization_membership_order.rb | 2 +- ...gement_organization_membership_statuses.rb | 2 +- ...ent_users_authorized_applications_order.rb | 2 +- ...er_management_users_feature_flags_order.rb | 2 +- .../types/user_management_users_order.rb | 2 +- ...zation_membership_base_list_data_status.rb | 2 +- .../user_organization_membership_status.rb | 2 +- lib/workos/types/user_sessions_auth_method.rb | 14 +- lib/workos/types/user_sessions_status.rb | 7 +- .../vault_data_created_data_actor_source.rb | 6 +- .../vault_data_deleted_data_actor_source.rb | 2 +- .../vault_data_read_data_actor_source.rb | 2 +- .../vault_data_updated_data_actor_source.rb | 2 +- .../vault_dek_decrypted_data_actor_source.rb | 2 +- .../types/vault_dek_read_data_actor_source.rb | 6 +- .../vault_kek_created_data_actor_source.rb | 2 +- .../vault_metadata_read_data_actor_source.rb | 2 +- .../vault_names_listed_data_actor_source.rb | 2 +- .../types/webhook_endpoint_json_status.rb | 9 + lib/workos/types/webhooks_order.rb | 2 +- lib/workos/user_management.rb | 598 +++++++++++------- .../user_management/jwks_response_keys.rb | 16 +- lib/workos/webhooks.rb | 63 +- lib/workos/webhooks/webhook_endpoint_json.rb | 45 ++ lib/workos/widgets.rb | 5 +- rbi/workos/action_authentication_denied.rbi | 1 + .../action_authentication_denied_data.rbi | 1 + .../action_user_registration_denied.rbi | 1 + .../action_user_registration_denied_data.rbi | 1 + rbi/workos/add_role_permission.rbi | 1 + rbi/workos/admin_portal.rbi | 1 + rbi/workos/api_key.rbi | 1 + rbi/workos/api_key_created.rbi | 1 + rbi/workos/api_key_created_data.rbi | 1 + rbi/workos/api_key_created_data_owner.rbi | 1 + rbi/workos/api_key_owner.rbi | 1 + rbi/workos/api_key_revoked.rbi | 1 + rbi/workos/api_key_revoked_data.rbi | 1 + rbi/workos/api_key_revoked_data_owner.rbi | 1 + rbi/workos/api_key_validation_response.rbi | 1 + rbi/workos/api_key_with_value.rbi | 1 + rbi/workos/api_key_with_value_owner.rbi | 1 + rbi/workos/api_keys.rbi | 1 + .../application_credentials_list_item.rbi | 1 + rbi/workos/assign_role.rbi | 1 + rbi/workos/audit_log_action_json.rbi | 48 ++ rbi/workos/audit_log_configuration.rbi | 1 + .../audit_log_configuration_log_stream.rbi | 1 + rbi/workos/audit_log_event.rbi | 1 + rbi/workos/audit_log_event_actor.rbi | 1 + rbi/workos/audit_log_event_context.rbi | 1 + .../audit_log_event_create_response.rbi | 1 + rbi/workos/audit_log_event_ingestion.rbi | 1 + rbi/workos/audit_log_event_target.rbi | 1 + rbi/workos/audit_log_export_creation.rbi | 1 + rbi/workos/audit_log_export_json.rbi | 54 ++ rbi/workos/audit_log_schema.rbi | 19 +- rbi/workos/audit_log_schema_actor.rbi | 1 + rbi/workos/audit_log_schema_json.rbi | 54 ++ rbi/workos/audit_log_schema_json_actor.rbi | 24 + rbi/workos/audit_log_schema_json_target.rbi | 30 + rbi/workos/audit_log_schema_target.rbi | 1 + rbi/workos/audit_logs.rbi | 15 +- rbi/workos/audit_logs_retention_json.rbi | 24 + rbi/workos/authenticate_response.rbi | 1 + .../authenticate_response_impersonator.rbi | 1 + .../authenticate_response_oauth_token.rbi | 1 + rbi/workos/authentication_challenge.rbi | 1 + ...thentication_challenge_verify_response.rbi | 1 + ...thentication_challenges_verify_request.rbi | 1 + ...thentication_email_verification_failed.rbi | 1 + ...ication_email_verification_failed_data.rbi | 1 + ...n_email_verification_failed_data_error.rbi | 1 + ...ntication_email_verification_succeeded.rbi | 1 + ...tion_email_verification_succeeded_data.rbi | 1 + rbi/workos/authentication_factor.rbi | 1 + rbi/workos/authentication_factor_enrolled.rbi | 1 + .../authentication_factor_enrolled_sms.rbi | 1 + .../authentication_factor_enrolled_totp.rbi | 1 + rbi/workos/authentication_factor_sms.rbi | 1 + rbi/workos/authentication_factor_totp.rbi | 1 + .../authentication_factors_create_request.rbi | 1 + .../authentication_magic_auth_failed.rbi | 1 + .../authentication_magic_auth_failed_data.rbi | 1 + ...ntication_magic_auth_failed_data_error.rbi | 1 + .../authentication_magic_auth_succeeded.rbi | 1 + ...thentication_magic_auth_succeeded_data.rbi | 1 + rbi/workos/authentication_mfa_failed.rbi | 1 + rbi/workos/authentication_mfa_failed_data.rbi | 1 + .../authentication_mfa_failed_data_error.rbi | 1 + rbi/workos/authentication_mfa_succeeded.rbi | 1 + .../authentication_mfa_succeeded_data.rbi | 1 + rbi/workos/authentication_oauth_failed.rbi | 1 + .../authentication_oauth_failed_data.rbi | 1 + ...authentication_oauth_failed_data_error.rbi | 1 + rbi/workos/authentication_oauth_succeeded.rbi | 1 + .../authentication_oauth_succeeded_data.rbi | 1 + rbi/workos/authentication_passkey_failed.rbi | 1 + .../authentication_passkey_failed_data.rbi | 1 + ...thentication_passkey_failed_data_error.rbi | 1 + .../authentication_passkey_succeeded.rbi | 1 + .../authentication_passkey_succeeded_data.rbi | 1 + rbi/workos/authentication_password_failed.rbi | 1 + .../authentication_password_failed_data.rbi | 1 + ...hentication_password_failed_data_error.rbi | 1 + .../authentication_password_succeeded.rbi | 1 + ...authentication_password_succeeded_data.rbi | 1 + .../authentication_radar_risk_detected.rbi | 1 + ...uthentication_radar_risk_detected_data.rbi | 1 + rbi/workos/authentication_sso_failed.rbi | 1 + rbi/workos/authentication_sso_failed_data.rbi | 1 + .../authentication_sso_failed_data_error.rbi | 1 + .../authentication_sso_failed_data_sso.rbi | 1 + rbi/workos/authentication_sso_started.rbi | 1 + .../authentication_sso_started_data.rbi | 1 + .../authentication_sso_started_data_sso.rbi | 1 + rbi/workos/authentication_sso_succeeded.rbi | 1 + .../authentication_sso_succeeded_data.rbi | 1 + .../authentication_sso_succeeded_data_sso.rbi | 1 + rbi/workos/authentication_sso_timed_out.rbi | 1 + .../authentication_sso_timed_out_data.rbi | 1 + ...uthentication_sso_timed_out_data_error.rbi | 1 + .../authentication_sso_timed_out_data_sso.rbi | 1 + rbi/workos/authorization.rbi | 1 + rbi/workos/authorization_check.rbi | 1 + ...tion_code_session_authenticate_request.rbi | 1 + rbi/workos/authorization_permission.rbi | 1 + rbi/workos/authorization_resource.rbi | 1 + ...thorized_connect_application_list_data.rbi | 1 + .../challenge_authentication_factor.rbi | 1 + rbi/workos/check_authorization.rbi | 1 + rbi/workos/client.rbi | 1 + rbi/workos/confirm_email_change.rbi | 1 + rbi/workos/connect.rbi | 1 + rbi/workos/connect_application.rbi | 1 + rbi/workos/connected_account.rbi | 1 + rbi/workos/connection.rbi | 1 + rbi/workos/connection_activated.rbi | 1 + rbi/workos/connection_activated_data.rbi | 1 + .../connection_activated_data_domain.rbi | 1 + rbi/workos/connection_deactivated.rbi | 1 + rbi/workos/connection_deactivated_data.rbi | 1 + .../connection_deactivated_data_domain.rbi | 1 + rbi/workos/connection_deleted.rbi | 1 + rbi/workos/connection_deleted_data.rbi | 1 + rbi/workos/connection_domain.rbi | 1 + rbi/workos/connection_option.rbi | 1 + ...tion_saml_certificate_renewal_required.rbi | 1 + ...saml_certificate_renewal_required_data.rbi | 1 + ...cate_renewal_required_data_certificate.rbi | 1 + ...icate_renewal_required_data_connection.rbi | 1 + .../connection_saml_certificate_renewed.rbi | 1 + ...nnection_saml_certificate_renewed_data.rbi | 1 + ...l_certificate_renewed_data_certificate.rbi | 1 + ...ml_certificate_renewed_data_connection.rbi | 1 + rbi/workos/cors_origin_response.rbi | 1 + rbi/workos/create_application_secret.rbi | 1 + .../create_authorization_permission.rbi | 1 + rbi/workos/create_authorization_resource.rbi | 1 + rbi/workos/create_cors_origin.rbi | 1 + rbi/workos/create_m2m_application.rbi | 1 + rbi/workos/create_magic_code_and_return.rbi | 1 + rbi/workos/create_oauth_application.rbi | 1 + rbi/workos/create_organization_api_key.rbi | 1 + rbi/workos/create_organization_domain.rbi | 1 + rbi/workos/create_organization_role.rbi | 1 + rbi/workos/create_password_reset.rbi | 1 + rbi/workos/create_password_reset_token.rbi | 1 + rbi/workos/create_redirect_uri.rbi | 1 + rbi/workos/create_role.rbi | 1 + rbi/workos/create_user.rbi | 1 + rbi/workos/create_user_invite_options.rbi | 1 + .../create_user_organization_membership.rbi | 1 + rbi/workos/create_webhook_endpoint.rbi | 1 + ...data_integration_access_token_response.rbi | 1 + ...ion_access_token_response_access_token.rbi | 1 + ...ata_integration_authorize_url_response.rbi | 1 + ...data_integration_authorize_url_request.rbi | 1 + ...ta_integrations_get_user_token_request.rbi | 1 + .../data_integrations_list_response.rbi | 1 + .../data_integrations_list_response_data.rbi | 1 + ...s_list_response_data_connected_account.rbi | 1 + rbi/workos/device_authorization_response.rbi | 1 + ...vice_code_session_authenticate_request.rbi | 1 + rbi/workos/directory.rbi | 1 + rbi/workos/directory_group.rbi | 1 + rbi/workos/directory_metadata.rbi | 1 + rbi/workos/directory_metadata_user.rbi | 1 + rbi/workos/directory_sync.rbi | 1 + rbi/workos/directory_user.rbi | 1 + rbi/workos/directory_user_email.rbi | 1 + rbi/workos/directory_user_with_groups.rbi | 1 + .../directory_user_with_groups_email.rbi | 1 + rbi/workos/dsync_activated.rbi | 1 + rbi/workos/dsync_activated_data.rbi | 1 + rbi/workos/dsync_activated_data_domain.rbi | 1 + rbi/workos/dsync_deactivated.rbi | 1 + rbi/workos/dsync_deactivated_data.rbi | 1 + rbi/workos/dsync_deactivated_data_domain.rbi | 1 + rbi/workos/dsync_deleted.rbi | 1 + rbi/workos/dsync_deleted_data.rbi | 1 + rbi/workos/dsync_group_created.rbi | 1 + rbi/workos/dsync_group_deleted.rbi | 1 + rbi/workos/dsync_group_updated.rbi | 1 + rbi/workos/dsync_group_updated_data.rbi | 1 + rbi/workos/dsync_group_user_added.rbi | 1 + rbi/workos/dsync_group_user_added_data.rbi | 1 + rbi/workos/dsync_group_user_removed.rbi | 1 + rbi/workos/dsync_group_user_removed_data.rbi | 1 + rbi/workos/dsync_user_created.rbi | 1 + rbi/workos/dsync_user_deleted.rbi | 1 + rbi/workos/dsync_user_updated.rbi | 1 + rbi/workos/dsync_user_updated_data.rbi | 1 + rbi/workos/dsync_user_updated_data_email.rbi | 1 + rbi/workos/email_change.rbi | 1 + rbi/workos/email_change_confirmation.rbi | 1 + rbi/workos/email_change_confirmation_user.rbi | 1 + rbi/workos/email_verification.rbi | 1 + ...tion_code_session_authenticate_request.rbi | 1 + rbi/workos/email_verification_created.rbi | 1 + .../email_verification_created_data.rbi | 1 + .../enroll_user_authentication_factor.rbi | 1 + rbi/workos/event_context.rbi | 1 + rbi/workos/event_context_actor.rbi | 1 + ...event_context_google_analytics_session.rbi | 1 + rbi/workos/event_list_list_metadata.rbi | 1 + rbi/workos/event_schema.rbi | 1 + rbi/workos/events.rbi | 1 + .../external_auth_complete_response.rbi | 1 + rbi/workos/feature_flag.rbi | 1 + rbi/workos/feature_flag_owner.rbi | 1 + rbi/workos/feature_flags.rbi | 1 + rbi/workos/flag.rbi | 1 + rbi/workos/flag_created.rbi | 1 + rbi/workos/flag_created_context.rbi | 1 + rbi/workos/flag_created_context_actor.rbi | 1 + rbi/workos/flag_created_data.rbi | 1 + rbi/workos/flag_created_data_owner.rbi | 1 + rbi/workos/flag_deleted.rbi | 1 + rbi/workos/flag_deleted_context.rbi | 1 + rbi/workos/flag_deleted_context_actor.rbi | 1 + rbi/workos/flag_deleted_data.rbi | 1 + rbi/workos/flag_deleted_data_owner.rbi | 1 + rbi/workos/flag_owner.rbi | 1 + rbi/workos/flag_rule_updated.rbi | 1 + rbi/workos/flag_rule_updated_context.rbi | 1 + .../flag_rule_updated_context_actor.rbi | 1 + ...rule_updated_context_configured_target.rbi | 1 + ...context_configured_target_organization.rbi | 1 + ...updated_context_configured_target_user.rbi | 1 + ...ule_updated_context_previous_attribute.rbi | 1 + ...ted_context_previous_attribute_context.rbi | 1 + ...us_attribute_context_configured_target.rbi | 1 + ...context_configured_target_organization.rbi | 1 + ...tribute_context_configured_target_user.rbi | 1 + ...pdated_context_previous_attribute_data.rbi | 1 + rbi/workos/flag_rule_updated_data.rbi | 1 + rbi/workos/flag_rule_updated_data_owner.rbi | 1 + rbi/workos/flag_updated.rbi | 1 + rbi/workos/flag_updated_context.rbi | 1 + rbi/workos/flag_updated_context_actor.rbi | 1 + ...lag_updated_context_previous_attribute.rbi | 1 + ...pdated_context_previous_attribute_data.rbi | 1 + rbi/workos/flag_updated_data.rbi | 1 + rbi/workos/flag_updated_data_owner.rbi | 1 + rbi/workos/generate_link.rbi | 1 + rbi/workos/group.rbi | 1 + rbi/workos/group_created.rbi | 1 + rbi/workos/group_deleted.rbi | 1 + rbi/workos/group_member_added.rbi | 1 + rbi/workos/group_member_added_data.rbi | 1 + rbi/workos/group_member_removed.rbi | 1 + rbi/workos/group_member_removed_data.rbi | 1 + rbi/workos/group_updated.rbi | 1 + rbi/workos/intent_options.rbi | 1 + rbi/workos/invitation.rbi | 1 + rbi/workos/invitation_accepted.rbi | 1 + rbi/workos/invitation_accepted_data.rbi | 1 + rbi/workos/invitation_created.rbi | 1 + rbi/workos/invitation_created_data.rbi | 1 + rbi/workos/invitation_resent.rbi | 1 + rbi/workos/invitation_resent_data.rbi | 1 + rbi/workos/invitation_revoked.rbi | 1 + rbi/workos/invitation_revoked_data.rbi | 1 + rbi/workos/jwks_response.rbi | 1 + rbi/workos/jwks_response_keys.rbi | 1 + rbi/workos/jwt_template_response.rbi | 1 + rbi/workos/magic_auth.rbi | 1 + ...auth_code_session_authenticate_request.rbi | 1 + rbi/workos/magic_auth_created.rbi | 1 + rbi/workos/magic_auth_created_data.rbi | 1 + .../mfa_totp_session_authenticate_request.rbi | 1 + rbi/workos/multi_factor_auth.rbi | 1 + rbi/workos/new_connect_application_secret.rbi | 1 + rbi/workos/organization.rbi | 1 + rbi/workos/organization_created.rbi | 1 + rbi/workos/organization_created_data.rbi | 1 + .../organization_created_data_domain.rbi | 1 + rbi/workos/organization_deleted.rbi | 1 + rbi/workos/organization_deleted_data.rbi | 1 + .../organization_deleted_data_domain.rbi | 1 + rbi/workos/organization_domain.rbi | 1 + rbi/workos/organization_domain_created.rbi | 1 + .../organization_domain_created_data.rbi | 1 + rbi/workos/organization_domain_data.rbi | 1 + rbi/workos/organization_domain_deleted.rbi | 1 + .../organization_domain_deleted_data.rbi | 1 + .../organization_domain_stand_alone.rbi | 1 + rbi/workos/organization_domain_updated.rbi | 1 + .../organization_domain_updated_data.rbi | 1 + ...rganization_domain_verification_failed.rbi | 1 + ...zation_domain_verification_failed_data.rbi | 1 + ...cation_failed_data_organization_domain.rbi | 1 + rbi/workos/organization_domain_verified.rbi | 1 + .../organization_domain_verified_data.rbi | 1 + rbi/workos/organization_domains.rbi | 1 + rbi/workos/organization_input.rbi | 1 + rbi/workos/organization_membership.rbi | 1 + .../organization_membership_created.rbi | 1 + .../organization_membership_created_data.rbi | 1 + .../organization_membership_deleted.rbi | 1 + .../organization_membership_deleted_data.rbi | 1 + .../organization_membership_updated.rbi | 1 + .../organization_membership_updated_data.rbi | 1 + rbi/workos/organization_role_created.rbi | 1 + rbi/workos/organization_role_created_data.rbi | 1 + rbi/workos/organization_role_deleted.rbi | 1 + rbi/workos/organization_role_deleted_data.rbi | 1 + rbi/workos/organization_role_updated.rbi | 1 + rbi/workos/organization_role_updated_data.rbi | 1 + ...selection_session_authenticate_request.rbi | 1 + rbi/workos/organization_updated.rbi | 1 + rbi/workos/organization_updated_data.rbi | 1 + .../organization_updated_data_domain.rbi | 1 + rbi/workos/organizations.rbi | 1 + rbi/workos/password_reset.rbi | 1 + rbi/workos/password_reset_created.rbi | 1 + rbi/workos/password_reset_created_data.rbi | 1 + rbi/workos/password_reset_succeeded.rbi | 1 + rbi/workos/password_reset_succeeded_data.rbi | 1 + .../password_session_authenticate_request.rbi | 1 + rbi/workos/permission.rbi | 1 + rbi/workos/permission_created.rbi | 1 + rbi/workos/permission_created_data.rbi | 1 + rbi/workos/permission_deleted.rbi | 1 + rbi/workos/permission_deleted_data.rbi | 1 + rbi/workos/permission_updated.rbi | 1 + rbi/workos/permission_updated_data.rbi | 1 + rbi/workos/pipes.rbi | 1 + rbi/workos/portal_link_response.rbi | 1 + rbi/workos/profile.rbi | 1 + rbi/workos/radar.rbi | 1 + ...ar_list_entry_already_present_response.rbi | 1 + .../radar_standalone_assess_request.rbi | 1 + ...dalone_delete_radar_list_entry_request.rbi | 1 + rbi/workos/radar_standalone_response.rbi | 1 + ...tandalone_update_radar_attempt_request.rbi | 1 + ...r_standalone_update_radar_list_request.rbi | 1 + rbi/workos/redirect_uri.rbi | 1 + rbi/workos/redirect_uri_input.rbi | 1 + ...esh_token_session_authenticate_request.rbi | 1 + rbi/workos/remove_role.rbi | 1 + rbi/workos/resend_user_invite_options.rbi | 1 + rbi/workos/reset_password_response.rbi | 1 + rbi/workos/revoke_session.rbi | 1 + rbi/workos/role.rbi | 1 + rbi/workos/role_assignment.rbi | 1 + rbi/workos/role_assignment_resource.rbi | 1 + rbi/workos/role_created.rbi | 1 + rbi/workos/role_created_data.rbi | 1 + rbi/workos/role_deleted.rbi | 1 + rbi/workos/role_deleted_data.rbi | 1 + rbi/workos/role_list.rbi | 1 + rbi/workos/role_updated.rbi | 1 + rbi/workos/role_updated_data.rbi | 1 + rbi/workos/send_email_change.rbi | 1 + .../send_verification_email_response.rbi | 1 + rbi/workos/session_created.rbi | 1 + rbi/workos/session_created_data.rbi | 1 + .../session_created_data_impersonator.rbi | 1 + rbi/workos/session_revoked.rbi | 1 + rbi/workos/session_revoked_data.rbi | 1 + .../session_revoked_data_impersonator.rbi | 1 + rbi/workos/set_role_permissions.rbi | 1 + rbi/workos/slim_role.rbi | 1 + rbi/workos/sso.rbi | 1 + rbi/workos/sso_authorize_url_response.rbi | 1 + .../sso_device_authorization_request.rbi | 1 + rbi/workos/sso_intent_options.rbi | 1 + rbi/workos/sso_logout_authorize_request.rbi | 1 + rbi/workos/sso_logout_authorize_response.rbi | 1 + rbi/workos/sso_token_response.rbi | 1 + rbi/workos/sso_token_response_oauth_token.rbi | 1 + rbi/workos/token_query.rbi | 1 + rbi/workos/update_audit_logs_retention.rbi | 1 + .../update_authorization_permission.rbi | 1 + rbi/workos/update_authorization_resource.rbi | 1 + rbi/workos/update_jwt_template.rbi | 1 + rbi/workos/update_oauth_application.rbi | 1 + rbi/workos/update_organization.rbi | 1 + rbi/workos/update_organization_role.rbi | 1 + rbi/workos/update_role.rbi | 1 + rbi/workos/update_user.rbi | 1 + .../update_user_organization_membership.rbi | 1 + rbi/workos/update_webhook_endpoint.rbi | 1 + rbi/workos/user.rbi | 1 + ..._authentication_factor_enroll_response.rbi | 1 + rbi/workos/user_consent_option.rbi | 1 + rbi/workos/user_consent_option_choice.rbi | 1 + rbi/workos/user_created.rbi | 1 + rbi/workos/user_deleted.rbi | 1 + rbi/workos/user_identities_get_item.rbi | 1 + rbi/workos/user_invite.rbi | 1 + rbi/workos/user_management.rbi | 1 + rbi/workos/user_management_login_request.rbi | 1 + rbi/workos/user_object.rbi | 1 + rbi/workos/user_organization_membership.rbi | 1 + ...organization_membership_base_list_data.rbi | 1 + rbi/workos/user_sessions_impersonator.rbi | 1 + rbi/workos/user_sessions_list_item.rbi | 1 + rbi/workos/user_updated.rbi | 1 + rbi/workos/validate_api_key.rbi | 1 + .../vault_byok_key_verification_completed.rbi | 1 + ...t_byok_key_verification_completed_data.rbi | 1 + rbi/workos/vault_data_created.rbi | 1 + rbi/workos/vault_data_created_data.rbi | 1 + rbi/workos/vault_data_deleted.rbi | 1 + rbi/workos/vault_data_deleted_data.rbi | 1 + rbi/workos/vault_data_read.rbi | 1 + rbi/workos/vault_data_read_data.rbi | 1 + rbi/workos/vault_data_updated.rbi | 1 + rbi/workos/vault_data_updated_data.rbi | 1 + rbi/workos/vault_dek_decrypted.rbi | 1 + rbi/workos/vault_dek_decrypted_data.rbi | 1 + rbi/workos/vault_dek_read.rbi | 1 + rbi/workos/vault_dek_read_data.rbi | 1 + rbi/workos/vault_kek_created.rbi | 1 + rbi/workos/vault_kek_created_data.rbi | 1 + rbi/workos/vault_metadata_read.rbi | 1 + rbi/workos/vault_metadata_read_data.rbi | 1 + rbi/workos/vault_names_listed.rbi | 1 + rbi/workos/vault_names_listed_data.rbi | 1 + rbi/workos/verify_email_address.rbi | 1 + rbi/workos/verify_email_response.rbi | 1 + rbi/workos/webhook_endpoint_json.rbi | 66 ++ rbi/workos/webhooks.rbi | 5 +- rbi/workos/widget_session_token.rbi | 1 + rbi/workos/widget_session_token_response.rbi | 1 + rbi/workos/widgets.rbi | 1 + test/workos/test_model_round_trip.rb | 52 +- 554 files changed, 2535 insertions(+), 1325 deletions(-) create mode 100644 lib/workos/audit_logs/audit_log_action_json.rb create mode 100644 lib/workos/audit_logs/audit_log_export_json.rb create mode 100644 lib/workos/audit_logs/audit_log_schema_json.rb create mode 100644 lib/workos/audit_logs/audit_log_schema_json_actor.rb create mode 100644 lib/workos/audit_logs/audit_log_schema_json_target.rb create mode 100644 lib/workos/organizations/audit_logs_retention_json.rb create mode 100644 lib/workos/types/audit_log_export_json_state.rb create mode 100644 lib/workos/types/webhook_endpoint_json_status.rb create mode 100644 lib/workos/webhooks/webhook_endpoint_json.rb create mode 100644 rbi/workos/audit_log_action_json.rbi create mode 100644 rbi/workos/audit_log_export_json.rbi create mode 100644 rbi/workos/audit_log_schema_json.rbi create mode 100644 rbi/workos/audit_log_schema_json_actor.rbi create mode 100644 rbi/workos/audit_log_schema_json_target.rbi create mode 100644 rbi/workos/audit_logs_retention_json.rbi create mode 100644 rbi/workos/webhook_endpoint_json.rbi diff --git a/.oagen-manifest.json b/.oagen-manifest.json index 9c9bbf94..ff68035c 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,7 +1,7 @@ { "version": 1, "language": "ruby", - "generatedAt": "2026-04-18T22:03:57.403Z", + "generatedAt": "2026-04-20T08:02:20.958Z", "files": [ "lib/workos.rb", "lib/workos/admin_portal.rb", @@ -24,17 +24,20 @@ "lib/workos/api_keys/create_organization_api_key.rb", "lib/workos/api_keys/validate_api_key.rb", "lib/workos/audit_logs.rb", - "lib/workos/audit_logs/audit_log_action.rb", + "lib/workos/audit_logs/audit_log_action_json.rb", "lib/workos/audit_logs/audit_log_event.rb", "lib/workos/audit_logs/audit_log_event_actor.rb", "lib/workos/audit_logs/audit_log_event_context.rb", "lib/workos/audit_logs/audit_log_event_create_response.rb", "lib/workos/audit_logs/audit_log_event_ingestion.rb", "lib/workos/audit_logs/audit_log_event_target.rb", - "lib/workos/audit_logs/audit_log_export.rb", "lib/workos/audit_logs/audit_log_export_creation.rb", + "lib/workos/audit_logs/audit_log_export_json.rb", "lib/workos/audit_logs/audit_log_schema.rb", "lib/workos/audit_logs/audit_log_schema_actor.rb", + "lib/workos/audit_logs/audit_log_schema_json.rb", + "lib/workos/audit_logs/audit_log_schema_json_actor.rb", + "lib/workos/audit_logs/audit_log_schema_json_target.rb", "lib/workos/audit_logs/audit_log_schema_target.rb", "lib/workos/authorization.rb", "lib/workos/authorization/add_role_permission.rb", @@ -188,7 +191,7 @@ "lib/workos/organizations.rb", "lib/workos/organizations/audit_log_configuration.rb", "lib/workos/organizations/audit_log_configuration_log_stream.rb", - "lib/workos/organizations/audit_logs_retention.rb", + "lib/workos/organizations/audit_logs_retention_json.rb", "lib/workos/organizations/organization.rb", "lib/workos/organizations/organization_created.rb", "lib/workos/organizations/organization_created_data.rb", @@ -274,7 +277,7 @@ "lib/workos/types/audit_log_configuration_log_stream_state.rb", "lib/workos/types/audit_log_configuration_log_stream_type.rb", "lib/workos/types/audit_log_configuration_state.rb", - "lib/workos/types/audit_log_export_state.rb", + "lib/workos/types/audit_log_export_json_state.rb", "lib/workos/types/audit_logs_order.rb", "lib/workos/types/authenticate_response_authentication_method.rb", "lib/workos/types/authentication_factor_enrolled_type.rb", @@ -407,7 +410,7 @@ "lib/workos/types/vault_kek_created_data_actor_source.rb", "lib/workos/types/vault_metadata_read_data_actor_source.rb", "lib/workos/types/vault_names_listed_data_actor_source.rb", - "lib/workos/types/webhook_endpoint_status.rb", + "lib/workos/types/webhook_endpoint_json_status.rb", "lib/workos/types/webhooks_order.rb", "lib/workos/types/widget_session_token_scopes.rb", "lib/workos/user_management.rb", @@ -561,7 +564,7 @@ "lib/workos/webhooks.rb", "lib/workos/webhooks/create_webhook_endpoint.rb", "lib/workos/webhooks/update_webhook_endpoint.rb", - "lib/workos/webhooks/webhook_endpoint.rb", + "lib/workos/webhooks/webhook_endpoint_json.rb", "lib/workos/widgets.rb", "lib/workos/widgets/widget_session_token.rb", "lib/workos/widgets/widget_session_token_response.rb", @@ -585,7 +588,7 @@ "rbi/workos/api_keys.rbi", "rbi/workos/application_credentials_list_item.rbi", "rbi/workos/assign_role.rbi", - "rbi/workos/audit_log_action.rbi", + "rbi/workos/audit_log_action_json.rbi", "rbi/workos/audit_log_configuration.rbi", "rbi/workos/audit_log_configuration_log_stream.rbi", "rbi/workos/audit_log_event.rbi", @@ -594,13 +597,16 @@ "rbi/workos/audit_log_event_create_response.rbi", "rbi/workos/audit_log_event_ingestion.rbi", "rbi/workos/audit_log_event_target.rbi", - "rbi/workos/audit_log_export.rbi", "rbi/workos/audit_log_export_creation.rbi", + "rbi/workos/audit_log_export_json.rbi", "rbi/workos/audit_log_schema.rbi", "rbi/workos/audit_log_schema_actor.rbi", + "rbi/workos/audit_log_schema_json.rbi", + "rbi/workos/audit_log_schema_json_actor.rbi", + "rbi/workos/audit_log_schema_json_target.rbi", "rbi/workos/audit_log_schema_target.rbi", "rbi/workos/audit_logs.rbi", - "rbi/workos/audit_logs_retention.rbi", + "rbi/workos/audit_logs_retention_json.rbi", "rbi/workos/authenticate_response.rbi", "rbi/workos/authenticate_response_impersonator.rbi", "rbi/workos/authenticate_response_oauth_token.rbi", @@ -981,7 +987,7 @@ "rbi/workos/vault_names_listed_data.rbi", "rbi/workos/verify_email_address.rbi", "rbi/workos/verify_email_response.rbi", - "rbi/workos/webhook_endpoint.rbi", + "rbi/workos/webhook_endpoint_json.rbi", "rbi/workos/webhooks.rbi", "rbi/workos/widget_session_token.rbi", "rbi/workos/widget_session_token_response.rbi", diff --git a/lib/workos/admin_portal.rb b/lib/workos/admin_portal.rb index 4e670c22..904c638a 100644 --- a/lib/workos/admin_portal.rb +++ b/lib/workos/admin_portal.rb @@ -36,7 +36,10 @@ def generate_link( "intent_options" => intent_options, "admin_emails" => admin_emails }.compact - response = @client.request(method: :post, path: "/portal/generate_link", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/portal/generate_link", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::PortalLinkResponse.new(response.body) end end diff --git a/lib/workos/api_keys.rb b/lib/workos/api_keys.rb index 14d1ca5c..f4087934 100644 --- a/lib/workos/api_keys.rb +++ b/lib/workos/api_keys.rb @@ -21,7 +21,10 @@ def create_validation( body = { "value" => value }.compact - response = @client.request(method: :post, path: "/api_keys/validations", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/api_keys/validations", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::ApiKeyValidationResponse.new(response.body) end @@ -33,7 +36,10 @@ def delete_api_key( id:, request_options: {} ) - @client.request(method: :delete, path: "/api_keys/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/api_keys/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -50,7 +56,7 @@ def list_organization_api_keys( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -59,30 +65,25 @@ def list_organization_api_keys( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/api_keys", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::ApiKey, filters: {organization_id: organization_id, before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_organization_api_keys( - organization_id: organization_id, - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_organization_api_keys( - organization_id: organization_id, - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/organizations/#{CGI.escape(organization_id.to_s)}/api_keys", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::ApiKey.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_organization_api_keys( + organization_id: organization_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_id: organization_id, before: before, limit: limit, order: order}) end # Create an API key for an organization @@ -101,7 +102,10 @@ def create_organization_api_key( "name" => name, "permissions" => permissions }.compact - response = @client.request(method: :post, path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/api_keys", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/organizations/#{CGI.escape(organization_id.to_s)}/api_keys", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::ApiKeyWithValue.new(response.body) end end diff --git a/lib/workos/audit_logs.rb b/lib/workos/audit_logs.rb index dee34bfe..c8bb2a8f 100644 --- a/lib/workos/audit_logs.rb +++ b/lib/workos/audit_logs.rb @@ -13,20 +13,23 @@ def initialize(client) # Get Retention # @param id [String] Unique identifier of the Organization. # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::AuditLogsRetention] + # @return [WorkOS::AuditLogsRetentionJson] def get_organization_audit_logs_retention( id:, request_options: {} ) - response = @client.request(method: :get, path: "/organizations/#{WorkOS::Util.encode_path(id)}/audit_logs_retention", auth: true, request_options: request_options) - WorkOS::AuditLogsRetention.new(response.body) + response = @client.execute_request( + request: @client.get_request(path: "/organizations/#{CGI.escape(id.to_s)}/audit_logs_retention", auth: true, request_options: request_options), + request_options: request_options + ) + WorkOS::AuditLogsRetentionJson.new(response.body) end # Set Retention # @param id [String] Unique identifier of the Organization. # @param retention_period_in_days [Integer] The number of days Audit Log events will be retained. Valid values are `30` and `365`. # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::AuditLogsRetention] + # @return [WorkOS::AuditLogsRetentionJson] def update_organization_audit_logs_retention( id:, retention_period_in_days:, @@ -35,8 +38,11 @@ def update_organization_audit_logs_retention( body = { "retention_period_in_days" => retention_period_in_days }.compact - response = @client.request(method: :put, path: "/organizations/#{WorkOS::Util.encode_path(id)}/audit_logs_retention", auth: true, body: body, request_options: request_options) - WorkOS::AuditLogsRetention.new(response.body) + response = @client.execute_request( + request: @client.put_request(path: "/organizations/#{CGI.escape(id.to_s)}/audit_logs_retention", auth: true, body: body, request_options: request_options), + request_options: request_options + ) + WorkOS::AuditLogsRetentionJson.new(response.body) end # List Actions @@ -50,7 +56,7 @@ def list_actions( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -59,28 +65,24 @@ def list_actions( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/audit_logs/actions", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::AuditLogAction, filters: {before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_actions( - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_actions( - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/audit_logs/actions", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::AuditLogActionJson.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_actions( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order}) end # List Schemas @@ -96,7 +98,7 @@ def list_action_schemas( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -105,30 +107,25 @@ def list_action_schemas( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/audit_logs/actions/#{WorkOS::Util.encode_path(action_name)}/schemas", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::AuditLogSchema, filters: {action_name: action_name, before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_action_schemas( - action_name: action_name, - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_action_schemas( - action_name: action_name, - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/audit_logs/actions/#{CGI.escape(action_name.to_s)}/schemas", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::AuditLogSchemaJson.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_action_schemas( + action_name: action_name, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {action_name: action_name, before: before, limit: limit, order: order}) end # Create Schema @@ -137,7 +134,7 @@ def list_action_schemas( # @param targets [Array] The list of targets for the schema. # @param metadata [Hash{String => Object}, nil] Optional JSON schema for event metadata. # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::AuditLogSchema] + # @return [WorkOS::AuditLogSchemaJson] def create_schema( action_name:, targets:, @@ -150,8 +147,11 @@ def create_schema( "targets" => targets, "metadata" => metadata }.compact - response = @client.request(method: :post, path: "/audit_logs/actions/#{WorkOS::Util.encode_path(action_name)}/schemas", auth: true, body: body, request_options: request_options) - WorkOS::AuditLogSchema.new(response.body) + response = @client.execute_request( + request: @client.post_request(path: "/audit_logs/actions/#{CGI.escape(action_name.to_s)}/schemas", auth: true, body: body, request_options: request_options), + request_options: request_options + ) + WorkOS::AuditLogSchemaJson.new(response.body) end # Create Event @@ -168,7 +168,10 @@ def create_event( "organization_id" => organization_id, "event" => event }.compact - response = @client.request(method: :post, path: "/audit_logs/events", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/audit_logs/events", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::AuditLogEventCreateResponse.new(response.body) end @@ -182,7 +185,7 @@ def create_event( # @param actor_ids [Array, nil] List of actor IDs to filter against. # @param targets [Array, nil] List of target types to filter against. # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::AuditLogExport] + # @return [WorkOS::AuditLogExportJson] def create_export( organization_id:, range_start:, @@ -204,20 +207,26 @@ def create_export( "actor_ids" => actor_ids, "targets" => targets }.compact - response = @client.request(method: :post, path: "/audit_logs/exports", auth: true, body: body, request_options: request_options) - WorkOS::AuditLogExport.new(response.body) + response = @client.execute_request( + request: @client.post_request(path: "/audit_logs/exports", auth: true, body: body, request_options: request_options), + request_options: request_options + ) + WorkOS::AuditLogExportJson.new(response.body) end # Get Export # @param audit_log_export_id [String] The unique ID of the Audit Log Export. # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::AuditLogExport] + # @return [WorkOS::AuditLogExportJson] def get_export( audit_log_export_id:, request_options: {} ) - response = @client.request(method: :get, path: "/audit_logs/exports/#{WorkOS::Util.encode_path(audit_log_export_id)}", auth: true, request_options: request_options) - WorkOS::AuditLogExport.new(response.body) + response = @client.execute_request( + request: @client.get_request(path: "/audit_logs/exports/#{CGI.escape(audit_log_export_id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) + WorkOS::AuditLogExportJson.new(response.body) end end end diff --git a/lib/workos/audit_logs/audit_log_action_json.rb b/lib/workos/audit_logs/audit_log_action_json.rb new file mode 100644 index 00000000..3575076e --- /dev/null +++ b/lib/workos/audit_logs/audit_log_action_json.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogActionJson + include HashProvider + + HASH_ATTRS = { + object: :object, + name: :name, + schema: :schema, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :name, + :schema, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @name = hash[:name] + @schema = hash[:schema] ? WorkOS::AuditLogSchemaJson.new(hash[:schema]) : nil + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/audit_logs/audit_log_export_creation.rb b/lib/workos/audit_logs/audit_log_export_creation.rb index 9a167896..013db17a 100644 --- a/lib/workos/audit_logs/audit_log_export_creation.rb +++ b/lib/workos/audit_logs/audit_log_export_creation.rb @@ -32,7 +32,7 @@ class AuditLogExportCreation :targets def actors - warn "[DEPRECATION] `actors` is deprecated. Deprecated. Use `actor_names` instead.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `actors` is deprecated. Deprecated. Use `actor_names` instead.", uplevel: 1 @actors end diff --git a/lib/workos/audit_logs/audit_log_export_json.rb b/lib/workos/audit_logs/audit_log_export_json.rb new file mode 100644 index 00000000..3e94144b --- /dev/null +++ b/lib/workos/audit_logs/audit_log_export_json.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogExportJson + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + state: :state, + url: :url, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :state, + :url, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @state = hash[:state] + @url = hash[:url] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/audit_logs/audit_log_schema.rb b/lib/workos/audit_logs/audit_log_schema.rb index cc8d0b69..c556aae2 100644 --- a/lib/workos/audit_logs/audit_log_schema.rb +++ b/lib/workos/audit_logs/audit_log_schema.rb @@ -9,31 +9,22 @@ class AuditLogSchema include HashProvider HASH_ATTRS = { - object: :object, - version: :version, actor: :actor, targets: :targets, - metadata: :metadata, - created_at: :created_at + metadata: :metadata }.freeze attr_accessor \ - :object, - :version, :actor, :targets, - :metadata, - :created_at + :metadata def initialize(json) hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) - @object = hash[:object] - @version = hash[:version] @actor = hash[:actor] ? WorkOS::AuditLogSchemaActor.new(hash[:actor]) : nil @targets = (hash[:targets] || []).map { |item| item ? WorkOS::AuditLogSchemaTarget.new(item) : nil } @metadata = hash[:metadata] || {} - @created_at = hash[:created_at] end end end diff --git a/lib/workos/audit_logs/audit_log_schema_json.rb b/lib/workos/audit_logs/audit_log_schema_json.rb new file mode 100644 index 00000000..8921e289 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_schema_json.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogSchemaJson + include HashProvider + + HASH_ATTRS = { + object: :object, + version: :version, + actor: :actor, + targets: :targets, + metadata: :metadata, + created_at: :created_at + }.freeze + + attr_accessor \ + :object, + :version, + :actor, + :targets, + :metadata, + :created_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @version = hash[:version] + @actor = hash[:actor] ? WorkOS::AuditLogSchemaJsonActor.new(hash[:actor]) : nil + @targets = (hash[:targets] || []).map { |item| item ? WorkOS::AuditLogSchemaJsonTarget.new(item) : nil } + @metadata = hash[:metadata] || {} + @created_at = hash[:created_at] + end + end +end diff --git a/lib/workos/audit_logs/audit_log_schema_json_actor.rb b/lib/workos/audit_logs/audit_log_schema_json_actor.rb new file mode 100644 index 00000000..8c476ede --- /dev/null +++ b/lib/workos/audit_logs/audit_log_schema_json_actor.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuditLogSchemaJsonActor = AuditLogSchemaActor +end diff --git a/lib/workos/audit_logs/audit_log_schema_json_target.rb b/lib/workos/audit_logs/audit_log_schema_json_target.rb new file mode 100644 index 00000000..6bd236a1 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_schema_json_target.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogSchemaJsonTarget + include HashProvider + + HASH_ATTRS = { + type: :type, + metadata: :metadata + }.freeze + + attr_accessor \ + :type, + :metadata + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @type = hash[:type] + @metadata = hash[:metadata] || {} + end + end +end diff --git a/lib/workos/audit_logs/audit_log_schema_target.rb b/lib/workos/audit_logs/audit_log_schema_target.rb index 8afdf12f..80fabc5d 100644 --- a/lib/workos/audit_logs/audit_log_schema_target.rb +++ b/lib/workos/audit_logs/audit_log_schema_target.rb @@ -2,26 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogSchemaTarget - include HashProvider - - HASH_ATTRS = { - type: :type, - metadata: :metadata - }.freeze - - attr_accessor \ - :type, - :metadata - - def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) - @type = hash[:type] - @metadata = hash[:metadata] || {} - end - end + AuditLogSchemaTarget = AuditLogSchemaJsonTarget end diff --git a/lib/workos/authorization.rb b/lib/workos/authorization.rb index 39834045..15e2c08d 100644 --- a/lib/workos/authorization.rb +++ b/lib/workos/authorization.rb @@ -27,7 +27,7 @@ def check( resource_type_slug: nil, request_options: {} ) - params = {} + params = {}.compact case resource_target[:type] when "by_id" params["resource_id"] = resource_target[:resource_id] @@ -41,7 +41,10 @@ def check( "resource_external_id" => resource_external_id, "resource_type_slug" => resource_type_slug }.compact - response = @client.request(method: :post, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/check", auth: true, params: params, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/check", auth: true, params: params, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::AuthorizationCheck.new(response.body) end @@ -61,7 +64,7 @@ def list_organization_membership_resources( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -78,34 +81,27 @@ def list_organization_membership_resources( params["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] params["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] end - response = @client.request(method: :get, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/resources", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::AuthorizationResource, filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order, permission_slug: permission_slug, parent_resource: parent_resource}, - fetch_next: lambda do |cursor| - list_organization_membership_resources( - organization_membership_id: organization_membership_id, - before: before, - after: cursor, - limit: limit, - order: order, - permission_slug: permission_slug, - parent_resource: parent_resource, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_organization_membership_resources( - organization_membership_id: organization_membership_id, - before: cursor, - after: nil, - limit: limit, - order: order, - permission_slug: permission_slug, - parent_resource: parent_resource, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/resources", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::AuthorizationResource.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_organization_membership_resources( + organization_membership_id: organization_membership_id, + before: before, + after: cursor, + limit: limit, + order: order, + permission_slug: permission_slug, + parent_resource: parent_resource, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order, permission_slug: permission_slug, parent_resource: parent_resource}) end # List effective permissions for an organization membership on a resource @@ -123,7 +119,7 @@ def list_resource_permissions( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -132,32 +128,26 @@ def list_resource_permissions( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/resources/#{WorkOS::Util.encode_path(resource_id)}/permissions", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::AuthorizationPermission, filters: {organization_membership_id: organization_membership_id, resource_id: resource_id, before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_resource_permissions( - organization_membership_id: organization_membership_id, - resource_id: resource_id, - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_resource_permissions( - organization_membership_id: organization_membership_id, - resource_id: resource_id, - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/resources/#{CGI.escape(resource_id.to_s)}/permissions", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::AuthorizationPermission.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_resource_permissions( + organization_membership_id: organization_membership_id, + resource_id: resource_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_membership_id: organization_membership_id, resource_id: resource_id, before: before, limit: limit, order: order}) end # List effective permissions for an organization membership on a resource by external ID @@ -177,7 +167,7 @@ def list_effective_permissions_by_external_id( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -186,34 +176,27 @@ def list_effective_permissions_by_external_id( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}/permissions", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::AuthorizationPermission, filters: {organization_membership_id: organization_membership_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_effective_permissions_by_external_id( - organization_membership_id: organization_membership_id, - resource_type_slug: resource_type_slug, - external_id: external_id, - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_effective_permissions_by_external_id( - organization_membership_id: organization_membership_id, - resource_type_slug: resource_type_slug, - external_id: external_id, - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/resources/#{CGI.escape(resource_type_slug.to_s)}/#{CGI.escape(external_id.to_s)}/permissions", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::AuthorizationPermission.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_effective_permissions_by_external_id( + organization_membership_id: organization_membership_id, + resource_type_slug: resource_type_slug, + external_id: external_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_membership_id: organization_membership_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order}) end # List role assignments @@ -229,7 +212,7 @@ def list_organization_membership_role_assignments( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -238,30 +221,25 @@ def list_organization_membership_role_assignments( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::RoleAssignment, filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_organization_membership_role_assignments( - organization_membership_id: organization_membership_id, - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_organization_membership_role_assignments( - organization_membership_id: organization_membership_id, - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/role_assignments", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::RoleAssignment.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_organization_membership_role_assignments( + organization_membership_id: organization_membership_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order}) end # Assign a role @@ -281,7 +259,7 @@ def assign_role( resource_type_slug: nil, request_options: {} ) - params = {} + params = {}.compact case resource_target[:type] when "by_id" params["resource_id"] = resource_target[:resource_id] @@ -295,7 +273,10 @@ def assign_role( "resource_external_id" => resource_external_id, "resource_type_slug" => resource_type_slug }.compact - response = @client.request(method: :post, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments", auth: true, params: params, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/role_assignments", auth: true, params: params, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::RoleAssignment.new(response.body) end @@ -316,7 +297,7 @@ def remove_role( resource_type_slug: nil, request_options: {} ) - params = {} + params = {}.compact case resource_target[:type] when "by_id" params["resource_id"] = resource_target[:resource_id] @@ -330,7 +311,10 @@ def remove_role( "resource_external_id" => resource_external_id, "resource_type_slug" => resource_type_slug }.compact - @client.request(method: :delete, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments", auth: true, params: params, body: body, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/role_assignments", auth: true, params: params, body: body, request_options: request_options), + request_options: request_options + ) nil end @@ -344,7 +328,10 @@ def delete_organization_membership_role_assignment( role_assignment_id:, request_options: {} ) - @client.request(method: :delete, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments/#{WorkOS::Util.encode_path(role_assignment_id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/role_assignments/#{CGI.escape(role_assignment_id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -356,7 +343,10 @@ def list_organization_roles( organization_id:, request_options: {} ) - response = @client.request(method: :get, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::RoleList.new(response.body) end @@ -382,7 +372,10 @@ def create_organization_role( "description" => description, "resource_type_slug" => resource_type_slug }.compact - response = @client.request(method: :post, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::Role.new(response.body) end @@ -396,7 +389,10 @@ def get_organization_role( slug:, request_options: {} ) - response = @client.request(method: :get, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::Role.new(response.body) end @@ -418,7 +414,10 @@ def update_organization_role( "name" => name, "description" => description }.compact - response = @client.request(method: :patch, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.patch_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::Role.new(response.body) end @@ -432,7 +431,10 @@ def delete_organization_role( slug:, request_options: {} ) - @client.request(method: :delete, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -451,7 +453,10 @@ def create_role_permission( body = { "slug" => body_slug }.compact - response = @client.request(method: :post, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}/permissions", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}/permissions", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::Role.new(response.body) end @@ -470,7 +475,10 @@ def update_role_permissions( body = { "permissions" => permissions }.compact - response = @client.request(method: :put, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}/permissions", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.put_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}/permissions", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::Role.new(response.body) end @@ -486,7 +494,10 @@ def delete_role_permission( permission_slug:, request_options: {} ) - response = @client.request(method: :delete, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}/permissions/#{WorkOS::Util.encode_path(permission_slug)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.delete_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}/permissions/#{CGI.escape(permission_slug.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::Role.new(response.body) end @@ -502,7 +513,10 @@ def get_organization_resource( external_id:, request_options: {} ) - response = @client.request(method: :get, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/resources/#{CGI.escape(resource_type_slug.to_s)}/#{CGI.escape(external_id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::AuthorizationResource.new(response.body) end @@ -529,7 +543,7 @@ def update_organization_resource( parent_resource: nil, request_options: {} ) - params = {} + params = {}.compact if parent_resource case parent_resource[:type] when "by_id" @@ -546,7 +560,10 @@ def update_organization_resource( "parent_resource_external_id" => parent_resource_external_id, "parent_resource_type_slug" => parent_resource_type_slug }.compact - response = @client.request(method: :patch, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}", auth: true, params: params, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.patch_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/resources/#{CGI.escape(resource_type_slug.to_s)}/#{CGI.escape(external_id.to_s)}", auth: true, params: params, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::AuthorizationResource.new(response.body) end @@ -567,7 +584,10 @@ def delete_organization_resource( params = { "cascade_delete" => cascade_delete }.compact - @client.request(method: :delete, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}", auth: true, params: params, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/resources/#{CGI.escape(resource_type_slug.to_s)}/#{CGI.escape(external_id.to_s)}", auth: true, params: params, request_options: request_options), + request_options: request_options + ) nil end @@ -591,7 +611,7 @@ def list_resource_organization_memberships( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", assignment: nil, request_options: {} ) @@ -603,38 +623,29 @@ def list_resource_organization_memberships( "permission_slug" => permission_slug, "assignment" => assignment }.compact - response = @client.request(method: :get, path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}/organization_memberships", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::UserOrganizationMembershipBaseListData, filters: {organization_id: organization_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order, permission_slug: permission_slug, assignment: assignment}, - fetch_next: lambda do |cursor| - list_resource_organization_memberships( - organization_id: organization_id, - resource_type_slug: resource_type_slug, - external_id: external_id, - before: before, - after: cursor, - limit: limit, - order: order, - permission_slug: permission_slug, - assignment: assignment, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_resource_organization_memberships( - organization_id: organization_id, - resource_type_slug: resource_type_slug, - external_id: external_id, - before: cursor, - after: nil, - limit: limit, - order: order, - permission_slug: permission_slug, - assignment: assignment, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/resources/#{CGI.escape(resource_type_slug.to_s)}/#{CGI.escape(external_id.to_s)}/organization_memberships", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::UserOrganizationMembershipBaseListData.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_resource_organization_memberships( + organization_id: organization_id, + resource_type_slug: resource_type_slug, + external_id: external_id, + before: before, + after: cursor, + limit: limit, + order: order, + permission_slug: permission_slug, + assignment: assignment, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_id: organization_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order, permission_slug: permission_slug, assignment: assignment}) end # List resources @@ -651,7 +662,7 @@ def list_resources( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", organization_id: nil, resource_type_slug: nil, search: nil, @@ -676,36 +687,28 @@ def list_resources( params["parent_external_id"] = parent[:parent_external_id] end end - response = @client.request(method: :get, path: "/authorization/resources", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::AuthorizationResource, filters: {before: before, limit: limit, order: order, organization_id: organization_id, resource_type_slug: resource_type_slug, search: search, parent: parent}, - fetch_next: lambda do |cursor| - list_resources( - before: before, - after: cursor, - limit: limit, - order: order, - organization_id: organization_id, - resource_type_slug: resource_type_slug, - search: search, - parent: parent, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_resources( - before: cursor, - after: nil, - limit: limit, - order: order, - organization_id: organization_id, - resource_type_slug: resource_type_slug, - search: search, - parent: parent, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/authorization/resources", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::AuthorizationResource.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_resources( + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + resource_type_slug: resource_type_slug, + search: search, + parent: parent, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization_id: organization_id, resource_type_slug: resource_type_slug, search: search, parent: parent}) end # Create an authorization resource @@ -731,7 +734,7 @@ def create_resource( parent_resource: nil, request_options: {} ) - params = {} + params = {}.compact if parent_resource case parent_resource[:type] when "by_id" @@ -751,7 +754,10 @@ def create_resource( "parent_resource_external_id" => parent_resource_external_id, "parent_resource_type_slug" => parent_resource_type_slug }.compact - response = @client.request(method: :post, path: "/authorization/resources", auth: true, params: params, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/authorization/resources", auth: true, params: params, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::AuthorizationResource.new(response.body) end @@ -763,7 +769,10 @@ def get_resource( resource_id:, request_options: {} ) - response = @client.request(method: :get, path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/authorization/resources/#{CGI.escape(resource_id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::AuthorizationResource.new(response.body) end @@ -786,7 +795,7 @@ def update_resource( parent_resource: nil, request_options: {} ) - params = {} + params = {}.compact if parent_resource case parent_resource[:type] when "by_id" @@ -803,7 +812,10 @@ def update_resource( "parent_resource_external_id" => parent_resource_external_id, "parent_resource_type_slug" => parent_resource_type_slug }.compact - response = @client.request(method: :patch, path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}", auth: true, params: params, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.patch_request(path: "/authorization/resources/#{CGI.escape(resource_id.to_s)}", auth: true, params: params, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::AuthorizationResource.new(response.body) end @@ -820,7 +832,10 @@ def delete_resource( params = { "cascade_delete" => cascade_delete }.compact - @client.request(method: :delete, path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}", auth: true, params: params, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/authorization/resources/#{CGI.escape(resource_id.to_s)}", auth: true, params: params, request_options: request_options), + request_options: request_options + ) nil end @@ -840,7 +855,7 @@ def list_memberships_for_resource( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", assignment: nil, request_options: {} ) @@ -852,41 +867,37 @@ def list_memberships_for_resource( "permission_slug" => permission_slug, "assignment" => assignment }.compact - response = @client.request(method: :get, path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}/organization_memberships", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::UserOrganizationMembershipBaseListData, filters: {resource_id: resource_id, before: before, limit: limit, order: order, permission_slug: permission_slug, assignment: assignment}, - fetch_next: lambda do |cursor| - list_memberships_for_resource( - resource_id: resource_id, - before: before, - after: cursor, - limit: limit, - order: order, - permission_slug: permission_slug, - assignment: assignment, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_memberships_for_resource( - resource_id: resource_id, - before: cursor, - after: nil, - limit: limit, - order: order, - permission_slug: permission_slug, - assignment: assignment, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/authorization/resources/#{CGI.escape(resource_id.to_s)}/organization_memberships", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::UserOrganizationMembershipBaseListData.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_memberships_for_resource( + resource_id: resource_id, + before: before, + after: cursor, + limit: limit, + order: order, + permission_slug: permission_slug, + assignment: assignment, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {resource_id: resource_id, before: before, limit: limit, order: order, permission_slug: permission_slug, assignment: assignment}) end # List environment roles # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. # @return [WorkOS::RoleList] def list_environment_roles(request_options: {}) - response = @client.request(method: :get, path: "/authorization/roles", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/authorization/roles", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::RoleList.new(response.body) end @@ -910,7 +921,10 @@ def create_environment_role( "description" => description, "resource_type_slug" => resource_type_slug }.compact - response = @client.request(method: :post, path: "/authorization/roles", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/authorization/roles", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::Role.new(response.body) end @@ -922,7 +936,10 @@ def get_environment_role( slug:, request_options: {} ) - response = @client.request(method: :get, path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/authorization/roles/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::Role.new(response.body) end @@ -942,7 +959,10 @@ def update_environment_role( "name" => name, "description" => description }.compact - response = @client.request(method: :patch, path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.patch_request(path: "/authorization/roles/#{CGI.escape(slug.to_s)}", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::Role.new(response.body) end @@ -959,7 +979,10 @@ def add_environment_role_permission( body = { "slug" => body_slug }.compact - response = @client.request(method: :post, path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}/permissions", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/authorization/roles/#{CGI.escape(slug.to_s)}/permissions", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::Role.new(response.body) end @@ -976,7 +999,10 @@ def set_environment_role_permissions( body = { "permissions" => permissions }.compact - response = @client.request(method: :put, path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}/permissions", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.put_request(path: "/authorization/roles/#{CGI.escape(slug.to_s)}/permissions", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::Role.new(response.body) end @@ -991,7 +1017,7 @@ def list_permissions( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -1000,28 +1026,24 @@ def list_permissions( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/authorization/permissions", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::AuthorizationPermission, filters: {before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_permissions( - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_permissions( - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/authorization/permissions", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::AuthorizationPermission.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_permissions( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order}) end # Create a permission @@ -1044,7 +1066,10 @@ def create_permission( "description" => description, "resource_type_slug" => resource_type_slug }.compact - response = @client.request(method: :post, path: "/authorization/permissions", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/authorization/permissions", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::Permission.new(response.body) end @@ -1056,7 +1081,10 @@ def get_permission( slug:, request_options: {} ) - response = @client.request(method: :get, path: "/authorization/permissions/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/authorization/permissions/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::AuthorizationPermission.new(response.body) end @@ -1076,7 +1104,10 @@ def update_permission( "name" => name, "description" => description }.compact - response = @client.request(method: :patch, path: "/authorization/permissions/#{WorkOS::Util.encode_path(slug)}", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.patch_request(path: "/authorization/permissions/#{CGI.escape(slug.to_s)}", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::AuthorizationPermission.new(response.body) end @@ -1088,7 +1119,10 @@ def delete_permission( slug:, request_options: {} ) - @client.request(method: :delete, path: "/authorization/permissions/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/authorization/permissions/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end end diff --git a/lib/workos/connect.rb b/lib/workos/connect.rb index 90680aad..a355b098 100644 --- a/lib/workos/connect.rb +++ b/lib/workos/connect.rb @@ -27,7 +27,10 @@ def complete_oauth2( "user" => user, "user_consent_options" => user_consent_options }.compact - response = @client.request(method: :post, path: "/authkit/oauth2/complete", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/authkit/oauth2/complete", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::ExternalAuthCompleteResponse.new(response.body) end @@ -43,7 +46,7 @@ def list_applications( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", organization_id: nil, request_options: {} ) @@ -54,30 +57,25 @@ def list_applications( "order" => order, "organization_id" => organization_id }.compact - response = @client.request(method: :get, path: "/connect/applications", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::ConnectApplication, filters: {before: before, limit: limit, order: order, organization_id: organization_id}, - fetch_next: lambda do |cursor| - list_applications( - before: before, - after: cursor, - limit: limit, - order: order, - organization_id: organization_id, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_applications( - before: cursor, - after: nil, - limit: limit, - order: order, - organization_id: organization_id, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/connect/applications", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::ConnectApplication.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_applications( + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization_id: organization_id}) end # Create a Connect Application @@ -112,7 +110,10 @@ def create_application( "is_first_party" => is_first_party, "organization_id" => organization_id }.compact - response = @client.request(method: :post, path: "/connect/applications", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/connect/applications", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::ConnectApplication.new(response.body) end @@ -136,17 +137,21 @@ def create_oauth_application( organization_id: nil, request_options: {} ) - create_application( - application_type: "oauth", - name: name, - is_first_party: is_first_party, - description: description, - scopes: scopes, - redirect_uris: redirect_uris, - uses_pkce: uses_pkce, - organization_id: organization_id, + body = { + "application_type" => "oauth", + "name" => name, + "is_first_party" => is_first_party, + "description" => description, + "scopes" => scopes, + "redirect_uris" => redirect_uris, + "uses_pkce" => uses_pkce, + "organization_id" => organization_id + }.compact + response = @client.execute_request( + request: @client.post_request(path: "/connect/applications", auth: true, body: body, request_options: request_options), request_options: request_options ) + WorkOS::ConnectApplication.new(response.body) end # Create m2m application. @@ -163,14 +168,18 @@ def create_m2m_application( scopes: nil, request_options: {} ) - create_application( - application_type: "m2m", - name: name, - organization_id: organization_id, - description: description, - scopes: scopes, + body = { + "application_type" => "m2m", + "name" => name, + "organization_id" => organization_id, + "description" => description, + "scopes" => scopes + }.compact + response = @client.execute_request( + request: @client.post_request(path: "/connect/applications", auth: true, body: body, request_options: request_options), request_options: request_options ) + WorkOS::ConnectApplication.new(response.body) end # Get a Connect Application @@ -181,7 +190,10 @@ def get_application( id:, request_options: {} ) - response = @client.request(method: :get, path: "/connect/applications/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/connect/applications/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::ConnectApplication.new(response.body) end @@ -207,7 +219,10 @@ def update_application( "scopes" => scopes, "redirect_uris" => redirect_uris }.compact - response = @client.request(method: :put, path: "/connect/applications/#{WorkOS::Util.encode_path(id)}", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.put_request(path: "/connect/applications/#{CGI.escape(id.to_s)}", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::ConnectApplication.new(response.body) end @@ -219,7 +234,10 @@ def delete_application( id:, request_options: {} ) - @client.request(method: :delete, path: "/connect/applications/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/connect/applications/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -231,7 +249,10 @@ def list_application_client_secrets( id:, request_options: {} ) - response = @client.request(method: :get, path: "/connect/applications/#{WorkOS::Util.encode_path(id)}/client_secrets", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/connect/applications/#{CGI.escape(id.to_s)}/client_secrets", auth: true, request_options: request_options), + request_options: request_options + ) parsed = JSON.parse(response.body) (parsed || []).map { |item| WorkOS::ApplicationCredentialsListItem.new(item) } end @@ -244,7 +265,10 @@ def create_application_client_secret( id:, request_options: {} ) - response = @client.request(method: :post, path: "/connect/applications/#{WorkOS::Util.encode_path(id)}/client_secrets", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/connect/applications/#{CGI.escape(id.to_s)}/client_secrets", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::NewConnectApplicationSecret.new(response.body) end @@ -256,7 +280,10 @@ def delete_client_secret( id:, request_options: {} ) - @client.request(method: :delete, path: "/connect/client_secrets/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/connect/client_secrets/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end end diff --git a/lib/workos/directory_sync.rb b/lib/workos/directory_sync.rb index a29faec0..16b3dbf6 100644 --- a/lib/workos/directory_sync.rb +++ b/lib/workos/directory_sync.rb @@ -24,7 +24,7 @@ def list_directories( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", organization_id: nil, search: nil, domain: nil, @@ -39,34 +39,27 @@ def list_directories( "search" => search, "domain" => domain }.compact - response = @client.request(method: :get, path: "/directories", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::Directory, filters: {before: before, limit: limit, order: order, organization_id: organization_id, search: search, domain: domain}, - fetch_next: lambda do |cursor| - list_directories( - before: before, - after: cursor, - limit: limit, - order: order, - organization_id: organization_id, - search: search, - domain: domain, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_directories( - before: cursor, - after: nil, - limit: limit, - order: order, - organization_id: organization_id, - search: search, - domain: domain, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/directories", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::Directory.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_directories( + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + search: search, + domain: domain, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization_id: organization_id, search: search, domain: domain}) end # Get a Directory @@ -77,7 +70,10 @@ def get_directory( id:, request_options: {} ) - response = @client.request(method: :get, path: "/directories/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/directories/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::Directory.new(response.body) end @@ -89,7 +85,10 @@ def delete_directory( id:, request_options: {} ) - @client.request(method: :delete, path: "/directories/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/directories/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -106,7 +105,7 @@ def list_groups( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", directory: nil, user: nil, request_options: {} @@ -119,32 +118,26 @@ def list_groups( "directory" => directory, "user" => user }.compact - response = @client.request(method: :get, path: "/directory_groups", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::DirectoryGroup, filters: {before: before, limit: limit, order: order, directory: directory, user: user}, - fetch_next: lambda do |cursor| - list_groups( - before: before, - after: cursor, - limit: limit, - order: order, - directory: directory, - user: user, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_groups( - before: cursor, - after: nil, - limit: limit, - order: order, - directory: directory, - user: user, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/directory_groups", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::DirectoryGroup.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_groups( + before: before, + after: cursor, + limit: limit, + order: order, + directory: directory, + user: user, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, directory: directory, user: user}) end # Get a Directory Group @@ -155,7 +148,10 @@ def get_group( id:, request_options: {} ) - response = @client.request(method: :get, path: "/directory_groups/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/directory_groups/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::DirectoryGroup.new(response.body) end @@ -172,7 +168,7 @@ def list_users( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", directory: nil, group: nil, request_options: {} @@ -185,32 +181,26 @@ def list_users( "directory" => directory, "group" => group }.compact - response = @client.request(method: :get, path: "/directory_users", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::DirectoryUserWithGroups, filters: {before: before, limit: limit, order: order, directory: directory, group: group}, - fetch_next: lambda do |cursor| - list_users( - before: before, - after: cursor, - limit: limit, - order: order, - directory: directory, - group: group, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_users( - before: cursor, - after: nil, - limit: limit, - order: order, - directory: directory, - group: group, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/directory_users", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::DirectoryUserWithGroups.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_users( + before: before, + after: cursor, + limit: limit, + order: order, + directory: directory, + group: group, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, directory: directory, group: group}) end # Get a Directory User @@ -221,7 +211,10 @@ def get_user( id:, request_options: {} ) - response = @client.request(method: :get, path: "/directory_users/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/directory_users/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::DirectoryUserWithGroups.new(response.body) end end diff --git a/lib/workos/directory_sync/directory_user.rb b/lib/workos/directory_sync/directory_user.rb index 82a3fbe1..9df21183 100644 --- a/lib/workos/directory_sync/directory_user.rb +++ b/lib/workos/directory_sync/directory_user.rb @@ -55,28 +55,28 @@ class DirectoryUser :updated_at def emails - warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1 @emails end attr_writer :emails def job_title - warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1 @job_title end attr_writer :job_title def username - warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1 @username end attr_writer :username def raw_attributes - warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1 @raw_attributes end diff --git a/lib/workos/directory_sync/directory_user_with_groups.rb b/lib/workos/directory_sync/directory_user_with_groups.rb index 39266c76..13ddbaea 100644 --- a/lib/workos/directory_sync/directory_user_with_groups.rb +++ b/lib/workos/directory_sync/directory_user_with_groups.rb @@ -57,28 +57,28 @@ class DirectoryUserWithGroups :groups def emails - warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1 @emails end attr_writer :emails def job_title - warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1 @job_title end attr_writer :job_title def username - warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1 @username end attr_writer :username def raw_attributes - warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1 @raw_attributes end diff --git a/lib/workos/directory_sync/dsync_user_updated_data.rb b/lib/workos/directory_sync/dsync_user_updated_data.rb index 040438d8..74b8e6cc 100644 --- a/lib/workos/directory_sync/dsync_user_updated_data.rb +++ b/lib/workos/directory_sync/dsync_user_updated_data.rb @@ -57,28 +57,28 @@ class DsyncUserUpdatedData :previous_attributes def emails - warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1 @emails end attr_writer :emails def job_title - warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1 @job_title end attr_writer :job_title def username - warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1 @username end attr_writer :username def raw_attributes - warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1 @raw_attributes end diff --git a/lib/workos/events.rb b/lib/workos/events.rb index 1b1b77ec..9eeeba7f 100644 --- a/lib/workos/events.rb +++ b/lib/workos/events.rb @@ -25,7 +25,7 @@ def list_events( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", events: nil, range_start: nil, range_end: nil, @@ -42,36 +42,28 @@ def list_events( "range_end" => range_end, "organization_id" => organization_id }.compact - response = @client.request(method: :get, path: "/events", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::EventSchema, filters: {before: before, limit: limit, order: order, events: events, range_start: range_start, range_end: range_end, organization_id: organization_id}, - fetch_next: lambda do |cursor| - list_events( - before: before, - after: cursor, - limit: limit, - order: order, - events: events, - range_start: range_start, - range_end: range_end, - organization_id: organization_id, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_events( - before: cursor, - after: nil, - limit: limit, - order: order, - events: events, - range_start: range_start, - range_end: range_end, - organization_id: organization_id, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/events", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::EventSchema.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_events( + before: before, + after: cursor, + limit: limit, + order: order, + events: events, + range_start: range_start, + range_end: range_end, + organization_id: organization_id, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, events: events, range_start: range_start, range_end: range_end, organization_id: organization_id}) end end end diff --git a/lib/workos/feature_flags.rb b/lib/workos/feature_flags.rb index 73422a94..b5b97bde 100644 --- a/lib/workos/feature_flags.rb +++ b/lib/workos/feature_flags.rb @@ -21,7 +21,7 @@ def list_feature_flags( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -30,28 +30,24 @@ def list_feature_flags( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/feature-flags", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::Flag, filters: {before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_feature_flags( - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_feature_flags( - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/feature-flags", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::Flag.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_feature_flags( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order}) end # Get a feature flag @@ -62,7 +58,10 @@ def get_feature_flag( slug:, request_options: {} ) - response = @client.request(method: :get, path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/feature-flags/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::Flag.new(response.body) end @@ -74,7 +73,10 @@ def disable_feature_flag( slug:, request_options: {} ) - response = @client.request(method: :put, path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/disable", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.put_request(path: "/feature-flags/#{CGI.escape(slug.to_s)}/disable", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::FeatureFlag.new(response.body) end @@ -86,7 +88,10 @@ def enable_feature_flag( slug:, request_options: {} ) - response = @client.request(method: :put, path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/enable", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.put_request(path: "/feature-flags/#{CGI.escape(slug.to_s)}/enable", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::FeatureFlag.new(response.body) end @@ -100,7 +105,10 @@ def add_flag_target( slug:, request_options: {} ) - @client.request(method: :post, path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/targets/#{WorkOS::Util.encode_path(resource_id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.post_request(path: "/feature-flags/#{CGI.escape(slug.to_s)}/targets/#{CGI.escape(resource_id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -114,7 +122,10 @@ def remove_flag_target( slug:, request_options: {} ) - @client.request(method: :delete, path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/targets/#{WorkOS::Util.encode_path(resource_id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/feature-flags/#{CGI.escape(slug.to_s)}/targets/#{CGI.escape(resource_id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -131,7 +142,7 @@ def list_organization_feature_flags( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -140,30 +151,25 @@ def list_organization_feature_flags( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/feature-flags", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::Flag, filters: {organization_id: organization_id, before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_organization_feature_flags( - organization_id: organization_id, - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_organization_feature_flags( - organization_id: organization_id, - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/organizations/#{CGI.escape(organization_id.to_s)}/feature-flags", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::Flag.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_organization_feature_flags( + organization_id: organization_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_id: organization_id, before: before, limit: limit, order: order}) end # List enabled feature flags for a user @@ -179,7 +185,7 @@ def list_user_feature_flags( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -188,30 +194,25 @@ def list_user_feature_flags( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/feature-flags", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::Flag, filters: {user_id: user_id, before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_user_feature_flags( - user_id: user_id, - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_user_feature_flags( - user_id: user_id, - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/feature-flags", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::Flag.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_user_feature_flags( + user_id: user_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {user_id: user_id, before: before, limit: limit, order: order}) end end end diff --git a/lib/workos/multi_factor_auth.rb b/lib/workos/multi_factor_auth.rb index 27b3e16b..39dbbf6d 100644 --- a/lib/workos/multi_factor_auth.rb +++ b/lib/workos/multi_factor_auth.rb @@ -23,7 +23,10 @@ def verify_challenge( body = { "code" => code }.compact - response = @client.request(method: :post, path: "/auth/challenges/#{WorkOS::Util.encode_path(id)}/verify", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/auth/challenges/#{CGI.escape(id.to_s)}/verify", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::AuthenticationChallengeVerifyResponse.new(response.body) end @@ -50,7 +53,10 @@ def enroll_factor( "totp_user" => totp_user, "user_id" => user_id }.compact - response = @client.request(method: :post, path: "/auth/factors/enroll", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/auth/factors/enroll", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::AuthenticationFactorEnrolled.new(response.body) end @@ -62,7 +68,10 @@ def get_factor( id:, request_options: {} ) - response = @client.request(method: :get, path: "/auth/factors/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/auth/factors/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::AuthenticationFactor.new(response.body) end @@ -74,7 +83,10 @@ def delete_factor( id:, request_options: {} ) - @client.request(method: :delete, path: "/auth/factors/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/auth/factors/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -91,7 +103,10 @@ def challenge_factor( body = { "sms_template" => sms_template }.compact - response = @client.request(method: :post, path: "/auth/factors/#{WorkOS::Util.encode_path(id)}/challenge", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/auth/factors/#{CGI.escape(id.to_s)}/challenge", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::AuthenticationChallenge.new(response.body) end @@ -108,7 +123,7 @@ def list_user_auth_factors( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -117,30 +132,25 @@ def list_user_auth_factors( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(userland_user_id)}/auth_factors", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::AuthenticationFactor, filters: {userland_user_id: userland_user_id, before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_user_auth_factors( - userland_user_id: userland_user_id, - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_user_auth_factors( - userland_user_id: userland_user_id, - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/user_management/users/#{CGI.escape(userland_user_id.to_s)}/auth_factors", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::AuthenticationFactor.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_user_auth_factors( + userland_user_id: userland_user_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {userland_user_id: userland_user_id, before: before, limit: limit, order: order}) end # Enroll an authentication factor @@ -165,7 +175,10 @@ def create_user_auth_factor( "totp_user" => totp_user, "totp_secret" => totp_secret }.compact - response = @client.request(method: :post, path: "/user_management/users/#{WorkOS::Util.encode_path(userland_user_id)}/auth_factors", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/users/#{CGI.escape(userland_user_id.to_s)}/auth_factors", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::UserAuthenticationFactorEnrollResponse.new(response.body) end end diff --git a/lib/workos/organization_domains.rb b/lib/workos/organization_domains.rb index 1f5d1273..3833447d 100644 --- a/lib/workos/organization_domains.rb +++ b/lib/workos/organization_domains.rb @@ -24,7 +24,10 @@ def create_organization_domain( "domain" => domain, "organization_id" => organization_id }.compact - response = @client.request(method: :post, path: "/organization_domains", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/organization_domains", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::OrganizationDomain.new(response.body) end @@ -36,7 +39,10 @@ def get_organization_domain( id:, request_options: {} ) - response = @client.request(method: :get, path: "/organization_domains/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/organization_domains/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::OrganizationDomainStandAlone.new(response.body) end @@ -48,7 +54,10 @@ def delete_organization_domain( id:, request_options: {} ) - @client.request(method: :delete, path: "/organization_domains/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/organization_domains/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -60,7 +69,10 @@ def verify_organization_domain( id:, request_options: {} ) - response = @client.request(method: :post, path: "/organization_domains/#{WorkOS::Util.encode_path(id)}/verify", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/organization_domains/#{CGI.escape(id.to_s)}/verify", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::OrganizationDomainStandAlone.new(response.body) end end diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index 23be696b..6bb12b81 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -23,7 +23,7 @@ def list_organizations( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", domains: nil, search: nil, request_options: {} @@ -36,32 +36,26 @@ def list_organizations( "domains" => domains, "search" => search }.compact - response = @client.request(method: :get, path: "/organizations", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::Organization, filters: {before: before, limit: limit, order: order, domains: domains, search: search}, - fetch_next: lambda do |cursor| - list_organizations( - before: before, - after: cursor, - limit: limit, - order: order, - domains: domains, - search: search, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_organizations( - before: cursor, - after: nil, - limit: limit, - order: order, - domains: domains, - search: search, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/organizations", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::Organization.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_organizations( + before: before, + after: cursor, + limit: limit, + order: order, + domains: domains, + search: search, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, domains: domains, search: search}) end # Create an Organization @@ -90,7 +84,10 @@ def create_organization( "metadata" => metadata, "external_id" => external_id }.compact - response = @client.request(method: :post, path: "/organizations", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/organizations", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::Organization.new(response.body) end @@ -102,7 +99,10 @@ def get_organization_by_external_id( external_id:, request_options: {} ) - response = @client.request(method: :get, path: "/organizations/external_id/#{WorkOS::Util.encode_path(external_id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/organizations/external_id/#{CGI.escape(external_id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::Organization.new(response.body) end @@ -114,7 +114,10 @@ def get_organization( id:, request_options: {} ) - response = @client.request(method: :get, path: "/organizations/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/organizations/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::Organization.new(response.body) end @@ -149,7 +152,10 @@ def update_organization( "metadata" => metadata, "external_id" => external_id }.compact - response = @client.request(method: :put, path: "/organizations/#{WorkOS::Util.encode_path(id)}", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.put_request(path: "/organizations/#{CGI.escape(id.to_s)}", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::Organization.new(response.body) end @@ -161,7 +167,10 @@ def delete_organization( id:, request_options: {} ) - @client.request(method: :delete, path: "/organizations/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/organizations/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -173,7 +182,10 @@ def get_audit_log_configuration( id:, request_options: {} ) - response = @client.request(method: :get, path: "/organizations/#{WorkOS::Util.encode_path(id)}/audit_log_configuration", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/organizations/#{CGI.escape(id.to_s)}/audit_log_configuration", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::AuditLogConfiguration.new(response.body) end end diff --git a/lib/workos/organizations/audit_logs_retention_json.rb b/lib/workos/organizations/audit_logs_retention_json.rb new file mode 100644 index 00000000..301c86da --- /dev/null +++ b/lib/workos/organizations/audit_logs_retention_json.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class AuditLogsRetentionJson + include HashProvider + + HASH_ATTRS = { + retention_period_in_days: :retention_period_in_days + }.freeze + + attr_accessor :retention_period_in_days + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @retention_period_in_days = hash[:retention_period_in_days] + end + end +end diff --git a/lib/workos/organizations/organization.rb b/lib/workos/organizations/organization.rb index 25920000..91aebadd 100644 --- a/lib/workos/organizations/organization.rb +++ b/lib/workos/organizations/organization.rb @@ -36,7 +36,7 @@ class Organization :updated_at def allow_profiles_outside_organization - warn "[DEPRECATION] `allow_profiles_outside_organization` is deprecated. Whether the Organization allows profiles outside of its managed domains.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `allow_profiles_outside_organization` is deprecated. Whether the Organization allows profiles outside of its managed domains.", uplevel: 1 @allow_profiles_outside_organization end diff --git a/lib/workos/organizations/update_organization.rb b/lib/workos/organizations/update_organization.rb index fb4d2a61..cf95c4ad 100644 --- a/lib/workos/organizations/update_organization.rb +++ b/lib/workos/organizations/update_organization.rb @@ -30,7 +30,7 @@ class UpdateOrganization :external_id def domains - warn "[DEPRECATION] `domains` is deprecated. The domains associated with the organization. Deprecated in favor of `domain_data`.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `domains` is deprecated. The domains associated with the organization. Deprecated in favor of `domain_data`.", uplevel: 1 @domains end diff --git a/lib/workos/pipes.rb b/lib/workos/pipes.rb index c3239482..e0a07e91 100644 --- a/lib/workos/pipes.rb +++ b/lib/workos/pipes.rb @@ -29,7 +29,10 @@ def authorize_data_integration( "organization_id" => organization_id, "return_to" => return_to }.compact - response = @client.request(method: :post, path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/authorize", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/data-integrations/#{CGI.escape(slug.to_s)}/authorize", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::DataIntegrationAuthorizeUrlResponse.new(response.body) end @@ -49,7 +52,10 @@ def create_data_integration_token( "user_id" => user_id, "organization_id" => organization_id }.compact - response = @client.request(method: :post, path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/token", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/data-integrations/#{CGI.escape(slug.to_s)}/token", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::DataIntegrationAccessTokenResponse.new(response.body) end @@ -68,7 +74,10 @@ def get_user_connected_account( params = { "organization_id" => organization_id }.compact - response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", auth: true, params: params, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/connected_accounts/#{CGI.escape(slug.to_s)}", auth: true, params: params, request_options: request_options), + request_options: request_options + ) WorkOS::ConnectedAccount.new(response.body) end @@ -87,7 +96,10 @@ def delete_user_connected_account( params = { "organization_id" => organization_id }.compact - @client.request(method: :delete, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", auth: true, params: params, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/connected_accounts/#{CGI.escape(slug.to_s)}", auth: true, params: params, request_options: request_options), + request_options: request_options + ) nil end @@ -104,7 +116,10 @@ def list_user_data_providers( params = { "organization_id" => organization_id }.compact - response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/data_providers", auth: true, params: params, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/data_providers", auth: true, params: params, request_options: request_options), + request_options: request_options + ) WorkOS::DataIntegrationsListResponse.new(response.body) end end diff --git a/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb b/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb index e949f5cf..ba5d00dc 100644 --- a/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +++ b/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb @@ -17,7 +17,7 @@ class DataIntegrationsListResponseDataConnectedAccount state: :state, created_at: :created_at, updated_at: :updated_at, - userlandUserId: :userland_user_id + userland_user_id: :userland_user_id }.freeze # @!attribute userland_user_id @@ -34,7 +34,7 @@ class DataIntegrationsListResponseDataConnectedAccount :updated_at def userland_user_id - warn "[DEPRECATION] `userland_user_id` is deprecated. Use `user_id` instead.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `userland_user_id` is deprecated. Use `user_id` instead.", uplevel: 1 @userland_user_id end diff --git a/lib/workos/radar.rb b/lib/workos/radar.rb index e61fe40d..db76a918 100644 --- a/lib/workos/radar.rb +++ b/lib/workos/radar.rb @@ -39,7 +39,10 @@ def create_attempt( "device_fingerprint" => device_fingerprint, "bot_score" => bot_score }.compact - response = @client.request(method: :post, path: "/radar/attempts", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/radar/attempts", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::RadarStandaloneResponse.new(response.body) end @@ -59,7 +62,10 @@ def update_attempt( "challenge_status" => challenge_status, "attempt_status" => attempt_status }.compact - @client.request(method: :put, path: "/radar/attempts/#{WorkOS::Util.encode_path(id)}", auth: true, body: body, request_options: request_options) + @client.execute_request( + request: @client.put_request(path: "/radar/attempts/#{CGI.escape(id.to_s)}", auth: true, body: body, request_options: request_options), + request_options: request_options + ) nil end @@ -78,7 +84,10 @@ def add_list_entry( body = { "entry" => entry }.compact - response = @client.request(method: :post, path: "/radar/lists/#{WorkOS::Util.encode_path(type)}/#{WorkOS::Util.encode_path(action)}", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/radar/lists/#{CGI.escape(type.to_s)}/#{CGI.escape(action.to_s)}", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::RadarListEntryAlreadyPresentResponse.new(response.body) end @@ -97,7 +106,10 @@ def remove_list_entry( body = { "entry" => entry }.compact - @client.request(method: :delete, path: "/radar/lists/#{WorkOS::Util.encode_path(type)}/#{WorkOS::Util.encode_path(action)}", auth: true, body: body, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/radar/lists/#{CGI.escape(type.to_s)}/#{CGI.escape(action.to_s)}", auth: true, body: body, request_options: request_options), + request_options: request_options + ) nil end end diff --git a/lib/workos/shared/event_context_google_analytics_session.rb b/lib/workos/shared/event_context_google_analytics_session.rb index ed422b60..c6dac289 100644 --- a/lib/workos/shared/event_context_google_analytics_session.rb +++ b/lib/workos/shared/event_context_google_analytics_session.rb @@ -9,9 +9,9 @@ class EventContextGoogleAnalyticsSession include HashProvider HASH_ATTRS = { - containerId: :container_id, - sessionId: :session_id, - sessionNumber: :session_number + container_id: :container_id, + session_id: :session_id, + session_number: :session_number }.freeze attr_accessor \ diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index 98222744..4572e9e4 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -25,7 +25,7 @@ def list_connections( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", connection_type: nil, domain: nil, organization_id: nil, @@ -42,36 +42,28 @@ def list_connections( "organization_id" => organization_id, "search" => search }.compact - response = @client.request(method: :get, path: "/connections", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::Connection, filters: {before: before, limit: limit, order: order, connection_type: connection_type, domain: domain, organization_id: organization_id, search: search}, - fetch_next: lambda do |cursor| - list_connections( - before: before, - after: cursor, - limit: limit, - order: order, - connection_type: connection_type, - domain: domain, - organization_id: organization_id, - search: search, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_connections( - before: cursor, - after: nil, - limit: limit, - order: order, - connection_type: connection_type, - domain: domain, - organization_id: organization_id, - search: search, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/connections", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::Connection.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_connections( + before: before, + after: cursor, + limit: limit, + order: order, + connection_type: connection_type, + domain: domain, + organization_id: organization_id, + search: search, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, connection_type: connection_type, domain: domain, organization_id: organization_id, search: search}) end # Get a Connection @@ -82,7 +74,10 @@ def get_connection( id:, request_options: {} ) - response = @client.request(method: :get, path: "/connections/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/connections/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::Connection.new(response.body) end @@ -94,7 +89,10 @@ def delete_connection( id:, request_options: {} ) - @client.request(method: :delete, path: "/connections/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/connections/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -109,7 +107,10 @@ def authorize_logout( body = { "profile_id" => profile_id }.compact - response = @client.request(method: :post, path: "/sso/logout/authorize", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/sso/logout/authorize", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::SSOLogoutAuthorizeResponse.new(response.body) end @@ -117,7 +118,10 @@ def authorize_logout( # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. # @return [WorkOS::Profile] def get_profile(request_options: {}) - response = @client.request(method: :get, path: "/sso/profile", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/sso/profile", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::Profile.new(response.body) end @@ -129,13 +133,19 @@ def get_profile_and_token( code:, request_options: {} ) + params = { + "code" => code + }.compact body = { "grant_type" => "authorization_code", - "client_id" => request_options[:client_id] || request_options["client_id"] || @client.client_id, - "client_secret" => request_options[:api_key] || request_options["api_key"] || @client.api_key, + "client_id" => @client.client_id, + "client_secret" => @client.api_key, "code" => code }.compact - response = @client.request(method: :post, path: "/sso/token", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/sso/token", auth: true, params: params, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::SSOTokenResponse.new(response.body) end diff --git a/lib/workos/sso/connection.rb b/lib/workos/sso/connection.rb index 09270b42..476858da 100644 --- a/lib/workos/sso/connection.rb +++ b/lib/workos/sso/connection.rb @@ -38,7 +38,7 @@ class Connection :updated_at def status - warn "[DEPRECATION] `status` is deprecated. Deprecated. Use `state` instead.", uplevel: 1, category: :deprecated + warn "[DEPRECATION] `status` is deprecated. Deprecated. Use `state` instead.", uplevel: 1 @status end diff --git a/lib/workos/types/applications_order.rb b/lib/workos/types/applications_order.rb index 08123a6d..779a57ee 100644 --- a/lib/workos/types/applications_order.rb +++ b/lib/workos/types/applications_order.rb @@ -4,6 +4,11 @@ module WorkOS module Types - ApplicationsOrder = EventsOrder + class ApplicationsOrder + NORMAL = "normal" + DESC = "desc" + ASC = "asc" + ALL = [NORMAL, DESC, ASC].freeze + end end end diff --git a/lib/workos/types/audit_log_export_json_state.rb b/lib/workos/types/audit_log_export_json_state.rb new file mode 100644 index 00000000..a3ddd394 --- /dev/null +++ b/lib/workos/types/audit_log_export_json_state.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class AuditLogExportJsonState + PENDING = "pending" + READY = "ready" + ERROR = "error" + ALL = [PENDING, READY, ERROR].freeze + end + end +end diff --git a/lib/workos/types/audit_logs_order.rb b/lib/workos/types/audit_logs_order.rb index 01b459f2..598b6279 100644 --- a/lib/workos/types/audit_logs_order.rb +++ b/lib/workos/types/audit_logs_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - AuditLogsOrder = EventsOrder + AuditLogsOrder = ApplicationsOrder end end diff --git a/lib/workos/types/authentication_factor_enrolled_type.rb b/lib/workos/types/authentication_factor_enrolled_type.rb index cb488016..788d3750 100644 --- a/lib/workos/types/authentication_factor_enrolled_type.rb +++ b/lib/workos/types/authentication_factor_enrolled_type.rb @@ -4,6 +4,12 @@ module WorkOS module Types - AuthenticationFactorEnrolledType = AuthenticationFactorType + class AuthenticationFactorEnrolledType + GENERIC_OTP = "generic_otp" + SMS = "sms" + TOTP = "totp" + WEBAUTHN = "webauthn" + ALL = [GENERIC_OTP, SMS, TOTP, WEBAUTHN].freeze + end end end diff --git a/lib/workos/types/authentication_factor_type.rb b/lib/workos/types/authentication_factor_type.rb index a35f4a72..06d4d032 100644 --- a/lib/workos/types/authentication_factor_type.rb +++ b/lib/workos/types/authentication_factor_type.rb @@ -4,12 +4,6 @@ module WorkOS module Types - class AuthenticationFactorType - GENERIC_OTP = "generic_otp" - SMS = "sms" - TOTP = "totp" - WEBAUTHN = "webauthn" - ALL = [GENERIC_OTP, SMS, TOTP, WEBAUTHN].freeze - end + AuthenticationFactorType = AuthenticationFactorEnrolledType end end diff --git a/lib/workos/types/authorization_order.rb b/lib/workos/types/authorization_order.rb index 3b763346..76c3a7e4 100644 --- a/lib/workos/types/authorization_order.rb +++ b/lib/workos/types/authorization_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - AuthorizationOrder = EventsOrder + AuthorizationOrder = ApplicationsOrder end end diff --git a/lib/workos/types/connection_activated_data_connection_type.rb b/lib/workos/types/connection_activated_data_connection_type.rb index ba2ec204..bc9da6ec 100644 --- a/lib/workos/types/connection_activated_data_connection_type.rb +++ b/lib/workos/types/connection_activated_data_connection_type.rb @@ -4,6 +4,58 @@ module WorkOS module Types - ConnectionActivatedDataConnectionType = ConnectionDeletedDataConnectionType + class ConnectionActivatedDataConnectionType + ADFSSAML = "ADFSSAML" + ADP_OIDC = "AdpOidc" + APPLE_OAUTH = "AppleOAuth" + AUTH_0_MIGRATION = "Auth0Migration" + AUTH_0_SAML = "Auth0SAML" + AZURE_SAML = "AzureSAML" + BITBUCKET_OAUTH = "BitbucketOAuth" + CAS_SAML = "CasSAML" + CLASS_LINK_SAML = "ClassLinkSAML" + CLEVER_OIDC = "CleverOIDC" + CLOUDFLARE_SAML = "CloudflareSAML" + CYBER_ARK_SAML = "CyberArkSAML" + DISCORD_OAUTH = "DiscordOAuth" + DUO_SAML = "DuoSAML" + ENTRA_ID_OIDC = "EntraIdOIDC" + GENERIC_OIDC = "GenericOIDC" + GENERIC_SAML = "GenericSAML" + GIT_HUB_OAUTH = "GitHubOAuth" + GIT_LAB_OAUTH = "GitLabOAuth" + GOOGLE_OAUTH = "GoogleOAuth" + GOOGLE_OIDC = "GoogleOIDC" + GOOGLE_SAML = "GoogleSAML" + INTUIT_OAUTH = "IntuitOAuth" + JUMP_CLOUD_SAML = "JumpCloudSAML" + KEYCLOAK_SAML = "KeycloakSAML" + LAST_PASS_SAML = "LastPassSAML" + LINKED_IN_OAUTH = "LinkedInOAuth" + LOGIN_GOV_OIDC = "LoginGovOidc" + MAGIC_LINK = "MagicLink" + MICROSOFT_OAUTH = "MicrosoftOAuth" + MINI_ORANGE_SAML = "MiniOrangeSAML" + NET_IQ_SAML = "NetIqSAML" + OKTA_OIDC = "OktaOIDC" + OKTA_SAML = "OktaSAML" + ONE_LOGIN_SAML = "OneLoginSAML" + ORACLE_SAML = "OracleSAML" + PING_FEDERATE_SAML = "PingFederateSAML" + PING_ONE_SAML = "PingOneSAML" + RIPPLING_SAML = "RipplingSAML" + SALESFORCE_SAML = "SalesforceSAML" + SHIBBOLETH_GENERIC_SAML = "ShibbolethGenericSAML" + SHIBBOLETH_SAML = "ShibbolethSAML" + SIMPLE_SAML_PHP_SAML = "SimpleSamlPhpSAML" + SALESFORCE_OAUTH = "SalesforceOAuth" + SLACK_OAUTH = "SlackOAuth" + TEST_IDP = "TestIdp" + VERCEL_MARKETPLACE_OAUTH = "VercelMarketplaceOAuth" + VERCEL_OAUTH = "VercelOAuth" + V_MWARE_SAML = "VMwareSAML" + XERO_OAUTH = "XeroOAuth" + ALL = [ADFSSAML, ADP_OIDC, APPLE_OAUTH, AUTH_0_MIGRATION, AUTH_0_SAML, AZURE_SAML, BITBUCKET_OAUTH, CAS_SAML, CLASS_LINK_SAML, CLEVER_OIDC, CLOUDFLARE_SAML, CYBER_ARK_SAML, DISCORD_OAUTH, DUO_SAML, ENTRA_ID_OIDC, GENERIC_OIDC, GENERIC_SAML, GIT_HUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GOOGLE_OIDC, GOOGLE_SAML, INTUIT_OAUTH, JUMP_CLOUD_SAML, KEYCLOAK_SAML, LAST_PASS_SAML, LINKED_IN_OAUTH, LOGIN_GOV_OIDC, MAGIC_LINK, MICROSOFT_OAUTH, MINI_ORANGE_SAML, NET_IQ_SAML, OKTA_OIDC, OKTA_SAML, ONE_LOGIN_SAML, ORACLE_SAML, PING_FEDERATE_SAML, PING_ONE_SAML, RIPPLING_SAML, SALESFORCE_SAML, SHIBBOLETH_GENERIC_SAML, SHIBBOLETH_SAML, SIMPLE_SAML_PHP_SAML, SALESFORCE_OAUTH, SLACK_OAUTH, TEST_IDP, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, V_MWARE_SAML, XERO_OAUTH].freeze + end end end diff --git a/lib/workos/types/connection_activated_data_state.rb b/lib/workos/types/connection_activated_data_state.rb index f9feeefb..e2f8859d 100644 --- a/lib/workos/types/connection_activated_data_state.rb +++ b/lib/workos/types/connection_activated_data_state.rb @@ -4,6 +4,13 @@ module WorkOS module Types - ConnectionActivatedDataState = ConnectionDeletedDataState + class ConnectionActivatedDataState + DRAFT = "draft" + ACTIVE = "active" + VALIDATING = "validating" + INACTIVE = "inactive" + DELETING = "deleting" + ALL = [DRAFT, ACTIVE, VALIDATING, INACTIVE, DELETING].freeze + end end end diff --git a/lib/workos/types/connection_activated_data_status.rb b/lib/workos/types/connection_activated_data_status.rb index 16238bc0..0c76fca0 100644 --- a/lib/workos/types/connection_activated_data_status.rb +++ b/lib/workos/types/connection_activated_data_status.rb @@ -4,6 +4,10 @@ module WorkOS module Types - ConnectionActivatedDataStatus = ConnectionStatus + class ConnectionActivatedDataStatus + LINKED = "linked" + UNLINKED = "unlinked" + ALL = [LINKED, UNLINKED].freeze + end end end diff --git a/lib/workos/types/connection_deactivated_data_connection_type.rb b/lib/workos/types/connection_deactivated_data_connection_type.rb index 63110f3a..6c92eb99 100644 --- a/lib/workos/types/connection_deactivated_data_connection_type.rb +++ b/lib/workos/types/connection_deactivated_data_connection_type.rb @@ -4,6 +4,6 @@ module WorkOS module Types - ConnectionDeactivatedDataConnectionType = ConnectionDeletedDataConnectionType + ConnectionDeactivatedDataConnectionType = ConnectionActivatedDataConnectionType end end diff --git a/lib/workos/types/connection_deactivated_data_state.rb b/lib/workos/types/connection_deactivated_data_state.rb index cef596f0..4e5b6724 100644 --- a/lib/workos/types/connection_deactivated_data_state.rb +++ b/lib/workos/types/connection_deactivated_data_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - ConnectionDeactivatedDataState = ConnectionDeletedDataState + ConnectionDeactivatedDataState = ConnectionActivatedDataState end end diff --git a/lib/workos/types/connection_deactivated_data_status.rb b/lib/workos/types/connection_deactivated_data_status.rb index 7ee9904c..dfb61ac9 100644 --- a/lib/workos/types/connection_deactivated_data_status.rb +++ b/lib/workos/types/connection_deactivated_data_status.rb @@ -4,6 +4,6 @@ module WorkOS module Types - ConnectionDeactivatedDataStatus = ConnectionStatus + ConnectionDeactivatedDataStatus = ConnectionActivatedDataStatus end end diff --git a/lib/workos/types/connection_deleted_data_connection_type.rb b/lib/workos/types/connection_deleted_data_connection_type.rb index 971d8c06..20105452 100644 --- a/lib/workos/types/connection_deleted_data_connection_type.rb +++ b/lib/workos/types/connection_deleted_data_connection_type.rb @@ -4,58 +4,6 @@ module WorkOS module Types - class ConnectionDeletedDataConnectionType - ADFSSAML = "ADFSSAML" - ADP_OIDC = "AdpOidc" - APPLE_OAUTH = "AppleOAuth" - AUTH_0_MIGRATION = "Auth0Migration" - AUTH_0_SAML = "Auth0SAML" - AZURE_SAML = "AzureSAML" - BITBUCKET_OAUTH = "BitbucketOAuth" - CAS_SAML = "CasSAML" - CLASS_LINK_SAML = "ClassLinkSAML" - CLEVER_OIDC = "CleverOIDC" - CLOUDFLARE_SAML = "CloudflareSAML" - CYBER_ARK_SAML = "CyberArkSAML" - DISCORD_OAUTH = "DiscordOAuth" - DUO_SAML = "DuoSAML" - ENTRA_ID_OIDC = "EntraIdOIDC" - GENERIC_OIDC = "GenericOIDC" - GENERIC_SAML = "GenericSAML" - GIT_HUB_OAUTH = "GitHubOAuth" - GIT_LAB_OAUTH = "GitLabOAuth" - GOOGLE_OAUTH = "GoogleOAuth" - GOOGLE_OIDC = "GoogleOIDC" - GOOGLE_SAML = "GoogleSAML" - INTUIT_OAUTH = "IntuitOAuth" - JUMP_CLOUD_SAML = "JumpCloudSAML" - KEYCLOAK_SAML = "KeycloakSAML" - LAST_PASS_SAML = "LastPassSAML" - LINKED_IN_OAUTH = "LinkedInOAuth" - LOGIN_GOV_OIDC = "LoginGovOidc" - MAGIC_LINK = "MagicLink" - MICROSOFT_OAUTH = "MicrosoftOAuth" - MINI_ORANGE_SAML = "MiniOrangeSAML" - NET_IQ_SAML = "NetIqSAML" - OKTA_OIDC = "OktaOIDC" - OKTA_SAML = "OktaSAML" - ONE_LOGIN_SAML = "OneLoginSAML" - ORACLE_SAML = "OracleSAML" - PING_FEDERATE_SAML = "PingFederateSAML" - PING_ONE_SAML = "PingOneSAML" - RIPPLING_SAML = "RipplingSAML" - SALESFORCE_SAML = "SalesforceSAML" - SHIBBOLETH_GENERIC_SAML = "ShibbolethGenericSAML" - SHIBBOLETH_SAML = "ShibbolethSAML" - SIMPLE_SAML_PHP_SAML = "SimpleSamlPhpSAML" - SALESFORCE_OAUTH = "SalesforceOAuth" - SLACK_OAUTH = "SlackOAuth" - TEST_IDP = "TestIdp" - VERCEL_MARKETPLACE_OAUTH = "VercelMarketplaceOAuth" - VERCEL_OAUTH = "VercelOAuth" - V_MWARE_SAML = "VMwareSAML" - XERO_OAUTH = "XeroOAuth" - ALL = [ADFSSAML, ADP_OIDC, APPLE_OAUTH, AUTH_0_MIGRATION, AUTH_0_SAML, AZURE_SAML, BITBUCKET_OAUTH, CAS_SAML, CLASS_LINK_SAML, CLEVER_OIDC, CLOUDFLARE_SAML, CYBER_ARK_SAML, DISCORD_OAUTH, DUO_SAML, ENTRA_ID_OIDC, GENERIC_OIDC, GENERIC_SAML, GIT_HUB_OAUTH, GIT_LAB_OAUTH, GOOGLE_OAUTH, GOOGLE_OIDC, GOOGLE_SAML, INTUIT_OAUTH, JUMP_CLOUD_SAML, KEYCLOAK_SAML, LAST_PASS_SAML, LINKED_IN_OAUTH, LOGIN_GOV_OIDC, MAGIC_LINK, MICROSOFT_OAUTH, MINI_ORANGE_SAML, NET_IQ_SAML, OKTA_OIDC, OKTA_SAML, ONE_LOGIN_SAML, ORACLE_SAML, PING_FEDERATE_SAML, PING_ONE_SAML, RIPPLING_SAML, SALESFORCE_SAML, SHIBBOLETH_GENERIC_SAML, SHIBBOLETH_SAML, SIMPLE_SAML_PHP_SAML, SALESFORCE_OAUTH, SLACK_OAUTH, TEST_IDP, VERCEL_MARKETPLACE_OAUTH, VERCEL_OAUTH, V_MWARE_SAML, XERO_OAUTH].freeze - end + ConnectionDeletedDataConnectionType = ConnectionActivatedDataConnectionType end end diff --git a/lib/workos/types/connection_deleted_data_state.rb b/lib/workos/types/connection_deleted_data_state.rb index b0f16df0..f2c44904 100644 --- a/lib/workos/types/connection_deleted_data_state.rb +++ b/lib/workos/types/connection_deleted_data_state.rb @@ -4,13 +4,6 @@ module WorkOS module Types - class ConnectionDeletedDataState - DRAFT = "draft" - ACTIVE = "active" - VALIDATING = "validating" - INACTIVE = "inactive" - DELETING = "deleting" - ALL = [DRAFT, ACTIVE, VALIDATING, INACTIVE, DELETING].freeze - end + ConnectionDeletedDataState = ConnectionActivatedDataState end end diff --git a/lib/workos/types/connection_saml_certificate_renewal_required_data_certificate_certificate_type.rb b/lib/workos/types/connection_saml_certificate_renewal_required_data_certificate_certificate_type.rb index 77fa1203..9aed8144 100644 --- a/lib/workos/types/connection_saml_certificate_renewal_required_data_certificate_certificate_type.rb +++ b/lib/workos/types/connection_saml_certificate_renewal_required_data_certificate_certificate_type.rb @@ -4,6 +4,11 @@ module WorkOS module Types - ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType = ConnectionSAMLCertificateRenewedDataCertificateCertificateType + class ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType + RESPONSE_SIGNING = "ResponseSigning" + REQUEST_SIGNING = "RequestSigning" + RESPONSE_ENCRYPTION = "ResponseEncryption" + ALL = [RESPONSE_SIGNING, REQUEST_SIGNING, RESPONSE_ENCRYPTION].freeze + end end end diff --git a/lib/workos/types/connection_saml_certificate_renewed_data_certificate_certificate_type.rb b/lib/workos/types/connection_saml_certificate_renewed_data_certificate_certificate_type.rb index dc1945d8..4caf9619 100644 --- a/lib/workos/types/connection_saml_certificate_renewed_data_certificate_certificate_type.rb +++ b/lib/workos/types/connection_saml_certificate_renewed_data_certificate_certificate_type.rb @@ -4,11 +4,6 @@ module WorkOS module Types - class ConnectionSAMLCertificateRenewedDataCertificateCertificateType - RESPONSE_SIGNING = "ResponseSigning" - REQUEST_SIGNING = "RequestSigning" - RESPONSE_ENCRYPTION = "ResponseEncryption" - ALL = [RESPONSE_SIGNING, REQUEST_SIGNING, RESPONSE_ENCRYPTION].freeze - end + ConnectionSAMLCertificateRenewedDataCertificateCertificateType = ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType end end diff --git a/lib/workos/types/connection_status.rb b/lib/workos/types/connection_status.rb index 3be6c1a3..f2168764 100644 --- a/lib/workos/types/connection_status.rb +++ b/lib/workos/types/connection_status.rb @@ -4,10 +4,6 @@ module WorkOS module Types - class ConnectionStatus - LINKED = "linked" - UNLINKED = "unlinked" - ALL = [LINKED, UNLINKED].freeze - end + ConnectionStatus = ConnectionActivatedDataStatus end end diff --git a/lib/workos/types/connections_order.rb b/lib/workos/types/connections_order.rb index 793d2a42..97175e72 100644 --- a/lib/workos/types/connections_order.rb +++ b/lib/workos/types/connections_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - ConnectionsOrder = EventsOrder + ConnectionsOrder = ApplicationsOrder end end diff --git a/lib/workos/types/directories_order.rb b/lib/workos/types/directories_order.rb index 08e30935..4fc0eff0 100644 --- a/lib/workos/types/directories_order.rb +++ b/lib/workos/types/directories_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - DirectoriesOrder = EventsOrder + DirectoriesOrder = ApplicationsOrder end end diff --git a/lib/workos/types/directory_groups_order.rb b/lib/workos/types/directory_groups_order.rb index 3ae626b1..1cc006ec 100644 --- a/lib/workos/types/directory_groups_order.rb +++ b/lib/workos/types/directory_groups_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - DirectoryGroupsOrder = EventsOrder + DirectoryGroupsOrder = ApplicationsOrder end end diff --git a/lib/workos/types/directory_users_order.rb b/lib/workos/types/directory_users_order.rb index ff3c0484..37052177 100644 --- a/lib/workos/types/directory_users_order.rb +++ b/lib/workos/types/directory_users_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - DirectoryUsersOrder = EventsOrder + DirectoryUsersOrder = ApplicationsOrder end end diff --git a/lib/workos/types/dsync_activated_data_state.rb b/lib/workos/types/dsync_activated_data_state.rb index 9959673c..2e7d4d87 100644 --- a/lib/workos/types/dsync_activated_data_state.rb +++ b/lib/workos/types/dsync_activated_data_state.rb @@ -4,6 +4,13 @@ module WorkOS module Types - DsyncActivatedDataState = DsyncDeletedDataState + class DsyncActivatedDataState + ACTIVE = "active" + VALIDATING = "validating" + INVALID_CREDENTIALS = "invalid_credentials" + INACTIVE = "inactive" + DELETING = "deleting" + ALL = [ACTIVE, VALIDATING, INVALID_CREDENTIALS, INACTIVE, DELETING].freeze + end end end diff --git a/lib/workos/types/dsync_activated_data_type.rb b/lib/workos/types/dsync_activated_data_type.rb index 7724f513..6e2949dd 100644 --- a/lib/workos/types/dsync_activated_data_type.rb +++ b/lib/workos/types/dsync_activated_data_type.rb @@ -4,6 +4,31 @@ module WorkOS module Types - DsyncActivatedDataType = DsyncDeletedDataType + class DsyncActivatedDataType + AZURE_SCIM_V_2_0 = "azure scim v2.0" + BAMBOOHR = "bamboohr" + BREATHE_HR = "breathe hr" + CEZANNE_HR = "cezanne hr" + CYBERARK_SCIM_V_2_0 = "cyberark scim v2.0" + FOURTH_HR = "fourth hr" + GENERIC_SCIM_V_2_0 = "generic scim v2.0" + GSUITE_DIRECTORY = "gsuite directory" + GUSTO = "gusto" + HIBOB = "hibob" + JUMP_CLOUD_SCIM_V_2_0 = "jump cloud scim v2.0" + OKTA_SCIM_V_2_0 = "okta scim v2.0" + ONELOGIN_SCIM_V_2_0 = "onelogin scim v2.0" + PEOPLE_HR = "people hr" + PERSONIO = "personio" + PINGFEDERATE_SCIM_V_2_0 = "pingfederate scim v2.0" + RIPPLING_SCIM_V_2_0 = "rippling scim v2.0" + RIPPLING = "rippling" + SAILPOINT_SCIM_V_2_0 = "sailpoint scim v2.0" + S_3 = "s3" + SFTP = "sftp" + SFTP_WORKDAY = "sftp workday" + WORKDAY = "workday" + ALL = [AZURE_SCIM_V_2_0, BAMBOOHR, BREATHE_HR, CEZANNE_HR, CYBERARK_SCIM_V_2_0, FOURTH_HR, GENERIC_SCIM_V_2_0, GSUITE_DIRECTORY, GUSTO, HIBOB, JUMP_CLOUD_SCIM_V_2_0, OKTA_SCIM_V_2_0, ONELOGIN_SCIM_V_2_0, PEOPLE_HR, PERSONIO, PINGFEDERATE_SCIM_V_2_0, RIPPLING_SCIM_V_2_0, RIPPLING, SAILPOINT_SCIM_V_2_0, S_3, SFTP, SFTP_WORKDAY, WORKDAY].freeze + end end end diff --git a/lib/workos/types/dsync_deactivated_data_state.rb b/lib/workos/types/dsync_deactivated_data_state.rb index 97a661f2..33e4814e 100644 --- a/lib/workos/types/dsync_deactivated_data_state.rb +++ b/lib/workos/types/dsync_deactivated_data_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - DsyncDeactivatedDataState = DsyncDeletedDataState + DsyncDeactivatedDataState = DsyncActivatedDataState end end diff --git a/lib/workos/types/dsync_deactivated_data_type.rb b/lib/workos/types/dsync_deactivated_data_type.rb index 247de49a..3ca02e36 100644 --- a/lib/workos/types/dsync_deactivated_data_type.rb +++ b/lib/workos/types/dsync_deactivated_data_type.rb @@ -4,6 +4,6 @@ module WorkOS module Types - DsyncDeactivatedDataType = DsyncDeletedDataType + DsyncDeactivatedDataType = DsyncActivatedDataType end end diff --git a/lib/workos/types/dsync_deleted_data_state.rb b/lib/workos/types/dsync_deleted_data_state.rb index 4989bc40..7a836522 100644 --- a/lib/workos/types/dsync_deleted_data_state.rb +++ b/lib/workos/types/dsync_deleted_data_state.rb @@ -4,13 +4,6 @@ module WorkOS module Types - class DsyncDeletedDataState - ACTIVE = "active" - VALIDATING = "validating" - INVALID_CREDENTIALS = "invalid_credentials" - INACTIVE = "inactive" - DELETING = "deleting" - ALL = [ACTIVE, VALIDATING, INVALID_CREDENTIALS, INACTIVE, DELETING].freeze - end + DsyncDeletedDataState = DsyncActivatedDataState end end diff --git a/lib/workos/types/dsync_deleted_data_type.rb b/lib/workos/types/dsync_deleted_data_type.rb index 74b2d08c..6c074cc1 100644 --- a/lib/workos/types/dsync_deleted_data_type.rb +++ b/lib/workos/types/dsync_deleted_data_type.rb @@ -4,31 +4,6 @@ module WorkOS module Types - class DsyncDeletedDataType - AZURE_SCIM_V_2_0 = "azure scim v2.0" - BAMBOOHR = "bamboohr" - BREATHE_HR = "breathe hr" - CEZANNE_HR = "cezanne hr" - CYBERARK_SCIM_V_2_0 = "cyberark scim v2.0" - FOURTH_HR = "fourth hr" - GENERIC_SCIM_V_2_0 = "generic scim v2.0" - GSUITE_DIRECTORY = "gsuite directory" - GUSTO = "gusto" - HIBOB = "hibob" - JUMP_CLOUD_SCIM_V_2_0 = "jump cloud scim v2.0" - OKTA_SCIM_V_2_0 = "okta scim v2.0" - ONELOGIN_SCIM_V_2_0 = "onelogin scim v2.0" - PEOPLE_HR = "people hr" - PERSONIO = "personio" - PINGFEDERATE_SCIM_V_2_0 = "pingfederate scim v2.0" - RIPPLING_SCIM_V_2_0 = "rippling scim v2.0" - RIPPLING = "rippling" - SAILPOINT_SCIM_V_2_0 = "sailpoint scim v2.0" - S_3 = "s3" - SFTP = "sftp" - SFTP_WORKDAY = "sftp workday" - WORKDAY = "workday" - ALL = [AZURE_SCIM_V_2_0, BAMBOOHR, BREATHE_HR, CEZANNE_HR, CYBERARK_SCIM_V_2_0, FOURTH_HR, GENERIC_SCIM_V_2_0, GSUITE_DIRECTORY, GUSTO, HIBOB, JUMP_CLOUD_SCIM_V_2_0, OKTA_SCIM_V_2_0, ONELOGIN_SCIM_V_2_0, PEOPLE_HR, PERSONIO, PINGFEDERATE_SCIM_V_2_0, RIPPLING_SCIM_V_2_0, RIPPLING, SAILPOINT_SCIM_V_2_0, S_3, SFTP, SFTP_WORKDAY, WORKDAY].freeze - end + DsyncDeletedDataType = DsyncActivatedDataType end end diff --git a/lib/workos/types/events_order.rb b/lib/workos/types/events_order.rb index 6ab23aa1..4f73381f 100644 --- a/lib/workos/types/events_order.rb +++ b/lib/workos/types/events_order.rb @@ -4,11 +4,6 @@ module WorkOS module Types - class EventsOrder - NORMAL = "normal" - DESC = "desc" - ASC = "asc" - ALL = [NORMAL, DESC, ASC].freeze - end + EventsOrder = ApplicationsOrder end end diff --git a/lib/workos/types/feature_flags_order.rb b/lib/workos/types/feature_flags_order.rb index 79ed103e..c66da69e 100644 --- a/lib/workos/types/feature_flags_order.rb +++ b/lib/workos/types/feature_flags_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - FeatureFlagsOrder = EventsOrder + FeatureFlagsOrder = ApplicationsOrder end end diff --git a/lib/workos/types/invitation_accepted_data_state.rb b/lib/workos/types/invitation_accepted_data_state.rb index 679958a5..23a31066 100644 --- a/lib/workos/types/invitation_accepted_data_state.rb +++ b/lib/workos/types/invitation_accepted_data_state.rb @@ -4,6 +4,12 @@ module WorkOS module Types - InvitationAcceptedDataState = InvitationState + class InvitationAcceptedDataState + PENDING = "pending" + ACCEPTED = "accepted" + EXPIRED = "expired" + REVOKED = "revoked" + ALL = [PENDING, ACCEPTED, EXPIRED, REVOKED].freeze + end end end diff --git a/lib/workos/types/invitation_created_data_state.rb b/lib/workos/types/invitation_created_data_state.rb index 91e402b5..51a03f2c 100644 --- a/lib/workos/types/invitation_created_data_state.rb +++ b/lib/workos/types/invitation_created_data_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - InvitationCreatedDataState = InvitationState + InvitationCreatedDataState = InvitationAcceptedDataState end end diff --git a/lib/workos/types/invitation_resent_data_state.rb b/lib/workos/types/invitation_resent_data_state.rb index 249fcae4..b55a3484 100644 --- a/lib/workos/types/invitation_resent_data_state.rb +++ b/lib/workos/types/invitation_resent_data_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - InvitationResentDataState = InvitationState + InvitationResentDataState = InvitationAcceptedDataState end end diff --git a/lib/workos/types/invitation_revoked_data_state.rb b/lib/workos/types/invitation_revoked_data_state.rb index e61ba667..df851c52 100644 --- a/lib/workos/types/invitation_revoked_data_state.rb +++ b/lib/workos/types/invitation_revoked_data_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - InvitationRevokedDataState = InvitationState + InvitationRevokedDataState = InvitationAcceptedDataState end end diff --git a/lib/workos/types/invitation_state.rb b/lib/workos/types/invitation_state.rb index d9941640..f3515097 100644 --- a/lib/workos/types/invitation_state.rb +++ b/lib/workos/types/invitation_state.rb @@ -4,12 +4,6 @@ module WorkOS module Types - class InvitationState - PENDING = "pending" - ACCEPTED = "accepted" - EXPIRED = "expired" - REVOKED = "revoked" - ALL = [PENDING, ACCEPTED, EXPIRED, REVOKED].freeze - end + InvitationState = InvitationAcceptedDataState end end diff --git a/lib/workos/types/organization_created_data_domain_state.rb b/lib/workos/types/organization_created_data_domain_state.rb index 65af8d20..3912e632 100644 --- a/lib/workos/types/organization_created_data_domain_state.rb +++ b/lib/workos/types/organization_created_data_domain_state.rb @@ -4,6 +4,13 @@ module WorkOS module Types - OrganizationCreatedDataDomainState = OrganizationDomainState + class OrganizationCreatedDataDomainState + FAILED = "failed" + LEGACY_VERIFIED = "legacy_verified" + PENDING = "pending" + UNVERIFIED = "unverified" + VERIFIED = "verified" + ALL = [FAILED, LEGACY_VERIFIED, PENDING, UNVERIFIED, VERIFIED].freeze + end end end diff --git a/lib/workos/types/organization_created_data_domain_verification_strategy.rb b/lib/workos/types/organization_created_data_domain_verification_strategy.rb index 606b8c90..f6f7f850 100644 --- a/lib/workos/types/organization_created_data_domain_verification_strategy.rb +++ b/lib/workos/types/organization_created_data_domain_verification_strategy.rb @@ -4,6 +4,10 @@ module WorkOS module Types - OrganizationCreatedDataDomainVerificationStrategy = OrganizationDomainVerificationStrategy + class OrganizationCreatedDataDomainVerificationStrategy + DNS = "dns" + MANUAL = "manual" + ALL = [DNS, MANUAL].freeze + end end end diff --git a/lib/workos/types/organization_deleted_data_domain_state.rb b/lib/workos/types/organization_deleted_data_domain_state.rb index 4a12f4c8..67a51231 100644 --- a/lib/workos/types/organization_deleted_data_domain_state.rb +++ b/lib/workos/types/organization_deleted_data_domain_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDeletedDataDomainState = OrganizationDomainState + OrganizationDeletedDataDomainState = OrganizationCreatedDataDomainState end end diff --git a/lib/workos/types/organization_deleted_data_domain_verification_strategy.rb b/lib/workos/types/organization_deleted_data_domain_verification_strategy.rb index f7ebca49..3ce2fc4a 100644 --- a/lib/workos/types/organization_deleted_data_domain_verification_strategy.rb +++ b/lib/workos/types/organization_deleted_data_domain_verification_strategy.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDeletedDataDomainVerificationStrategy = OrganizationDomainVerificationStrategy + OrganizationDeletedDataDomainVerificationStrategy = OrganizationCreatedDataDomainVerificationStrategy end end diff --git a/lib/workos/types/organization_domain_created_data_state.rb b/lib/workos/types/organization_domain_created_data_state.rb index 615e21cf..fad7dae6 100644 --- a/lib/workos/types/organization_domain_created_data_state.rb +++ b/lib/workos/types/organization_domain_created_data_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainCreatedDataState = OrganizationDomainState + OrganizationDomainCreatedDataState = OrganizationCreatedDataDomainState end end diff --git a/lib/workos/types/organization_domain_created_data_verification_strategy.rb b/lib/workos/types/organization_domain_created_data_verification_strategy.rb index 282c9166..9d9ff25b 100644 --- a/lib/workos/types/organization_domain_created_data_verification_strategy.rb +++ b/lib/workos/types/organization_domain_created_data_verification_strategy.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainCreatedDataVerificationStrategy = OrganizationDomainVerificationStrategy + OrganizationDomainCreatedDataVerificationStrategy = OrganizationCreatedDataDomainVerificationStrategy end end diff --git a/lib/workos/types/organization_domain_deleted_data_state.rb b/lib/workos/types/organization_domain_deleted_data_state.rb index 9942c22d..cca3448b 100644 --- a/lib/workos/types/organization_domain_deleted_data_state.rb +++ b/lib/workos/types/organization_domain_deleted_data_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainDeletedDataState = OrganizationDomainState + OrganizationDomainDeletedDataState = OrganizationCreatedDataDomainState end end diff --git a/lib/workos/types/organization_domain_deleted_data_verification_strategy.rb b/lib/workos/types/organization_domain_deleted_data_verification_strategy.rb index 6243421a..8c20c5be 100644 --- a/lib/workos/types/organization_domain_deleted_data_verification_strategy.rb +++ b/lib/workos/types/organization_domain_deleted_data_verification_strategy.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainDeletedDataVerificationStrategy = OrganizationDomainVerificationStrategy + OrganizationDomainDeletedDataVerificationStrategy = OrganizationCreatedDataDomainVerificationStrategy end end diff --git a/lib/workos/types/organization_domain_stand_alone_state.rb b/lib/workos/types/organization_domain_stand_alone_state.rb index ce55049f..c3b8fb81 100644 --- a/lib/workos/types/organization_domain_stand_alone_state.rb +++ b/lib/workos/types/organization_domain_stand_alone_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainStandAloneState = OrganizationDomainState + OrganizationDomainStandAloneState = OrganizationCreatedDataDomainState end end diff --git a/lib/workos/types/organization_domain_stand_alone_verification_strategy.rb b/lib/workos/types/organization_domain_stand_alone_verification_strategy.rb index 4c9b3177..bd05d21b 100644 --- a/lib/workos/types/organization_domain_stand_alone_verification_strategy.rb +++ b/lib/workos/types/organization_domain_stand_alone_verification_strategy.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainStandAloneVerificationStrategy = OrganizationDomainVerificationStrategy + OrganizationDomainStandAloneVerificationStrategy = OrganizationCreatedDataDomainVerificationStrategy end end diff --git a/lib/workos/types/organization_domain_state.rb b/lib/workos/types/organization_domain_state.rb index 45351e5a..62a30702 100644 --- a/lib/workos/types/organization_domain_state.rb +++ b/lib/workos/types/organization_domain_state.rb @@ -4,13 +4,6 @@ module WorkOS module Types - class OrganizationDomainState - FAILED = "failed" - LEGACY_VERIFIED = "legacy_verified" - PENDING = "pending" - UNVERIFIED = "unverified" - VERIFIED = "verified" - ALL = [FAILED, LEGACY_VERIFIED, PENDING, UNVERIFIED, VERIFIED].freeze - end + OrganizationDomainState = OrganizationCreatedDataDomainState end end diff --git a/lib/workos/types/organization_domain_updated_data_state.rb b/lib/workos/types/organization_domain_updated_data_state.rb index b3f18d41..8957d295 100644 --- a/lib/workos/types/organization_domain_updated_data_state.rb +++ b/lib/workos/types/organization_domain_updated_data_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainUpdatedDataState = OrganizationDomainState + OrganizationDomainUpdatedDataState = OrganizationCreatedDataDomainState end end diff --git a/lib/workos/types/organization_domain_updated_data_verification_strategy.rb b/lib/workos/types/organization_domain_updated_data_verification_strategy.rb index c4a7045a..f19b6545 100644 --- a/lib/workos/types/organization_domain_updated_data_verification_strategy.rb +++ b/lib/workos/types/organization_domain_updated_data_verification_strategy.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainUpdatedDataVerificationStrategy = OrganizationDomainVerificationStrategy + OrganizationDomainUpdatedDataVerificationStrategy = OrganizationCreatedDataDomainVerificationStrategy end end diff --git a/lib/workos/types/organization_domain_verification_failed_data_organization_domain_state.rb b/lib/workos/types/organization_domain_verification_failed_data_organization_domain_state.rb index f87d334f..b36fb81d 100644 --- a/lib/workos/types/organization_domain_verification_failed_data_organization_domain_state.rb +++ b/lib/workos/types/organization_domain_verification_failed_data_organization_domain_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainVerificationFailedDataOrganizationDomainState = OrganizationDomainState + OrganizationDomainVerificationFailedDataOrganizationDomainState = OrganizationCreatedDataDomainState end end diff --git a/lib/workos/types/organization_domain_verification_failed_data_organization_domain_verification_strategy.rb b/lib/workos/types/organization_domain_verification_failed_data_organization_domain_verification_strategy.rb index 23fac1be..65b22801 100644 --- a/lib/workos/types/organization_domain_verification_failed_data_organization_domain_verification_strategy.rb +++ b/lib/workos/types/organization_domain_verification_failed_data_organization_domain_verification_strategy.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainVerificationFailedDataOrganizationDomainVerificationStrategy = OrganizationDomainVerificationStrategy + OrganizationDomainVerificationFailedDataOrganizationDomainVerificationStrategy = OrganizationCreatedDataDomainVerificationStrategy end end diff --git a/lib/workos/types/organization_domain_verification_strategy.rb b/lib/workos/types/organization_domain_verification_strategy.rb index e4d51458..d50b88f8 100644 --- a/lib/workos/types/organization_domain_verification_strategy.rb +++ b/lib/workos/types/organization_domain_verification_strategy.rb @@ -4,10 +4,6 @@ module WorkOS module Types - class OrganizationDomainVerificationStrategy - DNS = "dns" - MANUAL = "manual" - ALL = [DNS, MANUAL].freeze - end + OrganizationDomainVerificationStrategy = OrganizationCreatedDataDomainVerificationStrategy end end diff --git a/lib/workos/types/organization_domain_verified_data_state.rb b/lib/workos/types/organization_domain_verified_data_state.rb index 5d2ed8aa..05d12ccc 100644 --- a/lib/workos/types/organization_domain_verified_data_state.rb +++ b/lib/workos/types/organization_domain_verified_data_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainVerifiedDataState = OrganizationDomainState + OrganizationDomainVerifiedDataState = OrganizationCreatedDataDomainState end end diff --git a/lib/workos/types/organization_domain_verified_data_verification_strategy.rb b/lib/workos/types/organization_domain_verified_data_verification_strategy.rb index b170b087..79bf9ad5 100644 --- a/lib/workos/types/organization_domain_verified_data_verification_strategy.rb +++ b/lib/workos/types/organization_domain_verified_data_verification_strategy.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationDomainVerifiedDataVerificationStrategy = OrganizationDomainVerificationStrategy + OrganizationDomainVerifiedDataVerificationStrategy = OrganizationCreatedDataDomainVerificationStrategy end end diff --git a/lib/workos/types/organization_membership_created_data_status.rb b/lib/workos/types/organization_membership_created_data_status.rb index b48d4008..ba9baa58 100644 --- a/lib/workos/types/organization_membership_created_data_status.rb +++ b/lib/workos/types/organization_membership_created_data_status.rb @@ -4,6 +4,11 @@ module WorkOS module Types - OrganizationMembershipCreatedDataStatus = OrganizationMembershipStatus + class OrganizationMembershipCreatedDataStatus + ACTIVE = "active" + INACTIVE = "inactive" + PENDING = "pending" + ALL = [ACTIVE, INACTIVE, PENDING].freeze + end end end diff --git a/lib/workos/types/organization_membership_deleted_data_status.rb b/lib/workos/types/organization_membership_deleted_data_status.rb index eb1ac4b3..1105bede 100644 --- a/lib/workos/types/organization_membership_deleted_data_status.rb +++ b/lib/workos/types/organization_membership_deleted_data_status.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationMembershipDeletedDataStatus = OrganizationMembershipStatus + OrganizationMembershipDeletedDataStatus = OrganizationMembershipCreatedDataStatus end end diff --git a/lib/workos/types/organization_membership_status.rb b/lib/workos/types/organization_membership_status.rb index e0f54dbc..4fd1d9b0 100644 --- a/lib/workos/types/organization_membership_status.rb +++ b/lib/workos/types/organization_membership_status.rb @@ -4,11 +4,6 @@ module WorkOS module Types - class OrganizationMembershipStatus - ACTIVE = "active" - INACTIVE = "inactive" - PENDING = "pending" - ALL = [ACTIVE, INACTIVE, PENDING].freeze - end + OrganizationMembershipStatus = OrganizationMembershipCreatedDataStatus end end diff --git a/lib/workos/types/organization_membership_updated_data_status.rb b/lib/workos/types/organization_membership_updated_data_status.rb index 1e0c6718..3062a6f2 100644 --- a/lib/workos/types/organization_membership_updated_data_status.rb +++ b/lib/workos/types/organization_membership_updated_data_status.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationMembershipUpdatedDataStatus = OrganizationMembershipStatus + OrganizationMembershipUpdatedDataStatus = OrganizationMembershipCreatedDataStatus end end diff --git a/lib/workos/types/organization_updated_data_domain_state.rb b/lib/workos/types/organization_updated_data_domain_state.rb index 1c33717e..176ba64a 100644 --- a/lib/workos/types/organization_updated_data_domain_state.rb +++ b/lib/workos/types/organization_updated_data_domain_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationUpdatedDataDomainState = OrganizationDomainState + OrganizationUpdatedDataDomainState = OrganizationCreatedDataDomainState end end diff --git a/lib/workos/types/organization_updated_data_domain_verification_strategy.rb b/lib/workos/types/organization_updated_data_domain_verification_strategy.rb index 2b5f95dd..186792b2 100644 --- a/lib/workos/types/organization_updated_data_domain_verification_strategy.rb +++ b/lib/workos/types/organization_updated_data_domain_verification_strategy.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationUpdatedDataDomainVerificationStrategy = OrganizationDomainVerificationStrategy + OrganizationUpdatedDataDomainVerificationStrategy = OrganizationCreatedDataDomainVerificationStrategy end end diff --git a/lib/workos/types/organizations_api_keys_order.rb b/lib/workos/types/organizations_api_keys_order.rb index 92d2aff3..01c79f57 100644 --- a/lib/workos/types/organizations_api_keys_order.rb +++ b/lib/workos/types/organizations_api_keys_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationsApiKeysOrder = EventsOrder + OrganizationsApiKeysOrder = ApplicationsOrder end end diff --git a/lib/workos/types/organizations_feature_flags_order.rb b/lib/workos/types/organizations_feature_flags_order.rb index ed0b68a3..d7e5414e 100644 --- a/lib/workos/types/organizations_feature_flags_order.rb +++ b/lib/workos/types/organizations_feature_flags_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationsFeatureFlagsOrder = EventsOrder + OrganizationsFeatureFlagsOrder = ApplicationsOrder end end diff --git a/lib/workos/types/organizations_order.rb b/lib/workos/types/organizations_order.rb index fc869f04..38fad388 100644 --- a/lib/workos/types/organizations_order.rb +++ b/lib/workos/types/organizations_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - OrganizationsOrder = EventsOrder + OrganizationsOrder = ApplicationsOrder end end diff --git a/lib/workos/types/permissions_order.rb b/lib/workos/types/permissions_order.rb index a63c10be..a55d8a97 100644 --- a/lib/workos/types/permissions_order.rb +++ b/lib/workos/types/permissions_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - PermissionsOrder = EventsOrder + PermissionsOrder = ApplicationsOrder end end diff --git a/lib/workos/types/radar_standalone_response_blocklist_type.rb b/lib/workos/types/radar_standalone_response_blocklist_type.rb index 4f73c9a3..4301d9bf 100644 --- a/lib/workos/types/radar_standalone_response_blocklist_type.rb +++ b/lib/workos/types/radar_standalone_response_blocklist_type.rb @@ -4,6 +4,15 @@ module WorkOS module Types - RadarStandaloneResponseBlocklistType = RadarType + class RadarStandaloneResponseBlocklistType + IP_ADDRESS = "ip_address" + DOMAIN = "domain" + EMAIL = "email" + DEVICE = "device" + USER_AGENT = "user_agent" + DEVICE_FINGERPRINT = "device_fingerprint" + COUNTRY = "country" + ALL = [IP_ADDRESS, DOMAIN, EMAIL, DEVICE, USER_AGENT, DEVICE_FINGERPRINT, COUNTRY].freeze + end end end diff --git a/lib/workos/types/radar_type.rb b/lib/workos/types/radar_type.rb index ec0e4e67..7e17d9c6 100644 --- a/lib/workos/types/radar_type.rb +++ b/lib/workos/types/radar_type.rb @@ -4,15 +4,6 @@ module WorkOS module Types - class RadarType - IP_ADDRESS = "ip_address" - DOMAIN = "domain" - EMAIL = "email" - DEVICE = "device" - USER_AGENT = "user_agent" - DEVICE_FINGERPRINT = "device_fingerprint" - COUNTRY = "country" - ALL = [IP_ADDRESS, DOMAIN, EMAIL, DEVICE, USER_AGENT, DEVICE_FINGERPRINT, COUNTRY].freeze - end + RadarType = RadarStandaloneResponseBlocklistType end end diff --git a/lib/workos/types/session_created_data_auth_method.rb b/lib/workos/types/session_created_data_auth_method.rb index f1f018b0..1ab6204c 100644 --- a/lib/workos/types/session_created_data_auth_method.rb +++ b/lib/workos/types/session_created_data_auth_method.rb @@ -4,6 +4,18 @@ module WorkOS module Types - SessionCreatedDataAuthMethod = UserSessionsAuthMethod + class SessionCreatedDataAuthMethod + CROSS_APP_AUTH = "cross_app_auth" + EXTERNAL_AUTH = "external_auth" + IMPERSONATION = "impersonation" + MAGIC_CODE = "magic_code" + MIGRATED_SESSION = "migrated_session" + OAUTH = "oauth" + PASSKEY = "passkey" + PASSWORD = "password" + SSO = "sso" + UNKNOWN = "unknown" + ALL = [CROSS_APP_AUTH, EXTERNAL_AUTH, IMPERSONATION, MAGIC_CODE, MIGRATED_SESSION, OAUTH, PASSKEY, PASSWORD, SSO, UNKNOWN].freeze + end end end diff --git a/lib/workos/types/session_created_data_status.rb b/lib/workos/types/session_created_data_status.rb index 586c38ad..61e58218 100644 --- a/lib/workos/types/session_created_data_status.rb +++ b/lib/workos/types/session_created_data_status.rb @@ -4,6 +4,11 @@ module WorkOS module Types - SessionCreatedDataStatus = UserSessionsStatus + class SessionCreatedDataStatus + ACTIVE = "active" + EXPIRED = "expired" + REVOKED = "revoked" + ALL = [ACTIVE, EXPIRED, REVOKED].freeze + end end end diff --git a/lib/workos/types/session_revoked_data_auth_method.rb b/lib/workos/types/session_revoked_data_auth_method.rb index c602ad86..6834cd86 100644 --- a/lib/workos/types/session_revoked_data_auth_method.rb +++ b/lib/workos/types/session_revoked_data_auth_method.rb @@ -4,6 +4,6 @@ module WorkOS module Types - SessionRevokedDataAuthMethod = UserSessionsAuthMethod + SessionRevokedDataAuthMethod = SessionCreatedDataAuthMethod end end diff --git a/lib/workos/types/session_revoked_data_status.rb b/lib/workos/types/session_revoked_data_status.rb index d54991e3..b9e1d357 100644 --- a/lib/workos/types/session_revoked_data_status.rb +++ b/lib/workos/types/session_revoked_data_status.rb @@ -4,6 +4,6 @@ module WorkOS module Types - SessionRevokedDataStatus = UserSessionsStatus + SessionRevokedDataStatus = SessionCreatedDataStatus end end diff --git a/lib/workos/types/update_webhook_endpoint_status.rb b/lib/workos/types/update_webhook_endpoint_status.rb index 5551ba7d..d56593e1 100644 --- a/lib/workos/types/update_webhook_endpoint_status.rb +++ b/lib/workos/types/update_webhook_endpoint_status.rb @@ -4,6 +4,10 @@ module WorkOS module Types - UpdateWebhookEndpointStatus = WebhookEndpointStatus + class UpdateWebhookEndpointStatus + ENABLED = "enabled" + DISABLED = "disabled" + ALL = [ENABLED, DISABLED].freeze + end end end diff --git a/lib/workos/types/user_invite_state.rb b/lib/workos/types/user_invite_state.rb index 077a8fd2..fce1c6c5 100644 --- a/lib/workos/types/user_invite_state.rb +++ b/lib/workos/types/user_invite_state.rb @@ -4,6 +4,6 @@ module WorkOS module Types - UserInviteState = InvitationState + UserInviteState = InvitationAcceptedDataState end end diff --git a/lib/workos/types/user_management_invitations_order.rb b/lib/workos/types/user_management_invitations_order.rb index 99286ac3..59339740 100644 --- a/lib/workos/types/user_management_invitations_order.rb +++ b/lib/workos/types/user_management_invitations_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - UserManagementInvitationsOrder = EventsOrder + UserManagementInvitationsOrder = ApplicationsOrder end end diff --git a/lib/workos/types/user_management_multi_factor_authentication_order.rb b/lib/workos/types/user_management_multi_factor_authentication_order.rb index 2b1f2d30..32948f79 100644 --- a/lib/workos/types/user_management_multi_factor_authentication_order.rb +++ b/lib/workos/types/user_management_multi_factor_authentication_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - UserManagementMultiFactorAuthenticationOrder = EventsOrder + UserManagementMultiFactorAuthenticationOrder = ApplicationsOrder end end diff --git a/lib/workos/types/user_management_organization_membership_order.rb b/lib/workos/types/user_management_organization_membership_order.rb index 6612381b..54b5bc4c 100644 --- a/lib/workos/types/user_management_organization_membership_order.rb +++ b/lib/workos/types/user_management_organization_membership_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - UserManagementOrganizationMembershipOrder = EventsOrder + UserManagementOrganizationMembershipOrder = ApplicationsOrder end end diff --git a/lib/workos/types/user_management_organization_membership_statuses.rb b/lib/workos/types/user_management_organization_membership_statuses.rb index 4ec54dca..810af00a 100644 --- a/lib/workos/types/user_management_organization_membership_statuses.rb +++ b/lib/workos/types/user_management_organization_membership_statuses.rb @@ -4,6 +4,6 @@ module WorkOS module Types - UserManagementOrganizationMembershipStatuses = OrganizationMembershipStatus + UserManagementOrganizationMembershipStatuses = OrganizationMembershipCreatedDataStatus end end diff --git a/lib/workos/types/user_management_users_authorized_applications_order.rb b/lib/workos/types/user_management_users_authorized_applications_order.rb index decfb1a5..e3b383f3 100644 --- a/lib/workos/types/user_management_users_authorized_applications_order.rb +++ b/lib/workos/types/user_management_users_authorized_applications_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - UserManagementUsersAuthorizedApplicationsOrder = EventsOrder + UserManagementUsersAuthorizedApplicationsOrder = ApplicationsOrder end end diff --git a/lib/workos/types/user_management_users_feature_flags_order.rb b/lib/workos/types/user_management_users_feature_flags_order.rb index f1ae2324..8ab6a151 100644 --- a/lib/workos/types/user_management_users_feature_flags_order.rb +++ b/lib/workos/types/user_management_users_feature_flags_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - UserManagementUsersFeatureFlagsOrder = EventsOrder + UserManagementUsersFeatureFlagsOrder = ApplicationsOrder end end diff --git a/lib/workos/types/user_management_users_order.rb b/lib/workos/types/user_management_users_order.rb index de888172..6caafaf0 100644 --- a/lib/workos/types/user_management_users_order.rb +++ b/lib/workos/types/user_management_users_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - UserManagementUsersOrder = EventsOrder + UserManagementUsersOrder = ApplicationsOrder end end diff --git a/lib/workos/types/user_organization_membership_base_list_data_status.rb b/lib/workos/types/user_organization_membership_base_list_data_status.rb index dd108464..4204b56c 100644 --- a/lib/workos/types/user_organization_membership_base_list_data_status.rb +++ b/lib/workos/types/user_organization_membership_base_list_data_status.rb @@ -4,6 +4,6 @@ module WorkOS module Types - UserOrganizationMembershipBaseListDataStatus = OrganizationMembershipStatus + UserOrganizationMembershipBaseListDataStatus = OrganizationMembershipCreatedDataStatus end end diff --git a/lib/workos/types/user_organization_membership_status.rb b/lib/workos/types/user_organization_membership_status.rb index 1c7efa17..4fa9faee 100644 --- a/lib/workos/types/user_organization_membership_status.rb +++ b/lib/workos/types/user_organization_membership_status.rb @@ -4,6 +4,6 @@ module WorkOS module Types - UserOrganizationMembershipStatus = OrganizationMembershipStatus + UserOrganizationMembershipStatus = OrganizationMembershipCreatedDataStatus end end diff --git a/lib/workos/types/user_sessions_auth_method.rb b/lib/workos/types/user_sessions_auth_method.rb index 05607244..80e749d7 100644 --- a/lib/workos/types/user_sessions_auth_method.rb +++ b/lib/workos/types/user_sessions_auth_method.rb @@ -4,18 +4,6 @@ module WorkOS module Types - class UserSessionsAuthMethod - CROSS_APP_AUTH = "cross_app_auth" - EXTERNAL_AUTH = "external_auth" - IMPERSONATION = "impersonation" - MAGIC_CODE = "magic_code" - MIGRATED_SESSION = "migrated_session" - OAUTH = "oauth" - PASSKEY = "passkey" - PASSWORD = "password" - SSO = "sso" - UNKNOWN = "unknown" - ALL = [CROSS_APP_AUTH, EXTERNAL_AUTH, IMPERSONATION, MAGIC_CODE, MIGRATED_SESSION, OAUTH, PASSKEY, PASSWORD, SSO, UNKNOWN].freeze - end + UserSessionsAuthMethod = SessionCreatedDataAuthMethod end end diff --git a/lib/workos/types/user_sessions_status.rb b/lib/workos/types/user_sessions_status.rb index eeac4216..0d7e0642 100644 --- a/lib/workos/types/user_sessions_status.rb +++ b/lib/workos/types/user_sessions_status.rb @@ -4,11 +4,6 @@ module WorkOS module Types - class UserSessionsStatus - ACTIVE = "active" - EXPIRED = "expired" - REVOKED = "revoked" - ALL = [ACTIVE, EXPIRED, REVOKED].freeze - end + UserSessionsStatus = SessionCreatedDataStatus end end diff --git a/lib/workos/types/vault_data_created_data_actor_source.rb b/lib/workos/types/vault_data_created_data_actor_source.rb index d264b13d..000aebb9 100644 --- a/lib/workos/types/vault_data_created_data_actor_source.rb +++ b/lib/workos/types/vault_data_created_data_actor_source.rb @@ -4,6 +4,10 @@ module WorkOS module Types - VaultDataCreatedDataActorSource = VaultDekReadDataActorSource + class VaultDataCreatedDataActorSource + API = "api" + DASHBOARD = "dashboard" + ALL = [API, DASHBOARD].freeze + end end end diff --git a/lib/workos/types/vault_data_deleted_data_actor_source.rb b/lib/workos/types/vault_data_deleted_data_actor_source.rb index a2fecc99..9c51bcbc 100644 --- a/lib/workos/types/vault_data_deleted_data_actor_source.rb +++ b/lib/workos/types/vault_data_deleted_data_actor_source.rb @@ -4,6 +4,6 @@ module WorkOS module Types - VaultDataDeletedDataActorSource = VaultDekReadDataActorSource + VaultDataDeletedDataActorSource = VaultDataCreatedDataActorSource end end diff --git a/lib/workos/types/vault_data_read_data_actor_source.rb b/lib/workos/types/vault_data_read_data_actor_source.rb index 5a9eba8b..af5db407 100644 --- a/lib/workos/types/vault_data_read_data_actor_source.rb +++ b/lib/workos/types/vault_data_read_data_actor_source.rb @@ -4,6 +4,6 @@ module WorkOS module Types - VaultDataReadDataActorSource = VaultDekReadDataActorSource + VaultDataReadDataActorSource = VaultDataCreatedDataActorSource end end diff --git a/lib/workos/types/vault_data_updated_data_actor_source.rb b/lib/workos/types/vault_data_updated_data_actor_source.rb index ea957a16..085a659f 100644 --- a/lib/workos/types/vault_data_updated_data_actor_source.rb +++ b/lib/workos/types/vault_data_updated_data_actor_source.rb @@ -4,6 +4,6 @@ module WorkOS module Types - VaultDataUpdatedDataActorSource = VaultDekReadDataActorSource + VaultDataUpdatedDataActorSource = VaultDataCreatedDataActorSource end end diff --git a/lib/workos/types/vault_dek_decrypted_data_actor_source.rb b/lib/workos/types/vault_dek_decrypted_data_actor_source.rb index 4fa00a6c..be978084 100644 --- a/lib/workos/types/vault_dek_decrypted_data_actor_source.rb +++ b/lib/workos/types/vault_dek_decrypted_data_actor_source.rb @@ -4,6 +4,6 @@ module WorkOS module Types - VaultDekDecryptedDataActorSource = VaultDekReadDataActorSource + VaultDekDecryptedDataActorSource = VaultDataCreatedDataActorSource end end diff --git a/lib/workos/types/vault_dek_read_data_actor_source.rb b/lib/workos/types/vault_dek_read_data_actor_source.rb index 306c76b5..80c10a36 100644 --- a/lib/workos/types/vault_dek_read_data_actor_source.rb +++ b/lib/workos/types/vault_dek_read_data_actor_source.rb @@ -4,10 +4,6 @@ module WorkOS module Types - class VaultDekReadDataActorSource - API = "api" - DASHBOARD = "dashboard" - ALL = [API, DASHBOARD].freeze - end + VaultDekReadDataActorSource = VaultDataCreatedDataActorSource end end diff --git a/lib/workos/types/vault_kek_created_data_actor_source.rb b/lib/workos/types/vault_kek_created_data_actor_source.rb index 920d6c11..cd1f6981 100644 --- a/lib/workos/types/vault_kek_created_data_actor_source.rb +++ b/lib/workos/types/vault_kek_created_data_actor_source.rb @@ -4,6 +4,6 @@ module WorkOS module Types - VaultKekCreatedDataActorSource = VaultDekReadDataActorSource + VaultKekCreatedDataActorSource = VaultDataCreatedDataActorSource end end diff --git a/lib/workos/types/vault_metadata_read_data_actor_source.rb b/lib/workos/types/vault_metadata_read_data_actor_source.rb index 6bc83710..51568292 100644 --- a/lib/workos/types/vault_metadata_read_data_actor_source.rb +++ b/lib/workos/types/vault_metadata_read_data_actor_source.rb @@ -4,6 +4,6 @@ module WorkOS module Types - VaultMetadataReadDataActorSource = VaultDekReadDataActorSource + VaultMetadataReadDataActorSource = VaultDataCreatedDataActorSource end end diff --git a/lib/workos/types/vault_names_listed_data_actor_source.rb b/lib/workos/types/vault_names_listed_data_actor_source.rb index 0e391686..9d4e6a27 100644 --- a/lib/workos/types/vault_names_listed_data_actor_source.rb +++ b/lib/workos/types/vault_names_listed_data_actor_source.rb @@ -4,6 +4,6 @@ module WorkOS module Types - VaultNamesListedDataActorSource = VaultDekReadDataActorSource + VaultNamesListedDataActorSource = VaultDataCreatedDataActorSource end end diff --git a/lib/workos/types/webhook_endpoint_json_status.rb b/lib/workos/types/webhook_endpoint_json_status.rb new file mode 100644 index 00000000..1403fbee --- /dev/null +++ b/lib/workos/types/webhook_endpoint_json_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + WebhookEndpointJsonStatus = UpdateWebhookEndpointStatus + end +end diff --git a/lib/workos/types/webhooks_order.rb b/lib/workos/types/webhooks_order.rb index 90eaaa8b..955368cd 100644 --- a/lib/workos/types/webhooks_order.rb +++ b/lib/workos/types/webhooks_order.rb @@ -4,6 +4,6 @@ module WorkOS module Types - WebhooksOrder = EventsOrder + WebhooksOrder = ApplicationsOrder end end diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 5f87d8c3..cd608bce 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -18,7 +18,10 @@ def get_jwks( client_id:, request_options: {} ) - response = @client.request(method: :get, path: "/sso/jwks/#{WorkOS::Util.encode_path(client_id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/sso/jwks/#{CGI.escape(client_id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::JwksResponse.new(response.body) end @@ -78,7 +81,10 @@ def create_authenticate( "authentication_challenge_id" => authentication_challenge_id, "device_code" => device_code }.compact - response = @client.request(method: :post, path: "/user_management/authenticate", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::AuthenticateResponse.new(response.body) end @@ -100,18 +106,22 @@ def authenticate_with_password( user_agent: nil, request_options: {} ) - create_authenticate( - grant_type: "password", - client_id: @client.client_id, - client_secret: @client.api_key, - email: email, - password: password, - invitation_token: invitation_token, - ip_address: ip_address, - device_id: device_id, - user_agent: user_agent, + body = { + "grant_type" => "password", + "client_id" => @client.client_id, + "client_secret" => @client.api_key, + "email" => email, + "password" => password, + "invitation_token" => invitation_token, + "ip_address" => ip_address, + "device_id" => device_id, + "user_agent" => user_agent + }.compact + response = @client.execute_request( + request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), request_options: request_options ) + WorkOS::AuthenticateResponse.new(response.body) end # Authenticate with code. @@ -132,18 +142,22 @@ def authenticate_with_code( user_agent: nil, request_options: {} ) - create_authenticate( - grant_type: "authorization_code", - client_id: @client.client_id, - client_secret: @client.api_key, - code: code, - code_verifier: code_verifier, - invitation_token: invitation_token, - ip_address: ip_address, - device_id: device_id, - user_agent: user_agent, + body = { + "grant_type" => "authorization_code", + "client_id" => @client.client_id, + "client_secret" => @client.api_key, + "code" => code, + "code_verifier" => code_verifier, + "invitation_token" => invitation_token, + "ip_address" => ip_address, + "device_id" => device_id, + "user_agent" => user_agent + }.compact + response = @client.execute_request( + request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), request_options: request_options ) + WorkOS::AuthenticateResponse.new(response.body) end # Authenticate with refresh token. @@ -162,17 +176,21 @@ def authenticate_with_refresh_token( user_agent: nil, request_options: {} ) - create_authenticate( - grant_type: "refresh_token", - client_id: @client.client_id, - client_secret: @client.api_key, - refresh_token: refresh_token, - organization_id: organization_id, - ip_address: ip_address, - device_id: device_id, - user_agent: user_agent, + body = { + "grant_type" => "refresh_token", + "client_id" => @client.client_id, + "client_secret" => @client.api_key, + "refresh_token" => refresh_token, + "organization_id" => organization_id, + "ip_address" => ip_address, + "device_id" => device_id, + "user_agent" => user_agent + }.compact + response = @client.execute_request( + request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), request_options: request_options ) + WorkOS::AuthenticateResponse.new(response.body) end # Authenticate with magic auth. @@ -193,18 +211,22 @@ def authenticate_with_magic_auth( user_agent: nil, request_options: {} ) - create_authenticate( - grant_type: "urn:workos:oauth:grant-type:magic-auth:code", - client_id: @client.client_id, - client_secret: @client.api_key, - code: code, - email: email, - invitation_token: invitation_token, - ip_address: ip_address, - device_id: device_id, - user_agent: user_agent, + body = { + "grant_type" => "urn:workos:oauth:grant-type:magic-auth:code", + "client_id" => @client.client_id, + "client_secret" => @client.api_key, + "code" => code, + "email" => email, + "invitation_token" => invitation_token, + "ip_address" => ip_address, + "device_id" => device_id, + "user_agent" => user_agent + }.compact + response = @client.execute_request( + request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), request_options: request_options ) + WorkOS::AuthenticateResponse.new(response.body) end # Authenticate with email verification. @@ -223,17 +245,21 @@ def authenticate_with_email_verification( user_agent: nil, request_options: {} ) - create_authenticate( - grant_type: "urn:workos:oauth:grant-type:email-verification:code", - client_id: @client.client_id, - client_secret: @client.api_key, - code: code, - pending_authentication_token: pending_authentication_token, - ip_address: ip_address, - device_id: device_id, - user_agent: user_agent, + body = { + "grant_type" => "urn:workos:oauth:grant-type:email-verification:code", + "client_id" => @client.client_id, + "client_secret" => @client.api_key, + "code" => code, + "pending_authentication_token" => pending_authentication_token, + "ip_address" => ip_address, + "device_id" => device_id, + "user_agent" => user_agent + }.compact + response = @client.execute_request( + request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), request_options: request_options ) + WorkOS::AuthenticateResponse.new(response.body) end # Authenticate with totp. @@ -254,18 +280,22 @@ def authenticate_with_totp( user_agent: nil, request_options: {} ) - create_authenticate( - grant_type: "urn:workos:oauth:grant-type:mfa-totp", - client_id: @client.client_id, - client_secret: @client.api_key, - code: code, - pending_authentication_token: pending_authentication_token, - authentication_challenge_id: authentication_challenge_id, - ip_address: ip_address, - device_id: device_id, - user_agent: user_agent, + body = { + "grant_type" => "urn:workos:oauth:grant-type:mfa-totp", + "client_id" => @client.client_id, + "client_secret" => @client.api_key, + "code" => code, + "pending_authentication_token" => pending_authentication_token, + "authentication_challenge_id" => authentication_challenge_id, + "ip_address" => ip_address, + "device_id" => device_id, + "user_agent" => user_agent + }.compact + response = @client.execute_request( + request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), request_options: request_options ) + WorkOS::AuthenticateResponse.new(response.body) end # Authenticate with organization selection. @@ -284,17 +314,21 @@ def authenticate_with_organization_selection( user_agent: nil, request_options: {} ) - create_authenticate( - grant_type: "urn:workos:oauth:grant-type:organization-selection", - client_id: @client.client_id, - client_secret: @client.api_key, - pending_authentication_token: pending_authentication_token, - organization_id: organization_id, - ip_address: ip_address, - device_id: device_id, - user_agent: user_agent, + body = { + "grant_type" => "urn:workos:oauth:grant-type:organization-selection", + "client_id" => @client.client_id, + "client_secret" => @client.api_key, + "pending_authentication_token" => pending_authentication_token, + "organization_id" => organization_id, + "ip_address" => ip_address, + "device_id" => device_id, + "user_agent" => user_agent + }.compact + response = @client.execute_request( + request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), request_options: request_options ) + WorkOS::AuthenticateResponse.new(response.body) end # Authenticate with device code. @@ -311,15 +345,19 @@ def authenticate_with_device_code( user_agent: nil, request_options: {} ) - create_authenticate( - grant_type: "urn:ietf:params:oauth:grant-type:device_code", - client_id: @client.client_id, - device_code: device_code, - ip_address: ip_address, - device_id: device_id, - user_agent: user_agent, + body = { + "grant_type" => "urn:ietf:params:oauth:grant-type:device_code", + "client_id" => @client.client_id, + "device_code" => device_code, + "ip_address" => ip_address, + "device_id" => device_id, + "user_agent" => user_agent + }.compact + response = @client.execute_request( + request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), request_options: request_options ) + WorkOS::AuthenticateResponse.new(response.body) end # Get device authorization URL @@ -333,7 +371,10 @@ def create_device( body = { "client_id" => client_id }.compact - response = @client.request(method: :post, path: "/user_management/authorize/device", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/authorize/device", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::DeviceAuthorizationResponse.new(response.body) end @@ -351,7 +392,10 @@ def revoke_session( "session_id" => session_id, "return_to" => return_to }.compact - @client.request(method: :post, path: "/user_management/sessions/revoke", auth: true, body: body, request_options: request_options) + @client.execute_request( + request: @client.post_request(path: "/user_management/sessions/revoke", auth: true, body: body, request_options: request_options), + request_options: request_options + ) nil end @@ -366,7 +410,10 @@ def create_cors_origin( body = { "origin" => origin }.compact - response = @client.request(method: :post, path: "/user_management/cors_origins", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/cors_origins", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::CORSOriginResponse.new(response.body) end @@ -378,7 +425,10 @@ def get_email_verification( id:, request_options: {} ) - response = @client.request(method: :get, path: "/user_management/email_verification/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/user_management/email_verification/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::EmailVerification.new(response.body) end @@ -393,7 +443,10 @@ def reset_password( body = { "email" => email }.compact - response = @client.request(method: :post, path: "/user_management/password_reset", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/password_reset", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::PasswordReset.new(response.body) end @@ -411,7 +464,10 @@ def confirm_password_reset( "token" => token, "new_password" => new_password }.compact - response = @client.request(method: :post, path: "/user_management/password_reset/confirm", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/password_reset/confirm", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::ResetPasswordResponse.new(response.body) end @@ -423,7 +479,10 @@ def get_password_reset( id:, request_options: {} ) - response = @client.request(method: :get, path: "/user_management/password_reset/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/user_management/password_reset/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::PasswordReset.new(response.body) end @@ -441,7 +500,7 @@ def list_users( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", organization: nil, organization_id: nil, email: nil, @@ -456,34 +515,27 @@ def list_users( "organization_id" => organization_id, "email" => email }.compact - response = @client.request(method: :get, path: "/user_management/users", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::User, filters: {before: before, limit: limit, order: order, organization: organization, organization_id: organization_id, email: email}, - fetch_next: lambda do |cursor| - list_users( - before: before, - after: cursor, - limit: limit, - order: order, - organization: organization, - organization_id: organization_id, - email: email, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_users( - before: cursor, - after: nil, - limit: limit, - order: order, - organization: organization, - organization_id: organization_id, - email: email, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/user_management/users", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::User.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_users( + before: before, + after: cursor, + limit: limit, + order: order, + organization: organization, + organization_id: organization_id, + email: email, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization: organization, organization_id: organization_id, email: email}) end # Create a user @@ -510,7 +562,7 @@ def create_user( password_hash_type: nil, request_options: {} ) - params = {} + params = {}.compact if password case password[:type] when "plaintext" @@ -531,7 +583,10 @@ def create_user( "password_hash" => password_hash, "password_hash_type" => password_hash_type }.compact - response = @client.request(method: :post, path: "/user_management/users", auth: true, params: params, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/users", auth: true, params: params, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::User.new(response.body) end @@ -543,7 +598,10 @@ def get_user_by_external_id( external_id:, request_options: {} ) - response = @client.request(method: :get, path: "/user_management/users/external_id/#{WorkOS::Util.encode_path(external_id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/user_management/users/external_id/#{CGI.escape(external_id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::User.new(response.body) end @@ -555,7 +613,10 @@ def get_user( id:, request_options: {} ) - response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/user_management/users/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::User.new(response.body) end @@ -587,7 +648,7 @@ def update_user( password_hash_type: nil, request_options: {} ) - params = {} + params = {}.compact if password case password[:type] when "plaintext" @@ -609,7 +670,10 @@ def update_user( "password_hash" => password_hash, "password_hash_type" => password_hash_type }.compact - response = @client.request(method: :put, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}", auth: true, params: params, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.put_request(path: "/user_management/users/#{CGI.escape(id.to_s)}", auth: true, params: params, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::User.new(response.body) end @@ -621,7 +685,10 @@ def delete_user( id:, request_options: {} ) - @client.request(method: :delete, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/user_management/users/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -638,7 +705,10 @@ def confirm_email_change( body = { "code" => code }.compact - response = @client.request(method: :post, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/confirm", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/email_change/confirm", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::EmailChangeConfirmation.new(response.body) end @@ -655,7 +725,10 @@ def send_email_change( body = { "new_email" => new_email }.compact - response = @client.request(method: :post, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/send", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/email_change/send", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::EmailChange.new(response.body) end @@ -672,7 +745,10 @@ def verify_email( body = { "code" => code }.compact - response = @client.request(method: :post, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_verification/confirm", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/email_verification/confirm", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::VerifyEmailResponse.new(response.body) end @@ -684,7 +760,10 @@ def send_verification_email( id:, request_options: {} ) - response = @client.request(method: :post, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_verification/send", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/email_verification/send", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::SendVerificationEmailResponse.new(response.body) end @@ -696,7 +775,10 @@ def get_user_identities( id:, request_options: {} ) - response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/identities", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/identities", auth: true, request_options: request_options), + request_options: request_options + ) parsed = JSON.parse(response.body) (parsed || []).map { |item| WorkOS::UserIdentitiesGetItem.new(item) } end @@ -714,7 +796,7 @@ def list_sessions( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -723,30 +805,25 @@ def list_sessions( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/sessions", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::UserSessionsListItem, filters: {id: id, before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_sessions( - id: id, - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_sessions( - id: id, - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/sessions", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::UserSessionsListItem.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_sessions( + id: id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {id: id, before: before, limit: limit, order: order}) end # List invitations @@ -762,7 +839,7 @@ def list_invitations( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", organization_id: nil, email: nil, request_options: {} @@ -775,32 +852,26 @@ def list_invitations( "organization_id" => organization_id, "email" => email }.compact - response = @client.request(method: :get, path: "/user_management/invitations", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::UserInvite, filters: {before: before, limit: limit, order: order, organization_id: organization_id, email: email}, - fetch_next: lambda do |cursor| - list_invitations( - before: before, - after: cursor, - limit: limit, - order: order, - organization_id: organization_id, - email: email, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_invitations( - before: cursor, - after: nil, - limit: limit, - order: order, - organization_id: organization_id, - email: email, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/user_management/invitations", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::UserInvite.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_invitations( + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + email: email, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization_id: organization_id, email: email}) end # Send an invitation @@ -829,7 +900,10 @@ def send_invitation( "inviter_user_id" => inviter_user_id, "locale" => locale }.compact - response = @client.request(method: :post, path: "/user_management/invitations", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/invitations", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::UserInvite.new(response.body) end @@ -841,7 +915,10 @@ def find_invitation_by_token( token:, request_options: {} ) - response = @client.request(method: :get, path: "/user_management/invitations/by_token/#{WorkOS::Util.encode_path(token)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/user_management/invitations/by_token/#{CGI.escape(token.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::UserInvite.new(response.body) end @@ -853,7 +930,10 @@ def get_invitation( id:, request_options: {} ) - response = @client.request(method: :get, path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/user_management/invitations/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::UserInvite.new(response.body) end @@ -865,7 +945,10 @@ def accept_invitation( id:, request_options: {} ) - response = @client.request(method: :post, path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/accept", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/invitations/#{CGI.escape(id.to_s)}/accept", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::Invitation.new(response.body) end @@ -882,7 +965,10 @@ def resend_invitation( body = { "locale" => locale }.compact - response = @client.request(method: :post, path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/resend", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/invitations/#{CGI.escape(id.to_s)}/resend", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::UserInvite.new(response.body) end @@ -894,7 +980,10 @@ def revoke_invitation( id:, request_options: {} ) - response = @client.request(method: :post, path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/revoke", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/invitations/#{CGI.escape(id.to_s)}/revoke", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::Invitation.new(response.body) end @@ -909,7 +998,10 @@ def update_jwt_template( body = { "content" => content }.compact - response = @client.request(method: :put, path: "/user_management/jwt_template", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.put_request(path: "/user_management/jwt_template", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::JWTTemplateResponse.new(response.body) end @@ -927,7 +1019,10 @@ def create_magic_auth( "email" => email, "invitation_token" => invitation_token }.compact - response = @client.request(method: :post, path: "/user_management/magic_auth", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/magic_auth", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::MagicAuth.new(response.body) end @@ -939,7 +1034,10 @@ def get_magic_auth( id:, request_options: {} ) - response = @client.request(method: :get, path: "/user_management/magic_auth/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/user_management/magic_auth/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::MagicAuth.new(response.body) end @@ -957,7 +1055,7 @@ def list_organization_memberships( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", organization_id: nil, statuses: nil, user_id: nil, @@ -972,34 +1070,27 @@ def list_organization_memberships( "statuses" => statuses, "user_id" => user_id }.compact - response = @client.request(method: :get, path: "/user_management/organization_memberships", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::UserOrganizationMembership, filters: {before: before, limit: limit, order: order, organization_id: organization_id, statuses: statuses, user_id: user_id}, - fetch_next: lambda do |cursor| - list_organization_memberships( - before: before, - after: cursor, - limit: limit, - order: order, - organization_id: organization_id, - statuses: statuses, - user_id: user_id, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_organization_memberships( - before: cursor, - after: nil, - limit: limit, - order: order, - organization_id: organization_id, - statuses: statuses, - user_id: user_id, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/user_management/organization_memberships", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::UserOrganizationMembership.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_organization_memberships( + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + statuses: statuses, + user_id: user_id, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization_id: organization_id, statuses: statuses, user_id: user_id}) end # Create an organization membership @@ -1017,7 +1108,7 @@ def create_organization_membership( role: nil, request_options: {} ) - params = {} + params = {}.compact if role case role[:type] when "single" @@ -1032,7 +1123,10 @@ def create_organization_membership( "role_slug" => role_slug, "role_slugs" => role_slugs }.compact - response = @client.request(method: :post, path: "/user_management/organization_memberships", auth: true, params: params, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/organization_memberships", auth: true, params: params, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::OrganizationMembership.new(response.body) end @@ -1044,7 +1138,10 @@ def get_organization_membership( id:, request_options: {} ) - response = @client.request(method: :get, path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.get_request(path: "/user_management/organization_memberships/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::UserOrganizationMembership.new(response.body) end @@ -1061,7 +1158,7 @@ def update_organization_membership( role: nil, request_options: {} ) - params = {} + params = {}.compact if role case role[:type] when "single" @@ -1074,7 +1171,10 @@ def update_organization_membership( "role_slug" => role_slug, "role_slugs" => role_slugs }.compact - response = @client.request(method: :put, path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}", auth: true, params: params, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.put_request(path: "/user_management/organization_memberships/#{CGI.escape(id.to_s)}", auth: true, params: params, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::UserOrganizationMembership.new(response.body) end @@ -1086,7 +1186,10 @@ def delete_organization_membership( id:, request_options: {} ) - @client.request(method: :delete, path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/user_management/organization_memberships/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end @@ -1098,7 +1201,10 @@ def deactivate_organization_membership( id:, request_options: {} ) - response = @client.request(method: :put, path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}/deactivate", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.put_request(path: "/user_management/organization_memberships/#{CGI.escape(id.to_s)}/deactivate", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::OrganizationMembership.new(response.body) end @@ -1110,7 +1216,10 @@ def reactivate_organization_membership( id:, request_options: {} ) - response = @client.request(method: :put, path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}/reactivate", auth: true, request_options: request_options) + response = @client.execute_request( + request: @client.put_request(path: "/user_management/organization_memberships/#{CGI.escape(id.to_s)}/reactivate", auth: true, request_options: request_options), + request_options: request_options + ) WorkOS::UserOrganizationMembership.new(response.body) end @@ -1125,7 +1234,10 @@ def create_redirect_uri( body = { "uri" => uri }.compact - response = @client.request(method: :post, path: "/user_management/redirect_uris", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/user_management/redirect_uris", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::RedirectUri.new(response.body) end @@ -1142,7 +1254,7 @@ def list_user_authorized_applications( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -1151,30 +1263,25 @@ def list_user_authorized_applications( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/authorized_applications", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::AuthorizedConnectApplicationListData, filters: {user_id: user_id, before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_user_authorized_applications( - user_id: user_id, - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_user_authorized_applications( - user_id: user_id, - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/authorized_applications", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::AuthorizedConnectApplicationListData.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_user_authorized_applications( + user_id: user_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {user_id: user_id, before: before, limit: limit, order: order}) end # Delete an authorized application @@ -1187,7 +1294,10 @@ def delete_user_authorized_application( user_id:, request_options: {} ) - @client.request(method: :delete, path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/authorized_applications/#{WorkOS::Util.encode_path(application_id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/authorized_applications/#{CGI.escape(application_id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end diff --git a/lib/workos/user_management/jwks_response_keys.rb b/lib/workos/user_management/jwks_response_keys.rb index 9a4c72f7..25e1938e 100644 --- a/lib/workos/user_management/jwks_response_keys.rb +++ b/lib/workos/user_management/jwks_response_keys.rb @@ -9,14 +9,14 @@ class JwksResponseKeys include HashProvider HASH_ATTRS = { - :alg => :alg, - :kty => :kty, - :use => :use, - :x5c => :x_5_c, - :n => :n, - :e => :e, - :kid => :kid, - "x5t#S256" => :x_5_t_s_256 + alg: :alg, + kty: :kty, + use: :use, + x_5_c: :x_5_c, + n: :n, + e: :e, + kid: :kid, + x_5_t_s_256: :x_5_t_s_256 }.freeze attr_accessor \ diff --git a/lib/workos/webhooks.rb b/lib/workos/webhooks.rb index ad6562a4..d3da2dd2 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -21,7 +21,7 @@ def list_webhook_endpoints( before: nil, after: nil, limit: nil, - order: nil, + order: "desc", request_options: {} ) params = { @@ -30,35 +30,31 @@ def list_webhook_endpoints( "limit" => limit, "order" => order }.compact - response = @client.request(method: :get, path: "/webhook_endpoints", auth: true, params: params, request_options: request_options) - WorkOS::Types::ListStruct.from_response( - response, model: WorkOS::WebhookEndpoint, filters: {before: before, limit: limit, order: order}, - fetch_next: lambda do |cursor| - list_webhook_endpoints( - before: before, - after: cursor, - limit: limit, - order: order, - request_options: request_options - ) - end, - fetch_previous: lambda do |cursor| - list_webhook_endpoints( - before: cursor, - after: nil, - limit: limit, - order: order, - request_options: request_options - ) - end + response = @client.execute_request( + request: @client.get_request(path: "/webhook_endpoints", auth: true, params: params, request_options: request_options), + request_options: request_options ) + parsed = JSON.parse(response.body) + items = (parsed["data"] || []).map { |item| WorkOS::WebhookEndpointJson.new(item) } + fetch_next = lambda do |metadata| + cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil + return nil if cursor.nil? || cursor.to_s.empty? + list_webhook_endpoints( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + end + WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order}) end # Create a Webhook Endpoint # @param endpoint_url [String] The HTTPS URL where webhooks will be sent. # @param events [Array] The events that the Webhook Endpoint is subscribed to. # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::WebhookEndpoint] + # @return [WorkOS::WebhookEndpointJson] def create_webhook_endpoint( endpoint_url:, events:, @@ -68,8 +64,11 @@ def create_webhook_endpoint( "endpoint_url" => endpoint_url, "events" => events }.compact - response = @client.request(method: :post, path: "/webhook_endpoints", auth: true, body: body, request_options: request_options) - WorkOS::WebhookEndpoint.new(response.body) + response = @client.execute_request( + request: @client.post_request(path: "/webhook_endpoints", auth: true, body: body, request_options: request_options), + request_options: request_options + ) + WorkOS::WebhookEndpointJson.new(response.body) end # Update a Webhook Endpoint @@ -78,7 +77,7 @@ def create_webhook_endpoint( # @param status [WorkOS::Types::UpdateWebhookEndpointStatus, nil] Whether the Webhook Endpoint is enabled or disabled. # @param events [Array, nil] The events that the Webhook Endpoint is subscribed to. # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::WebhookEndpoint] + # @return [WorkOS::WebhookEndpointJson] def update_webhook_endpoint( id:, endpoint_url: nil, @@ -91,8 +90,11 @@ def update_webhook_endpoint( "status" => status, "events" => events }.compact - response = @client.request(method: :patch, path: "/webhook_endpoints/#{WorkOS::Util.encode_path(id)}", auth: true, body: body, request_options: request_options) - WorkOS::WebhookEndpoint.new(response.body) + response = @client.execute_request( + request: @client.patch_request(path: "/webhook_endpoints/#{CGI.escape(id.to_s)}", auth: true, body: body, request_options: request_options), + request_options: request_options + ) + WorkOS::WebhookEndpointJson.new(response.body) end # Delete a Webhook Endpoint @@ -103,7 +105,10 @@ def delete_webhook_endpoint( id:, request_options: {} ) - @client.request(method: :delete, path: "/webhook_endpoints/#{WorkOS::Util.encode_path(id)}", auth: true, request_options: request_options) + @client.execute_request( + request: @client.delete_request(path: "/webhook_endpoints/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + request_options: request_options + ) nil end diff --git a/lib/workos/webhooks/webhook_endpoint_json.rb b/lib/workos/webhooks/webhook_endpoint_json.rb new file mode 100644 index 00000000..c3a08851 --- /dev/null +++ b/lib/workos/webhooks/webhook_endpoint_json.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class WebhookEndpointJson + include HashProvider + + HASH_ATTRS = { + object: :object, + id: :id, + endpoint_url: :endpoint_url, + secret: :secret, + status: :status, + events: :events, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :endpoint_url, + :secret, + :status, + :events, + :created_at, + :updated_at + + def initialize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + @object = hash[:object] + @id = hash[:id] + @endpoint_url = hash[:endpoint_url] + @secret = hash[:secret] + @status = hash[:status] + @events = hash[:events] || [] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/widgets.rb b/lib/workos/widgets.rb index e77f1ed3..7799360e 100644 --- a/lib/workos/widgets.rb +++ b/lib/workos/widgets.rb @@ -27,7 +27,10 @@ def create_token( "user_id" => user_id, "scopes" => scopes }.compact - response = @client.request(method: :post, path: "/widgets/token", auth: true, body: body, request_options: request_options) + response = @client.execute_request( + request: @client.post_request(path: "/widgets/token", auth: true, body: body, request_options: request_options), + request_options: request_options + ) WorkOS::WidgetSessionTokenResponse.new(response.body) end end diff --git a/rbi/workos/action_authentication_denied.rbi b/rbi/workos/action_authentication_denied.rbi index 11a58664..b292df51 100644 --- a/rbi/workos/action_authentication_denied.rbi +++ b/rbi/workos/action_authentication_denied.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/action_authentication_denied_data.rbi b/rbi/workos/action_authentication_denied_data.rbi index c380af71..14cc5f25 100644 --- a/rbi/workos/action_authentication_denied_data.rbi +++ b/rbi/workos/action_authentication_denied_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/action_user_registration_denied.rbi b/rbi/workos/action_user_registration_denied.rbi index 8274ff27..b02e0b0a 100644 --- a/rbi/workos/action_user_registration_denied.rbi +++ b/rbi/workos/action_user_registration_denied.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/action_user_registration_denied_data.rbi b/rbi/workos/action_user_registration_denied_data.rbi index b9bd4a1d..d7b83312 100644 --- a/rbi/workos/action_user_registration_denied_data.rbi +++ b/rbi/workos/action_user_registration_denied_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/add_role_permission.rbi b/rbi/workos/add_role_permission.rbi index e037cf6e..049baa84 100644 --- a/rbi/workos/add_role_permission.rbi +++ b/rbi/workos/add_role_permission.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/admin_portal.rbi b/rbi/workos/admin_portal.rbi index cc294dcd..1a2f4961 100644 --- a/rbi/workos/admin_portal.rbi +++ b/rbi/workos/admin_portal.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_key.rbi b/rbi/workos/api_key.rbi index 12202b66..1a91ee61 100644 --- a/rbi/workos/api_key.rbi +++ b/rbi/workos/api_key.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_key_created.rbi b/rbi/workos/api_key_created.rbi index e90fabbd..a59f3d55 100644 --- a/rbi/workos/api_key_created.rbi +++ b/rbi/workos/api_key_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_key_created_data.rbi b/rbi/workos/api_key_created_data.rbi index 9a0c701c..dfab3a6f 100644 --- a/rbi/workos/api_key_created_data.rbi +++ b/rbi/workos/api_key_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_key_created_data_owner.rbi b/rbi/workos/api_key_created_data_owner.rbi index 8110aa78..ca58254d 100644 --- a/rbi/workos/api_key_created_data_owner.rbi +++ b/rbi/workos/api_key_created_data_owner.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_key_owner.rbi b/rbi/workos/api_key_owner.rbi index 147dd489..32662250 100644 --- a/rbi/workos/api_key_owner.rbi +++ b/rbi/workos/api_key_owner.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_key_revoked.rbi b/rbi/workos/api_key_revoked.rbi index f40850a6..022de35c 100644 --- a/rbi/workos/api_key_revoked.rbi +++ b/rbi/workos/api_key_revoked.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_key_revoked_data.rbi b/rbi/workos/api_key_revoked_data.rbi index 9d1f6a01..2fe10d3a 100644 --- a/rbi/workos/api_key_revoked_data.rbi +++ b/rbi/workos/api_key_revoked_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_key_revoked_data_owner.rbi b/rbi/workos/api_key_revoked_data_owner.rbi index 61f89b84..03aa89ee 100644 --- a/rbi/workos/api_key_revoked_data_owner.rbi +++ b/rbi/workos/api_key_revoked_data_owner.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_key_validation_response.rbi b/rbi/workos/api_key_validation_response.rbi index 7421cf14..1b691a1f 100644 --- a/rbi/workos/api_key_validation_response.rbi +++ b/rbi/workos/api_key_validation_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_key_with_value.rbi b/rbi/workos/api_key_with_value.rbi index 472345e9..6519584f 100644 --- a/rbi/workos/api_key_with_value.rbi +++ b/rbi/workos/api_key_with_value.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_key_with_value_owner.rbi b/rbi/workos/api_key_with_value_owner.rbi index 7f9cb4ff..4dcca49b 100644 --- a/rbi/workos/api_key_with_value_owner.rbi +++ b/rbi/workos/api_key_with_value_owner.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/api_keys.rbi b/rbi/workos/api_keys.rbi index 14c27a4a..059df93a 100644 --- a/rbi/workos/api_keys.rbi +++ b/rbi/workos/api_keys.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/application_credentials_list_item.rbi b/rbi/workos/application_credentials_list_item.rbi index 3930956e..2f9228e9 100644 --- a/rbi/workos/application_credentials_list_item.rbi +++ b/rbi/workos/application_credentials_list_item.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/assign_role.rbi b/rbi/workos/assign_role.rbi index 7c2648b3..d359992d 100644 --- a/rbi/workos/assign_role.rbi +++ b/rbi/workos/assign_role.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_log_action_json.rbi b/rbi/workos/audit_log_action_json.rbi new file mode 100644 index 00000000..f88f196d --- /dev/null +++ b/rbi/workos/audit_log_action_json.rbi @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogActionJson + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def name; end + + sig { params(value: String).returns(String) } + def name=(value); end + + sig { returns(WorkOS::AuditLogSchemaJson) } + def schema; end + + sig { params(value: WorkOS::AuditLogSchemaJson).returns(WorkOS::AuditLogSchemaJson) } + def schema=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_configuration.rbi b/rbi/workos/audit_log_configuration.rbi index 70e61485..b660bb20 100644 --- a/rbi/workos/audit_log_configuration.rbi +++ b/rbi/workos/audit_log_configuration.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_log_configuration_log_stream.rbi b/rbi/workos/audit_log_configuration_log_stream.rbi index 71bab227..e0129929 100644 --- a/rbi/workos/audit_log_configuration_log_stream.rbi +++ b/rbi/workos/audit_log_configuration_log_stream.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_log_event.rbi b/rbi/workos/audit_log_event.rbi index 9a18b996..885bba72 100644 --- a/rbi/workos/audit_log_event.rbi +++ b/rbi/workos/audit_log_event.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_log_event_actor.rbi b/rbi/workos/audit_log_event_actor.rbi index 30675d97..b2338729 100644 --- a/rbi/workos/audit_log_event_actor.rbi +++ b/rbi/workos/audit_log_event_actor.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_log_event_context.rbi b/rbi/workos/audit_log_event_context.rbi index 007594a2..5585a178 100644 --- a/rbi/workos/audit_log_event_context.rbi +++ b/rbi/workos/audit_log_event_context.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_log_event_create_response.rbi b/rbi/workos/audit_log_event_create_response.rbi index 261ffc2e..c7021b8f 100644 --- a/rbi/workos/audit_log_event_create_response.rbi +++ b/rbi/workos/audit_log_event_create_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_log_event_ingestion.rbi b/rbi/workos/audit_log_event_ingestion.rbi index 3170177d..52d94203 100644 --- a/rbi/workos/audit_log_event_ingestion.rbi +++ b/rbi/workos/audit_log_event_ingestion.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_log_event_target.rbi b/rbi/workos/audit_log_event_target.rbi index 0c798df1..b8e7237d 100644 --- a/rbi/workos/audit_log_event_target.rbi +++ b/rbi/workos/audit_log_event_target.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_log_export_creation.rbi b/rbi/workos/audit_log_export_creation.rbi index bb88cbbd..7b6f2cee 100644 --- a/rbi/workos/audit_log_export_creation.rbi +++ b/rbi/workos/audit_log_export_creation.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_log_export_json.rbi b/rbi/workos/audit_log_export_json.rbi new file mode 100644 index 00000000..acdb6312 --- /dev/null +++ b/rbi/workos/audit_log_export_json.rbi @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogExportJson + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def state; end + + sig { params(value: String).returns(String) } + def state=(value); end + + sig { returns(T.nilable(String)) } + def url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def url=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_schema.rbi b/rbi/workos/audit_log_schema.rbi index 6cc95782..580253b6 100644 --- a/rbi/workos/audit_log_schema.rbi +++ b/rbi/workos/audit_log_schema.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong @@ -8,18 +9,6 @@ module WorkOS sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } def initialize(json); end - sig { returns(String) } - def object; end - - sig { params(value: String).returns(String) } - def object=(value); end - - sig { returns(Integer) } - def version; end - - sig { params(value: Integer).returns(Integer) } - def version=(value); end - sig { returns(T.nilable(WorkOS::AuditLogSchemaActor)) } def actor; end @@ -38,12 +27,6 @@ module WorkOS sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } def metadata=(value); end - sig { returns(String) } - def created_at; end - - sig { params(value: String).returns(String) } - def created_at=(value); end - sig { returns(T::Hash[Symbol, T.untyped]) } def to_h; end diff --git a/rbi/workos/audit_log_schema_actor.rbi b/rbi/workos/audit_log_schema_actor.rbi index ba1b0c92..2ee5202c 100644 --- a/rbi/workos/audit_log_schema_actor.rbi +++ b/rbi/workos/audit_log_schema_actor.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_log_schema_json.rbi b/rbi/workos/audit_log_schema_json.rbi new file mode 100644 index 00000000..22087b7e --- /dev/null +++ b/rbi/workos/audit_log_schema_json.rbi @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogSchemaJson + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(Integer) } + def version; end + + sig { params(value: Integer).returns(Integer) } + def version=(value); end + + sig { returns(T.nilable(WorkOS::AuditLogSchemaJsonActor)) } + def actor; end + + sig { params(value: T.nilable(WorkOS::AuditLogSchemaJsonActor)).returns(T.nilable(WorkOS::AuditLogSchemaJsonActor)) } + def actor=(value); end + + sig { returns(T::Array[WorkOS::AuditLogSchemaJsonTarget]) } + def targets; end + + sig { params(value: T::Array[WorkOS::AuditLogSchemaJsonTarget]).returns(T::Array[WorkOS::AuditLogSchemaJsonTarget]) } + def targets=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def metadata=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_schema_json_actor.rbi b/rbi/workos/audit_log_schema_json_actor.rbi new file mode 100644 index 00000000..ec091541 --- /dev/null +++ b/rbi/workos/audit_log_schema_json_actor.rbi @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogSchemaJsonActor + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T::Hash[String, T.untyped]) } + def metadata; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def metadata=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_schema_json_target.rbi b/rbi/workos/audit_log_schema_json_target.rbi new file mode 100644 index 00000000..04c80112 --- /dev/null +++ b/rbi/workos/audit_log_schema_json_target.rbi @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogSchemaJsonTarget + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def type; end + + sig { params(value: String).returns(String) } + def type=(value); end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def metadata; end + + sig { params(value: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(T::Hash[String, T.untyped])) } + def metadata=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/audit_log_schema_target.rbi b/rbi/workos/audit_log_schema_target.rbi index 2a929733..8cc049e8 100644 --- a/rbi/workos/audit_log_schema_target.rbi +++ b/rbi/workos/audit_log_schema_target.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/audit_logs.rbi b/rbi/workos/audit_logs.rbi index 5d309ca8..b022e197 100644 --- a/rbi/workos/audit_logs.rbi +++ b/rbi/workos/audit_logs.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong @@ -12,7 +13,7 @@ module WorkOS params( id: String, request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::AuditLogsRetention) + ).returns(WorkOS::AuditLogsRetentionJson) end def get_organization_audit_logs_retention(id:, request_options:); end @@ -21,7 +22,7 @@ module WorkOS id: String, retention_period_in_days: Integer, request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::AuditLogsRetention) + ).returns(WorkOS::AuditLogsRetentionJson) end def update_organization_audit_logs_retention(id:, retention_period_in_days:, request_options:); end @@ -32,7 +33,7 @@ module WorkOS limit: T.nilable(Integer), order: T.nilable(String), request_options: T::Hash[Symbol, T.untyped] - ).returns(T::Array[WorkOS::AuditLogAction]) + ).returns(T::Array[WorkOS::AuditLogActionJson]) end def list_actions(before:, after:, limit:, order:, request_options:); end @@ -44,7 +45,7 @@ module WorkOS limit: T.nilable(Integer), order: T.nilable(String), request_options: T::Hash[Symbol, T.untyped] - ).returns(T::Array[WorkOS::AuditLogSchema]) + ).returns(T::Array[WorkOS::AuditLogSchemaJson]) end def list_action_schemas(action_name:, before:, after:, limit:, order:, request_options:); end @@ -55,7 +56,7 @@ module WorkOS actor: T.nilable(WorkOS::AuditLogSchemaActor), metadata: T.nilable(T::Hash[String, T.untyped]), request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::AuditLogSchema) + ).returns(WorkOS::AuditLogSchemaJson) end def create_schema(action_name:, targets:, actor:, metadata:, request_options:); end @@ -79,7 +80,7 @@ module WorkOS actor_ids: T.nilable(T::Array[String]), targets: T.nilable(T::Array[String]), request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::AuditLogExport) + ).returns(WorkOS::AuditLogExportJson) end def create_export(organization_id:, range_start:, range_end:, actions:, actors:, actor_names:, actor_ids:, targets:, request_options:); end @@ -87,7 +88,7 @@ module WorkOS params( audit_log_export_id: String, request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::AuditLogExport) + ).returns(WorkOS::AuditLogExportJson) end def get_export(audit_log_export_id:, request_options:); end diff --git a/rbi/workos/audit_logs_retention_json.rbi b/rbi/workos/audit_logs_retention_json.rbi new file mode 100644 index 00000000..151b6d7a --- /dev/null +++ b/rbi/workos/audit_logs_retention_json.rbi @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class AuditLogsRetentionJson + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(Integer)) } + def retention_period_in_days; end + + sig { params(value: T.nilable(Integer)).returns(T.nilable(Integer)) } + def retention_period_in_days=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/authenticate_response.rbi b/rbi/workos/authenticate_response.rbi index c9623130..9c64547e 100644 --- a/rbi/workos/authenticate_response.rbi +++ b/rbi/workos/authenticate_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authenticate_response_impersonator.rbi b/rbi/workos/authenticate_response_impersonator.rbi index cf4bfb47..6ce8467b 100644 --- a/rbi/workos/authenticate_response_impersonator.rbi +++ b/rbi/workos/authenticate_response_impersonator.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authenticate_response_oauth_token.rbi b/rbi/workos/authenticate_response_oauth_token.rbi index e4069f46..856dc88e 100644 --- a/rbi/workos/authenticate_response_oauth_token.rbi +++ b/rbi/workos/authenticate_response_oauth_token.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_challenge.rbi b/rbi/workos/authentication_challenge.rbi index ebfa4cd3..cebdd598 100644 --- a/rbi/workos/authentication_challenge.rbi +++ b/rbi/workos/authentication_challenge.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_challenge_verify_response.rbi b/rbi/workos/authentication_challenge_verify_response.rbi index 86ecbf42..6b9b39d6 100644 --- a/rbi/workos/authentication_challenge_verify_response.rbi +++ b/rbi/workos/authentication_challenge_verify_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_challenges_verify_request.rbi b/rbi/workos/authentication_challenges_verify_request.rbi index 3db4ce32..03970967 100644 --- a/rbi/workos/authentication_challenges_verify_request.rbi +++ b/rbi/workos/authentication_challenges_verify_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_email_verification_failed.rbi b/rbi/workos/authentication_email_verification_failed.rbi index 643dfd0f..5e0f6388 100644 --- a/rbi/workos/authentication_email_verification_failed.rbi +++ b/rbi/workos/authentication_email_verification_failed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_email_verification_failed_data.rbi b/rbi/workos/authentication_email_verification_failed_data.rbi index dd4b2563..ccf21d39 100644 --- a/rbi/workos/authentication_email_verification_failed_data.rbi +++ b/rbi/workos/authentication_email_verification_failed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_email_verification_failed_data_error.rbi b/rbi/workos/authentication_email_verification_failed_data_error.rbi index fd77664e..9da0cfe1 100644 --- a/rbi/workos/authentication_email_verification_failed_data_error.rbi +++ b/rbi/workos/authentication_email_verification_failed_data_error.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_email_verification_succeeded.rbi b/rbi/workos/authentication_email_verification_succeeded.rbi index 6e482077..50831892 100644 --- a/rbi/workos/authentication_email_verification_succeeded.rbi +++ b/rbi/workos/authentication_email_verification_succeeded.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_email_verification_succeeded_data.rbi b/rbi/workos/authentication_email_verification_succeeded_data.rbi index b3cb404d..1ede1392 100644 --- a/rbi/workos/authentication_email_verification_succeeded_data.rbi +++ b/rbi/workos/authentication_email_verification_succeeded_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_factor.rbi b/rbi/workos/authentication_factor.rbi index 019bc202..5f5ddd71 100644 --- a/rbi/workos/authentication_factor.rbi +++ b/rbi/workos/authentication_factor.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_factor_enrolled.rbi b/rbi/workos/authentication_factor_enrolled.rbi index ef0b10dd..ebbcf833 100644 --- a/rbi/workos/authentication_factor_enrolled.rbi +++ b/rbi/workos/authentication_factor_enrolled.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_factor_enrolled_sms.rbi b/rbi/workos/authentication_factor_enrolled_sms.rbi index 3d0b0b34..356a39c0 100644 --- a/rbi/workos/authentication_factor_enrolled_sms.rbi +++ b/rbi/workos/authentication_factor_enrolled_sms.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_factor_enrolled_totp.rbi b/rbi/workos/authentication_factor_enrolled_totp.rbi index b5f29de1..b8c30ccf 100644 --- a/rbi/workos/authentication_factor_enrolled_totp.rbi +++ b/rbi/workos/authentication_factor_enrolled_totp.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_factor_sms.rbi b/rbi/workos/authentication_factor_sms.rbi index 6c7fcdfe..03e79bbd 100644 --- a/rbi/workos/authentication_factor_sms.rbi +++ b/rbi/workos/authentication_factor_sms.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_factor_totp.rbi b/rbi/workos/authentication_factor_totp.rbi index c1215a3e..7553d31c 100644 --- a/rbi/workos/authentication_factor_totp.rbi +++ b/rbi/workos/authentication_factor_totp.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_factors_create_request.rbi b/rbi/workos/authentication_factors_create_request.rbi index 7fe1d564..66d39735 100644 --- a/rbi/workos/authentication_factors_create_request.rbi +++ b/rbi/workos/authentication_factors_create_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_magic_auth_failed.rbi b/rbi/workos/authentication_magic_auth_failed.rbi index 4daba7c0..56dc51ef 100644 --- a/rbi/workos/authentication_magic_auth_failed.rbi +++ b/rbi/workos/authentication_magic_auth_failed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_magic_auth_failed_data.rbi b/rbi/workos/authentication_magic_auth_failed_data.rbi index abdbc5ce..6dabd36c 100644 --- a/rbi/workos/authentication_magic_auth_failed_data.rbi +++ b/rbi/workos/authentication_magic_auth_failed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_magic_auth_failed_data_error.rbi b/rbi/workos/authentication_magic_auth_failed_data_error.rbi index bffc8836..322bcb88 100644 --- a/rbi/workos/authentication_magic_auth_failed_data_error.rbi +++ b/rbi/workos/authentication_magic_auth_failed_data_error.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_magic_auth_succeeded.rbi b/rbi/workos/authentication_magic_auth_succeeded.rbi index 26fefe57..51d53e57 100644 --- a/rbi/workos/authentication_magic_auth_succeeded.rbi +++ b/rbi/workos/authentication_magic_auth_succeeded.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_magic_auth_succeeded_data.rbi b/rbi/workos/authentication_magic_auth_succeeded_data.rbi index 01328059..ed155614 100644 --- a/rbi/workos/authentication_magic_auth_succeeded_data.rbi +++ b/rbi/workos/authentication_magic_auth_succeeded_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_mfa_failed.rbi b/rbi/workos/authentication_mfa_failed.rbi index 00f5dad2..4352dd45 100644 --- a/rbi/workos/authentication_mfa_failed.rbi +++ b/rbi/workos/authentication_mfa_failed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_mfa_failed_data.rbi b/rbi/workos/authentication_mfa_failed_data.rbi index 1d665a9a..5f2997cd 100644 --- a/rbi/workos/authentication_mfa_failed_data.rbi +++ b/rbi/workos/authentication_mfa_failed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_mfa_failed_data_error.rbi b/rbi/workos/authentication_mfa_failed_data_error.rbi index 98d12cf1..624541ab 100644 --- a/rbi/workos/authentication_mfa_failed_data_error.rbi +++ b/rbi/workos/authentication_mfa_failed_data_error.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_mfa_succeeded.rbi b/rbi/workos/authentication_mfa_succeeded.rbi index cf7a20e3..105895fe 100644 --- a/rbi/workos/authentication_mfa_succeeded.rbi +++ b/rbi/workos/authentication_mfa_succeeded.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_mfa_succeeded_data.rbi b/rbi/workos/authentication_mfa_succeeded_data.rbi index 7cd8fb90..309ff5c5 100644 --- a/rbi/workos/authentication_mfa_succeeded_data.rbi +++ b/rbi/workos/authentication_mfa_succeeded_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_oauth_failed.rbi b/rbi/workos/authentication_oauth_failed.rbi index 3eb102fb..f10b076c 100644 --- a/rbi/workos/authentication_oauth_failed.rbi +++ b/rbi/workos/authentication_oauth_failed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_oauth_failed_data.rbi b/rbi/workos/authentication_oauth_failed_data.rbi index d22145c2..6b90714b 100644 --- a/rbi/workos/authentication_oauth_failed_data.rbi +++ b/rbi/workos/authentication_oauth_failed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_oauth_failed_data_error.rbi b/rbi/workos/authentication_oauth_failed_data_error.rbi index 3ace7754..c4d32d63 100644 --- a/rbi/workos/authentication_oauth_failed_data_error.rbi +++ b/rbi/workos/authentication_oauth_failed_data_error.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_oauth_succeeded.rbi b/rbi/workos/authentication_oauth_succeeded.rbi index f6a5b2a5..bb768038 100644 --- a/rbi/workos/authentication_oauth_succeeded.rbi +++ b/rbi/workos/authentication_oauth_succeeded.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_oauth_succeeded_data.rbi b/rbi/workos/authentication_oauth_succeeded_data.rbi index 7805c006..94cb8314 100644 --- a/rbi/workos/authentication_oauth_succeeded_data.rbi +++ b/rbi/workos/authentication_oauth_succeeded_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_passkey_failed.rbi b/rbi/workos/authentication_passkey_failed.rbi index a08a9562..b8986307 100644 --- a/rbi/workos/authentication_passkey_failed.rbi +++ b/rbi/workos/authentication_passkey_failed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_passkey_failed_data.rbi b/rbi/workos/authentication_passkey_failed_data.rbi index b4327ebd..66db1035 100644 --- a/rbi/workos/authentication_passkey_failed_data.rbi +++ b/rbi/workos/authentication_passkey_failed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_passkey_failed_data_error.rbi b/rbi/workos/authentication_passkey_failed_data_error.rbi index 8ed94323..ba6848e5 100644 --- a/rbi/workos/authentication_passkey_failed_data_error.rbi +++ b/rbi/workos/authentication_passkey_failed_data_error.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_passkey_succeeded.rbi b/rbi/workos/authentication_passkey_succeeded.rbi index 6f479663..ccebdc2d 100644 --- a/rbi/workos/authentication_passkey_succeeded.rbi +++ b/rbi/workos/authentication_passkey_succeeded.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_passkey_succeeded_data.rbi b/rbi/workos/authentication_passkey_succeeded_data.rbi index 1f1e3d16..fab857e8 100644 --- a/rbi/workos/authentication_passkey_succeeded_data.rbi +++ b/rbi/workos/authentication_passkey_succeeded_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_password_failed.rbi b/rbi/workos/authentication_password_failed.rbi index 2fdc910b..bbc2c357 100644 --- a/rbi/workos/authentication_password_failed.rbi +++ b/rbi/workos/authentication_password_failed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_password_failed_data.rbi b/rbi/workos/authentication_password_failed_data.rbi index 242c4f1a..58ee2873 100644 --- a/rbi/workos/authentication_password_failed_data.rbi +++ b/rbi/workos/authentication_password_failed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_password_failed_data_error.rbi b/rbi/workos/authentication_password_failed_data_error.rbi index f4048725..7c66c25b 100644 --- a/rbi/workos/authentication_password_failed_data_error.rbi +++ b/rbi/workos/authentication_password_failed_data_error.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_password_succeeded.rbi b/rbi/workos/authentication_password_succeeded.rbi index 3274e7fd..d12b4370 100644 --- a/rbi/workos/authentication_password_succeeded.rbi +++ b/rbi/workos/authentication_password_succeeded.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_password_succeeded_data.rbi b/rbi/workos/authentication_password_succeeded_data.rbi index aa9c6c7e..a25c726b 100644 --- a/rbi/workos/authentication_password_succeeded_data.rbi +++ b/rbi/workos/authentication_password_succeeded_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_radar_risk_detected.rbi b/rbi/workos/authentication_radar_risk_detected.rbi index d49c0656..3ec81b68 100644 --- a/rbi/workos/authentication_radar_risk_detected.rbi +++ b/rbi/workos/authentication_radar_risk_detected.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_radar_risk_detected_data.rbi b/rbi/workos/authentication_radar_risk_detected_data.rbi index d610f7fe..6bf908c2 100644 --- a/rbi/workos/authentication_radar_risk_detected_data.rbi +++ b/rbi/workos/authentication_radar_risk_detected_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_failed.rbi b/rbi/workos/authentication_sso_failed.rbi index 1fcc5e48..1177cc10 100644 --- a/rbi/workos/authentication_sso_failed.rbi +++ b/rbi/workos/authentication_sso_failed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_failed_data.rbi b/rbi/workos/authentication_sso_failed_data.rbi index 2526e8e6..8d72f477 100644 --- a/rbi/workos/authentication_sso_failed_data.rbi +++ b/rbi/workos/authentication_sso_failed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_failed_data_error.rbi b/rbi/workos/authentication_sso_failed_data_error.rbi index d727e446..3b44cd20 100644 --- a/rbi/workos/authentication_sso_failed_data_error.rbi +++ b/rbi/workos/authentication_sso_failed_data_error.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_failed_data_sso.rbi b/rbi/workos/authentication_sso_failed_data_sso.rbi index ce8a2cd1..44c4f139 100644 --- a/rbi/workos/authentication_sso_failed_data_sso.rbi +++ b/rbi/workos/authentication_sso_failed_data_sso.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_started.rbi b/rbi/workos/authentication_sso_started.rbi index ca7a4cb3..6707b6b6 100644 --- a/rbi/workos/authentication_sso_started.rbi +++ b/rbi/workos/authentication_sso_started.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_started_data.rbi b/rbi/workos/authentication_sso_started_data.rbi index 8cc05ea7..1eadea6a 100644 --- a/rbi/workos/authentication_sso_started_data.rbi +++ b/rbi/workos/authentication_sso_started_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_started_data_sso.rbi b/rbi/workos/authentication_sso_started_data_sso.rbi index 32dee512..a60da2b2 100644 --- a/rbi/workos/authentication_sso_started_data_sso.rbi +++ b/rbi/workos/authentication_sso_started_data_sso.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_succeeded.rbi b/rbi/workos/authentication_sso_succeeded.rbi index 315da666..8e1a6d42 100644 --- a/rbi/workos/authentication_sso_succeeded.rbi +++ b/rbi/workos/authentication_sso_succeeded.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_succeeded_data.rbi b/rbi/workos/authentication_sso_succeeded_data.rbi index a5ed670d..af057ca5 100644 --- a/rbi/workos/authentication_sso_succeeded_data.rbi +++ b/rbi/workos/authentication_sso_succeeded_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_succeeded_data_sso.rbi b/rbi/workos/authentication_sso_succeeded_data_sso.rbi index bbaa446e..0f3672d0 100644 --- a/rbi/workos/authentication_sso_succeeded_data_sso.rbi +++ b/rbi/workos/authentication_sso_succeeded_data_sso.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_timed_out.rbi b/rbi/workos/authentication_sso_timed_out.rbi index efe6702b..d1fa6656 100644 --- a/rbi/workos/authentication_sso_timed_out.rbi +++ b/rbi/workos/authentication_sso_timed_out.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_timed_out_data.rbi b/rbi/workos/authentication_sso_timed_out_data.rbi index 7c5d6507..3b434681 100644 --- a/rbi/workos/authentication_sso_timed_out_data.rbi +++ b/rbi/workos/authentication_sso_timed_out_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_timed_out_data_error.rbi b/rbi/workos/authentication_sso_timed_out_data_error.rbi index 71475788..65188269 100644 --- a/rbi/workos/authentication_sso_timed_out_data_error.rbi +++ b/rbi/workos/authentication_sso_timed_out_data_error.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authentication_sso_timed_out_data_sso.rbi b/rbi/workos/authentication_sso_timed_out_data_sso.rbi index 3d36cf76..0e6ce663 100644 --- a/rbi/workos/authentication_sso_timed_out_data_sso.rbi +++ b/rbi/workos/authentication_sso_timed_out_data_sso.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authorization.rbi b/rbi/workos/authorization.rbi index f8f5a119..6e2c1cda 100644 --- a/rbi/workos/authorization.rbi +++ b/rbi/workos/authorization.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authorization_check.rbi b/rbi/workos/authorization_check.rbi index 989e3a8f..61461282 100644 --- a/rbi/workos/authorization_check.rbi +++ b/rbi/workos/authorization_check.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authorization_code_session_authenticate_request.rbi b/rbi/workos/authorization_code_session_authenticate_request.rbi index cc8a1326..bbd4696e 100644 --- a/rbi/workos/authorization_code_session_authenticate_request.rbi +++ b/rbi/workos/authorization_code_session_authenticate_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authorization_permission.rbi b/rbi/workos/authorization_permission.rbi index 1954ea06..8dee7e9b 100644 --- a/rbi/workos/authorization_permission.rbi +++ b/rbi/workos/authorization_permission.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authorization_resource.rbi b/rbi/workos/authorization_resource.rbi index c53c03d5..608d99c6 100644 --- a/rbi/workos/authorization_resource.rbi +++ b/rbi/workos/authorization_resource.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/authorized_connect_application_list_data.rbi b/rbi/workos/authorized_connect_application_list_data.rbi index c99cbb17..3c60be86 100644 --- a/rbi/workos/authorized_connect_application_list_data.rbi +++ b/rbi/workos/authorized_connect_application_list_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/challenge_authentication_factor.rbi b/rbi/workos/challenge_authentication_factor.rbi index 3d7595ad..d0acd989 100644 --- a/rbi/workos/challenge_authentication_factor.rbi +++ b/rbi/workos/challenge_authentication_factor.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/check_authorization.rbi b/rbi/workos/check_authorization.rbi index 3902713d..7efd4e8d 100644 --- a/rbi/workos/check_authorization.rbi +++ b/rbi/workos/check_authorization.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/client.rbi b/rbi/workos/client.rbi index e5a54610..0282b224 100644 --- a/rbi/workos/client.rbi +++ b/rbi/workos/client.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/confirm_email_change.rbi b/rbi/workos/confirm_email_change.rbi index 2448e07f..249f59a2 100644 --- a/rbi/workos/confirm_email_change.rbi +++ b/rbi/workos/confirm_email_change.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connect.rbi b/rbi/workos/connect.rbi index 5d2a6179..d7179206 100644 --- a/rbi/workos/connect.rbi +++ b/rbi/workos/connect.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connect_application.rbi b/rbi/workos/connect_application.rbi index d5b46a8f..dd7f4488 100644 --- a/rbi/workos/connect_application.rbi +++ b/rbi/workos/connect_application.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connected_account.rbi b/rbi/workos/connected_account.rbi index 15239b2a..ccc12a54 100644 --- a/rbi/workos/connected_account.rbi +++ b/rbi/workos/connected_account.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection.rbi b/rbi/workos/connection.rbi index 2d97b96c..2affbc25 100644 --- a/rbi/workos/connection.rbi +++ b/rbi/workos/connection.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_activated.rbi b/rbi/workos/connection_activated.rbi index 3e5a8a95..7c0323ef 100644 --- a/rbi/workos/connection_activated.rbi +++ b/rbi/workos/connection_activated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_activated_data.rbi b/rbi/workos/connection_activated_data.rbi index bb626753..e7340347 100644 --- a/rbi/workos/connection_activated_data.rbi +++ b/rbi/workos/connection_activated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_activated_data_domain.rbi b/rbi/workos/connection_activated_data_domain.rbi index 49fa32a0..650f4b76 100644 --- a/rbi/workos/connection_activated_data_domain.rbi +++ b/rbi/workos/connection_activated_data_domain.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_deactivated.rbi b/rbi/workos/connection_deactivated.rbi index 5b7e7f34..c0fd502c 100644 --- a/rbi/workos/connection_deactivated.rbi +++ b/rbi/workos/connection_deactivated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_deactivated_data.rbi b/rbi/workos/connection_deactivated_data.rbi index 545a3f48..c3ceb14b 100644 --- a/rbi/workos/connection_deactivated_data.rbi +++ b/rbi/workos/connection_deactivated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_deactivated_data_domain.rbi b/rbi/workos/connection_deactivated_data_domain.rbi index 02d0e3a6..f2450a5d 100644 --- a/rbi/workos/connection_deactivated_data_domain.rbi +++ b/rbi/workos/connection_deactivated_data_domain.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_deleted.rbi b/rbi/workos/connection_deleted.rbi index 7a2cc41e..628720ce 100644 --- a/rbi/workos/connection_deleted.rbi +++ b/rbi/workos/connection_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_deleted_data.rbi b/rbi/workos/connection_deleted_data.rbi index 3aa13364..5c860805 100644 --- a/rbi/workos/connection_deleted_data.rbi +++ b/rbi/workos/connection_deleted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_domain.rbi b/rbi/workos/connection_domain.rbi index 26e89240..1ec9c344 100644 --- a/rbi/workos/connection_domain.rbi +++ b/rbi/workos/connection_domain.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_option.rbi b/rbi/workos/connection_option.rbi index 164bd40a..42fc29f3 100644 --- a/rbi/workos/connection_option.rbi +++ b/rbi/workos/connection_option.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_saml_certificate_renewal_required.rbi b/rbi/workos/connection_saml_certificate_renewal_required.rbi index 9f8dd2a2..66696e2f 100644 --- a/rbi/workos/connection_saml_certificate_renewal_required.rbi +++ b/rbi/workos/connection_saml_certificate_renewal_required.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_saml_certificate_renewal_required_data.rbi b/rbi/workos/connection_saml_certificate_renewal_required_data.rbi index 2cb1383c..f33fcf8c 100644 --- a/rbi/workos/connection_saml_certificate_renewal_required_data.rbi +++ b/rbi/workos/connection_saml_certificate_renewal_required_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_saml_certificate_renewal_required_data_certificate.rbi b/rbi/workos/connection_saml_certificate_renewal_required_data_certificate.rbi index 13f57f11..ec3bdf4a 100644 --- a/rbi/workos/connection_saml_certificate_renewal_required_data_certificate.rbi +++ b/rbi/workos/connection_saml_certificate_renewal_required_data_certificate.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_saml_certificate_renewal_required_data_connection.rbi b/rbi/workos/connection_saml_certificate_renewal_required_data_connection.rbi index 2c85d855..004e3b22 100644 --- a/rbi/workos/connection_saml_certificate_renewal_required_data_connection.rbi +++ b/rbi/workos/connection_saml_certificate_renewal_required_data_connection.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_saml_certificate_renewed.rbi b/rbi/workos/connection_saml_certificate_renewed.rbi index 2d7374ca..74a32493 100644 --- a/rbi/workos/connection_saml_certificate_renewed.rbi +++ b/rbi/workos/connection_saml_certificate_renewed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_saml_certificate_renewed_data.rbi b/rbi/workos/connection_saml_certificate_renewed_data.rbi index 96a90258..5a2806ed 100644 --- a/rbi/workos/connection_saml_certificate_renewed_data.rbi +++ b/rbi/workos/connection_saml_certificate_renewed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_saml_certificate_renewed_data_certificate.rbi b/rbi/workos/connection_saml_certificate_renewed_data_certificate.rbi index b69df2fc..829436c6 100644 --- a/rbi/workos/connection_saml_certificate_renewed_data_certificate.rbi +++ b/rbi/workos/connection_saml_certificate_renewed_data_certificate.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/connection_saml_certificate_renewed_data_connection.rbi b/rbi/workos/connection_saml_certificate_renewed_data_connection.rbi index 8d8b97bc..4ed4df06 100644 --- a/rbi/workos/connection_saml_certificate_renewed_data_connection.rbi +++ b/rbi/workos/connection_saml_certificate_renewed_data_connection.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/cors_origin_response.rbi b/rbi/workos/cors_origin_response.rbi index e5cfbea5..7699305c 100644 --- a/rbi/workos/cors_origin_response.rbi +++ b/rbi/workos/cors_origin_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_application_secret.rbi b/rbi/workos/create_application_secret.rbi index 456ce8a6..14067768 100644 --- a/rbi/workos/create_application_secret.rbi +++ b/rbi/workos/create_application_secret.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_authorization_permission.rbi b/rbi/workos/create_authorization_permission.rbi index 3e5ef533..872439a9 100644 --- a/rbi/workos/create_authorization_permission.rbi +++ b/rbi/workos/create_authorization_permission.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_authorization_resource.rbi b/rbi/workos/create_authorization_resource.rbi index c70d8fd9..96810bc2 100644 --- a/rbi/workos/create_authorization_resource.rbi +++ b/rbi/workos/create_authorization_resource.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_cors_origin.rbi b/rbi/workos/create_cors_origin.rbi index 2bbd58e2..6679dee4 100644 --- a/rbi/workos/create_cors_origin.rbi +++ b/rbi/workos/create_cors_origin.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_m2m_application.rbi b/rbi/workos/create_m2m_application.rbi index dc3d703e..53bf736a 100644 --- a/rbi/workos/create_m2m_application.rbi +++ b/rbi/workos/create_m2m_application.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_magic_code_and_return.rbi b/rbi/workos/create_magic_code_and_return.rbi index f7cc1098..55e625c4 100644 --- a/rbi/workos/create_magic_code_and_return.rbi +++ b/rbi/workos/create_magic_code_and_return.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_oauth_application.rbi b/rbi/workos/create_oauth_application.rbi index e397e54c..8fff4ca8 100644 --- a/rbi/workos/create_oauth_application.rbi +++ b/rbi/workos/create_oauth_application.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_organization_api_key.rbi b/rbi/workos/create_organization_api_key.rbi index 5103d741..26502f63 100644 --- a/rbi/workos/create_organization_api_key.rbi +++ b/rbi/workos/create_organization_api_key.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_organization_domain.rbi b/rbi/workos/create_organization_domain.rbi index 17aef8c5..c7db689a 100644 --- a/rbi/workos/create_organization_domain.rbi +++ b/rbi/workos/create_organization_domain.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_organization_role.rbi b/rbi/workos/create_organization_role.rbi index 32909063..6328349d 100644 --- a/rbi/workos/create_organization_role.rbi +++ b/rbi/workos/create_organization_role.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_password_reset.rbi b/rbi/workos/create_password_reset.rbi index 33491654..0d9220c6 100644 --- a/rbi/workos/create_password_reset.rbi +++ b/rbi/workos/create_password_reset.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_password_reset_token.rbi b/rbi/workos/create_password_reset_token.rbi index eca9fb79..b6cedb02 100644 --- a/rbi/workos/create_password_reset_token.rbi +++ b/rbi/workos/create_password_reset_token.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_redirect_uri.rbi b/rbi/workos/create_redirect_uri.rbi index 9acf0b91..5373598a 100644 --- a/rbi/workos/create_redirect_uri.rbi +++ b/rbi/workos/create_redirect_uri.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_role.rbi b/rbi/workos/create_role.rbi index 66140b7d..92e9af9a 100644 --- a/rbi/workos/create_role.rbi +++ b/rbi/workos/create_role.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_user.rbi b/rbi/workos/create_user.rbi index 7a12b788..74d7b3b1 100644 --- a/rbi/workos/create_user.rbi +++ b/rbi/workos/create_user.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_user_invite_options.rbi b/rbi/workos/create_user_invite_options.rbi index 4f8774b4..fa6a6af2 100644 --- a/rbi/workos/create_user_invite_options.rbi +++ b/rbi/workos/create_user_invite_options.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_user_organization_membership.rbi b/rbi/workos/create_user_organization_membership.rbi index cc76b974..8f70fa39 100644 --- a/rbi/workos/create_user_organization_membership.rbi +++ b/rbi/workos/create_user_organization_membership.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/create_webhook_endpoint.rbi b/rbi/workos/create_webhook_endpoint.rbi index dea4847d..3950b34b 100644 --- a/rbi/workos/create_webhook_endpoint.rbi +++ b/rbi/workos/create_webhook_endpoint.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/data_integration_access_token_response.rbi b/rbi/workos/data_integration_access_token_response.rbi index 7df918be..2320dd34 100644 --- a/rbi/workos/data_integration_access_token_response.rbi +++ b/rbi/workos/data_integration_access_token_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/data_integration_access_token_response_access_token.rbi b/rbi/workos/data_integration_access_token_response_access_token.rbi index 54a7a3a3..a7678930 100644 --- a/rbi/workos/data_integration_access_token_response_access_token.rbi +++ b/rbi/workos/data_integration_access_token_response_access_token.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/data_integration_authorize_url_response.rbi b/rbi/workos/data_integration_authorize_url_response.rbi index 62e515fb..5c3e7729 100644 --- a/rbi/workos/data_integration_authorize_url_response.rbi +++ b/rbi/workos/data_integration_authorize_url_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi b/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi index 803a4006..5b1ab5b9 100644 --- a/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi +++ b/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/data_integrations_get_user_token_request.rbi b/rbi/workos/data_integrations_get_user_token_request.rbi index eb8a0021..bad71270 100644 --- a/rbi/workos/data_integrations_get_user_token_request.rbi +++ b/rbi/workos/data_integrations_get_user_token_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/data_integrations_list_response.rbi b/rbi/workos/data_integrations_list_response.rbi index ddd641ba..72ae7976 100644 --- a/rbi/workos/data_integrations_list_response.rbi +++ b/rbi/workos/data_integrations_list_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/data_integrations_list_response_data.rbi b/rbi/workos/data_integrations_list_response_data.rbi index c732d527..a796f906 100644 --- a/rbi/workos/data_integrations_list_response_data.rbi +++ b/rbi/workos/data_integrations_list_response_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/data_integrations_list_response_data_connected_account.rbi b/rbi/workos/data_integrations_list_response_data_connected_account.rbi index 7266a9a7..9799b3b7 100644 --- a/rbi/workos/data_integrations_list_response_data_connected_account.rbi +++ b/rbi/workos/data_integrations_list_response_data_connected_account.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/device_authorization_response.rbi b/rbi/workos/device_authorization_response.rbi index fbe536bb..630bee1a 100644 --- a/rbi/workos/device_authorization_response.rbi +++ b/rbi/workos/device_authorization_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/device_code_session_authenticate_request.rbi b/rbi/workos/device_code_session_authenticate_request.rbi index 53641b01..d9532902 100644 --- a/rbi/workos/device_code_session_authenticate_request.rbi +++ b/rbi/workos/device_code_session_authenticate_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/directory.rbi b/rbi/workos/directory.rbi index 9643760a..e1572880 100644 --- a/rbi/workos/directory.rbi +++ b/rbi/workos/directory.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/directory_group.rbi b/rbi/workos/directory_group.rbi index 46805244..1391c5a1 100644 --- a/rbi/workos/directory_group.rbi +++ b/rbi/workos/directory_group.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/directory_metadata.rbi b/rbi/workos/directory_metadata.rbi index b8ed8de9..e88d8de6 100644 --- a/rbi/workos/directory_metadata.rbi +++ b/rbi/workos/directory_metadata.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/directory_metadata_user.rbi b/rbi/workos/directory_metadata_user.rbi index 9f7c8da2..5d637da2 100644 --- a/rbi/workos/directory_metadata_user.rbi +++ b/rbi/workos/directory_metadata_user.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/directory_sync.rbi b/rbi/workos/directory_sync.rbi index 43161514..c4985c8e 100644 --- a/rbi/workos/directory_sync.rbi +++ b/rbi/workos/directory_sync.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/directory_user.rbi b/rbi/workos/directory_user.rbi index 68182618..baaaaa95 100644 --- a/rbi/workos/directory_user.rbi +++ b/rbi/workos/directory_user.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/directory_user_email.rbi b/rbi/workos/directory_user_email.rbi index bf1e5a10..01ca0061 100644 --- a/rbi/workos/directory_user_email.rbi +++ b/rbi/workos/directory_user_email.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/directory_user_with_groups.rbi b/rbi/workos/directory_user_with_groups.rbi index 708bfcd8..55fba4d7 100644 --- a/rbi/workos/directory_user_with_groups.rbi +++ b/rbi/workos/directory_user_with_groups.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/directory_user_with_groups_email.rbi b/rbi/workos/directory_user_with_groups_email.rbi index dc8d4482..2864e702 100644 --- a/rbi/workos/directory_user_with_groups_email.rbi +++ b/rbi/workos/directory_user_with_groups_email.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_activated.rbi b/rbi/workos/dsync_activated.rbi index a4496855..8c74eaea 100644 --- a/rbi/workos/dsync_activated.rbi +++ b/rbi/workos/dsync_activated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_activated_data.rbi b/rbi/workos/dsync_activated_data.rbi index 2db20eb4..2e382cf4 100644 --- a/rbi/workos/dsync_activated_data.rbi +++ b/rbi/workos/dsync_activated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_activated_data_domain.rbi b/rbi/workos/dsync_activated_data_domain.rbi index 82e5818f..d19530fd 100644 --- a/rbi/workos/dsync_activated_data_domain.rbi +++ b/rbi/workos/dsync_activated_data_domain.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_deactivated.rbi b/rbi/workos/dsync_deactivated.rbi index b9f2ad27..51bf08cb 100644 --- a/rbi/workos/dsync_deactivated.rbi +++ b/rbi/workos/dsync_deactivated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_deactivated_data.rbi b/rbi/workos/dsync_deactivated_data.rbi index 4ff0cdc4..056bc3f5 100644 --- a/rbi/workos/dsync_deactivated_data.rbi +++ b/rbi/workos/dsync_deactivated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_deactivated_data_domain.rbi b/rbi/workos/dsync_deactivated_data_domain.rbi index f0564698..c8f60862 100644 --- a/rbi/workos/dsync_deactivated_data_domain.rbi +++ b/rbi/workos/dsync_deactivated_data_domain.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_deleted.rbi b/rbi/workos/dsync_deleted.rbi index 6aba9243..705080e9 100644 --- a/rbi/workos/dsync_deleted.rbi +++ b/rbi/workos/dsync_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_deleted_data.rbi b/rbi/workos/dsync_deleted_data.rbi index ab87c0fa..97cdf3b0 100644 --- a/rbi/workos/dsync_deleted_data.rbi +++ b/rbi/workos/dsync_deleted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_group_created.rbi b/rbi/workos/dsync_group_created.rbi index fe9321df..57ab9d28 100644 --- a/rbi/workos/dsync_group_created.rbi +++ b/rbi/workos/dsync_group_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_group_deleted.rbi b/rbi/workos/dsync_group_deleted.rbi index 992b7cc6..6d62a1c0 100644 --- a/rbi/workos/dsync_group_deleted.rbi +++ b/rbi/workos/dsync_group_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_group_updated.rbi b/rbi/workos/dsync_group_updated.rbi index 6551b219..e190600e 100644 --- a/rbi/workos/dsync_group_updated.rbi +++ b/rbi/workos/dsync_group_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_group_updated_data.rbi b/rbi/workos/dsync_group_updated_data.rbi index 647a479f..0a1c6838 100644 --- a/rbi/workos/dsync_group_updated_data.rbi +++ b/rbi/workos/dsync_group_updated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_group_user_added.rbi b/rbi/workos/dsync_group_user_added.rbi index 628fae19..b1a55cf3 100644 --- a/rbi/workos/dsync_group_user_added.rbi +++ b/rbi/workos/dsync_group_user_added.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_group_user_added_data.rbi b/rbi/workos/dsync_group_user_added_data.rbi index a82881ff..fcb1a232 100644 --- a/rbi/workos/dsync_group_user_added_data.rbi +++ b/rbi/workos/dsync_group_user_added_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_group_user_removed.rbi b/rbi/workos/dsync_group_user_removed.rbi index 648084a6..1756b81b 100644 --- a/rbi/workos/dsync_group_user_removed.rbi +++ b/rbi/workos/dsync_group_user_removed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_group_user_removed_data.rbi b/rbi/workos/dsync_group_user_removed_data.rbi index 7257ba1c..c21f46d0 100644 --- a/rbi/workos/dsync_group_user_removed_data.rbi +++ b/rbi/workos/dsync_group_user_removed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_user_created.rbi b/rbi/workos/dsync_user_created.rbi index bb8462a7..8a0d78a4 100644 --- a/rbi/workos/dsync_user_created.rbi +++ b/rbi/workos/dsync_user_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_user_deleted.rbi b/rbi/workos/dsync_user_deleted.rbi index 14cc036a..7d2151c9 100644 --- a/rbi/workos/dsync_user_deleted.rbi +++ b/rbi/workos/dsync_user_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_user_updated.rbi b/rbi/workos/dsync_user_updated.rbi index ffe17df3..888d2261 100644 --- a/rbi/workos/dsync_user_updated.rbi +++ b/rbi/workos/dsync_user_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_user_updated_data.rbi b/rbi/workos/dsync_user_updated_data.rbi index ed11b411..a96b6925 100644 --- a/rbi/workos/dsync_user_updated_data.rbi +++ b/rbi/workos/dsync_user_updated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/dsync_user_updated_data_email.rbi b/rbi/workos/dsync_user_updated_data_email.rbi index be555785..642f4ac5 100644 --- a/rbi/workos/dsync_user_updated_data_email.rbi +++ b/rbi/workos/dsync_user_updated_data_email.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/email_change.rbi b/rbi/workos/email_change.rbi index f0d73d5f..b0aa8bbf 100644 --- a/rbi/workos/email_change.rbi +++ b/rbi/workos/email_change.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/email_change_confirmation.rbi b/rbi/workos/email_change_confirmation.rbi index aad0ef58..bbfe547d 100644 --- a/rbi/workos/email_change_confirmation.rbi +++ b/rbi/workos/email_change_confirmation.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/email_change_confirmation_user.rbi b/rbi/workos/email_change_confirmation_user.rbi index 74cc8f10..67fbca88 100644 --- a/rbi/workos/email_change_confirmation_user.rbi +++ b/rbi/workos/email_change_confirmation_user.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/email_verification.rbi b/rbi/workos/email_verification.rbi index b709939a..93206900 100644 --- a/rbi/workos/email_verification.rbi +++ b/rbi/workos/email_verification.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/email_verification_code_session_authenticate_request.rbi b/rbi/workos/email_verification_code_session_authenticate_request.rbi index cba5dde9..7078be32 100644 --- a/rbi/workos/email_verification_code_session_authenticate_request.rbi +++ b/rbi/workos/email_verification_code_session_authenticate_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/email_verification_created.rbi b/rbi/workos/email_verification_created.rbi index 85582e95..43d1aadd 100644 --- a/rbi/workos/email_verification_created.rbi +++ b/rbi/workos/email_verification_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/email_verification_created_data.rbi b/rbi/workos/email_verification_created_data.rbi index fed19236..663199e0 100644 --- a/rbi/workos/email_verification_created_data.rbi +++ b/rbi/workos/email_verification_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/enroll_user_authentication_factor.rbi b/rbi/workos/enroll_user_authentication_factor.rbi index 0b24512d..76de94ae 100644 --- a/rbi/workos/enroll_user_authentication_factor.rbi +++ b/rbi/workos/enroll_user_authentication_factor.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/event_context.rbi b/rbi/workos/event_context.rbi index fa51ebd6..9948c962 100644 --- a/rbi/workos/event_context.rbi +++ b/rbi/workos/event_context.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/event_context_actor.rbi b/rbi/workos/event_context_actor.rbi index a004a019..8ec23b7e 100644 --- a/rbi/workos/event_context_actor.rbi +++ b/rbi/workos/event_context_actor.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/event_context_google_analytics_session.rbi b/rbi/workos/event_context_google_analytics_session.rbi index 7cb1048c..1821df41 100644 --- a/rbi/workos/event_context_google_analytics_session.rbi +++ b/rbi/workos/event_context_google_analytics_session.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/event_list_list_metadata.rbi b/rbi/workos/event_list_list_metadata.rbi index 4d427e29..7e920ef6 100644 --- a/rbi/workos/event_list_list_metadata.rbi +++ b/rbi/workos/event_list_list_metadata.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/event_schema.rbi b/rbi/workos/event_schema.rbi index 3528f55c..455ee748 100644 --- a/rbi/workos/event_schema.rbi +++ b/rbi/workos/event_schema.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/events.rbi b/rbi/workos/events.rbi index 06c03bcb..d1b75791 100644 --- a/rbi/workos/events.rbi +++ b/rbi/workos/events.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/external_auth_complete_response.rbi b/rbi/workos/external_auth_complete_response.rbi index bc50335b..f0372b89 100644 --- a/rbi/workos/external_auth_complete_response.rbi +++ b/rbi/workos/external_auth_complete_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/feature_flag.rbi b/rbi/workos/feature_flag.rbi index 2f6f9ccc..4adb5bd9 100644 --- a/rbi/workos/feature_flag.rbi +++ b/rbi/workos/feature_flag.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/feature_flag_owner.rbi b/rbi/workos/feature_flag_owner.rbi index 01e0966e..e0656831 100644 --- a/rbi/workos/feature_flag_owner.rbi +++ b/rbi/workos/feature_flag_owner.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/feature_flags.rbi b/rbi/workos/feature_flags.rbi index 0697e13a..7c31cbfc 100644 --- a/rbi/workos/feature_flags.rbi +++ b/rbi/workos/feature_flags.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag.rbi b/rbi/workos/flag.rbi index d78ffaef..ee3b1660 100644 --- a/rbi/workos/flag.rbi +++ b/rbi/workos/flag.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_created.rbi b/rbi/workos/flag_created.rbi index 1347f936..23af0ef9 100644 --- a/rbi/workos/flag_created.rbi +++ b/rbi/workos/flag_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_created_context.rbi b/rbi/workos/flag_created_context.rbi index f15e2d00..420606da 100644 --- a/rbi/workos/flag_created_context.rbi +++ b/rbi/workos/flag_created_context.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_created_context_actor.rbi b/rbi/workos/flag_created_context_actor.rbi index dfbb7b3b..80c98994 100644 --- a/rbi/workos/flag_created_context_actor.rbi +++ b/rbi/workos/flag_created_context_actor.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_created_data.rbi b/rbi/workos/flag_created_data.rbi index b137797c..e93594e2 100644 --- a/rbi/workos/flag_created_data.rbi +++ b/rbi/workos/flag_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_created_data_owner.rbi b/rbi/workos/flag_created_data_owner.rbi index bcd69499..22ac1afd 100644 --- a/rbi/workos/flag_created_data_owner.rbi +++ b/rbi/workos/flag_created_data_owner.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_deleted.rbi b/rbi/workos/flag_deleted.rbi index c288e0e4..59b473d4 100644 --- a/rbi/workos/flag_deleted.rbi +++ b/rbi/workos/flag_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_deleted_context.rbi b/rbi/workos/flag_deleted_context.rbi index 22a4cef8..e7ef6ee4 100644 --- a/rbi/workos/flag_deleted_context.rbi +++ b/rbi/workos/flag_deleted_context.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_deleted_context_actor.rbi b/rbi/workos/flag_deleted_context_actor.rbi index 8c8657d3..487b4572 100644 --- a/rbi/workos/flag_deleted_context_actor.rbi +++ b/rbi/workos/flag_deleted_context_actor.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_deleted_data.rbi b/rbi/workos/flag_deleted_data.rbi index 3702853a..dffb387b 100644 --- a/rbi/workos/flag_deleted_data.rbi +++ b/rbi/workos/flag_deleted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_deleted_data_owner.rbi b/rbi/workos/flag_deleted_data_owner.rbi index 15c42591..3f596dd7 100644 --- a/rbi/workos/flag_deleted_data_owner.rbi +++ b/rbi/workos/flag_deleted_data_owner.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_owner.rbi b/rbi/workos/flag_owner.rbi index d37e4d94..c03cc037 100644 --- a/rbi/workos/flag_owner.rbi +++ b/rbi/workos/flag_owner.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated.rbi b/rbi/workos/flag_rule_updated.rbi index fed6bf00..8f8f68d2 100644 --- a/rbi/workos/flag_rule_updated.rbi +++ b/rbi/workos/flag_rule_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_context.rbi b/rbi/workos/flag_rule_updated_context.rbi index fda7617c..93d58644 100644 --- a/rbi/workos/flag_rule_updated_context.rbi +++ b/rbi/workos/flag_rule_updated_context.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_context_actor.rbi b/rbi/workos/flag_rule_updated_context_actor.rbi index 0aedc7e2..274ad954 100644 --- a/rbi/workos/flag_rule_updated_context_actor.rbi +++ b/rbi/workos/flag_rule_updated_context_actor.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_context_configured_target.rbi b/rbi/workos/flag_rule_updated_context_configured_target.rbi index a18fa0f9..e98cf9ab 100644 --- a/rbi/workos/flag_rule_updated_context_configured_target.rbi +++ b/rbi/workos/flag_rule_updated_context_configured_target.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_context_configured_target_organization.rbi b/rbi/workos/flag_rule_updated_context_configured_target_organization.rbi index b7b8c664..b396d686 100644 --- a/rbi/workos/flag_rule_updated_context_configured_target_organization.rbi +++ b/rbi/workos/flag_rule_updated_context_configured_target_organization.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_context_configured_target_user.rbi b/rbi/workos/flag_rule_updated_context_configured_target_user.rbi index e96d1356..8b472f74 100644 --- a/rbi/workos/flag_rule_updated_context_configured_target_user.rbi +++ b/rbi/workos/flag_rule_updated_context_configured_target_user.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute.rbi index ff1739c8..8b781870 100644 --- a/rbi/workos/flag_rule_updated_context_previous_attribute.rbi +++ b/rbi/workos/flag_rule_updated_context_previous_attribute.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute_context.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute_context.rbi index 5a2072f8..3c3504cf 100644 --- a/rbi/workos/flag_rule_updated_context_previous_attribute_context.rbi +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target.rbi index eee60924..2ded502d 100644 --- a/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target.rbi +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rbi index 34faff98..8512965d 100644 --- a/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rbi +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_user.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_user.rbi index 2061b4e6..b39c98b3 100644 --- a/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_user.rbi +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_user.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_context_previous_attribute_data.rbi b/rbi/workos/flag_rule_updated_context_previous_attribute_data.rbi index 46afa87f..3923ada8 100644 --- a/rbi/workos/flag_rule_updated_context_previous_attribute_data.rbi +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_data.rbi b/rbi/workos/flag_rule_updated_data.rbi index 4153b1f0..fccc290e 100644 --- a/rbi/workos/flag_rule_updated_data.rbi +++ b/rbi/workos/flag_rule_updated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_rule_updated_data_owner.rbi b/rbi/workos/flag_rule_updated_data_owner.rbi index ffd44107..188638c2 100644 --- a/rbi/workos/flag_rule_updated_data_owner.rbi +++ b/rbi/workos/flag_rule_updated_data_owner.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_updated.rbi b/rbi/workos/flag_updated.rbi index 49c1645f..82be340b 100644 --- a/rbi/workos/flag_updated.rbi +++ b/rbi/workos/flag_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_updated_context.rbi b/rbi/workos/flag_updated_context.rbi index dda52bb1..7a54833d 100644 --- a/rbi/workos/flag_updated_context.rbi +++ b/rbi/workos/flag_updated_context.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_updated_context_actor.rbi b/rbi/workos/flag_updated_context_actor.rbi index 9207b59c..fa3ecefa 100644 --- a/rbi/workos/flag_updated_context_actor.rbi +++ b/rbi/workos/flag_updated_context_actor.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_updated_context_previous_attribute.rbi b/rbi/workos/flag_updated_context_previous_attribute.rbi index 2c38186e..6a9e1deb 100644 --- a/rbi/workos/flag_updated_context_previous_attribute.rbi +++ b/rbi/workos/flag_updated_context_previous_attribute.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_updated_context_previous_attribute_data.rbi b/rbi/workos/flag_updated_context_previous_attribute_data.rbi index 3a5d6980..edab5b5f 100644 --- a/rbi/workos/flag_updated_context_previous_attribute_data.rbi +++ b/rbi/workos/flag_updated_context_previous_attribute_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_updated_data.rbi b/rbi/workos/flag_updated_data.rbi index 84603121..a7b477a3 100644 --- a/rbi/workos/flag_updated_data.rbi +++ b/rbi/workos/flag_updated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/flag_updated_data_owner.rbi b/rbi/workos/flag_updated_data_owner.rbi index 7f0c8cb2..3489ad4d 100644 --- a/rbi/workos/flag_updated_data_owner.rbi +++ b/rbi/workos/flag_updated_data_owner.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/generate_link.rbi b/rbi/workos/generate_link.rbi index 279e2699..cb3d4bc7 100644 --- a/rbi/workos/generate_link.rbi +++ b/rbi/workos/generate_link.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/group.rbi b/rbi/workos/group.rbi index 3b2df923..ff7fda30 100644 --- a/rbi/workos/group.rbi +++ b/rbi/workos/group.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/group_created.rbi b/rbi/workos/group_created.rbi index 67fbe903..5785c0fa 100644 --- a/rbi/workos/group_created.rbi +++ b/rbi/workos/group_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/group_deleted.rbi b/rbi/workos/group_deleted.rbi index 7a301d76..0f10e4f8 100644 --- a/rbi/workos/group_deleted.rbi +++ b/rbi/workos/group_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/group_member_added.rbi b/rbi/workos/group_member_added.rbi index eaf82143..30d370e5 100644 --- a/rbi/workos/group_member_added.rbi +++ b/rbi/workos/group_member_added.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/group_member_added_data.rbi b/rbi/workos/group_member_added_data.rbi index 9f4ba621..668dd0a1 100644 --- a/rbi/workos/group_member_added_data.rbi +++ b/rbi/workos/group_member_added_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/group_member_removed.rbi b/rbi/workos/group_member_removed.rbi index b783ec2e..59a49f71 100644 --- a/rbi/workos/group_member_removed.rbi +++ b/rbi/workos/group_member_removed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/group_member_removed_data.rbi b/rbi/workos/group_member_removed_data.rbi index 79eb768c..ea493d12 100644 --- a/rbi/workos/group_member_removed_data.rbi +++ b/rbi/workos/group_member_removed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/group_updated.rbi b/rbi/workos/group_updated.rbi index 7a905c86..454691bb 100644 --- a/rbi/workos/group_updated.rbi +++ b/rbi/workos/group_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/intent_options.rbi b/rbi/workos/intent_options.rbi index dc55f9db..e8c68c59 100644 --- a/rbi/workos/intent_options.rbi +++ b/rbi/workos/intent_options.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/invitation.rbi b/rbi/workos/invitation.rbi index 26694f42..4ce15d01 100644 --- a/rbi/workos/invitation.rbi +++ b/rbi/workos/invitation.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/invitation_accepted.rbi b/rbi/workos/invitation_accepted.rbi index ee8264e6..8138556f 100644 --- a/rbi/workos/invitation_accepted.rbi +++ b/rbi/workos/invitation_accepted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/invitation_accepted_data.rbi b/rbi/workos/invitation_accepted_data.rbi index 92cb681e..56f976ed 100644 --- a/rbi/workos/invitation_accepted_data.rbi +++ b/rbi/workos/invitation_accepted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/invitation_created.rbi b/rbi/workos/invitation_created.rbi index 502919a4..c9c6eb69 100644 --- a/rbi/workos/invitation_created.rbi +++ b/rbi/workos/invitation_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/invitation_created_data.rbi b/rbi/workos/invitation_created_data.rbi index 0b239477..dfbdb553 100644 --- a/rbi/workos/invitation_created_data.rbi +++ b/rbi/workos/invitation_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/invitation_resent.rbi b/rbi/workos/invitation_resent.rbi index cdb11ecb..8edb243e 100644 --- a/rbi/workos/invitation_resent.rbi +++ b/rbi/workos/invitation_resent.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/invitation_resent_data.rbi b/rbi/workos/invitation_resent_data.rbi index e1a5acdb..07f8f4f8 100644 --- a/rbi/workos/invitation_resent_data.rbi +++ b/rbi/workos/invitation_resent_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/invitation_revoked.rbi b/rbi/workos/invitation_revoked.rbi index a2a784d0..220b34c8 100644 --- a/rbi/workos/invitation_revoked.rbi +++ b/rbi/workos/invitation_revoked.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/invitation_revoked_data.rbi b/rbi/workos/invitation_revoked_data.rbi index ea40a229..88e5f945 100644 --- a/rbi/workos/invitation_revoked_data.rbi +++ b/rbi/workos/invitation_revoked_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/jwks_response.rbi b/rbi/workos/jwks_response.rbi index 6c98b7be..64351f36 100644 --- a/rbi/workos/jwks_response.rbi +++ b/rbi/workos/jwks_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/jwks_response_keys.rbi b/rbi/workos/jwks_response_keys.rbi index 349e7c48..af12afd0 100644 --- a/rbi/workos/jwks_response_keys.rbi +++ b/rbi/workos/jwks_response_keys.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/jwt_template_response.rbi b/rbi/workos/jwt_template_response.rbi index f992a7e0..11687fff 100644 --- a/rbi/workos/jwt_template_response.rbi +++ b/rbi/workos/jwt_template_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/magic_auth.rbi b/rbi/workos/magic_auth.rbi index 7391ab80..a2e26f75 100644 --- a/rbi/workos/magic_auth.rbi +++ b/rbi/workos/magic_auth.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/magic_auth_code_session_authenticate_request.rbi b/rbi/workos/magic_auth_code_session_authenticate_request.rbi index d3272bff..36442669 100644 --- a/rbi/workos/magic_auth_code_session_authenticate_request.rbi +++ b/rbi/workos/magic_auth_code_session_authenticate_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/magic_auth_created.rbi b/rbi/workos/magic_auth_created.rbi index 811b2db3..a89fecb1 100644 --- a/rbi/workos/magic_auth_created.rbi +++ b/rbi/workos/magic_auth_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/magic_auth_created_data.rbi b/rbi/workos/magic_auth_created_data.rbi index d5028ce9..df9436fe 100644 --- a/rbi/workos/magic_auth_created_data.rbi +++ b/rbi/workos/magic_auth_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/mfa_totp_session_authenticate_request.rbi b/rbi/workos/mfa_totp_session_authenticate_request.rbi index c27d73d5..0d410bb9 100644 --- a/rbi/workos/mfa_totp_session_authenticate_request.rbi +++ b/rbi/workos/mfa_totp_session_authenticate_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/multi_factor_auth.rbi b/rbi/workos/multi_factor_auth.rbi index 4d501310..5ffb9677 100644 --- a/rbi/workos/multi_factor_auth.rbi +++ b/rbi/workos/multi_factor_auth.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/new_connect_application_secret.rbi b/rbi/workos/new_connect_application_secret.rbi index e5df458b..1435ed6d 100644 --- a/rbi/workos/new_connect_application_secret.rbi +++ b/rbi/workos/new_connect_application_secret.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization.rbi b/rbi/workos/organization.rbi index 12b14bcd..1443290b 100644 --- a/rbi/workos/organization.rbi +++ b/rbi/workos/organization.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_created.rbi b/rbi/workos/organization_created.rbi index 79b6f27e..6bc18228 100644 --- a/rbi/workos/organization_created.rbi +++ b/rbi/workos/organization_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_created_data.rbi b/rbi/workos/organization_created_data.rbi index fe881206..c24a180b 100644 --- a/rbi/workos/organization_created_data.rbi +++ b/rbi/workos/organization_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_created_data_domain.rbi b/rbi/workos/organization_created_data_domain.rbi index 1a2d0337..c1e6f37a 100644 --- a/rbi/workos/organization_created_data_domain.rbi +++ b/rbi/workos/organization_created_data_domain.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_deleted.rbi b/rbi/workos/organization_deleted.rbi index 8a013c1f..5ac4a868 100644 --- a/rbi/workos/organization_deleted.rbi +++ b/rbi/workos/organization_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_deleted_data.rbi b/rbi/workos/organization_deleted_data.rbi index 33583bc4..933b5656 100644 --- a/rbi/workos/organization_deleted_data.rbi +++ b/rbi/workos/organization_deleted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_deleted_data_domain.rbi b/rbi/workos/organization_deleted_data_domain.rbi index 69aba9c6..40a235a1 100644 --- a/rbi/workos/organization_deleted_data_domain.rbi +++ b/rbi/workos/organization_deleted_data_domain.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain.rbi b/rbi/workos/organization_domain.rbi index 6e8081bb..4776a2ce 100644 --- a/rbi/workos/organization_domain.rbi +++ b/rbi/workos/organization_domain.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_created.rbi b/rbi/workos/organization_domain_created.rbi index ec340da6..6c718835 100644 --- a/rbi/workos/organization_domain_created.rbi +++ b/rbi/workos/organization_domain_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_created_data.rbi b/rbi/workos/organization_domain_created_data.rbi index 48114ebc..e67f729a 100644 --- a/rbi/workos/organization_domain_created_data.rbi +++ b/rbi/workos/organization_domain_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_data.rbi b/rbi/workos/organization_domain_data.rbi index 241878e5..66c0a19b 100644 --- a/rbi/workos/organization_domain_data.rbi +++ b/rbi/workos/organization_domain_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_deleted.rbi b/rbi/workos/organization_domain_deleted.rbi index bfa1fd13..dc844e3a 100644 --- a/rbi/workos/organization_domain_deleted.rbi +++ b/rbi/workos/organization_domain_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_deleted_data.rbi b/rbi/workos/organization_domain_deleted_data.rbi index 8e8ebc09..cb6a7fe1 100644 --- a/rbi/workos/organization_domain_deleted_data.rbi +++ b/rbi/workos/organization_domain_deleted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_stand_alone.rbi b/rbi/workos/organization_domain_stand_alone.rbi index 354d6f1b..950db190 100644 --- a/rbi/workos/organization_domain_stand_alone.rbi +++ b/rbi/workos/organization_domain_stand_alone.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_updated.rbi b/rbi/workos/organization_domain_updated.rbi index 7f34c771..e9fd3033 100644 --- a/rbi/workos/organization_domain_updated.rbi +++ b/rbi/workos/organization_domain_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_updated_data.rbi b/rbi/workos/organization_domain_updated_data.rbi index 0befd2f4..03b90221 100644 --- a/rbi/workos/organization_domain_updated_data.rbi +++ b/rbi/workos/organization_domain_updated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_verification_failed.rbi b/rbi/workos/organization_domain_verification_failed.rbi index fc6b8bf1..2967eb9d 100644 --- a/rbi/workos/organization_domain_verification_failed.rbi +++ b/rbi/workos/organization_domain_verification_failed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_verification_failed_data.rbi b/rbi/workos/organization_domain_verification_failed_data.rbi index 6021beb6..ccade209 100644 --- a/rbi/workos/organization_domain_verification_failed_data.rbi +++ b/rbi/workos/organization_domain_verification_failed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_verification_failed_data_organization_domain.rbi b/rbi/workos/organization_domain_verification_failed_data_organization_domain.rbi index 5fcac7cc..18c2fe7a 100644 --- a/rbi/workos/organization_domain_verification_failed_data_organization_domain.rbi +++ b/rbi/workos/organization_domain_verification_failed_data_organization_domain.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_verified.rbi b/rbi/workos/organization_domain_verified.rbi index c2ee1474..a5c65205 100644 --- a/rbi/workos/organization_domain_verified.rbi +++ b/rbi/workos/organization_domain_verified.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domain_verified_data.rbi b/rbi/workos/organization_domain_verified_data.rbi index bf99774b..ae28c143 100644 --- a/rbi/workos/organization_domain_verified_data.rbi +++ b/rbi/workos/organization_domain_verified_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_domains.rbi b/rbi/workos/organization_domains.rbi index 259fd4ec..36090166 100644 --- a/rbi/workos/organization_domains.rbi +++ b/rbi/workos/organization_domains.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_input.rbi b/rbi/workos/organization_input.rbi index b7a61c12..a86eb591 100644 --- a/rbi/workos/organization_input.rbi +++ b/rbi/workos/organization_input.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_membership.rbi b/rbi/workos/organization_membership.rbi index 153149d5..f51180a2 100644 --- a/rbi/workos/organization_membership.rbi +++ b/rbi/workos/organization_membership.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_membership_created.rbi b/rbi/workos/organization_membership_created.rbi index a112996c..6bf7b86d 100644 --- a/rbi/workos/organization_membership_created.rbi +++ b/rbi/workos/organization_membership_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_membership_created_data.rbi b/rbi/workos/organization_membership_created_data.rbi index 4a59aa07..f4151150 100644 --- a/rbi/workos/organization_membership_created_data.rbi +++ b/rbi/workos/organization_membership_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_membership_deleted.rbi b/rbi/workos/organization_membership_deleted.rbi index adc0012a..22741fc1 100644 --- a/rbi/workos/organization_membership_deleted.rbi +++ b/rbi/workos/organization_membership_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_membership_deleted_data.rbi b/rbi/workos/organization_membership_deleted_data.rbi index 8b1ba8b1..2e44b35e 100644 --- a/rbi/workos/organization_membership_deleted_data.rbi +++ b/rbi/workos/organization_membership_deleted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_membership_updated.rbi b/rbi/workos/organization_membership_updated.rbi index 8b8636f4..8dffb228 100644 --- a/rbi/workos/organization_membership_updated.rbi +++ b/rbi/workos/organization_membership_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_membership_updated_data.rbi b/rbi/workos/organization_membership_updated_data.rbi index 24621054..4034ab1f 100644 --- a/rbi/workos/organization_membership_updated_data.rbi +++ b/rbi/workos/organization_membership_updated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_role_created.rbi b/rbi/workos/organization_role_created.rbi index 9100100b..fd5227f2 100644 --- a/rbi/workos/organization_role_created.rbi +++ b/rbi/workos/organization_role_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_role_created_data.rbi b/rbi/workos/organization_role_created_data.rbi index 5285a4d9..bd537837 100644 --- a/rbi/workos/organization_role_created_data.rbi +++ b/rbi/workos/organization_role_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_role_deleted.rbi b/rbi/workos/organization_role_deleted.rbi index 0e6c0924..b9e48d16 100644 --- a/rbi/workos/organization_role_deleted.rbi +++ b/rbi/workos/organization_role_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_role_deleted_data.rbi b/rbi/workos/organization_role_deleted_data.rbi index 5abecf4c..0b522ccb 100644 --- a/rbi/workos/organization_role_deleted_data.rbi +++ b/rbi/workos/organization_role_deleted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_role_updated.rbi b/rbi/workos/organization_role_updated.rbi index f802ee76..acbc1660 100644 --- a/rbi/workos/organization_role_updated.rbi +++ b/rbi/workos/organization_role_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_role_updated_data.rbi b/rbi/workos/organization_role_updated_data.rbi index 6098d93e..1f815d66 100644 --- a/rbi/workos/organization_role_updated_data.rbi +++ b/rbi/workos/organization_role_updated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_selection_session_authenticate_request.rbi b/rbi/workos/organization_selection_session_authenticate_request.rbi index f114052b..a848fa56 100644 --- a/rbi/workos/organization_selection_session_authenticate_request.rbi +++ b/rbi/workos/organization_selection_session_authenticate_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_updated.rbi b/rbi/workos/organization_updated.rbi index 7c2e2dc9..0cf67fd6 100644 --- a/rbi/workos/organization_updated.rbi +++ b/rbi/workos/organization_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_updated_data.rbi b/rbi/workos/organization_updated_data.rbi index 213f23f0..92b25f60 100644 --- a/rbi/workos/organization_updated_data.rbi +++ b/rbi/workos/organization_updated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organization_updated_data_domain.rbi b/rbi/workos/organization_updated_data_domain.rbi index 2f07c889..e237df78 100644 --- a/rbi/workos/organization_updated_data_domain.rbi +++ b/rbi/workos/organization_updated_data_domain.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/organizations.rbi b/rbi/workos/organizations.rbi index 4d01afec..7995e453 100644 --- a/rbi/workos/organizations.rbi +++ b/rbi/workos/organizations.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/password_reset.rbi b/rbi/workos/password_reset.rbi index eba5f1de..649b4c24 100644 --- a/rbi/workos/password_reset.rbi +++ b/rbi/workos/password_reset.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/password_reset_created.rbi b/rbi/workos/password_reset_created.rbi index cb290d0f..3001796c 100644 --- a/rbi/workos/password_reset_created.rbi +++ b/rbi/workos/password_reset_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/password_reset_created_data.rbi b/rbi/workos/password_reset_created_data.rbi index 9a31c826..9ebb64a7 100644 --- a/rbi/workos/password_reset_created_data.rbi +++ b/rbi/workos/password_reset_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/password_reset_succeeded.rbi b/rbi/workos/password_reset_succeeded.rbi index e881dee0..167f283e 100644 --- a/rbi/workos/password_reset_succeeded.rbi +++ b/rbi/workos/password_reset_succeeded.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/password_reset_succeeded_data.rbi b/rbi/workos/password_reset_succeeded_data.rbi index 38b63605..f4f39942 100644 --- a/rbi/workos/password_reset_succeeded_data.rbi +++ b/rbi/workos/password_reset_succeeded_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/password_session_authenticate_request.rbi b/rbi/workos/password_session_authenticate_request.rbi index 09104979..bcb0f23e 100644 --- a/rbi/workos/password_session_authenticate_request.rbi +++ b/rbi/workos/password_session_authenticate_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/permission.rbi b/rbi/workos/permission.rbi index 892ad82b..a1469b13 100644 --- a/rbi/workos/permission.rbi +++ b/rbi/workos/permission.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/permission_created.rbi b/rbi/workos/permission_created.rbi index da4e5b44..94f3d015 100644 --- a/rbi/workos/permission_created.rbi +++ b/rbi/workos/permission_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/permission_created_data.rbi b/rbi/workos/permission_created_data.rbi index ed47462a..878db3b0 100644 --- a/rbi/workos/permission_created_data.rbi +++ b/rbi/workos/permission_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/permission_deleted.rbi b/rbi/workos/permission_deleted.rbi index 5ec17265..fc04dc98 100644 --- a/rbi/workos/permission_deleted.rbi +++ b/rbi/workos/permission_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/permission_deleted_data.rbi b/rbi/workos/permission_deleted_data.rbi index 108c3952..7949f42d 100644 --- a/rbi/workos/permission_deleted_data.rbi +++ b/rbi/workos/permission_deleted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/permission_updated.rbi b/rbi/workos/permission_updated.rbi index 67504cb1..26e6d11e 100644 --- a/rbi/workos/permission_updated.rbi +++ b/rbi/workos/permission_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/permission_updated_data.rbi b/rbi/workos/permission_updated_data.rbi index 9ccb1d0c..87ecff9f 100644 --- a/rbi/workos/permission_updated_data.rbi +++ b/rbi/workos/permission_updated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/pipes.rbi b/rbi/workos/pipes.rbi index dcce8343..3680c7f1 100644 --- a/rbi/workos/pipes.rbi +++ b/rbi/workos/pipes.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/portal_link_response.rbi b/rbi/workos/portal_link_response.rbi index 64ab80ee..4c678fe6 100644 --- a/rbi/workos/portal_link_response.rbi +++ b/rbi/workos/portal_link_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/profile.rbi b/rbi/workos/profile.rbi index 44646dbf..fc021e14 100644 --- a/rbi/workos/profile.rbi +++ b/rbi/workos/profile.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/radar.rbi b/rbi/workos/radar.rbi index d5acceb0..0ae54330 100644 --- a/rbi/workos/radar.rbi +++ b/rbi/workos/radar.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/radar_list_entry_already_present_response.rbi b/rbi/workos/radar_list_entry_already_present_response.rbi index 375b2b0f..d4a61cdb 100644 --- a/rbi/workos/radar_list_entry_already_present_response.rbi +++ b/rbi/workos/radar_list_entry_already_present_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/radar_standalone_assess_request.rbi b/rbi/workos/radar_standalone_assess_request.rbi index 854dc0c4..ab905468 100644 --- a/rbi/workos/radar_standalone_assess_request.rbi +++ b/rbi/workos/radar_standalone_assess_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/radar_standalone_delete_radar_list_entry_request.rbi b/rbi/workos/radar_standalone_delete_radar_list_entry_request.rbi index 56adfe09..524f530d 100644 --- a/rbi/workos/radar_standalone_delete_radar_list_entry_request.rbi +++ b/rbi/workos/radar_standalone_delete_radar_list_entry_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/radar_standalone_response.rbi b/rbi/workos/radar_standalone_response.rbi index 360685d4..0affa270 100644 --- a/rbi/workos/radar_standalone_response.rbi +++ b/rbi/workos/radar_standalone_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/radar_standalone_update_radar_attempt_request.rbi b/rbi/workos/radar_standalone_update_radar_attempt_request.rbi index 703cbce3..2cc1ed8a 100644 --- a/rbi/workos/radar_standalone_update_radar_attempt_request.rbi +++ b/rbi/workos/radar_standalone_update_radar_attempt_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/radar_standalone_update_radar_list_request.rbi b/rbi/workos/radar_standalone_update_radar_list_request.rbi index 0ffe8913..a1da0421 100644 --- a/rbi/workos/radar_standalone_update_radar_list_request.rbi +++ b/rbi/workos/radar_standalone_update_radar_list_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/redirect_uri.rbi b/rbi/workos/redirect_uri.rbi index 7d038b8a..831933c8 100644 --- a/rbi/workos/redirect_uri.rbi +++ b/rbi/workos/redirect_uri.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/redirect_uri_input.rbi b/rbi/workos/redirect_uri_input.rbi index 052d97f2..e836922b 100644 --- a/rbi/workos/redirect_uri_input.rbi +++ b/rbi/workos/redirect_uri_input.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/refresh_token_session_authenticate_request.rbi b/rbi/workos/refresh_token_session_authenticate_request.rbi index 7bef4420..596f2a3a 100644 --- a/rbi/workos/refresh_token_session_authenticate_request.rbi +++ b/rbi/workos/refresh_token_session_authenticate_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/remove_role.rbi b/rbi/workos/remove_role.rbi index 4db68dd3..1c2b3bd0 100644 --- a/rbi/workos/remove_role.rbi +++ b/rbi/workos/remove_role.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/resend_user_invite_options.rbi b/rbi/workos/resend_user_invite_options.rbi index 19306772..d2e24c4a 100644 --- a/rbi/workos/resend_user_invite_options.rbi +++ b/rbi/workos/resend_user_invite_options.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/reset_password_response.rbi b/rbi/workos/reset_password_response.rbi index 1e45f991..d4c23b71 100644 --- a/rbi/workos/reset_password_response.rbi +++ b/rbi/workos/reset_password_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/revoke_session.rbi b/rbi/workos/revoke_session.rbi index 416ded9c..666aa43c 100644 --- a/rbi/workos/revoke_session.rbi +++ b/rbi/workos/revoke_session.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/role.rbi b/rbi/workos/role.rbi index cb7d5ade..131dccd8 100644 --- a/rbi/workos/role.rbi +++ b/rbi/workos/role.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/role_assignment.rbi b/rbi/workos/role_assignment.rbi index b1879a09..a5f17a46 100644 --- a/rbi/workos/role_assignment.rbi +++ b/rbi/workos/role_assignment.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/role_assignment_resource.rbi b/rbi/workos/role_assignment_resource.rbi index ffc48903..cce0558b 100644 --- a/rbi/workos/role_assignment_resource.rbi +++ b/rbi/workos/role_assignment_resource.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/role_created.rbi b/rbi/workos/role_created.rbi index c3854531..070899e7 100644 --- a/rbi/workos/role_created.rbi +++ b/rbi/workos/role_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/role_created_data.rbi b/rbi/workos/role_created_data.rbi index b8de5ae6..54beb7df 100644 --- a/rbi/workos/role_created_data.rbi +++ b/rbi/workos/role_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/role_deleted.rbi b/rbi/workos/role_deleted.rbi index 81e2ea3e..d75ccd0e 100644 --- a/rbi/workos/role_deleted.rbi +++ b/rbi/workos/role_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/role_deleted_data.rbi b/rbi/workos/role_deleted_data.rbi index 814556ea..5f14ab2d 100644 --- a/rbi/workos/role_deleted_data.rbi +++ b/rbi/workos/role_deleted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/role_list.rbi b/rbi/workos/role_list.rbi index 1c364c4d..b2b8cce5 100644 --- a/rbi/workos/role_list.rbi +++ b/rbi/workos/role_list.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/role_updated.rbi b/rbi/workos/role_updated.rbi index ecb1bd52..4465c3ec 100644 --- a/rbi/workos/role_updated.rbi +++ b/rbi/workos/role_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/role_updated_data.rbi b/rbi/workos/role_updated_data.rbi index 0c7109f4..e7aa1468 100644 --- a/rbi/workos/role_updated_data.rbi +++ b/rbi/workos/role_updated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/send_email_change.rbi b/rbi/workos/send_email_change.rbi index 1bc4030a..706163f2 100644 --- a/rbi/workos/send_email_change.rbi +++ b/rbi/workos/send_email_change.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/send_verification_email_response.rbi b/rbi/workos/send_verification_email_response.rbi index 08624991..5cf4909f 100644 --- a/rbi/workos/send_verification_email_response.rbi +++ b/rbi/workos/send_verification_email_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/session_created.rbi b/rbi/workos/session_created.rbi index f939178e..930e0478 100644 --- a/rbi/workos/session_created.rbi +++ b/rbi/workos/session_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/session_created_data.rbi b/rbi/workos/session_created_data.rbi index 2b7a52af..72b03de0 100644 --- a/rbi/workos/session_created_data.rbi +++ b/rbi/workos/session_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/session_created_data_impersonator.rbi b/rbi/workos/session_created_data_impersonator.rbi index 4a3a3190..cfb44837 100644 --- a/rbi/workos/session_created_data_impersonator.rbi +++ b/rbi/workos/session_created_data_impersonator.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/session_revoked.rbi b/rbi/workos/session_revoked.rbi index 747eb09b..605e90b1 100644 --- a/rbi/workos/session_revoked.rbi +++ b/rbi/workos/session_revoked.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/session_revoked_data.rbi b/rbi/workos/session_revoked_data.rbi index 1f7e1816..b0880cd9 100644 --- a/rbi/workos/session_revoked_data.rbi +++ b/rbi/workos/session_revoked_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/session_revoked_data_impersonator.rbi b/rbi/workos/session_revoked_data_impersonator.rbi index c7d0b44a..d7048563 100644 --- a/rbi/workos/session_revoked_data_impersonator.rbi +++ b/rbi/workos/session_revoked_data_impersonator.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/set_role_permissions.rbi b/rbi/workos/set_role_permissions.rbi index 33cdacfe..b0ce0b18 100644 --- a/rbi/workos/set_role_permissions.rbi +++ b/rbi/workos/set_role_permissions.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/slim_role.rbi b/rbi/workos/slim_role.rbi index 7c5c9744..ae66ab9c 100644 --- a/rbi/workos/slim_role.rbi +++ b/rbi/workos/slim_role.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/sso.rbi b/rbi/workos/sso.rbi index 2e29bf44..9c134fac 100644 --- a/rbi/workos/sso.rbi +++ b/rbi/workos/sso.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/sso_authorize_url_response.rbi b/rbi/workos/sso_authorize_url_response.rbi index 5af9c74f..5fa59c7e 100644 --- a/rbi/workos/sso_authorize_url_response.rbi +++ b/rbi/workos/sso_authorize_url_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/sso_device_authorization_request.rbi b/rbi/workos/sso_device_authorization_request.rbi index 3d45f349..82163afd 100644 --- a/rbi/workos/sso_device_authorization_request.rbi +++ b/rbi/workos/sso_device_authorization_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/sso_intent_options.rbi b/rbi/workos/sso_intent_options.rbi index 9d16da29..6f9ac5ee 100644 --- a/rbi/workos/sso_intent_options.rbi +++ b/rbi/workos/sso_intent_options.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/sso_logout_authorize_request.rbi b/rbi/workos/sso_logout_authorize_request.rbi index ec19231d..8ad9c49d 100644 --- a/rbi/workos/sso_logout_authorize_request.rbi +++ b/rbi/workos/sso_logout_authorize_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/sso_logout_authorize_response.rbi b/rbi/workos/sso_logout_authorize_response.rbi index 685a34f5..4cc3b97e 100644 --- a/rbi/workos/sso_logout_authorize_response.rbi +++ b/rbi/workos/sso_logout_authorize_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/sso_token_response.rbi b/rbi/workos/sso_token_response.rbi index d9a0b741..576bad40 100644 --- a/rbi/workos/sso_token_response.rbi +++ b/rbi/workos/sso_token_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/sso_token_response_oauth_token.rbi b/rbi/workos/sso_token_response_oauth_token.rbi index 5d183140..618ccfa6 100644 --- a/rbi/workos/sso_token_response_oauth_token.rbi +++ b/rbi/workos/sso_token_response_oauth_token.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/token_query.rbi b/rbi/workos/token_query.rbi index 1cfcb519..5ba0982d 100644 --- a/rbi/workos/token_query.rbi +++ b/rbi/workos/token_query.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/update_audit_logs_retention.rbi b/rbi/workos/update_audit_logs_retention.rbi index a8f29819..9784964c 100644 --- a/rbi/workos/update_audit_logs_retention.rbi +++ b/rbi/workos/update_audit_logs_retention.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/update_authorization_permission.rbi b/rbi/workos/update_authorization_permission.rbi index 496b8b10..da1c25d0 100644 --- a/rbi/workos/update_authorization_permission.rbi +++ b/rbi/workos/update_authorization_permission.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/update_authorization_resource.rbi b/rbi/workos/update_authorization_resource.rbi index 0ad00d8e..fa5f9eb8 100644 --- a/rbi/workos/update_authorization_resource.rbi +++ b/rbi/workos/update_authorization_resource.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/update_jwt_template.rbi b/rbi/workos/update_jwt_template.rbi index ba8fec98..ed9b8b49 100644 --- a/rbi/workos/update_jwt_template.rbi +++ b/rbi/workos/update_jwt_template.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/update_oauth_application.rbi b/rbi/workos/update_oauth_application.rbi index 30951111..8a83b8bb 100644 --- a/rbi/workos/update_oauth_application.rbi +++ b/rbi/workos/update_oauth_application.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/update_organization.rbi b/rbi/workos/update_organization.rbi index f0548dcb..cdc55825 100644 --- a/rbi/workos/update_organization.rbi +++ b/rbi/workos/update_organization.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/update_organization_role.rbi b/rbi/workos/update_organization_role.rbi index 39b9cefe..a7c333c7 100644 --- a/rbi/workos/update_organization_role.rbi +++ b/rbi/workos/update_organization_role.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/update_role.rbi b/rbi/workos/update_role.rbi index 9f47e73b..71a331e0 100644 --- a/rbi/workos/update_role.rbi +++ b/rbi/workos/update_role.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/update_user.rbi b/rbi/workos/update_user.rbi index 3dc63dec..e4311c0a 100644 --- a/rbi/workos/update_user.rbi +++ b/rbi/workos/update_user.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/update_user_organization_membership.rbi b/rbi/workos/update_user_organization_membership.rbi index 4a598263..7f6377f3 100644 --- a/rbi/workos/update_user_organization_membership.rbi +++ b/rbi/workos/update_user_organization_membership.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/update_webhook_endpoint.rbi b/rbi/workos/update_webhook_endpoint.rbi index 5ae55011..8ec96bb7 100644 --- a/rbi/workos/update_webhook_endpoint.rbi +++ b/rbi/workos/update_webhook_endpoint.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user.rbi b/rbi/workos/user.rbi index 82e2f536..91856669 100644 --- a/rbi/workos/user.rbi +++ b/rbi/workos/user.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_authentication_factor_enroll_response.rbi b/rbi/workos/user_authentication_factor_enroll_response.rbi index 3268a62a..3bd39137 100644 --- a/rbi/workos/user_authentication_factor_enroll_response.rbi +++ b/rbi/workos/user_authentication_factor_enroll_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_consent_option.rbi b/rbi/workos/user_consent_option.rbi index 00addadd..e4f01db4 100644 --- a/rbi/workos/user_consent_option.rbi +++ b/rbi/workos/user_consent_option.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_consent_option_choice.rbi b/rbi/workos/user_consent_option_choice.rbi index 6dd91fd1..7437ea64 100644 --- a/rbi/workos/user_consent_option_choice.rbi +++ b/rbi/workos/user_consent_option_choice.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_created.rbi b/rbi/workos/user_created.rbi index 06a3b548..1e36a910 100644 --- a/rbi/workos/user_created.rbi +++ b/rbi/workos/user_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_deleted.rbi b/rbi/workos/user_deleted.rbi index 57ece069..c2ba2e92 100644 --- a/rbi/workos/user_deleted.rbi +++ b/rbi/workos/user_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_identities_get_item.rbi b/rbi/workos/user_identities_get_item.rbi index 8ccd0baa..8c494401 100644 --- a/rbi/workos/user_identities_get_item.rbi +++ b/rbi/workos/user_identities_get_item.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_invite.rbi b/rbi/workos/user_invite.rbi index b2141229..e2abbc4d 100644 --- a/rbi/workos/user_invite.rbi +++ b/rbi/workos/user_invite.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_management.rbi b/rbi/workos/user_management.rbi index 3950a824..53d746e7 100644 --- a/rbi/workos/user_management.rbi +++ b/rbi/workos/user_management.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_management_login_request.rbi b/rbi/workos/user_management_login_request.rbi index 2e20cf9c..35ff184a 100644 --- a/rbi/workos/user_management_login_request.rbi +++ b/rbi/workos/user_management_login_request.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_object.rbi b/rbi/workos/user_object.rbi index b34fdedc..4e44fc89 100644 --- a/rbi/workos/user_object.rbi +++ b/rbi/workos/user_object.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_organization_membership.rbi b/rbi/workos/user_organization_membership.rbi index 61403395..5ebf5d51 100644 --- a/rbi/workos/user_organization_membership.rbi +++ b/rbi/workos/user_organization_membership.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_organization_membership_base_list_data.rbi b/rbi/workos/user_organization_membership_base_list_data.rbi index 0a285892..33d6d634 100644 --- a/rbi/workos/user_organization_membership_base_list_data.rbi +++ b/rbi/workos/user_organization_membership_base_list_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_sessions_impersonator.rbi b/rbi/workos/user_sessions_impersonator.rbi index 4a8e7b33..9aff166a 100644 --- a/rbi/workos/user_sessions_impersonator.rbi +++ b/rbi/workos/user_sessions_impersonator.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_sessions_list_item.rbi b/rbi/workos/user_sessions_list_item.rbi index 4679d500..646d576a 100644 --- a/rbi/workos/user_sessions_list_item.rbi +++ b/rbi/workos/user_sessions_list_item.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/user_updated.rbi b/rbi/workos/user_updated.rbi index dcb93c98..1e21a640 100644 --- a/rbi/workos/user_updated.rbi +++ b/rbi/workos/user_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/validate_api_key.rbi b/rbi/workos/validate_api_key.rbi index a0f29ab6..b8e03051 100644 --- a/rbi/workos/validate_api_key.rbi +++ b/rbi/workos/validate_api_key.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_byok_key_verification_completed.rbi b/rbi/workos/vault_byok_key_verification_completed.rbi index 8f452eca..d06710b9 100644 --- a/rbi/workos/vault_byok_key_verification_completed.rbi +++ b/rbi/workos/vault_byok_key_verification_completed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_byok_key_verification_completed_data.rbi b/rbi/workos/vault_byok_key_verification_completed_data.rbi index 844584c0..76d801ae 100644 --- a/rbi/workos/vault_byok_key_verification_completed_data.rbi +++ b/rbi/workos/vault_byok_key_verification_completed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_data_created.rbi b/rbi/workos/vault_data_created.rbi index 8e12e163..f2762093 100644 --- a/rbi/workos/vault_data_created.rbi +++ b/rbi/workos/vault_data_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_data_created_data.rbi b/rbi/workos/vault_data_created_data.rbi index 66bdb5af..2a5d3db2 100644 --- a/rbi/workos/vault_data_created_data.rbi +++ b/rbi/workos/vault_data_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_data_deleted.rbi b/rbi/workos/vault_data_deleted.rbi index d353cd38..9d424862 100644 --- a/rbi/workos/vault_data_deleted.rbi +++ b/rbi/workos/vault_data_deleted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_data_deleted_data.rbi b/rbi/workos/vault_data_deleted_data.rbi index bf957d95..ee52ad04 100644 --- a/rbi/workos/vault_data_deleted_data.rbi +++ b/rbi/workos/vault_data_deleted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_data_read.rbi b/rbi/workos/vault_data_read.rbi index 5106c8fa..e6aff1b8 100644 --- a/rbi/workos/vault_data_read.rbi +++ b/rbi/workos/vault_data_read.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_data_read_data.rbi b/rbi/workos/vault_data_read_data.rbi index 58b26b19..8316ba0c 100644 --- a/rbi/workos/vault_data_read_data.rbi +++ b/rbi/workos/vault_data_read_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_data_updated.rbi b/rbi/workos/vault_data_updated.rbi index f889f13e..05fdf3b6 100644 --- a/rbi/workos/vault_data_updated.rbi +++ b/rbi/workos/vault_data_updated.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_data_updated_data.rbi b/rbi/workos/vault_data_updated_data.rbi index 7126675d..add8e355 100644 --- a/rbi/workos/vault_data_updated_data.rbi +++ b/rbi/workos/vault_data_updated_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_dek_decrypted.rbi b/rbi/workos/vault_dek_decrypted.rbi index 2b4edf8b..9a77263e 100644 --- a/rbi/workos/vault_dek_decrypted.rbi +++ b/rbi/workos/vault_dek_decrypted.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_dek_decrypted_data.rbi b/rbi/workos/vault_dek_decrypted_data.rbi index 50ca3987..1930cbcc 100644 --- a/rbi/workos/vault_dek_decrypted_data.rbi +++ b/rbi/workos/vault_dek_decrypted_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_dek_read.rbi b/rbi/workos/vault_dek_read.rbi index 13e766c3..04995705 100644 --- a/rbi/workos/vault_dek_read.rbi +++ b/rbi/workos/vault_dek_read.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_dek_read_data.rbi b/rbi/workos/vault_dek_read_data.rbi index bd7f4ac1..5c428736 100644 --- a/rbi/workos/vault_dek_read_data.rbi +++ b/rbi/workos/vault_dek_read_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_kek_created.rbi b/rbi/workos/vault_kek_created.rbi index 59fda959..af66ec9b 100644 --- a/rbi/workos/vault_kek_created.rbi +++ b/rbi/workos/vault_kek_created.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_kek_created_data.rbi b/rbi/workos/vault_kek_created_data.rbi index a70b6302..baa25d1d 100644 --- a/rbi/workos/vault_kek_created_data.rbi +++ b/rbi/workos/vault_kek_created_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_metadata_read.rbi b/rbi/workos/vault_metadata_read.rbi index 90d43dcd..6073f667 100644 --- a/rbi/workos/vault_metadata_read.rbi +++ b/rbi/workos/vault_metadata_read.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_metadata_read_data.rbi b/rbi/workos/vault_metadata_read_data.rbi index 212473d6..9d2a6fd6 100644 --- a/rbi/workos/vault_metadata_read_data.rbi +++ b/rbi/workos/vault_metadata_read_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_names_listed.rbi b/rbi/workos/vault_names_listed.rbi index a3155914..8a64f47f 100644 --- a/rbi/workos/vault_names_listed.rbi +++ b/rbi/workos/vault_names_listed.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/vault_names_listed_data.rbi b/rbi/workos/vault_names_listed_data.rbi index 28ccb8fe..6ad289d3 100644 --- a/rbi/workos/vault_names_listed_data.rbi +++ b/rbi/workos/vault_names_listed_data.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/verify_email_address.rbi b/rbi/workos/verify_email_address.rbi index 96d9af1c..bf28d4c8 100644 --- a/rbi/workos/verify_email_address.rbi +++ b/rbi/workos/verify_email_address.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/verify_email_response.rbi b/rbi/workos/verify_email_response.rbi index 335a9f65..dd52765c 100644 --- a/rbi/workos/verify_email_response.rbi +++ b/rbi/workos/verify_email_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/webhook_endpoint_json.rbi b/rbi/workos/webhook_endpoint_json.rbi new file mode 100644 index 00000000..23b74d0e --- /dev/null +++ b/rbi/workos/webhook_endpoint_json.rbi @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class WebhookEndpointJson + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(String) } + def object; end + + sig { params(value: String).returns(String) } + def object=(value); end + + sig { returns(String) } + def id; end + + sig { params(value: String).returns(String) } + def id=(value); end + + sig { returns(String) } + def endpoint_url; end + + sig { params(value: String).returns(String) } + def endpoint_url=(value); end + + sig { returns(String) } + def secret; end + + sig { params(value: String).returns(String) } + def secret=(value); end + + sig { returns(String) } + def status; end + + sig { params(value: String).returns(String) } + def status=(value); end + + sig { returns(T::Array[String]) } + def events; end + + sig { params(value: T::Array[String]).returns(T::Array[String]) } + def events=(value); end + + sig { returns(String) } + def created_at; end + + sig { params(value: String).returns(String) } + def created_at=(value); end + + sig { returns(String) } + def updated_at; end + + sig { params(value: String).returns(String) } + def updated_at=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/rbi/workos/webhooks.rbi b/rbi/workos/webhooks.rbi index 73fc68b9..7a45a24f 100644 --- a/rbi/workos/webhooks.rbi +++ b/rbi/workos/webhooks.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong @@ -24,7 +25,7 @@ module WorkOS endpoint_url: String, events: T::Array[String], request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::WebhookEndpoint) + ).returns(WorkOS::WebhookEndpointJson) end def create_webhook_endpoint(endpoint_url:, events:, request_options:); end @@ -35,7 +36,7 @@ module WorkOS status: T.nilable(String), events: T.nilable(T::Array[String]), request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::WebhookEndpoint) + ).returns(WorkOS::WebhookEndpointJson) end def update_webhook_endpoint(id:, endpoint_url:, status:, events:, request_options:); end diff --git a/rbi/workos/widget_session_token.rbi b/rbi/workos/widget_session_token.rbi index dab99ffc..e0643d99 100644 --- a/rbi/workos/widget_session_token.rbi +++ b/rbi/workos/widget_session_token.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/widget_session_token_response.rbi b/rbi/workos/widget_session_token_response.rbi index bf91ee36..64a5a6b9 100644 --- a/rbi/workos/widget_session_token_response.rbi +++ b/rbi/workos/widget_session_token_response.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/rbi/workos/widgets.rbi b/rbi/workos/widgets.rbi index 60ae5ed3..c2feab5a 100644 --- a/rbi/workos/widgets.rbi +++ b/rbi/workos/widgets.rbi @@ -1,4 +1,5 @@ # frozen_string_literal: true + # This file is auto-generated by oagen. Do not edit. # typed: strong diff --git a/test/workos/test_model_round_trip.rb b/test/workos/test_model_round_trip.rb index 796384a0..8a2cf24c 100644 --- a/test/workos/test_model_round_trip.rb +++ b/test/workos/test_model_round_trip.rb @@ -860,7 +860,7 @@ def test_audit_log_event_create_response_round_trip assert_equal fixture["success"], json[:success] end - def test_audit_log_export_round_trip + def test_audit_log_export_json_round_trip fixture = { "object" => "audit_log_export", "id" => "stub", @@ -869,7 +869,7 @@ def test_audit_log_export_round_trip "created_at" => "stub", "updated_at" => "stub" } - model = WorkOS::AuditLogExport.new(fixture.to_json) + model = WorkOS::AuditLogExportJson.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] @@ -877,17 +877,33 @@ def test_audit_log_export_round_trip assert_equal fixture["updated_at"], json[:updated_at] end - def test_audit_logs_retention_round_trip + def test_audit_logs_retention_json_round_trip fixture = { "retention_period_in_days" => nil } - model = WorkOS::AuditLogsRetention.new(fixture.to_json) + model = WorkOS::AuditLogsRetentionJson.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_nil json[:retention_period_in_days] end - def test_audit_log_action_round_trip + def test_audit_log_schema_json_round_trip + fixture = { + "object" => "audit_log_schema", + "version" => 1, + "actor" => {}, + "targets" => [], + "metadata" => {}, + "created_at" => "stub" + } + model = WorkOS::AuditLogSchemaJson.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["version"], json[:version] + assert_equal fixture["created_at"], json[:created_at] + end + + def test_audit_log_action_json_round_trip fixture = { "object" => "audit_log_action", "name" => "stub", @@ -895,7 +911,7 @@ def test_audit_log_action_round_trip "created_at" => "stub", "updated_at" => "stub" } - model = WorkOS::AuditLogAction.new(fixture.to_json) + model = WorkOS::AuditLogActionJson.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_equal fixture["name"], json[:name] @@ -5544,7 +5560,7 @@ def test_device_authorization_response_round_trip assert_equal fixture["expires_in"], json[:expires_in] end - def test_webhook_endpoint_round_trip + def test_webhook_endpoint_json_round_trip fixture = { "object" => "webhook_endpoint", "id" => "stub", @@ -5555,7 +5571,7 @@ def test_webhook_endpoint_round_trip "created_at" => "stub", "updated_at" => "stub" } - model = WorkOS::WebhookEndpoint.new(fixture.to_json) + model = WorkOS::WebhookEndpointJson.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] @@ -5989,6 +6005,26 @@ def test_authentication_factor_enrolled_totp_round_trip assert_equal fixture["uri"], json[:uri] end + def test_audit_log_schema_json_actor_round_trip + fixture = { + "metadata" => {} + } + model = WorkOS::AuditLogSchemaJsonActor.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + end + + def test_audit_log_schema_json_target_round_trip + fixture = { + "type" => "stub", + "metadata" => {} + } + model = WorkOS::AuditLogSchemaJsonTarget.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + assert_equal fixture["type"], json[:type] + end + def test_authorized_connect_application_list_data_round_trip fixture = { "object" => "authorized_connect_application", From 52833f47207ea27a92ecc3b1a3bf4107d730f0cb Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Mon, 20 Apr 2026 04:18:11 -0400 Subject: [PATCH 09/12] need cgi --- .oagen-manifest.json | 2 +- lib/workos/admin_portal.rb | 1 + lib/workos/api_keys.rb | 1 + lib/workos/audit_logs.rb | 1 + lib/workos/authorization.rb | 1 + lib/workos/connect.rb | 1 + lib/workos/directory_sync.rb | 1 + lib/workos/events.rb | 1 + lib/workos/feature_flags.rb | 1 + lib/workos/multi_factor_auth.rb | 1 + lib/workos/organization_domains.rb | 1 + lib/workos/organizations.rb | 1 + lib/workos/pipes.rb | 1 + ...tions_list_response_data_connected_account.rb | 2 +- lib/workos/radar.rb | 1 + .../event_context_google_analytics_session.rb | 6 +++--- lib/workos/sso.rb | 10 ++++------ lib/workos/user_management.rb | 1 + lib/workos/user_management/jwks_response_keys.rb | 16 ++++++++-------- lib/workos/webhooks.rb | 1 + lib/workos/widgets.rb | 1 + 21 files changed, 33 insertions(+), 19 deletions(-) diff --git a/.oagen-manifest.json b/.oagen-manifest.json index ff68035c..aab66485 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,7 +1,7 @@ { "version": 1, "language": "ruby", - "generatedAt": "2026-04-20T08:02:20.958Z", + "generatedAt": "2026-04-20T08:17:13.463Z", "files": [ "lib/workos.rb", "lib/workos/admin_portal.rb", diff --git a/lib/workos/admin_portal.rb b/lib/workos/admin_portal.rb index 904c638a..226225dd 100644 --- a/lib/workos/admin_portal.rb +++ b/lib/workos/admin_portal.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/api_keys.rb b/lib/workos/api_keys.rb index f4087934..15b63b73 100644 --- a/lib/workos/api_keys.rb +++ b/lib/workos/api_keys.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/audit_logs.rb b/lib/workos/audit_logs.rb index c8bb2a8f..754c48c9 100644 --- a/lib/workos/audit_logs.rb +++ b/lib/workos/audit_logs.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/authorization.rb b/lib/workos/authorization.rb index 15e2c08d..e7f0b69f 100644 --- a/lib/workos/authorization.rb +++ b/lib/workos/authorization.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/connect.rb b/lib/workos/connect.rb index a355b098..c99587e2 100644 --- a/lib/workos/connect.rb +++ b/lib/workos/connect.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/directory_sync.rb b/lib/workos/directory_sync.rb index 16b3dbf6..db3917c3 100644 --- a/lib/workos/directory_sync.rb +++ b/lib/workos/directory_sync.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/events.rb b/lib/workos/events.rb index 9eeeba7f..05f87d13 100644 --- a/lib/workos/events.rb +++ b/lib/workos/events.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/feature_flags.rb b/lib/workos/feature_flags.rb index b5b97bde..0503e5dc 100644 --- a/lib/workos/feature_flags.rb +++ b/lib/workos/feature_flags.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/multi_factor_auth.rb b/lib/workos/multi_factor_auth.rb index 39dbbf6d..85f78faf 100644 --- a/lib/workos/multi_factor_auth.rb +++ b/lib/workos/multi_factor_auth.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/organization_domains.rb b/lib/workos/organization_domains.rb index 3833447d..611abad1 100644 --- a/lib/workos/organization_domains.rb +++ b/lib/workos/organization_domains.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index 6bb12b81..38abbc8f 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/pipes.rb b/lib/workos/pipes.rb index e0a07e91..9b1ceea2 100644 --- a/lib/workos/pipes.rb +++ b/lib/workos/pipes.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb b/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb index ba5d00dc..1df8b35d 100644 --- a/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +++ b/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb @@ -17,7 +17,7 @@ class DataIntegrationsListResponseDataConnectedAccount state: :state, created_at: :created_at, updated_at: :updated_at, - userland_user_id: :userland_user_id + userlandUserId: :userland_user_id }.freeze # @!attribute userland_user_id diff --git a/lib/workos/radar.rb b/lib/workos/radar.rb index db76a918..63ba9f21 100644 --- a/lib/workos/radar.rb +++ b/lib/workos/radar.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/shared/event_context_google_analytics_session.rb b/lib/workos/shared/event_context_google_analytics_session.rb index c6dac289..ed422b60 100644 --- a/lib/workos/shared/event_context_google_analytics_session.rb +++ b/lib/workos/shared/event_context_google_analytics_session.rb @@ -9,9 +9,9 @@ class EventContextGoogleAnalyticsSession include HashProvider HASH_ATTRS = { - container_id: :container_id, - session_id: :session_id, - session_number: :session_number + containerId: :container_id, + sessionId: :session_id, + sessionNumber: :session_number }.freeze attr_accessor \ diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index 4572e9e4..d141247d 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS @@ -133,17 +134,14 @@ def get_profile_and_token( code:, request_options: {} ) - params = { - "code" => code - }.compact body = { "grant_type" => "authorization_code", - "client_id" => @client.client_id, - "client_secret" => @client.api_key, + "client_id" => request_options[:client_id] || @client.client_id, + "client_secret" => request_options[:api_key] || @client.api_key, "code" => code }.compact response = @client.execute_request( - request: @client.post_request(path: "/sso/token", auth: true, params: params, body: body, request_options: request_options), + request: @client.post_request(path: "/sso/token", auth: true, body: body, request_options: request_options), request_options: request_options ) WorkOS::SSOTokenResponse.new(response.body) diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index cd608bce..a13ee7fd 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/user_management/jwks_response_keys.rb b/lib/workos/user_management/jwks_response_keys.rb index 25e1938e..9a4c72f7 100644 --- a/lib/workos/user_management/jwks_response_keys.rb +++ b/lib/workos/user_management/jwks_response_keys.rb @@ -9,14 +9,14 @@ class JwksResponseKeys include HashProvider HASH_ATTRS = { - alg: :alg, - kty: :kty, - use: :use, - x_5_c: :x_5_c, - n: :n, - e: :e, - kid: :kid, - x_5_t_s_256: :x_5_t_s_256 + :alg => :alg, + :kty => :kty, + :use => :use, + :x5c => :x_5_c, + :n => :n, + :e => :e, + :kid => :kid, + "x5t#S256" => :x_5_t_s_256 }.freeze attr_accessor \ diff --git a/lib/workos/webhooks.rb b/lib/workos/webhooks.rb index d3da2dd2..5d8faa2f 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS diff --git a/lib/workos/widgets.rb b/lib/workos/widgets.rb index 7799360e..2103fdc1 100644 --- a/lib/workos/widgets.rb +++ b/lib/workos/widgets.rb @@ -2,6 +2,7 @@ # This file is auto-generated by oagen. Do not edit. +require "cgi" require "json" module WorkOS From 1b276f2dfbb506035caeaa749b21453a4014c397 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Mon, 20 Apr 2026 05:25:39 -0400 Subject: [PATCH 10/12] address devin review --- .oagen-manifest.json | 3 +- README.md | 42 ++ lib/workos.rb | 59 +- lib/workos/admin_portal.rb | 14 +- lib/workos/admin_portal/generate_link.rb | 9 +- lib/workos/admin_portal/intent_options.rb | 9 +- .../admin_portal/portal_link_response.rb | 9 +- lib/workos/admin_portal/sso_intent_options.rb | 9 +- lib/workos/api_keys.rb | 61 +- lib/workos/api_keys/api_key.rb | 9 +- lib/workos/api_keys/api_key_created.rb | 9 +- lib/workos/api_keys/api_key_created_data.rb | 9 +- .../api_keys/api_key_created_data_owner.rb | 9 +- lib/workos/api_keys/api_key_revoked.rb | 9 +- .../api_keys/api_key_validation_response.rb | 9 +- lib/workos/api_keys/api_key_with_value.rb | 9 +- .../api_keys/create_organization_api_key.rb | 9 +- lib/workos/api_keys/validate_api_key.rb | 9 +- lib/workos/audit_logs.rb | 129 ++-- .../audit_logs/audit_log_action_json.rb | 9 +- lib/workos/audit_logs/audit_log_event.rb | 9 +- .../audit_logs/audit_log_event_actor.rb | 9 +- .../audit_logs/audit_log_event_context.rb | 9 +- .../audit_log_event_create_response.rb | 9 +- .../audit_logs/audit_log_event_ingestion.rb | 9 +- .../audit_logs/audit_log_export_creation.rb | 11 +- .../audit_logs/audit_log_export_json.rb | 9 +- lib/workos/audit_logs/audit_log_schema.rb | 9 +- .../audit_logs/audit_log_schema_actor.rb | 9 +- .../audit_logs/audit_log_schema_json.rb | 9 +- .../audit_log_schema_json_target.rb | 9 +- lib/workos/authorization.rb | 557 ++++++++++------ .../authorization/add_role_permission.rb | 9 +- lib/workos/authorization/assign_role.rb | 9 +- .../authorization/authorization_check.rb | 9 +- .../authorization/authorization_permission.rb | 9 +- .../authorization/authorization_resource.rb | 9 +- .../authorization/check_authorization.rb | 9 +- .../create_authorization_permission.rb | 9 +- .../create_authorization_resource.rb | 9 +- .../authorization/create_organization_role.rb | 9 +- .../authorization/permission_created.rb | 9 +- .../authorization/permission_created_data.rb | 9 +- .../authorization/permission_deleted.rb | 9 +- .../authorization/permission_updated.rb | 9 +- lib/workos/authorization/role.rb | 9 +- lib/workos/authorization/role_assignment.rb | 9 +- .../authorization/role_assignment_resource.rb | 9 +- lib/workos/authorization/role_created.rb | 9 +- lib/workos/authorization/role_created_data.rb | 9 +- lib/workos/authorization/role_deleted.rb | 9 +- lib/workos/authorization/role_list.rb | 9 +- lib/workos/authorization/role_updated.rb | 9 +- .../authorization/set_role_permissions.rb | 9 +- .../update_authorization_permission.rb | 9 +- .../update_authorization_resource.rb | 9 +- ..._organization_membership_base_list_data.rb | 9 +- lib/workos/base_client.rb | 35 +- lib/workos/configuration.rb | 9 +- lib/workos/connect.rb | 128 ++-- .../application_credentials_list_item.rb | 9 +- lib/workos/connect/connect_application.rb | 9 +- .../connect/create_application_secret.rb | 9 +- lib/workos/connect/create_m2m_application.rb | 9 +- .../connect/create_oauth_application.rb | 9 +- .../external_auth_complete_response.rb | 9 +- .../connect/new_connect_application_secret.rb | 9 +- lib/workos/connect/redirect_uri_input.rb | 9 +- .../connect/update_oauth_application.rb | 9 +- lib/workos/connect/user_consent_option.rb | 9 +- .../connect/user_consent_option_choice.rb | 9 +- .../connect/user_management_login_request.rb | 9 +- lib/workos/connect/user_object.rb | 9 +- lib/workos/directory_sync.rb | 123 ++-- lib/workos/directory_sync/directory.rb | 9 +- lib/workos/directory_sync/directory_group.rb | 9 +- .../directory_sync/directory_metadata.rb | 9 +- .../directory_sync/directory_metadata_user.rb | 9 +- lib/workos/directory_sync/directory_user.rb | 17 +- .../directory_sync/directory_user_email.rb | 9 +- .../directory_user_with_groups.rb | 17 +- lib/workos/directory_sync/dsync_activated.rb | 9 +- .../directory_sync/dsync_activated_data.rb | 9 +- .../dsync_activated_data_domain.rb | 9 +- .../directory_sync/dsync_deactivated.rb | 9 +- .../directory_sync/dsync_deactivated_data.rb | 9 +- lib/workos/directory_sync/dsync_deleted.rb | 9 +- .../directory_sync/dsync_deleted_data.rb | 9 +- .../directory_sync/dsync_group_created.rb | 9 +- .../directory_sync/dsync_group_deleted.rb | 9 +- .../directory_sync/dsync_group_updated.rb | 9 +- .../dsync_group_updated_data.rb | 9 +- .../directory_sync/dsync_group_user_added.rb | 9 +- .../dsync_group_user_added_data.rb | 9 +- .../dsync_group_user_removed.rb | 9 +- .../directory_sync/dsync_user_created.rb | 9 +- .../directory_sync/dsync_user_deleted.rb | 9 +- .../directory_sync/dsync_user_updated.rb | 9 +- .../directory_sync/dsync_user_updated_data.rb | 17 +- lib/workos/events.rb | 27 +- lib/workos/events/event_list_list_metadata.rb | 9 +- lib/workos/events/event_schema.rb | 9 +- lib/workos/feature_flags.rb | 131 ++-- lib/workos/feature_flags/feature_flag.rb | 9 +- .../feature_flags/feature_flag_owner.rb | 9 +- lib/workos/feature_flags/flag_created.rb | 9 +- .../feature_flags/flag_created_context.rb | 9 +- .../flag_created_context_actor.rb | 9 +- lib/workos/feature_flags/flag_created_data.rb | 9 +- lib/workos/feature_flags/flag_deleted.rb | 9 +- .../feature_flags/flag_deleted_context.rb | 9 +- .../flag_deleted_context_actor.rb | 9 +- lib/workos/feature_flags/flag_rule_updated.rb | 9 +- .../flag_rule_updated_context.rb | 9 +- .../flag_rule_updated_context_actor.rb | 9 +- ..._rule_updated_context_configured_target.rb | 9 +- ..._context_configured_target_organization.rb | 9 +- ..._updated_context_configured_target_user.rb | 9 +- ...rule_updated_context_previous_attribute.rb | 9 +- ...ated_context_previous_attribute_context.rb | 9 +- ...updated_context_previous_attribute_data.rb | 9 +- lib/workos/feature_flags/flag_updated.rb | 9 +- .../feature_flags/flag_updated_context.rb | 9 +- .../flag_updated_context_actor.rb | 9 +- ...flag_updated_context_previous_attribute.rb | 9 +- ...updated_context_previous_attribute_data.rb | 9 +- lib/workos/inflections.rb | 64 ++ lib/workos/multi_factor_auth.rb | 99 ++- .../authentication_challenge.rb | 9 +- ...uthentication_challenge_verify_response.rb | 9 +- ...uthentication_challenges_verify_request.rb | 9 +- .../authentication_factor.rb | 9 +- .../authentication_factor_enrolled.rb | 9 +- .../authentication_factor_enrolled_sms.rb | 9 +- .../authentication_factor_enrolled_totp.rb | 9 +- .../authentication_factor_totp.rb | 9 +- .../authentication_factors_create_request.rb | 9 +- .../challenge_authentication_factor.rb | 9 +- .../enroll_user_authentication_factor.rb | 9 +- ...r_authentication_factor_enroll_response.rb | 9 +- lib/workos/organization_domains.rb | 46 +- .../create_organization_domain.rb | 9 +- .../organization_domain.rb | 9 +- .../organization_domain_created.rb | 9 +- .../organization_domain_created_data.rb | 9 +- .../organization_domain_deleted.rb | 9 +- .../organization_domain_deleted_data.rb | 9 +- .../organization_domain_stand_alone.rb | 9 +- .../organization_domain_updated.rb | 9 +- .../organization_domain_updated_data.rb | 9 +- ...organization_domain_verification_failed.rb | 9 +- ...ization_domain_verification_failed_data.rb | 9 +- ...ication_failed_data_organization_domain.rb | 9 +- .../organization_domain_verified.rb | 9 +- .../organization_domain_verified_data.rb | 9 +- lib/workos/organizations.rb | 97 ++- .../organizations/audit_log_configuration.rb | 9 +- .../audit_log_configuration_log_stream.rb | 9 +- .../audit_logs_retention_json.rb | 9 +- lib/workos/organizations/organization.rb | 11 +- .../organizations/organization_created.rb | 9 +- .../organization_created_data.rb | 9 +- .../organization_created_data_domain.rb | 9 +- .../organizations/organization_deleted.rb | 9 +- .../organization_deleted_data.rb | 9 +- .../organization_deleted_data_domain.rb | 9 +- .../organizations/organization_domain_data.rb | 9 +- .../organizations/organization_input.rb | 9 +- .../organization_membership_created.rb | 9 +- .../organization_membership_created_data.rb | 9 +- .../organization_membership_deleted.rb | 9 +- .../organization_membership_deleted_data.rb | 9 +- .../organization_membership_updated.rb | 9 +- .../organization_membership_updated_data.rb | 9 +- .../organization_role_created.rb | 9 +- .../organization_role_created_data.rb | 9 +- .../organization_role_deleted.rb | 9 +- .../organization_role_updated.rb | 9 +- .../organizations/organization_updated.rb | 9 +- .../organization_updated_data.rb | 9 +- .../organization_updated_data_domain.rb | 9 +- .../update_audit_logs_retention.rb | 9 +- .../organizations/update_organization.rb | 11 +- lib/workos/pipes.rb | 62 +- lib/workos/pipes/connected_account.rb | 9 +- .../data_integration_access_token_response.rb | 9 +- ...tion_access_token_response_access_token.rb | 9 +- ...data_integration_authorize_url_response.rb | 9 +- ..._data_integration_authorize_url_request.rb | 9 +- ...ata_integrations_get_user_token_request.rb | 9 +- .../pipes/data_integrations_list_response.rb | 9 +- .../data_integrations_list_response_data.rb | 9 +- ...ns_list_response_data_connected_account.rb | 11 +- lib/workos/public_client.rb | 11 +- lib/workos/radar.rb | 45 +- ...dar_list_entry_already_present_response.rb | 9 +- .../radar/radar_standalone_assess_request.rb | 9 +- ...ndalone_delete_radar_list_entry_request.rb | 9 +- lib/workos/radar/radar_standalone_response.rb | 9 +- ...standalone_update_radar_attempt_request.rb | 9 +- lib/workos/session.rb | 6 +- lib/workos/session_manager.rb | 2 + lib/workos/shared/event_context.rb | 9 +- lib/workos/shared/event_context_actor.rb | 9 +- .../event_context_google_analytics_session.rb | 9 +- lib/workos/shared/group.rb | 9 +- lib/workos/shared/group_created.rb | 9 +- lib/workos/shared/group_deleted.rb | 9 +- lib/workos/shared/group_member_added.rb | 9 +- lib/workos/shared/group_member_added_data.rb | 9 +- lib/workos/shared/group_member_removed.rb | 9 +- lib/workos/shared/group_updated.rb | 9 +- lib/workos/sso.rb | 87 ++- lib/workos/sso/connection.rb | 11 +- lib/workos/sso/connection_activated.rb | 9 +- lib/workos/sso/connection_activated_data.rb | 9 +- .../sso/connection_activated_data_domain.rb | 9 +- lib/workos/sso/connection_deactivated.rb | 9 +- lib/workos/sso/connection_deactivated_data.rb | 9 +- lib/workos/sso/connection_deleted.rb | 9 +- lib/workos/sso/connection_deleted_data.rb | 9 +- lib/workos/sso/connection_option.rb | 9 +- ...ction_saml_certificate_renewal_required.rb | 9 +- ..._saml_certificate_renewal_required_data.rb | 9 +- ...icate_renewal_required_data_certificate.rb | 9 +- ...ficate_renewal_required_data_connection.rb | 9 +- .../connection_saml_certificate_renewed.rb | 9 +- ...onnection_saml_certificate_renewed_data.rb | 9 +- ...ml_certificate_renewed_data_certificate.rb | 9 +- lib/workos/sso/profile.rb | 9 +- lib/workos/sso/sso_authorize_url_response.rb | 9 +- .../sso/sso_logout_authorize_request.rb | 9 +- .../sso/sso_logout_authorize_response.rb | 9 +- lib/workos/sso/sso_token_response.rb | 9 +- lib/workos/sso/token_query.rb | 9 +- lib/workos/types/base_model.rb | 39 ++ lib/workos/types/request_options.rb | 33 + lib/workos/user_management.rb | 625 ++++++++++++------ .../action_authentication_denied.rb | 9 +- .../action_authentication_denied_data.rb | 9 +- .../action_user_registration_denied.rb | 9 +- .../action_user_registration_denied_data.rb | 9 +- .../user_management/authenticate_response.rb | 9 +- .../authenticate_response_impersonator.rb | 9 +- .../authenticate_response_oauth_token.rb | 9 +- ...uthentication_email_verification_failed.rb | 9 +- ...tication_email_verification_failed_data.rb | 9 +- ...on_email_verification_failed_data_error.rb | 9 +- ...entication_email_verification_succeeded.rb | 9 +- ...ation_email_verification_succeeded_data.rb | 9 +- .../authentication_magic_auth_failed.rb | 9 +- .../authentication_magic_auth_failed_data.rb | 9 +- .../authentication_magic_auth_succeeded.rb | 9 +- ...uthentication_magic_auth_succeeded_data.rb | 9 +- .../authentication_mfa_failed.rb | 9 +- .../authentication_mfa_failed_data.rb | 9 +- .../authentication_mfa_succeeded.rb | 9 +- .../authentication_mfa_succeeded_data.rb | 9 +- .../authentication_oauth_failed.rb | 9 +- .../authentication_oauth_failed_data.rb | 9 +- .../authentication_oauth_succeeded.rb | 9 +- .../authentication_oauth_succeeded_data.rb | 9 +- .../authentication_passkey_failed.rb | 9 +- .../authentication_passkey_failed_data.rb | 9 +- .../authentication_passkey_succeeded.rb | 9 +- .../authentication_passkey_succeeded_data.rb | 9 +- .../authentication_password_failed.rb | 9 +- .../authentication_password_failed_data.rb | 9 +- .../authentication_password_succeeded.rb | 9 +- .../authentication_password_succeeded_data.rb | 9 +- .../authentication_radar_risk_detected.rb | 9 +- ...authentication_radar_risk_detected_data.rb | 9 +- .../authentication_sso_failed.rb | 9 +- .../authentication_sso_failed_data.rb | 9 +- .../authentication_sso_failed_data_sso.rb | 9 +- .../authentication_sso_started.rb | 9 +- .../authentication_sso_started_data.rb | 9 +- .../authentication_sso_succeeded.rb | 9 +- .../authentication_sso_succeeded_data.rb | 9 +- .../authentication_sso_timed_out.rb | 9 +- .../authentication_sso_timed_out_data.rb | 9 +- ...ation_code_session_authenticate_request.rb | 9 +- ...uthorized_connect_application_list_data.rb | 9 +- .../user_management/cors_origin_response.rb | 9 +- .../user_management/create_cors_origin.rb | 9 +- .../create_magic_code_and_return.rb | 9 +- .../user_management/create_password_reset.rb | 9 +- .../create_password_reset_token.rb | 9 +- .../user_management/create_redirect_uri.rb | 9 +- lib/workos/user_management/create_user.rb | 9 +- .../create_user_invite_options.rb | 9 +- .../create_user_organization_membership.rb | 9 +- .../device_authorization_response.rb | 9 +- ...evice_code_session_authenticate_request.rb | 9 +- lib/workos/user_management/email_change.rb | 9 +- .../email_change_confirmation.rb | 9 +- .../email_change_confirmation_user.rb | 9 +- .../user_management/email_verification.rb | 9 +- ...ation_code_session_authenticate_request.rb | 9 +- .../email_verification_created.rb | 9 +- .../email_verification_created_data.rb | 9 +- lib/workos/user_management/invitation.rb | 9 +- .../user_management/invitation_accepted.rb | 9 +- .../invitation_accepted_data.rb | 9 +- .../user_management/invitation_created.rb | 9 +- .../invitation_created_data.rb | 9 +- .../user_management/invitation_resent.rb | 9 +- .../user_management/invitation_resent_data.rb | 9 +- .../user_management/invitation_revoked.rb | 9 +- .../invitation_revoked_data.rb | 9 +- lib/workos/user_management/jwks_response.rb | 9 +- .../user_management/jwks_response_keys.rb | 9 +- .../user_management/jwt_template_response.rb | 9 +- lib/workos/user_management/magic_auth.rb | 9 +- ..._auth_code_session_authenticate_request.rb | 9 +- .../user_management/magic_auth_created.rb | 9 +- .../magic_auth_created_data.rb | 9 +- .../mfa_totp_session_authenticate_request.rb | 9 +- .../organization_membership.rb | 9 +- ..._selection_session_authenticate_request.rb | 9 +- lib/workos/user_management/password_reset.rb | 9 +- .../user_management/password_reset_created.rb | 9 +- .../password_reset_created_data.rb | 9 +- .../password_reset_succeeded.rb | 9 +- .../password_session_authenticate_request.rb | 9 +- lib/workos/user_management/redirect_uri.rb | 9 +- ...resh_token_session_authenticate_request.rb | 9 +- .../resend_user_invite_options.rb | 9 +- .../reset_password_response.rb | 9 +- lib/workos/user_management/revoke_session.rb | 9 +- .../user_management/send_email_change.rb | 9 +- lib/workos/user_management/session_created.rb | 9 +- .../user_management/session_created_data.rb | 9 +- lib/workos/user_management/session_revoked.rb | 9 +- .../user_management/session_revoked_data.rb | 9 +- .../sso_device_authorization_request.rb | 9 +- .../user_management/update_jwt_template.rb | 9 +- lib/workos/user_management/update_user.rb | 9 +- .../update_user_organization_membership.rb | 9 +- lib/workos/user_management/user_created.rb | 9 +- lib/workos/user_management/user_deleted.rb | 9 +- .../user_identities_get_item.rb | 9 +- lib/workos/user_management/user_invite.rb | 9 +- .../user_organization_membership.rb | 9 +- .../user_sessions_list_item.rb | 9 +- lib/workos/user_management/user_updated.rb | 9 +- lib/workos/vault.rb | 17 +- .../vault_byok_key_verification_completed.rb | 9 +- ...lt_byok_key_verification_completed_data.rb | 9 +- lib/workos/vault/vault_data_created.rb | 9 +- lib/workos/vault/vault_data_created_data.rb | 9 +- lib/workos/vault/vault_data_deleted.rb | 9 +- lib/workos/vault/vault_data_deleted_data.rb | 9 +- lib/workos/vault/vault_data_read.rb | 9 +- lib/workos/vault/vault_data_read_data.rb | 9 +- lib/workos/vault/vault_data_updated.rb | 9 +- lib/workos/vault/vault_data_updated_data.rb | 9 +- lib/workos/vault/vault_dek_decrypted.rb | 9 +- lib/workos/vault/vault_dek_decrypted_data.rb | 9 +- lib/workos/vault/vault_dek_read.rb | 9 +- lib/workos/vault/vault_dek_read_data.rb | 9 +- lib/workos/vault/vault_kek_created.rb | 9 +- lib/workos/vault/vault_kek_created_data.rb | 9 +- lib/workos/vault/vault_metadata_read.rb | 9 +- lib/workos/vault/vault_metadata_read_data.rb | 9 +- lib/workos/vault/vault_names_listed.rb | 9 +- lib/workos/vault/vault_names_listed_data.rb | 9 +- lib/workos/webhooks.rb | 61 +- .../webhooks/create_webhook_endpoint.rb | 9 +- .../webhooks/update_webhook_endpoint.rb | 9 +- lib/workos/webhooks/webhook_endpoint_json.rb | 9 +- lib/workos/widgets.rb | 14 +- lib/workos/widgets/widget_session_token.rb | 9 +- .../widgets/widget_session_token_response.rb | 9 +- test/workos/test_admin_portal.rb | 17 +- test/workos/test_api_keys.rb | 52 +- test/workos/test_audit_logs.rb | 94 +-- test/workos/test_authorization.rb | 431 +++--------- test/workos/test_base_client.rb | 8 +- test/workos/test_connect.rb | 121 +--- test/workos/test_directory_sync.rb | 85 +-- test/workos/test_events.rb | 17 +- test/workos/test_feature_flags.rb | 98 +-- test/workos/test_model_round_trip.rb | 405 ++++++++++++ test/workos/test_multi_factor_auth.rb | 85 +-- test/workos/test_organization_domains.rb | 52 +- test/workos/test_organizations.rb | 85 +-- test/workos/test_pipes.rb | 63 +- test/workos/test_radar.rb | 58 +- test/workos/test_session.rb | 2 +- test/workos/test_sso.rb | 74 +-- test/workos/test_user_management.rb | 501 ++++---------- test/workos/test_webhooks.rb | 56 +- test/workos/test_widgets.rb | 17 +- 394 files changed, 3349 insertions(+), 4737 deletions(-) create mode 100644 lib/workos/inflections.rb create mode 100644 lib/workos/types/base_model.rb create mode 100644 lib/workos/types/request_options.rb diff --git a/.oagen-manifest.json b/.oagen-manifest.json index aab66485..a720fcab 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,7 +1,7 @@ { "version": 1, "language": "ruby", - "generatedAt": "2026-04-20T08:17:13.463Z", + "generatedAt": "2026-04-20T09:23:28.313Z", "files": [ "lib/workos.rb", "lib/workos/admin_portal.rb", @@ -159,6 +159,7 @@ "lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb", "lib/workos/feature_flags/flag_updated_data.rb", "lib/workos/feature_flags/flag_updated_data_owner.rb", + "lib/workos/inflections.rb", "lib/workos/multi_factor_auth.rb", "lib/workos/multi_factor_auth/authentication_challenge.rb", "lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb", diff --git a/README.md b/README.md index de8553a7..9749fa2e 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,48 @@ end client = WorkOS.client ``` +## Client patterns + +### Singleton (recommended for most apps) + +```ruby +WorkOS.configure do |config| + config.api_key = ENV.fetch("WORKOS_API_KEY") + config.client_id = ENV["WORKOS_CLIENT_ID"] +end + +WorkOS.client.organizations.list_organizations +``` + +### Multi-tenant (one client per API key) + +```ruby +tenant_a = WorkOS::Client.new(api_key: "sk_tenant_a", client_id: "client_a") +tenant_b = WorkOS::Client.new(api_key: "sk_tenant_b", client_id: "client_b") + +tenant_a.organizations.list_organizations +tenant_b.organizations.list_organizations +``` + +### Public / PKCE (browser, mobile, CLI) + +```ruby +public_client = WorkOS::PublicClient.create(client_id: "client_123") +url, verifier, state = public_client.user_management.get_authorization_url_with_pkce( + redirect_uri: "https://example.com/callback" +) +``` + +### Fork safety (Puma / Unicorn) + +The SDK caches persistent connections per fiber. After forking, call +`WorkOS.reset_client` (or `client.shutdown`) to close inherited sockets: + +```ruby +# config/puma.rb +on_worker_boot { WorkOS.reset_client } +``` + ## Per-request options Every API call accepts `request_options:` for per-call overrides: diff --git a/lib/workos.rb b/lib/workos.rb index 5a582df6..5e7621fc 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -8,63 +8,8 @@ module WorkOS end loader = Zeitwerk::Loader.for_gem -loader.inflector.inflect( - "authenticate_response_oauth_token" => "AuthenticateResponseOAuthToken", - "authentication_mfa_failed" => "AuthenticationMFAFailed", - "authentication_mfa_failed_data" => "AuthenticationMFAFailedData", - "authentication_mfa_failed_data_error" => "AuthenticationMFAFailedDataError", - "authentication_mfa_succeeded" => "AuthenticationMFASucceeded", - "authentication_mfa_succeeded_data" => "AuthenticationMFASucceededData", - "authentication_oauth_failed" => "AuthenticationOAuthFailed", - "authentication_oauth_failed_data" => "AuthenticationOAuthFailedData", - "authentication_oauth_failed_data_error" => "AuthenticationOAuthFailedDataError", - "authentication_oauth_succeeded" => "AuthenticationOAuthSucceeded", - "authentication_oauth_succeeded_data" => "AuthenticationOAuthSucceededData", - "authentication_sso_failed" => "AuthenticationSSOFailed", - "authentication_sso_failed_data" => "AuthenticationSSOFailedData", - "authentication_sso_failed_data_error" => "AuthenticationSSOFailedDataError", - "authentication_sso_failed_data_sso" => "AuthenticationSSOFailedDataSSO", - "authentication_sso_started" => "AuthenticationSSOStarted", - "authentication_sso_started_data" => "AuthenticationSSOStartedData", - "authentication_sso_started_data_sso" => "AuthenticationSSOStartedDataSSO", - "authentication_sso_succeeded" => "AuthenticationSSOSucceeded", - "authentication_sso_succeeded_data" => "AuthenticationSSOSucceededData", - "authentication_sso_succeeded_data_sso" => "AuthenticationSSOSucceededDataSSO", - "authentication_sso_timed_out" => "AuthenticationSSOTimedOut", - "authentication_sso_timed_out_data" => "AuthenticationSSOTimedOutData", - "authentication_sso_timed_out_data_error" => "AuthenticationSSOTimedOutDataError", - "authentication_sso_timed_out_data_sso" => "AuthenticationSSOTimedOutDataSSO", - "connection_saml_certificate_renewal_required" => "ConnectionSAMLCertificateRenewalRequired", - "connection_saml_certificate_renewal_required_data" => "ConnectionSAMLCertificateRenewalRequiredData", - "connection_saml_certificate_renewal_required_data_certificate" => "ConnectionSAMLCertificateRenewalRequiredDataCertificate", - "connection_saml_certificate_renewal_required_data_certificate_certificate_type" => "ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType", - "connection_saml_certificate_renewal_required_data_connection" => "ConnectionSAMLCertificateRenewalRequiredDataConnection", - "connection_saml_certificate_renewed" => "ConnectionSAMLCertificateRenewed", - "connection_saml_certificate_renewed_data" => "ConnectionSAMLCertificateRenewedData", - "connection_saml_certificate_renewed_data_certificate" => "ConnectionSAMLCertificateRenewedDataCertificate", - "connection_saml_certificate_renewed_data_certificate_certificate_type" => "ConnectionSAMLCertificateRenewedDataCertificateCertificateType", - "connection_saml_certificate_renewed_data_connection" => "ConnectionSAMLCertificateRenewedDataConnection", - "cors_origin_response" => "CORSOriginResponse", - "create_cors_origin" => "CreateCORSOrigin", - "create_m2m_application" => "CreateM2MApplication", - "create_oauth_application" => "CreateOAuthApplication", - "jwt_template_response" => "JWTTemplateResponse", - "m2m" => "M2M", - "mfa_totp_session_authenticate_request" => "MFATotpSessionAuthenticateRequest", - "pkce" => "PKCE", - "sso" => "SSO", - "sso_authorize_url_response" => "SSOAuthorizeUrlResponse", - "sso_device_authorization_request" => "SSODeviceAuthorizationRequest", - "sso_intent_options" => "SSOIntentOptions", - "sso_logout_authorize_request" => "SSOLogoutAuthorizeRequest", - "sso_logout_authorize_response" => "SSOLogoutAuthorizeResponse", - "sso_provider" => "SSOProvider", - "sso_token_response" => "SSOTokenResponse", - "sso_token_response_oauth_token" => "SSOTokenResponseOAuthToken", - "update_jwt_template" => "UpdateJWTTemplate", - "update_oauth_application" => "UpdateOAuthApplication", - "workos" => "WorkOS" -) +require_relative "workos/inflections" +loader.inflector.inflect(WORKOS_INFLECTIONS) loader.collapse("#{__dir__}/workos/admin_portal") loader.collapse("#{__dir__}/workos/api_keys") loader.collapse("#{__dir__}/workos/audit_logs") diff --git a/lib/workos/admin_portal.rb b/lib/workos/admin_portal.rb index 226225dd..7feb7884 100644 --- a/lib/workos/admin_portal.rb +++ b/lib/workos/admin_portal.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -18,7 +17,7 @@ def initialize(client) # @param intent [WorkOS::Types::GenerateLinkIntent, nil] The intent of the Admin Portal. - `sso` - Launch Admin Portal for creating SSO connections - `dsync` - Launch Admin Portal for creating Directory Sync connections - `audit_logs` - Launch Admin Portal for viewing Audit Logs - `log_streams` - Launch Admin Portal for creating Log Streams - `domain_verification` - Launch Admin Portal for Domain Verification - `certificate_renewal` - Launch Admin Portal for renewing SAML Certificates - `bring_your_own_key` - Launch Admin Portal for configuring Bring Your Own Key # @param intent_options [WorkOS::IntentOptions, nil] Options to configure the Admin Portal based on the intent. # @param admin_emails [Array, nil] The email addresses of the IT admins to grant access to the Admin Portal for the given organization. Accepts up to 20 emails. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::PortalLinkResponse] def generate_link( organization:, @@ -37,11 +36,16 @@ def generate_link( "intent_options" => intent_options, "admin_emails" => admin_emails }.compact - response = @client.execute_request( - request: @client.post_request(path: "/portal/generate_link", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/portal/generate_link", + auth: true, + body: body, request_options: request_options ) - WorkOS::PortalLinkResponse.new(response.body) + result = WorkOS::PortalLinkResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end end end diff --git a/lib/workos/admin_portal/generate_link.rb b/lib/workos/admin_portal/generate_link.rb index fd03a657..dba22d01 100644 --- a/lib/workos/admin_portal/generate_link.rb +++ b/lib/workos/admin_portal/generate_link.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class GenerateLink - include HashProvider - + class GenerateLink < WorkOS::Types::BaseModel HASH_ATTRS = { return_url: :return_url, success_url: :success_url, @@ -26,8 +22,7 @@ class GenerateLink :admin_emails def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @return_url = hash[:return_url] @success_url = hash[:success_url] @organization = hash[:organization] diff --git a/lib/workos/admin_portal/intent_options.rb b/lib/workos/admin_portal/intent_options.rb index 68e14db6..cb85c9ca 100644 --- a/lib/workos/admin_portal/intent_options.rb +++ b/lib/workos/admin_portal/intent_options.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class IntentOptions - include HashProvider - + class IntentOptions < WorkOS::Types::BaseModel HASH_ATTRS = { sso: :sso }.freeze @@ -15,8 +11,7 @@ class IntentOptions attr_accessor :sso def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @sso = hash[:sso] ? WorkOS::SSOIntentOptions.new(hash[:sso]) : nil end end diff --git a/lib/workos/admin_portal/portal_link_response.rb b/lib/workos/admin_portal/portal_link_response.rb index 75051dc7..0fa99d09 100644 --- a/lib/workos/admin_portal/portal_link_response.rb +++ b/lib/workos/admin_portal/portal_link_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class PortalLinkResponse - include HashProvider - + class PortalLinkResponse < WorkOS::Types::BaseModel HASH_ATTRS = { link: :link }.freeze @@ -15,8 +11,7 @@ class PortalLinkResponse attr_accessor :link def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @link = hash[:link] end end diff --git a/lib/workos/admin_portal/sso_intent_options.rb b/lib/workos/admin_portal/sso_intent_options.rb index 979132c6..13bfa8e4 100644 --- a/lib/workos/admin_portal/sso_intent_options.rb +++ b/lib/workos/admin_portal/sso_intent_options.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SSOIntentOptions - include HashProvider - + class SSOIntentOptions < WorkOS::Types::BaseModel HASH_ATTRS = { bookmark_slug: :bookmark_slug, provider_type: :provider_type @@ -18,8 +14,7 @@ class SSOIntentOptions :provider_type def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @bookmark_slug = hash[:bookmark_slug] @provider_type = hash[:provider_type] end diff --git a/lib/workos/api_keys.rb b/lib/workos/api_keys.rb index 15b63b73..746f4899 100644 --- a/lib/workos/api_keys.rb +++ b/lib/workos/api_keys.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -13,7 +12,7 @@ def initialize(client) # Validate API key # @param value [String] The value for an API key. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::ApiKeyValidationResponse] def create_validation( value:, @@ -22,23 +21,30 @@ def create_validation( body = { "value" => value }.compact - response = @client.execute_request( - request: @client.post_request(path: "/api_keys/validations", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/api_keys/validations", + auth: true, + body: body, request_options: request_options ) - WorkOS::ApiKeyValidationResponse.new(response.body) + result = WorkOS::ApiKeyValidationResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete an API key # @param id [String] The unique ID of the API key. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_api_key( id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/api_keys/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/api_keys/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) nil @@ -50,8 +56,8 @@ def delete_api_key( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::OrganizationsApiKeysOrder, nil] Order the results by the creation time. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_organization_api_keys( organization_id:, before: nil, @@ -66,15 +72,14 @@ def list_organization_api_keys( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/organizations/#{CGI.escape(organization_id.to_s)}/api_keys", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/api_keys", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::ApiKey.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_organization_api_keys( organization_id: organization_id, before: before, @@ -83,15 +88,20 @@ def list_organization_api_keys( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_id: organization_id, before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::ApiKey, + filters: {organization_id: organization_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # Create an API key for an organization # @param organization_id [String] Unique identifier of the Organization. # @param name [String] The name for the API key. # @param permissions [Array, nil] The permission slugs to assign to the API key. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::ApiKeyWithValue] def create_organization_api_key( organization_id:, @@ -103,11 +113,16 @@ def create_organization_api_key( "name" => name, "permissions" => permissions }.compact - response = @client.execute_request( - request: @client.post_request(path: "/organizations/#{CGI.escape(organization_id.to_s)}/api_keys", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/api_keys", + auth: true, + body: body, request_options: request_options ) - WorkOS::ApiKeyWithValue.new(response.body) + result = WorkOS::ApiKeyWithValue.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end end end diff --git a/lib/workos/api_keys/api_key.rb b/lib/workos/api_keys/api_key.rb index abc6b12d..94020562 100644 --- a/lib/workos/api_keys/api_key.rb +++ b/lib/workos/api_keys/api_key.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ApiKey - include HashProvider - + class ApiKey < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -32,8 +28,7 @@ class ApiKey :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @owner = hash[:owner] ? WorkOS::ApiKeyOwner.new(hash[:owner]) : nil diff --git a/lib/workos/api_keys/api_key_created.rb b/lib/workos/api_keys/api_key_created.rb index a114601f..f5e7179a 100644 --- a/lib/workos/api_keys/api_key_created.rb +++ b/lib/workos/api_keys/api_key_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ApiKeyCreated - include HashProvider - + class ApiKeyCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class ApiKeyCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::ApiKeyCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/api_keys/api_key_created_data.rb b/lib/workos/api_keys/api_key_created_data.rb index 7044faad..024af96c 100644 --- a/lib/workos/api_keys/api_key_created_data.rb +++ b/lib/workos/api_keys/api_key_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ApiKeyCreatedData - include HashProvider - + class ApiKeyCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -32,8 +28,7 @@ class ApiKeyCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @owner = hash[:owner] ? WorkOS::ApiKeyCreatedDataOwner.new(hash[:owner]) : nil diff --git a/lib/workos/api_keys/api_key_created_data_owner.rb b/lib/workos/api_keys/api_key_created_data_owner.rb index 792e929f..d0163f32 100644 --- a/lib/workos/api_keys/api_key_created_data_owner.rb +++ b/lib/workos/api_keys/api_key_created_data_owner.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ApiKeyCreatedDataOwner - include HashProvider - + class ApiKeyCreatedDataOwner < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, id: :id @@ -18,8 +14,7 @@ class ApiKeyCreatedDataOwner :id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @id = hash[:id] end diff --git a/lib/workos/api_keys/api_key_revoked.rb b/lib/workos/api_keys/api_key_revoked.rb index e1ce8941..9414c921 100644 --- a/lib/workos/api_keys/api_key_revoked.rb +++ b/lib/workos/api_keys/api_key_revoked.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ApiKeyRevoked - include HashProvider - + class ApiKeyRevoked < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class ApiKeyRevoked :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::ApiKeyRevokedData.new(hash[:data]) : nil diff --git a/lib/workos/api_keys/api_key_validation_response.rb b/lib/workos/api_keys/api_key_validation_response.rb index 2c7a4f19..7415d5c0 100644 --- a/lib/workos/api_keys/api_key_validation_response.rb +++ b/lib/workos/api_keys/api_key_validation_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ApiKeyValidationResponse - include HashProvider - + class ApiKeyValidationResponse < WorkOS::Types::BaseModel HASH_ATTRS = { api_key: :api_key }.freeze @@ -15,8 +11,7 @@ class ApiKeyValidationResponse attr_accessor :api_key def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @api_key = hash[:api_key] ? WorkOS::ApiKey.new(hash[:api_key]) : nil end end diff --git a/lib/workos/api_keys/api_key_with_value.rb b/lib/workos/api_keys/api_key_with_value.rb index 5eab2a5b..196bcce0 100644 --- a/lib/workos/api_keys/api_key_with_value.rb +++ b/lib/workos/api_keys/api_key_with_value.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ApiKeyWithValue - include HashProvider - + class ApiKeyWithValue < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class ApiKeyWithValue :value def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @owner = hash[:owner] ? WorkOS::ApiKeyWithValueOwner.new(hash[:owner]) : nil diff --git a/lib/workos/api_keys/create_organization_api_key.rb b/lib/workos/api_keys/create_organization_api_key.rb index 16f43ba4..51a01c95 100644 --- a/lib/workos/api_keys/create_organization_api_key.rb +++ b/lib/workos/api_keys/create_organization_api_key.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateOrganizationApiKey - include HashProvider - + class CreateOrganizationApiKey < WorkOS::Types::BaseModel HASH_ATTRS = { name: :name, permissions: :permissions @@ -18,8 +14,7 @@ class CreateOrganizationApiKey :permissions def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @name = hash[:name] @permissions = hash[:permissions] || [] end diff --git a/lib/workos/api_keys/validate_api_key.rb b/lib/workos/api_keys/validate_api_key.rb index e0624f23..e7d92a4c 100644 --- a/lib/workos/api_keys/validate_api_key.rb +++ b/lib/workos/api_keys/validate_api_key.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ValidateApiKey - include HashProvider - + class ValidateApiKey < WorkOS::Types::BaseModel HASH_ATTRS = { value: :value }.freeze @@ -15,8 +11,7 @@ class ValidateApiKey attr_accessor :value def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @value = hash[:value] end end diff --git a/lib/workos/audit_logs.rb b/lib/workos/audit_logs.rb index 754c48c9..7f21d0c7 100644 --- a/lib/workos/audit_logs.rb +++ b/lib/workos/audit_logs.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -13,23 +12,27 @@ def initialize(client) # Get Retention # @param id [String] Unique identifier of the Organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuditLogsRetentionJson] def get_organization_audit_logs_retention( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/organizations/#{CGI.escape(id.to_s)}/audit_logs_retention", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/organizations/#{WorkOS::Util.encode_path(id)}/audit_logs_retention", + auth: true, request_options: request_options ) - WorkOS::AuditLogsRetentionJson.new(response.body) + result = WorkOS::AuditLogsRetentionJson.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Set Retention # @param id [String] Unique identifier of the Organization. # @param retention_period_in_days [Integer] The number of days Audit Log events will be retained. Valid values are `30` and `365`. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuditLogsRetentionJson] def update_organization_audit_logs_retention( id:, @@ -39,11 +42,16 @@ def update_organization_audit_logs_retention( body = { "retention_period_in_days" => retention_period_in_days }.compact - response = @client.execute_request( - request: @client.put_request(path: "/organizations/#{CGI.escape(id.to_s)}/audit_logs_retention", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :put, + path: "/organizations/#{WorkOS::Util.encode_path(id)}/audit_logs_retention", + auth: true, + body: body, request_options: request_options ) - WorkOS::AuditLogsRetentionJson.new(response.body) + result = WorkOS::AuditLogsRetentionJson.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # List Actions @@ -51,8 +59,8 @@ def update_organization_audit_logs_retention( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::AuditLogsOrder, nil] Order the results by the creation time. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_actions( before: nil, after: nil, @@ -66,15 +74,14 @@ def list_actions( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/audit_logs/actions", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/audit_logs/actions", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::AuditLogActionJson.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_actions( before: before, after: cursor, @@ -82,8 +89,13 @@ def list_actions( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::AuditLogActionJson, + filters: {before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # List Schemas @@ -92,8 +104,8 @@ def list_actions( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::AuditLogsOrder, nil] Order the results by the creation time. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_action_schemas( action_name:, before: nil, @@ -108,15 +120,14 @@ def list_action_schemas( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/audit_logs/actions/#{CGI.escape(action_name.to_s)}/schemas", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/audit_logs/actions/#{WorkOS::Util.encode_path(action_name)}/schemas", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::AuditLogSchemaJson.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_action_schemas( action_name: action_name, before: before, @@ -125,8 +136,13 @@ def list_action_schemas( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {action_name: action_name, before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::AuditLogSchemaJson, + filters: {action_name: action_name, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # Create Schema @@ -134,7 +150,7 @@ def list_action_schemas( # @param actor [WorkOS::AuditLogSchemaActor, nil] The metadata schema for the actor. # @param targets [Array] The list of targets for the schema. # @param metadata [Hash{String => Object}, nil] Optional JSON schema for event metadata. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuditLogSchemaJson] def create_schema( action_name:, @@ -148,17 +164,22 @@ def create_schema( "targets" => targets, "metadata" => metadata }.compact - response = @client.execute_request( - request: @client.post_request(path: "/audit_logs/actions/#{CGI.escape(action_name.to_s)}/schemas", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/audit_logs/actions/#{WorkOS::Util.encode_path(action_name)}/schemas", + auth: true, + body: body, request_options: request_options ) - WorkOS::AuditLogSchemaJson.new(response.body) + result = WorkOS::AuditLogSchemaJson.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Create Event # @param organization_id [String] The unique ID of the Organization. # @param event [WorkOS::AuditLogEvent] The audit log event to create. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuditLogEventCreateResponse] def create_event( organization_id:, @@ -169,11 +190,16 @@ def create_event( "organization_id" => organization_id, "event" => event }.compact - response = @client.execute_request( - request: @client.post_request(path: "/audit_logs/events", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/audit_logs/events", + auth: true, + body: body, request_options: request_options ) - WorkOS::AuditLogEventCreateResponse.new(response.body) + result = WorkOS::AuditLogEventCreateResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Create Export @@ -185,7 +211,7 @@ def create_event( # @param actor_names [Array, nil] List of actor names to filter against. # @param actor_ids [Array, nil] List of actor IDs to filter against. # @param targets [Array, nil] List of target types to filter against. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuditLogExportJson] def create_export( organization_id:, @@ -208,26 +234,35 @@ def create_export( "actor_ids" => actor_ids, "targets" => targets }.compact - response = @client.execute_request( - request: @client.post_request(path: "/audit_logs/exports", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/audit_logs/exports", + auth: true, + body: body, request_options: request_options ) - WorkOS::AuditLogExportJson.new(response.body) + result = WorkOS::AuditLogExportJson.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get Export # @param audit_log_export_id [String] The unique ID of the Audit Log Export. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuditLogExportJson] def get_export( audit_log_export_id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/audit_logs/exports/#{CGI.escape(audit_log_export_id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/audit_logs/exports/#{WorkOS::Util.encode_path(audit_log_export_id)}", + auth: true, request_options: request_options ) - WorkOS::AuditLogExportJson.new(response.body) + result = WorkOS::AuditLogExportJson.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end end end diff --git a/lib/workos/audit_logs/audit_log_action_json.rb b/lib/workos/audit_logs/audit_log_action_json.rb index 3575076e..adf5b40a 100644 --- a/lib/workos/audit_logs/audit_log_action_json.rb +++ b/lib/workos/audit_logs/audit_log_action_json.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogActionJson - include HashProvider - + class AuditLogActionJson < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, name: :name, @@ -24,8 +20,7 @@ class AuditLogActionJson :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @name = hash[:name] @schema = hash[:schema] ? WorkOS::AuditLogSchemaJson.new(hash[:schema]) : nil diff --git a/lib/workos/audit_logs/audit_log_event.rb b/lib/workos/audit_logs/audit_log_event.rb index fa0ab77e..cfd9f418 100644 --- a/lib/workos/audit_logs/audit_log_event.rb +++ b/lib/workos/audit_logs/audit_log_event.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogEvent - include HashProvider - + class AuditLogEvent < WorkOS::Types::BaseModel HASH_ATTRS = { action: :action, occurred_at: :occurred_at, @@ -28,8 +24,7 @@ class AuditLogEvent :version def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @action = hash[:action] @occurred_at = hash[:occurred_at] @actor = hash[:actor] ? WorkOS::AuditLogEventActor.new(hash[:actor]) : nil diff --git a/lib/workos/audit_logs/audit_log_event_actor.rb b/lib/workos/audit_logs/audit_log_event_actor.rb index 2da2ce10..ae70d4f5 100644 --- a/lib/workos/audit_logs/audit_log_event_actor.rb +++ b/lib/workos/audit_logs/audit_log_event_actor.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogEventActor - include HashProvider - + class AuditLogEventActor < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, type: :type, @@ -22,8 +18,7 @@ class AuditLogEventActor :metadata def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @type = hash[:type] @name = hash[:name] diff --git a/lib/workos/audit_logs/audit_log_event_context.rb b/lib/workos/audit_logs/audit_log_event_context.rb index 4afc893e..c6ff6a78 100644 --- a/lib/workos/audit_logs/audit_log_event_context.rb +++ b/lib/workos/audit_logs/audit_log_event_context.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogEventContext - include HashProvider - + class AuditLogEventContext < WorkOS::Types::BaseModel HASH_ATTRS = { location: :location, user_agent: :user_agent @@ -18,8 +14,7 @@ class AuditLogEventContext :user_agent def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @location = hash[:location] @user_agent = hash[:user_agent] end diff --git a/lib/workos/audit_logs/audit_log_event_create_response.rb b/lib/workos/audit_logs/audit_log_event_create_response.rb index d913821a..d79450a0 100644 --- a/lib/workos/audit_logs/audit_log_event_create_response.rb +++ b/lib/workos/audit_logs/audit_log_event_create_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogEventCreateResponse - include HashProvider - + class AuditLogEventCreateResponse < WorkOS::Types::BaseModel HASH_ATTRS = { success: :success }.freeze @@ -15,8 +11,7 @@ class AuditLogEventCreateResponse attr_accessor :success def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @success = hash[:success] end end diff --git a/lib/workos/audit_logs/audit_log_event_ingestion.rb b/lib/workos/audit_logs/audit_log_event_ingestion.rb index f49ae753..b348450b 100644 --- a/lib/workos/audit_logs/audit_log_event_ingestion.rb +++ b/lib/workos/audit_logs/audit_log_event_ingestion.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogEventIngestion - include HashProvider - + class AuditLogEventIngestion < WorkOS::Types::BaseModel HASH_ATTRS = { organization_id: :organization_id, event: :event @@ -18,8 +14,7 @@ class AuditLogEventIngestion :event def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @organization_id = hash[:organization_id] @event = hash[:event] ? WorkOS::AuditLogEvent.new(hash[:event]) : nil end diff --git a/lib/workos/audit_logs/audit_log_export_creation.rb b/lib/workos/audit_logs/audit_log_export_creation.rb index 013db17a..8034cf9d 100644 --- a/lib/workos/audit_logs/audit_log_export_creation.rb +++ b/lib/workos/audit_logs/audit_log_export_creation.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogExportCreation - include HashProvider - + class AuditLogExportCreation < WorkOS::Types::BaseModel HASH_ATTRS = { organization_id: :organization_id, range_start: :range_start, @@ -32,15 +28,14 @@ class AuditLogExportCreation :targets def actors - warn "[DEPRECATION] `actors` is deprecated. Deprecated. Use `actor_names` instead.", uplevel: 1 + warn "[DEPRECATION] `actors` is deprecated and will be removed in a future version.", uplevel: 1 @actors end attr_writer :actors def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @organization_id = hash[:organization_id] @range_start = hash[:range_start] @range_end = hash[:range_end] diff --git a/lib/workos/audit_logs/audit_log_export_json.rb b/lib/workos/audit_logs/audit_log_export_json.rb index 3e94144b..c762c435 100644 --- a/lib/workos/audit_logs/audit_log_export_json.rb +++ b/lib/workos/audit_logs/audit_log_export_json.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogExportJson - include HashProvider - + class AuditLogExportJson < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -26,8 +22,7 @@ class AuditLogExportJson :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @state = hash[:state] diff --git a/lib/workos/audit_logs/audit_log_schema.rb b/lib/workos/audit_logs/audit_log_schema.rb index c556aae2..953374ef 100644 --- a/lib/workos/audit_logs/audit_log_schema.rb +++ b/lib/workos/audit_logs/audit_log_schema.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogSchema - include HashProvider - + class AuditLogSchema < WorkOS::Types::BaseModel HASH_ATTRS = { actor: :actor, targets: :targets, @@ -20,8 +16,7 @@ class AuditLogSchema :metadata def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @actor = hash[:actor] ? WorkOS::AuditLogSchemaActor.new(hash[:actor]) : nil @targets = (hash[:targets] || []).map { |item| item ? WorkOS::AuditLogSchemaTarget.new(item) : nil } @metadata = hash[:metadata] || {} diff --git a/lib/workos/audit_logs/audit_log_schema_actor.rb b/lib/workos/audit_logs/audit_log_schema_actor.rb index 8c6bfa65..1e8a2e32 100644 --- a/lib/workos/audit_logs/audit_log_schema_actor.rb +++ b/lib/workos/audit_logs/audit_log_schema_actor.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogSchemaActor - include HashProvider - + class AuditLogSchemaActor < WorkOS::Types::BaseModel HASH_ATTRS = { metadata: :metadata }.freeze @@ -15,8 +11,7 @@ class AuditLogSchemaActor attr_accessor :metadata def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @metadata = hash[:metadata] || {} end end diff --git a/lib/workos/audit_logs/audit_log_schema_json.rb b/lib/workos/audit_logs/audit_log_schema_json.rb index 8921e289..d96487cb 100644 --- a/lib/workos/audit_logs/audit_log_schema_json.rb +++ b/lib/workos/audit_logs/audit_log_schema_json.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogSchemaJson - include HashProvider - + class AuditLogSchemaJson < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, version: :version, @@ -26,8 +22,7 @@ class AuditLogSchemaJson :created_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @version = hash[:version] @actor = hash[:actor] ? WorkOS::AuditLogSchemaJsonActor.new(hash[:actor]) : nil diff --git a/lib/workos/audit_logs/audit_log_schema_json_target.rb b/lib/workos/audit_logs/audit_log_schema_json_target.rb index 6bd236a1..068382f0 100644 --- a/lib/workos/audit_logs/audit_log_schema_json_target.rb +++ b/lib/workos/audit_logs/audit_log_schema_json_target.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogSchemaJsonTarget - include HashProvider - + class AuditLogSchemaJsonTarget < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, metadata: :metadata @@ -18,8 +14,7 @@ class AuditLogSchemaJsonTarget :metadata def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @metadata = hash[:metadata] || {} end diff --git a/lib/workos/authorization.rb b/lib/workos/authorization.rb index e7f0b69f..d6a4fca8 100644 --- a/lib/workos/authorization.rb +++ b/lib/workos/authorization.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -17,7 +16,7 @@ def initialize(client) # @param resource_id [String, nil] The ID of the resource. Mutually exclusive with `resource_external_id` and `resource_type_slug`. # @param resource_external_id [String, nil] The external ID of the resource. Required with `resource_type_slug`. Mutually exclusive with `resource_id`. # @param resource_type_slug [String, nil] The slug of the resource type. Required with `resource_external_id`. Mutually exclusive with `resource_id`. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationCheck] def check( organization_membership_id:, @@ -42,11 +41,17 @@ def check( "resource_external_id" => resource_external_id, "resource_type_slug" => resource_type_slug }.compact - response = @client.execute_request( - request: @client.post_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/check", auth: true, params: params, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/check", + auth: true, + params: params, + body: body, request_options: request_options ) - WorkOS::AuthorizationCheck.new(response.body) + result = WorkOS::AuthorizationCheck.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # List resources for organization membership @@ -56,8 +61,8 @@ def check( # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. # @param permission_slug [String] The permission slug to filter by. Only child resources where the organization membership has this permission are returned. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_organization_membership_resources( organization_membership_id:, permission_slug:, @@ -82,15 +87,14 @@ def list_organization_membership_resources( params["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] params["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] end - response = @client.execute_request( - request: @client.get_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/resources", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/resources", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::AuthorizationResource.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_organization_membership_resources( organization_membership_id: organization_membership_id, before: before, @@ -101,8 +105,13 @@ def list_organization_membership_resources( parent_resource: parent_resource, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order, permission_slug: permission_slug, parent_resource: parent_resource}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::AuthorizationResource, + filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order, permission_slug: permission_slug, parent_resource: parent_resource}, + fetch_next: fetch_next + ) end # List effective permissions for an organization membership on a resource @@ -112,8 +121,8 @@ def list_organization_membership_resources( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_resource_permissions( organization_membership_id:, resource_id:, @@ -129,15 +138,14 @@ def list_resource_permissions( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/resources/#{CGI.escape(resource_id.to_s)}/permissions", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/resources/#{WorkOS::Util.encode_path(resource_id)}/permissions", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::AuthorizationPermission.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_resource_permissions( organization_membership_id: organization_membership_id, resource_id: resource_id, @@ -147,8 +155,13 @@ def list_resource_permissions( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_membership_id: organization_membership_id, resource_id: resource_id, before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::AuthorizationPermission, + filters: {organization_membership_id: organization_membership_id, resource_id: resource_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # List effective permissions for an organization membership on a resource by external ID @@ -159,8 +172,8 @@ def list_resource_permissions( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_effective_permissions_by_external_id( organization_membership_id:, resource_type_slug:, @@ -177,15 +190,14 @@ def list_effective_permissions_by_external_id( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/resources/#{CGI.escape(resource_type_slug.to_s)}/#{CGI.escape(external_id.to_s)}/permissions", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}/permissions", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::AuthorizationPermission.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_effective_permissions_by_external_id( organization_membership_id: organization_membership_id, resource_type_slug: resource_type_slug, @@ -196,8 +208,13 @@ def list_effective_permissions_by_external_id( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_membership_id: organization_membership_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::AuthorizationPermission, + filters: {organization_membership_id: organization_membership_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # List role assignments @@ -206,8 +223,8 @@ def list_effective_permissions_by_external_id( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_organization_membership_role_assignments( organization_membership_id:, before: nil, @@ -222,15 +239,14 @@ def list_organization_membership_role_assignments( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/role_assignments", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::RoleAssignment.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_organization_membership_role_assignments( organization_membership_id: organization_membership_id, before: before, @@ -239,8 +255,13 @@ def list_organization_membership_role_assignments( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::RoleAssignment, + filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # Assign a role @@ -249,7 +270,7 @@ def list_organization_membership_role_assignments( # @param resource_id [String, nil] The ID of the resource. Mutually exclusive with `resource_external_id` and `resource_type_slug`. # @param resource_external_id [String, nil] The external ID of the resource. Required with `resource_type_slug`. Mutually exclusive with `resource_id`. # @param resource_type_slug [String, nil] The resource type slug. Required with `resource_external_id`. Mutually exclusive with `resource_id`. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::RoleAssignment] def assign_role( organization_membership_id:, @@ -274,11 +295,17 @@ def assign_role( "resource_external_id" => resource_external_id, "resource_type_slug" => resource_type_slug }.compact - response = @client.execute_request( - request: @client.post_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/role_assignments", auth: true, params: params, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments", + auth: true, + params: params, + body: body, request_options: request_options ) - WorkOS::RoleAssignment.new(response.body) + result = WorkOS::RoleAssignment.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Remove a role assignment @@ -287,7 +314,7 @@ def assign_role( # @param resource_id [String, nil] The ID of the resource. Mutually exclusive with `resource_external_id` and `resource_type_slug`. # @param resource_external_id [String, nil] The external ID of the resource. Required with `resource_type_slug`. Mutually exclusive with `resource_id`. # @param resource_type_slug [String, nil] The resource type slug. Required with `resource_external_id`. Mutually exclusive with `resource_id`. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def remove_role( organization_membership_id:, @@ -312,8 +339,12 @@ def remove_role( "resource_external_id" => resource_external_id, "resource_type_slug" => resource_type_slug }.compact - @client.execute_request( - request: @client.delete_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/role_assignments", auth: true, params: params, body: body, request_options: request_options), + @client.request( + method: :delete, + path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments", + auth: true, + params: params, + body: body, request_options: request_options ) nil @@ -322,15 +353,17 @@ def remove_role( # Remove a role assignment by ID # @param organization_membership_id [String] The ID of the organization membership. # @param role_assignment_id [String] The ID of the role assignment to remove. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_organization_membership_role_assignment( organization_membership_id:, role_assignment_id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/authorization/organization_memberships/#{CGI.escape(organization_membership_id.to_s)}/role_assignments/#{CGI.escape(role_assignment_id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments/#{WorkOS::Util.encode_path(role_assignment_id)}", + auth: true, request_options: request_options ) nil @@ -338,17 +371,21 @@ def delete_organization_membership_role_assignment( # List custom roles # @param organization_id [String] The ID of the organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::RoleList] def list_organization_roles( organization_id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles", + auth: true, request_options: request_options ) - WorkOS::RoleList.new(response.body) + result = WorkOS::RoleList.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Create a custom role @@ -357,7 +394,7 @@ def list_organization_roles( # @param name [String] A descriptive name for the role. # @param description [String, nil] An optional description of the role's purpose. # @param resource_type_slug [String, nil] The slug of the resource type the role is scoped to. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] def create_organization_role( organization_id:, @@ -373,28 +410,37 @@ def create_organization_role( "description" => description, "resource_type_slug" => resource_type_slug }.compact - response = @client.execute_request( - request: @client.post_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles", + auth: true, + body: body, request_options: request_options ) - WorkOS::Role.new(response.body) + result = WorkOS::Role.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get a custom role # @param organization_id [String] The ID of the organization. # @param slug [String] The slug of the role. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] def get_organization_role( organization_id:, slug:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}", + auth: true, request_options: request_options ) - WorkOS::Role.new(response.body) + result = WorkOS::Role.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update a custom role @@ -402,7 +448,7 @@ def get_organization_role( # @param slug [String] The slug of the role. # @param name [String, nil] A descriptive name for the role. # @param description [String, nil] An optional description of the role's purpose. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] def update_organization_role( organization_id:, @@ -415,25 +461,32 @@ def update_organization_role( "name" => name, "description" => description }.compact - response = @client.execute_request( - request: @client.patch_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :patch, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}", + auth: true, + body: body, request_options: request_options ) - WorkOS::Role.new(response.body) + result = WorkOS::Role.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete a custom role # @param organization_id [String] The ID of the organization. # @param slug [String] The slug of the role. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_organization_role( organization_id:, slug:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}", + auth: true, request_options: request_options ) nil @@ -443,7 +496,7 @@ def delete_organization_role( # @param organization_id [String] The ID of the organization. # @param slug [String] The slug of the role. # @param body_slug [String] The slug of the permission to add to the role. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] def create_role_permission( organization_id:, @@ -454,18 +507,23 @@ def create_role_permission( body = { "slug" => body_slug }.compact - response = @client.execute_request( - request: @client.post_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}/permissions", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}/permissions", + auth: true, + body: body, request_options: request_options ) - WorkOS::Role.new(response.body) + result = WorkOS::Role.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Set permissions for a custom role # @param organization_id [String] The ID of the organization. # @param slug [String] The slug of the role. # @param permissions [Array] The permission slugs to assign to the role. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] def update_role_permissions( organization_id:, @@ -476,18 +534,23 @@ def update_role_permissions( body = { "permissions" => permissions }.compact - response = @client.execute_request( - request: @client.put_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}/permissions", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :put, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}/permissions", + auth: true, + body: body, request_options: request_options ) - WorkOS::Role.new(response.body) + result = WorkOS::Role.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Remove a permission from a custom role # @param organization_id [String] The ID of the organization. # @param slug [String] The slug of the role. # @param permission_slug [String] The slug of the permission to remove. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] def delete_role_permission( organization_id:, @@ -495,18 +558,22 @@ def delete_role_permission( permission_slug:, request_options: {} ) - response = @client.execute_request( - request: @client.delete_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/roles/#{CGI.escape(slug.to_s)}/permissions/#{CGI.escape(permission_slug.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :delete, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/roles/#{WorkOS::Util.encode_path(slug)}/permissions/#{WorkOS::Util.encode_path(permission_slug)}", + auth: true, request_options: request_options ) - WorkOS::Role.new(response.body) + result = WorkOS::Role.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get a resource by external ID # @param organization_id [String] The ID of the organization that owns the resource. # @param resource_type_slug [String] The slug of the resource type. # @param external_id [String] An identifier you provide to reference the resource in your system. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationResource] def get_organization_resource( organization_id:, @@ -514,11 +581,15 @@ def get_organization_resource( external_id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/resources/#{CGI.escape(resource_type_slug.to_s)}/#{CGI.escape(external_id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}", + auth: true, request_options: request_options ) - WorkOS::AuthorizationResource.new(response.body) + result = WorkOS::AuthorizationResource.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update a resource by external ID @@ -530,7 +601,7 @@ def get_organization_resource( # @param parent_resource_id [String, nil] The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`. # @param parent_resource_external_id [String, nil] The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`. # @param parent_resource_type_slug [String, nil] The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationResource] def update_organization_resource( organization_id:, @@ -561,11 +632,17 @@ def update_organization_resource( "parent_resource_external_id" => parent_resource_external_id, "parent_resource_type_slug" => parent_resource_type_slug }.compact - response = @client.execute_request( - request: @client.patch_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/resources/#{CGI.escape(resource_type_slug.to_s)}/#{CGI.escape(external_id.to_s)}", auth: true, params: params, body: body, request_options: request_options), + response = @client.request( + method: :patch, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}", + auth: true, + params: params, + body: body, request_options: request_options ) - WorkOS::AuthorizationResource.new(response.body) + result = WorkOS::AuthorizationResource.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete an authorization resource by external ID @@ -573,7 +650,7 @@ def update_organization_resource( # @param resource_type_slug [String] The slug of the resource type. # @param external_id [String] An identifier you provide to reference the resource in your system. # @param cascade_delete [Boolean, nil] If true, deletes all descendant resources and role assignments. If not set and the resource has children or assignments, the request will fail. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_organization_resource( organization_id:, @@ -585,8 +662,11 @@ def delete_organization_resource( params = { "cascade_delete" => cascade_delete }.compact - @client.execute_request( - request: @client.delete_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/resources/#{CGI.escape(resource_type_slug.to_s)}/#{CGI.escape(external_id.to_s)}", auth: true, params: params, request_options: request_options), + @client.request( + method: :delete, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}", + auth: true, + params: params, request_options: request_options ) nil @@ -602,8 +682,8 @@ def delete_organization_resource( # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. # @param permission_slug [String] The permission slug to filter by. Only users with this permission on the resource are returned. # @param assignment [WorkOS::Types::AuthorizationAssignment, nil] Filter by assignment type. Use "direct" for direct assignments only, or "indirect" to include inherited assignments. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_resource_organization_memberships( organization_id:, resource_type_slug:, @@ -624,15 +704,14 @@ def list_resource_organization_memberships( "permission_slug" => permission_slug, "assignment" => assignment }.compact - response = @client.execute_request( - request: @client.get_request(path: "/authorization/organizations/#{CGI.escape(organization_id.to_s)}/resources/#{CGI.escape(resource_type_slug.to_s)}/#{CGI.escape(external_id.to_s)}/organization_memberships", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/organizations/#{WorkOS::Util.encode_path(organization_id)}/resources/#{WorkOS::Util.encode_path(resource_type_slug)}/#{WorkOS::Util.encode_path(external_id)}/organization_memberships", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::UserOrganizationMembershipBaseListData.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_resource_organization_memberships( organization_id: organization_id, resource_type_slug: resource_type_slug, @@ -645,8 +724,13 @@ def list_resource_organization_memberships( assignment: assignment, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_id: organization_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order, permission_slug: permission_slug, assignment: assignment}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserOrganizationMembershipBaseListData, + filters: {organization_id: organization_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order, permission_slug: permission_slug, assignment: assignment}, + fetch_next: fetch_next + ) end # List resources @@ -657,8 +741,8 @@ def list_resource_organization_memberships( # @param organization_id [String, nil] Filter resources by organization ID. # @param resource_type_slug [String, nil] Filter resources by resource type slug. # @param search [String, nil] Search resources by name. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_resources( before: nil, after: nil, @@ -688,15 +772,14 @@ def list_resources( params["parent_external_id"] = parent[:parent_external_id] end end - response = @client.execute_request( - request: @client.get_request(path: "/authorization/resources", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/resources", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::AuthorizationResource.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_resources( before: before, after: cursor, @@ -708,8 +791,13 @@ def list_resources( parent: parent, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization_id: organization_id, resource_type_slug: resource_type_slug, search: search, parent: parent}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::AuthorizationResource, + filters: {before: before, limit: limit, order: order, organization_id: organization_id, resource_type_slug: resource_type_slug, search: search, parent: parent}, + fetch_next: fetch_next + ) end # Create an authorization resource @@ -721,7 +809,7 @@ def list_resources( # @param parent_resource_id [String, nil] The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`. # @param parent_resource_external_id [String, nil] The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`. # @param parent_resource_type_slug [String, nil] The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationResource] def create_resource( external_id:, @@ -755,26 +843,36 @@ def create_resource( "parent_resource_external_id" => parent_resource_external_id, "parent_resource_type_slug" => parent_resource_type_slug }.compact - response = @client.execute_request( - request: @client.post_request(path: "/authorization/resources", auth: true, params: params, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/authorization/resources", + auth: true, + params: params, + body: body, request_options: request_options ) - WorkOS::AuthorizationResource.new(response.body) + result = WorkOS::AuthorizationResource.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get a resource # @param resource_id [String] The ID of the authorization resource. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationResource] def get_resource( resource_id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/authorization/resources/#{CGI.escape(resource_id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}", + auth: true, request_options: request_options ) - WorkOS::AuthorizationResource.new(response.body) + result = WorkOS::AuthorizationResource.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update a resource @@ -784,7 +882,7 @@ def get_resource( # @param parent_resource_id [String, nil] The ID of the parent resource. Mutually exclusive with `parent_resource_external_id` and `parent_resource_type_slug`. # @param parent_resource_external_id [String, nil] The external ID of the parent resource. Required with `parent_resource_type_slug`. Mutually exclusive with `parent_resource_id`. # @param parent_resource_type_slug [String, nil] The resource type slug of the parent resource. Required with `parent_resource_external_id`. Mutually exclusive with `parent_resource_id`. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationResource] def update_resource( resource_id:, @@ -813,17 +911,23 @@ def update_resource( "parent_resource_external_id" => parent_resource_external_id, "parent_resource_type_slug" => parent_resource_type_slug }.compact - response = @client.execute_request( - request: @client.patch_request(path: "/authorization/resources/#{CGI.escape(resource_id.to_s)}", auth: true, params: params, body: body, request_options: request_options), + response = @client.request( + method: :patch, + path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}", + auth: true, + params: params, + body: body, request_options: request_options ) - WorkOS::AuthorizationResource.new(response.body) + result = WorkOS::AuthorizationResource.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete an authorization resource # @param resource_id [String] The ID of the authorization resource. # @param cascade_delete [Boolean, nil] If true, deletes all descendant resources and role assignments. If not set and the resource has children or assignments, the request will fail. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_resource( resource_id:, @@ -833,8 +937,11 @@ def delete_resource( params = { "cascade_delete" => cascade_delete }.compact - @client.execute_request( - request: @client.delete_request(path: "/authorization/resources/#{CGI.escape(resource_id.to_s)}", auth: true, params: params, request_options: request_options), + @client.request( + method: :delete, + path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}", + auth: true, + params: params, request_options: request_options ) nil @@ -848,8 +955,8 @@ def delete_resource( # @param order [WorkOS::Types::AuthorizationOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. # @param permission_slug [String] The permission slug to filter by. Only users with this permission on the resource are returned. # @param assignment [WorkOS::Types::AuthorizationAssignment, nil] Filter by assignment type. Use `direct` for direct assignments only, or `indirect` to include inherited assignments. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_memberships_for_resource( resource_id:, permission_slug:, @@ -868,15 +975,14 @@ def list_memberships_for_resource( "permission_slug" => permission_slug, "assignment" => assignment }.compact - response = @client.execute_request( - request: @client.get_request(path: "/authorization/resources/#{CGI.escape(resource_id.to_s)}/organization_memberships", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}/organization_memberships", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::UserOrganizationMembershipBaseListData.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_memberships_for_resource( resource_id: resource_id, before: before, @@ -887,19 +993,28 @@ def list_memberships_for_resource( assignment: assignment, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {resource_id: resource_id, before: before, limit: limit, order: order, permission_slug: permission_slug, assignment: assignment}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserOrganizationMembershipBaseListData, + filters: {resource_id: resource_id, before: before, limit: limit, order: order, permission_slug: permission_slug, assignment: assignment}, + fetch_next: fetch_next + ) end # List environment roles - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::RoleList] def list_environment_roles(request_options: {}) - response = @client.execute_request( - request: @client.get_request(path: "/authorization/roles", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/roles", + auth: true, request_options: request_options ) - WorkOS::RoleList.new(response.body) + result = WorkOS::RoleList.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Create an environment role @@ -907,7 +1022,7 @@ def list_environment_roles(request_options: {}) # @param name [String] A descriptive name for the role. # @param description [String, nil] An optional description of the role. # @param resource_type_slug [String, nil] The slug of the resource type the role is scoped to. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] def create_environment_role( slug:, @@ -922,33 +1037,42 @@ def create_environment_role( "description" => description, "resource_type_slug" => resource_type_slug }.compact - response = @client.execute_request( - request: @client.post_request(path: "/authorization/roles", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/authorization/roles", + auth: true, + body: body, request_options: request_options ) - WorkOS::Role.new(response.body) + result = WorkOS::Role.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get an environment role # @param slug [String] The slug of the environment role. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] def get_environment_role( slug:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/authorization/roles/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}", + auth: true, request_options: request_options ) - WorkOS::Role.new(response.body) + result = WorkOS::Role.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update an environment role # @param slug [String] The slug of the environment role. # @param name [String, nil] A descriptive name for the role. # @param description [String, nil] An optional description of the role. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] def update_environment_role( slug:, @@ -960,17 +1084,22 @@ def update_environment_role( "name" => name, "description" => description }.compact - response = @client.execute_request( - request: @client.patch_request(path: "/authorization/roles/#{CGI.escape(slug.to_s)}", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :patch, + path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}", + auth: true, + body: body, request_options: request_options ) - WorkOS::Role.new(response.body) + result = WorkOS::Role.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Add a permission to an environment role # @param slug [String] The slug of the environment role. # @param body_slug [String] The slug of the permission to add to the role. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] def add_environment_role_permission( slug:, @@ -980,17 +1109,22 @@ def add_environment_role_permission( body = { "slug" => body_slug }.compact - response = @client.execute_request( - request: @client.post_request(path: "/authorization/roles/#{CGI.escape(slug.to_s)}/permissions", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}/permissions", + auth: true, + body: body, request_options: request_options ) - WorkOS::Role.new(response.body) + result = WorkOS::Role.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Set permissions for an environment role # @param slug [String] The slug of the environment role. # @param permissions [Array] The permission slugs to assign to the role. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] def set_environment_role_permissions( slug:, @@ -1000,11 +1134,16 @@ def set_environment_role_permissions( body = { "permissions" => permissions }.compact - response = @client.execute_request( - request: @client.put_request(path: "/authorization/roles/#{CGI.escape(slug.to_s)}/permissions", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :put, + path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}/permissions", + auth: true, + body: body, request_options: request_options ) - WorkOS::Role.new(response.body) + result = WorkOS::Role.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # List permissions @@ -1012,8 +1151,8 @@ def set_environment_role_permissions( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::PermissionsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_permissions( before: nil, after: nil, @@ -1027,15 +1166,14 @@ def list_permissions( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/authorization/permissions", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/permissions", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::AuthorizationPermission.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_permissions( before: before, after: cursor, @@ -1043,8 +1181,13 @@ def list_permissions( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::AuthorizationPermission, + filters: {before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # Create a permission @@ -1052,7 +1195,7 @@ def list_permissions( # @param name [String] A descriptive name for the Permission. # @param description [String, nil] An optional description of the Permission. # @param resource_type_slug [String, nil] The slug of the resource type this permission is scoped to. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Permission] def create_permission( slug:, @@ -1067,33 +1210,42 @@ def create_permission( "description" => description, "resource_type_slug" => resource_type_slug }.compact - response = @client.execute_request( - request: @client.post_request(path: "/authorization/permissions", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/authorization/permissions", + auth: true, + body: body, request_options: request_options ) - WorkOS::Permission.new(response.body) + result = WorkOS::Permission.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get a permission # @param slug [String] A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationPermission] def get_permission( slug:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/authorization/permissions/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/authorization/permissions/#{WorkOS::Util.encode_path(slug)}", + auth: true, request_options: request_options ) - WorkOS::AuthorizationPermission.new(response.body) + result = WorkOS::AuthorizationPermission.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update a permission # @param slug [String] A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks. # @param name [String, nil] A descriptive name for the Permission. # @param description [String, nil] An optional description of the Permission. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationPermission] def update_permission( slug:, @@ -1105,23 +1257,30 @@ def update_permission( "name" => name, "description" => description }.compact - response = @client.execute_request( - request: @client.patch_request(path: "/authorization/permissions/#{CGI.escape(slug.to_s)}", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :patch, + path: "/authorization/permissions/#{WorkOS::Util.encode_path(slug)}", + auth: true, + body: body, request_options: request_options ) - WorkOS::AuthorizationPermission.new(response.body) + result = WorkOS::AuthorizationPermission.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete a permission # @param slug [String] A unique key to reference the permission. Must be lowercase and contain only letters, numbers, hyphens, underscores, colons, periods, and asterisks. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_permission( slug:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/authorization/permissions/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/authorization/permissions/#{WorkOS::Util.encode_path(slug)}", + auth: true, request_options: request_options ) nil diff --git a/lib/workos/authorization/add_role_permission.rb b/lib/workos/authorization/add_role_permission.rb index e7af4e22..da22eb7b 100644 --- a/lib/workos/authorization/add_role_permission.rb +++ b/lib/workos/authorization/add_role_permission.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AddRolePermission - include HashProvider - + class AddRolePermission < WorkOS::Types::BaseModel HASH_ATTRS = { slug: :slug }.freeze @@ -15,8 +11,7 @@ class AddRolePermission attr_accessor :slug def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @slug = hash[:slug] end end diff --git a/lib/workos/authorization/assign_role.rb b/lib/workos/authorization/assign_role.rb index 205671d0..3a550c03 100644 --- a/lib/workos/authorization/assign_role.rb +++ b/lib/workos/authorization/assign_role.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AssignRole - include HashProvider - + class AssignRole < WorkOS::Types::BaseModel HASH_ATTRS = { role_slug: :role_slug, resource_id: :resource_id, @@ -22,8 +18,7 @@ class AssignRole :resource_type_slug def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @role_slug = hash[:role_slug] @resource_id = hash[:resource_id] @resource_external_id = hash[:resource_external_id] diff --git a/lib/workos/authorization/authorization_check.rb b/lib/workos/authorization/authorization_check.rb index b3971c98..0164ed1a 100644 --- a/lib/workos/authorization/authorization_check.rb +++ b/lib/workos/authorization/authorization_check.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthorizationCheck - include HashProvider - + class AuthorizationCheck < WorkOS::Types::BaseModel HASH_ATTRS = { authorized: :authorized }.freeze @@ -15,8 +11,7 @@ class AuthorizationCheck attr_accessor :authorized def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @authorized = hash[:authorized] end end diff --git a/lib/workos/authorization/authorization_permission.rb b/lib/workos/authorization/authorization_permission.rb index a0dfb4c2..cf85df81 100644 --- a/lib/workos/authorization/authorization_permission.rb +++ b/lib/workos/authorization/authorization_permission.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthorizationPermission - include HashProvider - + class AuthorizationPermission < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -32,8 +28,7 @@ class AuthorizationPermission :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @slug = hash[:slug] diff --git a/lib/workos/authorization/authorization_resource.rb b/lib/workos/authorization/authorization_resource.rb index a30dac8f..1d7928df 100644 --- a/lib/workos/authorization/authorization_resource.rb +++ b/lib/workos/authorization/authorization_resource.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthorizationResource - include HashProvider - + class AuthorizationResource < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, name: :name, @@ -34,8 +30,7 @@ class AuthorizationResource :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @name = hash[:name] @description = hash[:description] diff --git a/lib/workos/authorization/check_authorization.rb b/lib/workos/authorization/check_authorization.rb index a4661462..490d5260 100644 --- a/lib/workos/authorization/check_authorization.rb +++ b/lib/workos/authorization/check_authorization.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CheckAuthorization - include HashProvider - + class CheckAuthorization < WorkOS::Types::BaseModel HASH_ATTRS = { permission_slug: :permission_slug, resource_id: :resource_id, @@ -22,8 +18,7 @@ class CheckAuthorization :resource_type_slug def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @permission_slug = hash[:permission_slug] @resource_id = hash[:resource_id] @resource_external_id = hash[:resource_external_id] diff --git a/lib/workos/authorization/create_authorization_permission.rb b/lib/workos/authorization/create_authorization_permission.rb index d5316d1d..d28bf57b 100644 --- a/lib/workos/authorization/create_authorization_permission.rb +++ b/lib/workos/authorization/create_authorization_permission.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateAuthorizationPermission - include HashProvider - + class CreateAuthorizationPermission < WorkOS::Types::BaseModel HASH_ATTRS = { slug: :slug, name: :name, @@ -22,8 +18,7 @@ class CreateAuthorizationPermission :resource_type_slug def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @slug = hash[:slug] @name = hash[:name] @description = hash[:description] diff --git a/lib/workos/authorization/create_authorization_resource.rb b/lib/workos/authorization/create_authorization_resource.rb index cc74f011..2aece3ad 100644 --- a/lib/workos/authorization/create_authorization_resource.rb +++ b/lib/workos/authorization/create_authorization_resource.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateAuthorizationResource - include HashProvider - + class CreateAuthorizationResource < WorkOS::Types::BaseModel HASH_ATTRS = { external_id: :external_id, name: :name, @@ -30,8 +26,7 @@ class CreateAuthorizationResource :parent_resource_type_slug def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @external_id = hash[:external_id] @name = hash[:name] @description = hash[:description] diff --git a/lib/workos/authorization/create_organization_role.rb b/lib/workos/authorization/create_organization_role.rb index 6ac70868..2b229d04 100644 --- a/lib/workos/authorization/create_organization_role.rb +++ b/lib/workos/authorization/create_organization_role.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateOrganizationRole - include HashProvider - + class CreateOrganizationRole < WorkOS::Types::BaseModel HASH_ATTRS = { slug: :slug, name: :name, @@ -22,8 +18,7 @@ class CreateOrganizationRole :resource_type_slug def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @slug = hash[:slug] @name = hash[:name] @description = hash[:description] diff --git a/lib/workos/authorization/permission_created.rb b/lib/workos/authorization/permission_created.rb index 92abfa40..57783b4c 100644 --- a/lib/workos/authorization/permission_created.rb +++ b/lib/workos/authorization/permission_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class PermissionCreated - include HashProvider - + class PermissionCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class PermissionCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::PermissionCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/authorization/permission_created_data.rb b/lib/workos/authorization/permission_created_data.rb index beb8abbc..69a41462 100644 --- a/lib/workos/authorization/permission_created_data.rb +++ b/lib/workos/authorization/permission_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class PermissionCreatedData - include HashProvider - + class PermissionCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -30,8 +26,7 @@ class PermissionCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @slug = hash[:slug] diff --git a/lib/workos/authorization/permission_deleted.rb b/lib/workos/authorization/permission_deleted.rb index 5de52b64..bc86c1f1 100644 --- a/lib/workos/authorization/permission_deleted.rb +++ b/lib/workos/authorization/permission_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class PermissionDeleted - include HashProvider - + class PermissionDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class PermissionDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::PermissionDeletedData.new(hash[:data]) : nil diff --git a/lib/workos/authorization/permission_updated.rb b/lib/workos/authorization/permission_updated.rb index 53d76974..b5d36157 100644 --- a/lib/workos/authorization/permission_updated.rb +++ b/lib/workos/authorization/permission_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class PermissionUpdated - include HashProvider - + class PermissionUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class PermissionUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::PermissionUpdatedData.new(hash[:data]) : nil diff --git a/lib/workos/authorization/role.rb b/lib/workos/authorization/role.rb index edac70f8..f5272bb7 100644 --- a/lib/workos/authorization/role.rb +++ b/lib/workos/authorization/role.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class Role - include HashProvider - + class Role < WorkOS::Types::BaseModel HASH_ATTRS = { slug: :slug, object: :object, @@ -34,8 +30,7 @@ class Role :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @slug = hash[:slug] @object = hash[:object] @id = hash[:id] diff --git a/lib/workos/authorization/role_assignment.rb b/lib/workos/authorization/role_assignment.rb index 76ec9d4f..b2281332 100644 --- a/lib/workos/authorization/role_assignment.rb +++ b/lib/workos/authorization/role_assignment.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RoleAssignment - include HashProvider - + class RoleAssignment < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -26,8 +22,7 @@ class RoleAssignment :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil diff --git a/lib/workos/authorization/role_assignment_resource.rb b/lib/workos/authorization/role_assignment_resource.rb index 822ed84b..bcdae5f2 100644 --- a/lib/workos/authorization/role_assignment_resource.rb +++ b/lib/workos/authorization/role_assignment_resource.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RoleAssignmentResource - include HashProvider - + class RoleAssignmentResource < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, external_id: :external_id, @@ -20,8 +16,7 @@ class RoleAssignmentResource :resource_type_slug def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @external_id = hash[:external_id] @resource_type_slug = hash[:resource_type_slug] diff --git a/lib/workos/authorization/role_created.rb b/lib/workos/authorization/role_created.rb index 775a880a..54e64472 100644 --- a/lib/workos/authorization/role_created.rb +++ b/lib/workos/authorization/role_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RoleCreated - include HashProvider - + class RoleCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class RoleCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::RoleCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/authorization/role_created_data.rb b/lib/workos/authorization/role_created_data.rb index c0c09556..e15482df 100644 --- a/lib/workos/authorization/role_created_data.rb +++ b/lib/workos/authorization/role_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RoleCreatedData - include HashProvider - + class RoleCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, slug: :slug, @@ -26,8 +22,7 @@ class RoleCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @slug = hash[:slug] @resource_type_slug = hash[:resource_type_slug] diff --git a/lib/workos/authorization/role_deleted.rb b/lib/workos/authorization/role_deleted.rb index 2c90d733..1bb859a1 100644 --- a/lib/workos/authorization/role_deleted.rb +++ b/lib/workos/authorization/role_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RoleDeleted - include HashProvider - + class RoleDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class RoleDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::RoleDeletedData.new(hash[:data]) : nil diff --git a/lib/workos/authorization/role_list.rb b/lib/workos/authorization/role_list.rb index 34961630..4dfe809c 100644 --- a/lib/workos/authorization/role_list.rb +++ b/lib/workos/authorization/role_list.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RoleList - include HashProvider - + class RoleList < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, data: :data @@ -18,8 +14,7 @@ class RoleList :data def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @data = (hash[:data] || []).map { |item| item ? WorkOS::Role.new(item) : nil } end diff --git a/lib/workos/authorization/role_updated.rb b/lib/workos/authorization/role_updated.rb index acf27f97..da154750 100644 --- a/lib/workos/authorization/role_updated.rb +++ b/lib/workos/authorization/role_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RoleUpdated - include HashProvider - + class RoleUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class RoleUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::RoleUpdatedData.new(hash[:data]) : nil diff --git a/lib/workos/authorization/set_role_permissions.rb b/lib/workos/authorization/set_role_permissions.rb index 475fd026..3e66efee 100644 --- a/lib/workos/authorization/set_role_permissions.rb +++ b/lib/workos/authorization/set_role_permissions.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SetRolePermissions - include HashProvider - + class SetRolePermissions < WorkOS::Types::BaseModel HASH_ATTRS = { permissions: :permissions }.freeze @@ -15,8 +11,7 @@ class SetRolePermissions attr_accessor :permissions def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @permissions = hash[:permissions] || [] end end diff --git a/lib/workos/authorization/update_authorization_permission.rb b/lib/workos/authorization/update_authorization_permission.rb index 638045b7..9d6ee344 100644 --- a/lib/workos/authorization/update_authorization_permission.rb +++ b/lib/workos/authorization/update_authorization_permission.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UpdateAuthorizationPermission - include HashProvider - + class UpdateAuthorizationPermission < WorkOS::Types::BaseModel HASH_ATTRS = { name: :name, description: :description @@ -18,8 +14,7 @@ class UpdateAuthorizationPermission :description def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @name = hash[:name] @description = hash[:description] end diff --git a/lib/workos/authorization/update_authorization_resource.rb b/lib/workos/authorization/update_authorization_resource.rb index c89c6382..3ca4fa3b 100644 --- a/lib/workos/authorization/update_authorization_resource.rb +++ b/lib/workos/authorization/update_authorization_resource.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UpdateAuthorizationResource - include HashProvider - + class UpdateAuthorizationResource < WorkOS::Types::BaseModel HASH_ATTRS = { name: :name, description: :description, @@ -24,8 +20,7 @@ class UpdateAuthorizationResource :parent_resource_type_slug def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @name = hash[:name] @description = hash[:description] @parent_resource_id = hash[:parent_resource_id] diff --git a/lib/workos/authorization/user_organization_membership_base_list_data.rb b/lib/workos/authorization/user_organization_membership_base_list_data.rb index d15d8a8e..c52c73d0 100644 --- a/lib/workos/authorization/user_organization_membership_base_list_data.rb +++ b/lib/workos/authorization/user_organization_membership_base_list_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserOrganizationMembershipBaseListData - include HashProvider - + class UserOrganizationMembershipBaseListData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class UserOrganizationMembershipBaseListData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/base_client.rb b/lib/workos/base_client.rb index f9836d41..8c1d1dde 100644 --- a/lib/workos/base_client.rb +++ b/lib/workos/base_client.rb @@ -17,6 +17,7 @@ class BaseClient DEFAULT_TIMEOUT = 30 DEFAULT_MAX_RETRIES = 2 RETRYABLE_STATUSES = [408, 409, 429, 500, 502, 503, 504].freeze + MAX_CACHED_CONNECTIONS = 8 RETRY_BACKOFF_BASE = 0.5 LOG_SEVERITY = {debug: 0, info: 1, warn: 2, error: 3, unknown: 4}.freeze @@ -25,7 +26,8 @@ class BaseClient attr_reader :api_key, :base_url, :client_id, :timeout, :max_retries, :logger, :log_level def initialize(api_key: nil, base_url: DEFAULT_BASE_URL, client_id: nil, - timeout: DEFAULT_TIMEOUT, max_retries: DEFAULT_MAX_RETRIES, logger: nil, log_level: nil) + timeout: DEFAULT_TIMEOUT, max_retries: DEFAULT_MAX_RETRIES, + logger: nil, log_level: nil, random: Random.new) @api_key = api_key @base_url = base_url @client_id = client_id @@ -33,6 +35,7 @@ def initialize(api_key: nil, base_url: DEFAULT_BASE_URL, client_id: nil, @max_retries = max_retries @logger = logger @log_level = log_level + @random = random end # -- Request builders ------------------------------------------------- @@ -84,7 +87,7 @@ def delete_request(path:, auth: false, body: nil, params: {}, request_options: n # Unified request helper: builds the verb-specific request and executes # it in a single call, removing the need for callers to pass # request_options twice. - def request(method:, path:, auth: true, params: {}, body: nil, request_options: nil) + def request(method:, path:, auth: true, params: {}, body: nil, request_options: {}) raise ArgumentError, "unsupported method" unless %i[get post put patch delete].include?(method) req = case method @@ -105,7 +108,7 @@ def request(method:, path:, auth: true, params: {}, body: nil, request_options: # -- Execution -------------------------------------------------------- def execute_request(request:, request_options: nil) - opts = request_options || {} + opts = (request_options || {}).transform_keys(&:to_sym) base = opts[:base_url] || @base_url timeout = opts[:timeout] || @timeout retries = opts[:max_retries] || @max_retries @@ -142,7 +145,13 @@ def execute_request(request:, request_options: nil) end end - # Close all persistent connections. + # Close all persistent connections cached by this client on the current + # fiber/thread. + # + # Call this before forking (e.g. in a Puma `on_worker_boot` block) to + # avoid sharing `Net::HTTP` sockets across processes. + # + # @return [void] def shutdown connections = thread_connections.values thread_connections.clear @@ -177,7 +186,9 @@ def connection_for(base_url, timeout) http.open_timeout = timeout http.keep_alive_timeout = 30 http.start - thread_connections[key] = http + cache = thread_connections + cache[key] = http + evict_lru_connections(cache) if cache.size > MAX_CACHED_CONNECTIONS http end @@ -192,12 +203,22 @@ def evict_connection(base_url) # Already closed, ignore end + def evict_lru_connections(cache) + while cache.size > MAX_CACHED_CONNECTIONS + oldest_key = cache.keys.first + conn = cache.delete(oldest_key) + conn&.finish if conn&.started? + end + rescue IOError + # Already closed, ignore + end + def connection_key(uri, timeout) "#{uri.scheme}:#{uri.host}:#{uri.port}:#{timeout}" end def thread_connections - Thread.current[:workos_connections] ||= {} + Fiber[:workos_connections] ||= {} end def resolve_option(opts, key) @@ -280,7 +301,7 @@ def retry_delay(response, attempt) end base = RETRY_BACKOFF_BASE * (2**(attempt - 1)) - jitter = rand * 0.25 * base + jitter = @random.rand * 0.25 * base base + jitter end diff --git a/lib/workos/configuration.rb b/lib/workos/configuration.rb index 29c744f4..8aaa5e31 100644 --- a/lib/workos/configuration.rb +++ b/lib/workos/configuration.rb @@ -43,7 +43,14 @@ def client ) end - # Reset the cached client (e.g., after reconfiguring). + # Reset the cached singleton client. Shuts down any open connections + # on the current fiber/thread, then clears the cached client so the + # next call to {.client} builds a fresh one. + # + # Call this after reconfiguring, or in a Puma/Unicorn `on_worker_boot` + # block to avoid sharing sockets across forked processes. + # + # @return [void] def reset_client @client&.shutdown @client = nil diff --git a/lib/workos/connect.rb b/lib/workos/connect.rb index c99587e2..3a46e737 100644 --- a/lib/workos/connect.rb +++ b/lib/workos/connect.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -15,7 +14,7 @@ def initialize(client) # @param external_auth_id [String] Identifier provided when AuthKit redirected to your login page. # @param user [WorkOS::UserObject] The user to create or update in AuthKit. # @param user_consent_options [Array, nil] Array of [User Consent Options](https://workos.com/docs/reference/workos-connect/standalone/user-consent-options) to store with the session. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::ExternalAuthCompleteResponse] def complete_oauth2( external_auth_id:, @@ -28,11 +27,16 @@ def complete_oauth2( "user" => user, "user_consent_options" => user_consent_options }.compact - response = @client.execute_request( - request: @client.post_request(path: "/authkit/oauth2/complete", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/authkit/oauth2/complete", + auth: true, + body: body, request_options: request_options ) - WorkOS::ExternalAuthCompleteResponse.new(response.body) + result = WorkOS::ExternalAuthCompleteResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # List Connect Applications @@ -41,8 +45,8 @@ def complete_oauth2( # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::ApplicationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. # @param organization_id [String, nil] Filter Connect Applications by organization ID. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_applications( before: nil, after: nil, @@ -58,15 +62,14 @@ def list_applications( "order" => order, "organization_id" => organization_id }.compact - response = @client.execute_request( - request: @client.get_request(path: "/connect/applications", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/connect/applications", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::ConnectApplication.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_applications( before: before, after: cursor, @@ -75,8 +78,13 @@ def list_applications( organization_id: organization_id, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization_id: organization_id}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::ConnectApplication, + filters: {before: before, limit: limit, order: order, organization_id: organization_id}, + fetch_next: fetch_next + ) end # Create a Connect Application @@ -88,7 +96,7 @@ def list_applications( # @param uses_pkce [Boolean, nil] Whether the application uses PKCE (Proof Key for Code Exchange). # @param is_first_party [Boolean, nil] Whether this is a first-party application. Third-party applications require an organization_id. # @param organization_id [String, nil] The organization ID this application belongs to. Required when is_first_party is false. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::ConnectApplication] def create_application( name:, @@ -111,11 +119,16 @@ def create_application( "is_first_party" => is_first_party, "organization_id" => organization_id }.compact - response = @client.execute_request( - request: @client.post_request(path: "/connect/applications", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/connect/applications", + auth: true, + body: body, request_options: request_options ) - WorkOS::ConnectApplication.new(response.body) + result = WorkOS::ConnectApplication.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Create oauth application. @@ -148,8 +161,11 @@ def create_oauth_application( "uses_pkce" => uses_pkce, "organization_id" => organization_id }.compact - response = @client.execute_request( - request: @client.post_request(path: "/connect/applications", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/connect/applications", + auth: true, + body: body, request_options: request_options ) WorkOS::ConnectApplication.new(response.body) @@ -176,8 +192,11 @@ def create_m2m_application( "description" => description, "scopes" => scopes }.compact - response = @client.execute_request( - request: @client.post_request(path: "/connect/applications", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/connect/applications", + auth: true, + body: body, request_options: request_options ) WorkOS::ConnectApplication.new(response.body) @@ -185,17 +204,21 @@ def create_m2m_application( # Get a Connect Application # @param id [String] The application ID or client ID of the Connect Application. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::ConnectApplication] def get_application( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/connect/applications/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/connect/applications/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::ConnectApplication.new(response.body) + result = WorkOS::ConnectApplication.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update a Connect Application @@ -204,7 +227,7 @@ def get_application( # @param description [String, nil] A description for the application. # @param scopes [Array, nil] The OAuth scopes granted to the application. # @param redirect_uris [Array, nil] Updated redirect URIs for the application. OAuth applications only. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::ConnectApplication] def update_application( id:, @@ -220,23 +243,30 @@ def update_application( "scopes" => scopes, "redirect_uris" => redirect_uris }.compact - response = @client.execute_request( - request: @client.put_request(path: "/connect/applications/#{CGI.escape(id.to_s)}", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :put, + path: "/connect/applications/#{WorkOS::Util.encode_path(id)}", + auth: true, + body: body, request_options: request_options ) - WorkOS::ConnectApplication.new(response.body) + result = WorkOS::ConnectApplication.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete a Connect Application # @param id [String] The application ID or client ID of the Connect Application. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_application( id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/connect/applications/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/connect/applications/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) nil @@ -244,14 +274,16 @@ def delete_application( # List Client Secrets for a Connect Application # @param id [String] The application ID or client ID of the Connect Application. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [Array] def list_application_client_secrets( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/connect/applications/#{CGI.escape(id.to_s)}/client_secrets", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/connect/applications/#{WorkOS::Util.encode_path(id)}/client_secrets", + auth: true, request_options: request_options ) parsed = JSON.parse(response.body) @@ -260,29 +292,35 @@ def list_application_client_secrets( # Create a new client secret for a Connect Application # @param id [String] The application ID or client ID of the Connect Application. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::NewConnectApplicationSecret] def create_application_client_secret( id:, request_options: {} ) - response = @client.execute_request( - request: @client.post_request(path: "/connect/applications/#{CGI.escape(id.to_s)}/client_secrets", auth: true, request_options: request_options), + response = @client.request( + method: :post, + path: "/connect/applications/#{WorkOS::Util.encode_path(id)}/client_secrets", + auth: true, request_options: request_options ) - WorkOS::NewConnectApplicationSecret.new(response.body) + result = WorkOS::NewConnectApplicationSecret.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete a Client Secret # @param id [String] The unique ID of the client secret. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_client_secret( id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/connect/client_secrets/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/connect/client_secrets/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) nil diff --git a/lib/workos/connect/application_credentials_list_item.rb b/lib/workos/connect/application_credentials_list_item.rb index 000f265f..c027d3c2 100644 --- a/lib/workos/connect/application_credentials_list_item.rb +++ b/lib/workos/connect/application_credentials_list_item.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ApplicationCredentialsListItem - include HashProvider - + class ApplicationCredentialsListItem < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -26,8 +22,7 @@ class ApplicationCredentialsListItem :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @secret_hint = hash[:secret_hint] diff --git a/lib/workos/connect/connect_application.rb b/lib/workos/connect/connect_application.rb index 1e6bf323..39230b72 100644 --- a/lib/workos/connect/connect_application.rb +++ b/lib/workos/connect/connect_application.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectApplication - include HashProvider - + class ConnectApplication < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class ConnectApplication :organization_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @client_id = hash[:client_id] diff --git a/lib/workos/connect/create_application_secret.rb b/lib/workos/connect/create_application_secret.rb index 4ee44d1b..6b3b1a03 100644 --- a/lib/workos/connect/create_application_secret.rb +++ b/lib/workos/connect/create_application_secret.rb @@ -2,17 +2,12 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateApplicationSecret - include HashProvider - + class CreateApplicationSecret < WorkOS::Types::BaseModel HASH_ATTRS = {}.freeze def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + self.class.normalize(json) end end end diff --git a/lib/workos/connect/create_m2m_application.rb b/lib/workos/connect/create_m2m_application.rb index fdeb67d2..d8ca27e6 100644 --- a/lib/workos/connect/create_m2m_application.rb +++ b/lib/workos/connect/create_m2m_application.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateM2MApplication - include HashProvider - + class CreateM2MApplication < WorkOS::Types::BaseModel HASH_ATTRS = { name: :name, application_type: :application_type, @@ -24,8 +20,7 @@ class CreateM2MApplication :organization_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @name = hash[:name] @application_type = hash[:application_type] @description = hash[:description] diff --git a/lib/workos/connect/create_oauth_application.rb b/lib/workos/connect/create_oauth_application.rb index 8c6fce66..ea780400 100644 --- a/lib/workos/connect/create_oauth_application.rb +++ b/lib/workos/connect/create_oauth_application.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateOAuthApplication - include HashProvider - + class CreateOAuthApplication < WorkOS::Types::BaseModel HASH_ATTRS = { name: :name, application_type: :application_type, @@ -30,8 +26,7 @@ class CreateOAuthApplication :organization_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @name = hash[:name] @application_type = hash[:application_type] @description = hash[:description] diff --git a/lib/workos/connect/external_auth_complete_response.rb b/lib/workos/connect/external_auth_complete_response.rb index bdc87db3..71dfcc7b 100644 --- a/lib/workos/connect/external_auth_complete_response.rb +++ b/lib/workos/connect/external_auth_complete_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ExternalAuthCompleteResponse - include HashProvider - + class ExternalAuthCompleteResponse < WorkOS::Types::BaseModel HASH_ATTRS = { redirect_uri: :redirect_uri }.freeze @@ -15,8 +11,7 @@ class ExternalAuthCompleteResponse attr_accessor :redirect_uri def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @redirect_uri = hash[:redirect_uri] end end diff --git a/lib/workos/connect/new_connect_application_secret.rb b/lib/workos/connect/new_connect_application_secret.rb index 74fc497e..a6a05b68 100644 --- a/lib/workos/connect/new_connect_application_secret.rb +++ b/lib/workos/connect/new_connect_application_secret.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class NewConnectApplicationSecret - include HashProvider - + class NewConnectApplicationSecret < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -28,8 +24,7 @@ class NewConnectApplicationSecret :secret def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @secret_hint = hash[:secret_hint] diff --git a/lib/workos/connect/redirect_uri_input.rb b/lib/workos/connect/redirect_uri_input.rb index 8c93066f..36bf7b3b 100644 --- a/lib/workos/connect/redirect_uri_input.rb +++ b/lib/workos/connect/redirect_uri_input.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RedirectUriInput - include HashProvider - + class RedirectUriInput < WorkOS::Types::BaseModel HASH_ATTRS = { uri: :uri, default: :default @@ -18,8 +14,7 @@ class RedirectUriInput :default def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @uri = hash[:uri] @default = hash[:default] end diff --git a/lib/workos/connect/update_oauth_application.rb b/lib/workos/connect/update_oauth_application.rb index be18e52e..1845ae13 100644 --- a/lib/workos/connect/update_oauth_application.rb +++ b/lib/workos/connect/update_oauth_application.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UpdateOAuthApplication - include HashProvider - + class UpdateOAuthApplication < WorkOS::Types::BaseModel HASH_ATTRS = { name: :name, description: :description, @@ -22,8 +18,7 @@ class UpdateOAuthApplication :redirect_uris def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @name = hash[:name] @description = hash[:description] @scopes = hash[:scopes] || [] diff --git a/lib/workos/connect/user_consent_option.rb b/lib/workos/connect/user_consent_option.rb index ac6c8e04..e1df94e8 100644 --- a/lib/workos/connect/user_consent_option.rb +++ b/lib/workos/connect/user_consent_option.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserConsentOption - include HashProvider - + class UserConsentOption < WorkOS::Types::BaseModel HASH_ATTRS = { claim: :claim, type: :type, @@ -22,8 +18,7 @@ class UserConsentOption :choices def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @claim = hash[:claim] @type = hash[:type] @label = hash[:label] diff --git a/lib/workos/connect/user_consent_option_choice.rb b/lib/workos/connect/user_consent_option_choice.rb index 769e76e3..6128a9f9 100644 --- a/lib/workos/connect/user_consent_option_choice.rb +++ b/lib/workos/connect/user_consent_option_choice.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserConsentOptionChoice - include HashProvider - + class UserConsentOptionChoice < WorkOS::Types::BaseModel HASH_ATTRS = { value: :value, label: :label @@ -18,8 +14,7 @@ class UserConsentOptionChoice :label def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @value = hash[:value] @label = hash[:label] end diff --git a/lib/workos/connect/user_management_login_request.rb b/lib/workos/connect/user_management_login_request.rb index 62c6a9cf..245fab6c 100644 --- a/lib/workos/connect/user_management_login_request.rb +++ b/lib/workos/connect/user_management_login_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserManagementLoginRequest - include HashProvider - + class UserManagementLoginRequest < WorkOS::Types::BaseModel HASH_ATTRS = { external_auth_id: :external_auth_id, user: :user, @@ -20,8 +16,7 @@ class UserManagementLoginRequest :user_consent_options def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @external_auth_id = hash[:external_auth_id] @user = hash[:user] ? WorkOS::UserObject.new(hash[:user]) : nil @user_consent_options = (hash[:user_consent_options] || []).map { |item| item ? WorkOS::UserConsentOption.new(item) : nil } diff --git a/lib/workos/connect/user_object.rb b/lib/workos/connect/user_object.rb index d0ac7b25..9d263482 100644 --- a/lib/workos/connect/user_object.rb +++ b/lib/workos/connect/user_object.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserObject - include HashProvider - + class UserObject < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, email: :email, @@ -24,8 +20,7 @@ class UserObject :metadata def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @email = hash[:email] @first_name = hash[:first_name] diff --git a/lib/workos/directory_sync.rb b/lib/workos/directory_sync.rb index db3917c3..70e856d1 100644 --- a/lib/workos/directory_sync.rb +++ b/lib/workos/directory_sync.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -19,8 +18,8 @@ def initialize(client) # @param organization_id [String, nil] Filter Directories by their associated organization. # @param search [String, nil] Searchable text to match against Directory names. # @param domain [String, nil] (deprecated) Filter Directories by their associated domain. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_directories( before: nil, after: nil, @@ -40,15 +39,14 @@ def list_directories( "search" => search, "domain" => domain }.compact - response = @client.execute_request( - request: @client.get_request(path: "/directories", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/directories", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::Directory.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_directories( before: before, after: cursor, @@ -59,35 +57,46 @@ def list_directories( domain: domain, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization_id: organization_id, search: search, domain: domain}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::Directory, + filters: {before: before, limit: limit, order: order, organization_id: organization_id, search: search, domain: domain}, + fetch_next: fetch_next + ) end # Get a Directory # @param id [String] Unique identifier for the Directory. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Directory] def get_directory( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/directories/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/directories/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::Directory.new(response.body) + result = WorkOS::Directory.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete a Directory # @param id [String] Unique identifier for the Directory. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_directory( id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/directories/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/directories/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) nil @@ -100,8 +109,8 @@ def delete_directory( # @param order [WorkOS::Types::DirectoryGroupsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. # @param directory [String, nil] Unique identifier of the WorkOS Directory. This value can be obtained from the WorkOS dashboard or from the WorkOS API. # @param user [String, nil] Unique identifier of the WorkOS Directory User. This value can be obtained from the WorkOS API. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_groups( before: nil, after: nil, @@ -119,15 +128,14 @@ def list_groups( "directory" => directory, "user" => user }.compact - response = @client.execute_request( - request: @client.get_request(path: "/directory_groups", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/directory_groups", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::DirectoryGroup.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_groups( before: before, after: cursor, @@ -137,23 +145,32 @@ def list_groups( user: user, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, directory: directory, user: user}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::DirectoryGroup, + filters: {before: before, limit: limit, order: order, directory: directory, user: user}, + fetch_next: fetch_next + ) end # Get a Directory Group # @param id [String] Unique identifier for the Directory Group. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::DirectoryGroup] def get_group( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/directory_groups/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/directory_groups/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::DirectoryGroup.new(response.body) + result = WorkOS::DirectoryGroup.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # List Directory Users @@ -163,8 +180,8 @@ def get_group( # @param order [WorkOS::Types::DirectoryUsersOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. # @param directory [String, nil] Unique identifier of the WorkOS Directory. This value can be obtained from the WorkOS dashboard or from the WorkOS API. # @param group [String, nil] Unique identifier of the WorkOS Directory Group. This value can be obtained from the WorkOS API. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_users( before: nil, after: nil, @@ -182,15 +199,14 @@ def list_users( "directory" => directory, "group" => group }.compact - response = @client.execute_request( - request: @client.get_request(path: "/directory_users", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/directory_users", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::DirectoryUserWithGroups.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_users( before: before, after: cursor, @@ -200,23 +216,32 @@ def list_users( group: group, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, directory: directory, group: group}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::DirectoryUserWithGroups, + filters: {before: before, limit: limit, order: order, directory: directory, group: group}, + fetch_next: fetch_next + ) end # Get a Directory User # @param id [String] Unique identifier for the Directory User. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::DirectoryUserWithGroups] def get_user( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/directory_users/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/directory_users/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::DirectoryUserWithGroups.new(response.body) + result = WorkOS::DirectoryUserWithGroups.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end end end diff --git a/lib/workos/directory_sync/directory.rb b/lib/workos/directory_sync/directory.rb index 3e2409bb..b69fcc33 100644 --- a/lib/workos/directory_sync/directory.rb +++ b/lib/workos/directory_sync/directory.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class Directory - include HashProvider - + class Directory < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -36,8 +32,7 @@ class Directory :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/directory_sync/directory_group.rb b/lib/workos/directory_sync/directory_group.rb index 00bd0dc2..8e115930 100644 --- a/lib/workos/directory_sync/directory_group.rb +++ b/lib/workos/directory_sync/directory_group.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DirectoryGroup - include HashProvider - + class DirectoryGroup < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -32,8 +28,7 @@ class DirectoryGroup :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @idp_id = hash[:idp_id] diff --git a/lib/workos/directory_sync/directory_metadata.rb b/lib/workos/directory_sync/directory_metadata.rb index a5990008..386a0be0 100644 --- a/lib/workos/directory_sync/directory_metadata.rb +++ b/lib/workos/directory_sync/directory_metadata.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DirectoryMetadata - include HashProvider - + class DirectoryMetadata < WorkOS::Types::BaseModel HASH_ATTRS = { users: :users, groups: :groups @@ -18,8 +14,7 @@ class DirectoryMetadata :groups def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @users = hash[:users] ? WorkOS::DirectoryMetadataUser.new(hash[:users]) : nil @groups = hash[:groups] end diff --git a/lib/workos/directory_sync/directory_metadata_user.rb b/lib/workos/directory_sync/directory_metadata_user.rb index 732638ec..1d43f750 100644 --- a/lib/workos/directory_sync/directory_metadata_user.rb +++ b/lib/workos/directory_sync/directory_metadata_user.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DirectoryMetadataUser - include HashProvider - + class DirectoryMetadataUser < WorkOS::Types::BaseModel HASH_ATTRS = { active: :active, inactive: :inactive @@ -18,8 +14,7 @@ class DirectoryMetadataUser :inactive def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @active = hash[:active] @inactive = hash[:inactive] end diff --git a/lib/workos/directory_sync/directory_user.rb b/lib/workos/directory_sync/directory_user.rb index 9df21183..b3b06b43 100644 --- a/lib/workos/directory_sync/directory_user.rb +++ b/lib/workos/directory_sync/directory_user.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DirectoryUser - include HashProvider - + class DirectoryUser < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -55,36 +51,35 @@ class DirectoryUser :updated_at def emails - warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1 + warn "[DEPRECATION] `emails` is deprecated and will be removed in a future version.", uplevel: 1 @emails end attr_writer :emails def job_title - warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1 + warn "[DEPRECATION] `job_title` is deprecated and will be removed in a future version.", uplevel: 1 @job_title end attr_writer :job_title def username - warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1 + warn "[DEPRECATION] `username` is deprecated and will be removed in a future version.", uplevel: 1 @username end attr_writer :username def raw_attributes - warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1 + warn "[DEPRECATION] `raw_attributes` is deprecated and will be removed in a future version.", uplevel: 1 @raw_attributes end attr_writer :raw_attributes def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @directory_id = hash[:directory_id] diff --git a/lib/workos/directory_sync/directory_user_email.rb b/lib/workos/directory_sync/directory_user_email.rb index 39f035cd..bb922a3b 100644 --- a/lib/workos/directory_sync/directory_user_email.rb +++ b/lib/workos/directory_sync/directory_user_email.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DirectoryUserEmail - include HashProvider - + class DirectoryUserEmail < WorkOS::Types::BaseModel HASH_ATTRS = { primary: :primary, type: :type, @@ -20,8 +16,7 @@ class DirectoryUserEmail :value def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @primary = hash[:primary] @type = hash[:type] @value = hash[:value] diff --git a/lib/workos/directory_sync/directory_user_with_groups.rb b/lib/workos/directory_sync/directory_user_with_groups.rb index 13ddbaea..32e14147 100644 --- a/lib/workos/directory_sync/directory_user_with_groups.rb +++ b/lib/workos/directory_sync/directory_user_with_groups.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DirectoryUserWithGroups - include HashProvider - + class DirectoryUserWithGroups < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -57,36 +53,35 @@ class DirectoryUserWithGroups :groups def emails - warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1 + warn "[DEPRECATION] `emails` is deprecated and will be removed in a future version.", uplevel: 1 @emails end attr_writer :emails def job_title - warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1 + warn "[DEPRECATION] `job_title` is deprecated and will be removed in a future version.", uplevel: 1 @job_title end attr_writer :job_title def username - warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1 + warn "[DEPRECATION] `username` is deprecated and will be removed in a future version.", uplevel: 1 @username end attr_writer :username def raw_attributes - warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1 + warn "[DEPRECATION] `raw_attributes` is deprecated and will be removed in a future version.", uplevel: 1 @raw_attributes end attr_writer :raw_attributes def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @directory_id = hash[:directory_id] diff --git a/lib/workos/directory_sync/dsync_activated.rb b/lib/workos/directory_sync/dsync_activated.rb index 815ea88b..8a8d4c32 100644 --- a/lib/workos/directory_sync/dsync_activated.rb +++ b/lib/workos/directory_sync/dsync_activated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncActivated - include HashProvider - + class DsyncActivated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class DsyncActivated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::DsyncActivatedData.new(hash[:data]) : nil diff --git a/lib/workos/directory_sync/dsync_activated_data.rb b/lib/workos/directory_sync/dsync_activated_data.rb index dfb2346b..b432c979 100644 --- a/lib/workos/directory_sync/dsync_activated_data.rb +++ b/lib/workos/directory_sync/dsync_activated_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncActivatedData - include HashProvider - + class DsyncActivatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class DsyncActivatedData :domains def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/directory_sync/dsync_activated_data_domain.rb b/lib/workos/directory_sync/dsync_activated_data_domain.rb index 1f96add5..f444b8a2 100644 --- a/lib/workos/directory_sync/dsync_activated_data_domain.rb +++ b/lib/workos/directory_sync/dsync_activated_data_domain.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncActivatedDataDomain - include HashProvider - + class DsyncActivatedDataDomain < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -20,8 +16,7 @@ class DsyncActivatedDataDomain :domain def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @domain = hash[:domain] diff --git a/lib/workos/directory_sync/dsync_deactivated.rb b/lib/workos/directory_sync/dsync_deactivated.rb index a8213e49..7955aad0 100644 --- a/lib/workos/directory_sync/dsync_deactivated.rb +++ b/lib/workos/directory_sync/dsync_deactivated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncDeactivated - include HashProvider - + class DsyncDeactivated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class DsyncDeactivated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::DsyncDeactivatedData.new(hash[:data]) : nil diff --git a/lib/workos/directory_sync/dsync_deactivated_data.rb b/lib/workos/directory_sync/dsync_deactivated_data.rb index c43d5233..afe57f6c 100644 --- a/lib/workos/directory_sync/dsync_deactivated_data.rb +++ b/lib/workos/directory_sync/dsync_deactivated_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncDeactivatedData - include HashProvider - + class DsyncDeactivatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class DsyncDeactivatedData :domains def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/directory_sync/dsync_deleted.rb b/lib/workos/directory_sync/dsync_deleted.rb index 1dd32454..71048d2c 100644 --- a/lib/workos/directory_sync/dsync_deleted.rb +++ b/lib/workos/directory_sync/dsync_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncDeleted - include HashProvider - + class DsyncDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class DsyncDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::DsyncDeletedData.new(hash[:data]) : nil diff --git a/lib/workos/directory_sync/dsync_deleted_data.rb b/lib/workos/directory_sync/dsync_deleted_data.rb index 488db3bf..24172251 100644 --- a/lib/workos/directory_sync/dsync_deleted_data.rb +++ b/lib/workos/directory_sync/dsync_deleted_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncDeletedData - include HashProvider - + class DsyncDeletedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -30,8 +26,7 @@ class DsyncDeletedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/directory_sync/dsync_group_created.rb b/lib/workos/directory_sync/dsync_group_created.rb index 2d7bc179..796aa890 100644 --- a/lib/workos/directory_sync/dsync_group_created.rb +++ b/lib/workos/directory_sync/dsync_group_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncGroupCreated - include HashProvider - + class DsyncGroupCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class DsyncGroupCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::DirectoryGroup.new(hash[:data]) : nil diff --git a/lib/workos/directory_sync/dsync_group_deleted.rb b/lib/workos/directory_sync/dsync_group_deleted.rb index 2ede2801..71ad0b07 100644 --- a/lib/workos/directory_sync/dsync_group_deleted.rb +++ b/lib/workos/directory_sync/dsync_group_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncGroupDeleted - include HashProvider - + class DsyncGroupDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class DsyncGroupDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::DirectoryGroup.new(hash[:data]) : nil diff --git a/lib/workos/directory_sync/dsync_group_updated.rb b/lib/workos/directory_sync/dsync_group_updated.rb index 454f7730..f6e549f7 100644 --- a/lib/workos/directory_sync/dsync_group_updated.rb +++ b/lib/workos/directory_sync/dsync_group_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncGroupUpdated - include HashProvider - + class DsyncGroupUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class DsyncGroupUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::DsyncGroupUpdatedData.new(hash[:data]) : nil diff --git a/lib/workos/directory_sync/dsync_group_updated_data.rb b/lib/workos/directory_sync/dsync_group_updated_data.rb index 225e743e..485abbbc 100644 --- a/lib/workos/directory_sync/dsync_group_updated_data.rb +++ b/lib/workos/directory_sync/dsync_group_updated_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncGroupUpdatedData - include HashProvider - + class DsyncGroupUpdatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class DsyncGroupUpdatedData :previous_attributes def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @idp_id = hash[:idp_id] diff --git a/lib/workos/directory_sync/dsync_group_user_added.rb b/lib/workos/directory_sync/dsync_group_user_added.rb index 10c9e6bd..b43325eb 100644 --- a/lib/workos/directory_sync/dsync_group_user_added.rb +++ b/lib/workos/directory_sync/dsync_group_user_added.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncGroupUserAdded - include HashProvider - + class DsyncGroupUserAdded < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class DsyncGroupUserAdded :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::DsyncGroupUserAddedData.new(hash[:data]) : nil diff --git a/lib/workos/directory_sync/dsync_group_user_added_data.rb b/lib/workos/directory_sync/dsync_group_user_added_data.rb index 04bb925e..aab4db3c 100644 --- a/lib/workos/directory_sync/dsync_group_user_added_data.rb +++ b/lib/workos/directory_sync/dsync_group_user_added_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncGroupUserAddedData - include HashProvider - + class DsyncGroupUserAddedData < WorkOS::Types::BaseModel HASH_ATTRS = { directory_id: :directory_id, user: :user, @@ -20,8 +16,7 @@ class DsyncGroupUserAddedData :group def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @directory_id = hash[:directory_id] @user = hash[:user] ? WorkOS::DirectoryUser.new(hash[:user]) : nil @group = hash[:group] ? WorkOS::DirectoryGroup.new(hash[:group]) : nil diff --git a/lib/workos/directory_sync/dsync_group_user_removed.rb b/lib/workos/directory_sync/dsync_group_user_removed.rb index d4cbae31..9b65fd90 100644 --- a/lib/workos/directory_sync/dsync_group_user_removed.rb +++ b/lib/workos/directory_sync/dsync_group_user_removed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncGroupUserRemoved - include HashProvider - + class DsyncGroupUserRemoved < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class DsyncGroupUserRemoved :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::DsyncGroupUserRemovedData.new(hash[:data]) : nil diff --git a/lib/workos/directory_sync/dsync_user_created.rb b/lib/workos/directory_sync/dsync_user_created.rb index 456f6751..6bde4dcb 100644 --- a/lib/workos/directory_sync/dsync_user_created.rb +++ b/lib/workos/directory_sync/dsync_user_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncUserCreated - include HashProvider - + class DsyncUserCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class DsyncUserCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::DirectoryUser.new(hash[:data]) : nil diff --git a/lib/workos/directory_sync/dsync_user_deleted.rb b/lib/workos/directory_sync/dsync_user_deleted.rb index 662923c6..b25ee2f8 100644 --- a/lib/workos/directory_sync/dsync_user_deleted.rb +++ b/lib/workos/directory_sync/dsync_user_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncUserDeleted - include HashProvider - + class DsyncUserDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class DsyncUserDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::DirectoryUser.new(hash[:data]) : nil diff --git a/lib/workos/directory_sync/dsync_user_updated.rb b/lib/workos/directory_sync/dsync_user_updated.rb index 6d8ed918..a4d24305 100644 --- a/lib/workos/directory_sync/dsync_user_updated.rb +++ b/lib/workos/directory_sync/dsync_user_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncUserUpdated - include HashProvider - + class DsyncUserUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class DsyncUserUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::DsyncUserUpdatedData.new(hash[:data]) : nil diff --git a/lib/workos/directory_sync/dsync_user_updated_data.rb b/lib/workos/directory_sync/dsync_user_updated_data.rb index 74b8e6cc..8298a54c 100644 --- a/lib/workos/directory_sync/dsync_user_updated_data.rb +++ b/lib/workos/directory_sync/dsync_user_updated_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DsyncUserUpdatedData - include HashProvider - + class DsyncUserUpdatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -57,36 +53,35 @@ class DsyncUserUpdatedData :previous_attributes def emails - warn "[DEPRECATION] `emails` is deprecated. A list of email addresses for the user.", uplevel: 1 + warn "[DEPRECATION] `emails` is deprecated and will be removed in a future version.", uplevel: 1 @emails end attr_writer :emails def job_title - warn "[DEPRECATION] `job_title` is deprecated. The job title of the user.", uplevel: 1 + warn "[DEPRECATION] `job_title` is deprecated and will be removed in a future version.", uplevel: 1 @job_title end attr_writer :job_title def username - warn "[DEPRECATION] `username` is deprecated. The username of the user.", uplevel: 1 + warn "[DEPRECATION] `username` is deprecated and will be removed in a future version.", uplevel: 1 @username end attr_writer :username def raw_attributes - warn "[DEPRECATION] `raw_attributes` is deprecated. The raw attributes received from the directory provider.", uplevel: 1 + warn "[DEPRECATION] `raw_attributes` is deprecated and will be removed in a future version.", uplevel: 1 @raw_attributes end attr_writer :raw_attributes def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @directory_id = hash[:directory_id] diff --git a/lib/workos/events.rb b/lib/workos/events.rb index 05f87d13..fbe5f618 100644 --- a/lib/workos/events.rb +++ b/lib/workos/events.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -20,8 +19,8 @@ def initialize(client) # @param range_start [String, nil] ISO-8601 date string to filter events created after this date. # @param range_end [String, nil] ISO-8601 date string to filter events created before this date. # @param organization_id [String, nil] Filter events by the [Organization](https://workos.com/docs/reference/organization) that the event is associated with. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_events( before: nil, after: nil, @@ -43,15 +42,14 @@ def list_events( "range_end" => range_end, "organization_id" => organization_id }.compact - response = @client.execute_request( - request: @client.get_request(path: "/events", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/events", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::EventSchema.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_events( before: before, after: cursor, @@ -63,8 +61,13 @@ def list_events( organization_id: organization_id, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, events: events, range_start: range_start, range_end: range_end, organization_id: organization_id}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::EventSchema, + filters: {before: before, limit: limit, order: order, events: events, range_start: range_start, range_end: range_end, organization_id: organization_id}, + fetch_next: fetch_next + ) end end end diff --git a/lib/workos/events/event_list_list_metadata.rb b/lib/workos/events/event_list_list_metadata.rb index 07dae44e..47625502 100644 --- a/lib/workos/events/event_list_list_metadata.rb +++ b/lib/workos/events/event_list_list_metadata.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EventListListMetadata - include HashProvider - + class EventListListMetadata < WorkOS::Types::BaseModel HASH_ATTRS = { after: :after }.freeze @@ -15,8 +11,7 @@ class EventListListMetadata attr_accessor :after def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @after = hash[:after] end end diff --git a/lib/workos/events/event_schema.rb b/lib/workos/events/event_schema.rb index 7c035608..f965dea5 100644 --- a/lib/workos/events/event_schema.rb +++ b/lib/workos/events/event_schema.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EventSchema - include HashProvider - + class EventSchema < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -26,8 +22,7 @@ class EventSchema :context def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @event = hash[:event] diff --git a/lib/workos/feature_flags.rb b/lib/workos/feature_flags.rb index 0503e5dc..e1b1a195 100644 --- a/lib/workos/feature_flags.rb +++ b/lib/workos/feature_flags.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -16,8 +15,8 @@ def initialize(client) # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::FeatureFlagsOrder, nil] Order the results by the creation time. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_feature_flags( before: nil, after: nil, @@ -31,15 +30,14 @@ def list_feature_flags( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/feature-flags", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/feature-flags", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::Flag.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_feature_flags( before: before, after: cursor, @@ -47,67 +45,86 @@ def list_feature_flags( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::Flag, + filters: {before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # Get a feature flag # @param slug [String] A unique key to reference the Feature Flag. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Flag] def get_feature_flag( slug:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/feature-flags/#{CGI.escape(slug.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}", + auth: true, request_options: request_options ) - WorkOS::Flag.new(response.body) + result = WorkOS::Flag.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Disable a feature flag # @param slug [String] A unique key to reference the Feature Flag. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::FeatureFlag] def disable_feature_flag( slug:, request_options: {} ) - response = @client.execute_request( - request: @client.put_request(path: "/feature-flags/#{CGI.escape(slug.to_s)}/disable", auth: true, request_options: request_options), + response = @client.request( + method: :put, + path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/disable", + auth: true, request_options: request_options ) - WorkOS::FeatureFlag.new(response.body) + result = WorkOS::FeatureFlag.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Enable a feature flag # @param slug [String] A unique key to reference the Feature Flag. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::FeatureFlag] def enable_feature_flag( slug:, request_options: {} ) - response = @client.execute_request( - request: @client.put_request(path: "/feature-flags/#{CGI.escape(slug.to_s)}/enable", auth: true, request_options: request_options), + response = @client.request( + method: :put, + path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/enable", + auth: true, request_options: request_options ) - WorkOS::FeatureFlag.new(response.body) + result = WorkOS::FeatureFlag.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Add a feature flag target # @param resource_id [String] The resource ID in format "user_" or "org_". # @param slug [String] The unique slug identifier of the feature flag. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def add_flag_target( resource_id:, slug:, request_options: {} ) - @client.execute_request( - request: @client.post_request(path: "/feature-flags/#{CGI.escape(slug.to_s)}/targets/#{CGI.escape(resource_id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :post, + path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/targets/#{WorkOS::Util.encode_path(resource_id)}", + auth: true, request_options: request_options ) nil @@ -116,15 +133,17 @@ def add_flag_target( # Remove a feature flag target # @param resource_id [String] The resource ID in format "user_" or "org_". # @param slug [String] The unique slug identifier of the feature flag. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def remove_flag_target( resource_id:, slug:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/feature-flags/#{CGI.escape(slug.to_s)}/targets/#{CGI.escape(resource_id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/feature-flags/#{WorkOS::Util.encode_path(slug)}/targets/#{WorkOS::Util.encode_path(resource_id)}", + auth: true, request_options: request_options ) nil @@ -136,8 +155,8 @@ def remove_flag_target( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::OrganizationsFeatureFlagsOrder, nil] Order the results by the creation time. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_organization_feature_flags( organization_id:, before: nil, @@ -152,15 +171,14 @@ def list_organization_feature_flags( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/organizations/#{CGI.escape(organization_id.to_s)}/feature-flags", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/feature-flags", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::Flag.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_organization_feature_flags( organization_id: organization_id, before: before, @@ -169,8 +187,13 @@ def list_organization_feature_flags( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {organization_id: organization_id, before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::Flag, + filters: {organization_id: organization_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # List enabled feature flags for a user @@ -179,8 +202,8 @@ def list_organization_feature_flags( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::UserManagementUsersFeatureFlagsOrder, nil] Order the results by the creation time. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_user_feature_flags( user_id:, before: nil, @@ -195,15 +218,14 @@ def list_user_feature_flags( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/feature-flags", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/feature-flags", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::Flag.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_user_feature_flags( user_id: user_id, before: before, @@ -212,8 +234,13 @@ def list_user_feature_flags( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {user_id: user_id, before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::Flag, + filters: {user_id: user_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end end end diff --git a/lib/workos/feature_flags/feature_flag.rb b/lib/workos/feature_flags/feature_flag.rb index e1cd05e2..126ebcb9 100644 --- a/lib/workos/feature_flags/feature_flag.rb +++ b/lib/workos/feature_flags/feature_flag.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FeatureFlag - include HashProvider - + class FeatureFlag < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -36,8 +32,7 @@ class FeatureFlag :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @slug = hash[:slug] diff --git a/lib/workos/feature_flags/feature_flag_owner.rb b/lib/workos/feature_flags/feature_flag_owner.rb index 84ad995e..5b995a3f 100644 --- a/lib/workos/feature_flags/feature_flag_owner.rb +++ b/lib/workos/feature_flags/feature_flag_owner.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FeatureFlagOwner - include HashProvider - + class FeatureFlagOwner < WorkOS::Types::BaseModel HASH_ATTRS = { email: :email, first_name: :first_name, @@ -20,8 +16,7 @@ class FeatureFlagOwner :last_name def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] diff --git a/lib/workos/feature_flags/flag_created.rb b/lib/workos/feature_flags/flag_created.rb index 6e76fa16..c9bb4782 100644 --- a/lib/workos/feature_flags/flag_created.rb +++ b/lib/workos/feature_flags/flag_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagCreated - include HashProvider - + class FlagCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class FlagCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::FlagCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/feature_flags/flag_created_context.rb b/lib/workos/feature_flags/flag_created_context.rb index 82c04aad..c3d9efb8 100644 --- a/lib/workos/feature_flags/flag_created_context.rb +++ b/lib/workos/feature_flags/flag_created_context.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagCreatedContext - include HashProvider - + class FlagCreatedContext < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, actor: :actor @@ -18,8 +14,7 @@ class FlagCreatedContext :actor def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @actor = hash[:actor] ? WorkOS::FlagCreatedContextActor.new(hash[:actor]) : nil end diff --git a/lib/workos/feature_flags/flag_created_context_actor.rb b/lib/workos/feature_flags/flag_created_context_actor.rb index bc848b12..115493a9 100644 --- a/lib/workos/feature_flags/flag_created_context_actor.rb +++ b/lib/workos/feature_flags/flag_created_context_actor.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagCreatedContextActor - include HashProvider - + class FlagCreatedContextActor < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, source: :source, @@ -20,8 +16,7 @@ class FlagCreatedContextActor :name def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @source = hash[:source] @name = hash[:name] diff --git a/lib/workos/feature_flags/flag_created_data.rb b/lib/workos/feature_flags/flag_created_data.rb index 17fb7c57..e2ada050 100644 --- a/lib/workos/feature_flags/flag_created_data.rb +++ b/lib/workos/feature_flags/flag_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagCreatedData - include HashProvider - + class FlagCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -38,8 +34,7 @@ class FlagCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @environment_id = hash[:environment_id] diff --git a/lib/workos/feature_flags/flag_deleted.rb b/lib/workos/feature_flags/flag_deleted.rb index ff1c9f30..8703a07b 100644 --- a/lib/workos/feature_flags/flag_deleted.rb +++ b/lib/workos/feature_flags/flag_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagDeleted - include HashProvider - + class FlagDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class FlagDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::FlagDeletedData.new(hash[:data]) : nil diff --git a/lib/workos/feature_flags/flag_deleted_context.rb b/lib/workos/feature_flags/flag_deleted_context.rb index e8e7a3fd..104b9369 100644 --- a/lib/workos/feature_flags/flag_deleted_context.rb +++ b/lib/workos/feature_flags/flag_deleted_context.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagDeletedContext - include HashProvider - + class FlagDeletedContext < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, actor: :actor @@ -18,8 +14,7 @@ class FlagDeletedContext :actor def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @actor = hash[:actor] ? WorkOS::FlagDeletedContextActor.new(hash[:actor]) : nil end diff --git a/lib/workos/feature_flags/flag_deleted_context_actor.rb b/lib/workos/feature_flags/flag_deleted_context_actor.rb index 727dd10f..1c08635c 100644 --- a/lib/workos/feature_flags/flag_deleted_context_actor.rb +++ b/lib/workos/feature_flags/flag_deleted_context_actor.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagDeletedContextActor - include HashProvider - + class FlagDeletedContextActor < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, source: :source, @@ -20,8 +16,7 @@ class FlagDeletedContextActor :name def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @source = hash[:source] @name = hash[:name] diff --git a/lib/workos/feature_flags/flag_rule_updated.rb b/lib/workos/feature_flags/flag_rule_updated.rb index fdb1d3e0..f87d2363 100644 --- a/lib/workos/feature_flags/flag_rule_updated.rb +++ b/lib/workos/feature_flags/flag_rule_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagRuleUpdated - include HashProvider - + class FlagRuleUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class FlagRuleUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::FlagRuleUpdatedData.new(hash[:data]) : nil diff --git a/lib/workos/feature_flags/flag_rule_updated_context.rb b/lib/workos/feature_flags/flag_rule_updated_context.rb index 2f33af0f..01d49432 100644 --- a/lib/workos/feature_flags/flag_rule_updated_context.rb +++ b/lib/workos/feature_flags/flag_rule_updated_context.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagRuleUpdatedContext - include HashProvider - + class FlagRuleUpdatedContext < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, actor: :actor, @@ -24,8 +20,7 @@ class FlagRuleUpdatedContext :previous_attributes def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @actor = hash[:actor] ? WorkOS::FlagRuleUpdatedContextActor.new(hash[:actor]) : nil @access_type = hash[:access_type] diff --git a/lib/workos/feature_flags/flag_rule_updated_context_actor.rb b/lib/workos/feature_flags/flag_rule_updated_context_actor.rb index 88c23f39..d904b983 100644 --- a/lib/workos/feature_flags/flag_rule_updated_context_actor.rb +++ b/lib/workos/feature_flags/flag_rule_updated_context_actor.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagRuleUpdatedContextActor - include HashProvider - + class FlagRuleUpdatedContextActor < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, source: :source, @@ -20,8 +16,7 @@ class FlagRuleUpdatedContextActor :name def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @source = hash[:source] @name = hash[:name] diff --git a/lib/workos/feature_flags/flag_rule_updated_context_configured_target.rb b/lib/workos/feature_flags/flag_rule_updated_context_configured_target.rb index adec82aa..2ab51a5f 100644 --- a/lib/workos/feature_flags/flag_rule_updated_context_configured_target.rb +++ b/lib/workos/feature_flags/flag_rule_updated_context_configured_target.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagRuleUpdatedContextConfiguredTarget - include HashProvider - + class FlagRuleUpdatedContextConfiguredTarget < WorkOS::Types::BaseModel HASH_ATTRS = { organizations: :organizations, users: :users @@ -18,8 +14,7 @@ class FlagRuleUpdatedContextConfiguredTarget :users def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @organizations = (hash[:organizations] || []).map { |item| item ? WorkOS::FlagRuleUpdatedContextConfiguredTargetOrganization.new(item) : nil } @users = (hash[:users] || []).map { |item| item ? WorkOS::FlagRuleUpdatedContextConfiguredTargetUser.new(item) : nil } end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb b/lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb index 1cc709d6..8f915fcf 100644 --- a/lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb +++ b/lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagRuleUpdatedContextConfiguredTargetOrganization - include HashProvider - + class FlagRuleUpdatedContextConfiguredTargetOrganization < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, name: :name @@ -18,8 +14,7 @@ class FlagRuleUpdatedContextConfiguredTargetOrganization :name def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @name = hash[:name] end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_configured_target_user.rb b/lib/workos/feature_flags/flag_rule_updated_context_configured_target_user.rb index a5abf15c..d9b257a4 100644 --- a/lib/workos/feature_flags/flag_rule_updated_context_configured_target_user.rb +++ b/lib/workos/feature_flags/flag_rule_updated_context_configured_target_user.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagRuleUpdatedContextConfiguredTargetUser - include HashProvider - + class FlagRuleUpdatedContextConfiguredTargetUser < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, email: :email @@ -18,8 +14,7 @@ class FlagRuleUpdatedContextConfiguredTargetUser :email def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @email = hash[:email] end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute.rb b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute.rb index cc257f0e..1f09fbf5 100644 --- a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute.rb +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagRuleUpdatedContextPreviousAttribute - include HashProvider - + class FlagRuleUpdatedContextPreviousAttribute < WorkOS::Types::BaseModel HASH_ATTRS = { data: :data, context: :context @@ -18,8 +14,7 @@ class FlagRuleUpdatedContextPreviousAttribute :context def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @data = hash[:data] ? WorkOS::FlagRuleUpdatedContextPreviousAttributeData.new(hash[:data]) : nil @context = hash[:context] ? WorkOS::FlagRuleUpdatedContextPreviousAttributeContext.new(hash[:context]) : nil end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context.rb b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context.rb index 905a70f7..76a4940a 100644 --- a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context.rb +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagRuleUpdatedContextPreviousAttributeContext - include HashProvider - + class FlagRuleUpdatedContextPreviousAttributeContext < WorkOS::Types::BaseModel HASH_ATTRS = { access_type: :access_type, configured_targets: :configured_targets @@ -18,8 +14,7 @@ class FlagRuleUpdatedContextPreviousAttributeContext :configured_targets def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @access_type = hash[:access_type] @configured_targets = hash[:configured_targets] ? WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.new(hash[:configured_targets]) : nil end diff --git a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_data.rb b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_data.rb index 871f54c9..7f666491 100644 --- a/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_data.rb +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagRuleUpdatedContextPreviousAttributeData - include HashProvider - + class FlagRuleUpdatedContextPreviousAttributeData < WorkOS::Types::BaseModel HASH_ATTRS = { enabled: :enabled, default_value: :default_value @@ -18,8 +14,7 @@ class FlagRuleUpdatedContextPreviousAttributeData :default_value def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @enabled = hash[:enabled] @default_value = hash[:default_value] end diff --git a/lib/workos/feature_flags/flag_updated.rb b/lib/workos/feature_flags/flag_updated.rb index 8ce9422a..488c9604 100644 --- a/lib/workos/feature_flags/flag_updated.rb +++ b/lib/workos/feature_flags/flag_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagUpdated - include HashProvider - + class FlagUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class FlagUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::FlagUpdatedData.new(hash[:data]) : nil diff --git a/lib/workos/feature_flags/flag_updated_context.rb b/lib/workos/feature_flags/flag_updated_context.rb index f298b5b7..fa1932cd 100644 --- a/lib/workos/feature_flags/flag_updated_context.rb +++ b/lib/workos/feature_flags/flag_updated_context.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagUpdatedContext - include HashProvider - + class FlagUpdatedContext < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, actor: :actor, @@ -20,8 +16,7 @@ class FlagUpdatedContext :previous_attributes def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @actor = hash[:actor] ? WorkOS::FlagUpdatedContextActor.new(hash[:actor]) : nil @previous_attributes = hash[:previous_attributes] ? WorkOS::FlagUpdatedContextPreviousAttribute.new(hash[:previous_attributes]) : nil diff --git a/lib/workos/feature_flags/flag_updated_context_actor.rb b/lib/workos/feature_flags/flag_updated_context_actor.rb index 08f3408d..368a082e 100644 --- a/lib/workos/feature_flags/flag_updated_context_actor.rb +++ b/lib/workos/feature_flags/flag_updated_context_actor.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagUpdatedContextActor - include HashProvider - + class FlagUpdatedContextActor < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, source: :source, @@ -20,8 +16,7 @@ class FlagUpdatedContextActor :name def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @source = hash[:source] @name = hash[:name] diff --git a/lib/workos/feature_flags/flag_updated_context_previous_attribute.rb b/lib/workos/feature_flags/flag_updated_context_previous_attribute.rb index 241c8b9d..4bdb14ee 100644 --- a/lib/workos/feature_flags/flag_updated_context_previous_attribute.rb +++ b/lib/workos/feature_flags/flag_updated_context_previous_attribute.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagUpdatedContextPreviousAttribute - include HashProvider - + class FlagUpdatedContextPreviousAttribute < WorkOS::Types::BaseModel HASH_ATTRS = { data: :data }.freeze @@ -15,8 +11,7 @@ class FlagUpdatedContextPreviousAttribute attr_accessor :data def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @data = hash[:data] ? WorkOS::FlagUpdatedContextPreviousAttributeData.new(hash[:data]) : nil end end diff --git a/lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb b/lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb index 589ac92f..394cd75f 100644 --- a/lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb +++ b/lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class FlagUpdatedContextPreviousAttributeData - include HashProvider - + class FlagUpdatedContextPreviousAttributeData < WorkOS::Types::BaseModel HASH_ATTRS = { name: :name, description: :description, @@ -24,8 +20,7 @@ class FlagUpdatedContextPreviousAttributeData :default_value def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @name = hash[:name] @description = hash[:description] @tags = hash[:tags] || [] diff --git a/lib/workos/inflections.rb b/lib/workos/inflections.rb new file mode 100644 index 00000000..bfcd121c --- /dev/null +++ b/lib/workos/inflections.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# Zeitwerk inflection overrides for the WorkOS gem. +# Maps file basenames to class/module names where the default +# CamelCase inference disagrees with the canonical class name. +WORKOS_INFLECTIONS = { + "authenticate_response_oauth_token" => "AuthenticateResponseOAuthToken", + "authentication_mfa_failed" => "AuthenticationMFAFailed", + "authentication_mfa_failed_data" => "AuthenticationMFAFailedData", + "authentication_mfa_failed_data_error" => "AuthenticationMFAFailedDataError", + "authentication_mfa_succeeded" => "AuthenticationMFASucceeded", + "authentication_mfa_succeeded_data" => "AuthenticationMFASucceededData", + "authentication_oauth_failed" => "AuthenticationOAuthFailed", + "authentication_oauth_failed_data" => "AuthenticationOAuthFailedData", + "authentication_oauth_failed_data_error" => "AuthenticationOAuthFailedDataError", + "authentication_oauth_succeeded" => "AuthenticationOAuthSucceeded", + "authentication_oauth_succeeded_data" => "AuthenticationOAuthSucceededData", + "authentication_sso_failed" => "AuthenticationSSOFailed", + "authentication_sso_failed_data" => "AuthenticationSSOFailedData", + "authentication_sso_failed_data_error" => "AuthenticationSSOFailedDataError", + "authentication_sso_failed_data_sso" => "AuthenticationSSOFailedDataSSO", + "authentication_sso_started" => "AuthenticationSSOStarted", + "authentication_sso_started_data" => "AuthenticationSSOStartedData", + "authentication_sso_started_data_sso" => "AuthenticationSSOStartedDataSSO", + "authentication_sso_succeeded" => "AuthenticationSSOSucceeded", + "authentication_sso_succeeded_data" => "AuthenticationSSOSucceededData", + "authentication_sso_succeeded_data_sso" => "AuthenticationSSOSucceededDataSSO", + "authentication_sso_timed_out" => "AuthenticationSSOTimedOut", + "authentication_sso_timed_out_data" => "AuthenticationSSOTimedOutData", + "authentication_sso_timed_out_data_error" => "AuthenticationSSOTimedOutDataError", + "authentication_sso_timed_out_data_sso" => "AuthenticationSSOTimedOutDataSSO", + "connection_saml_certificate_renewal_required" => "ConnectionSAMLCertificateRenewalRequired", + "connection_saml_certificate_renewal_required_data" => "ConnectionSAMLCertificateRenewalRequiredData", + "connection_saml_certificate_renewal_required_data_certificate" => "ConnectionSAMLCertificateRenewalRequiredDataCertificate", + "connection_saml_certificate_renewal_required_data_certificate_certificate_type" => "ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType", + "connection_saml_certificate_renewal_required_data_connection" => "ConnectionSAMLCertificateRenewalRequiredDataConnection", + "connection_saml_certificate_renewed" => "ConnectionSAMLCertificateRenewed", + "connection_saml_certificate_renewed_data" => "ConnectionSAMLCertificateRenewedData", + "connection_saml_certificate_renewed_data_certificate" => "ConnectionSAMLCertificateRenewedDataCertificate", + "connection_saml_certificate_renewed_data_certificate_certificate_type" => "ConnectionSAMLCertificateRenewedDataCertificateCertificateType", + "connection_saml_certificate_renewed_data_connection" => "ConnectionSAMLCertificateRenewedDataConnection", + "cors_origin_response" => "CORSOriginResponse", + "create_cors_origin" => "CreateCORSOrigin", + "create_m2m_application" => "CreateM2MApplication", + "create_oauth_application" => "CreateOAuthApplication", + "jwt_template_response" => "JWTTemplateResponse", + "m2m" => "M2M", + "mfa_totp_session_authenticate_request" => "MFATotpSessionAuthenticateRequest", + "pkce" => "PKCE", + "sso" => "SSO", + "sso_authorize_url_response" => "SSOAuthorizeUrlResponse", + "sso_device_authorization_request" => "SSODeviceAuthorizationRequest", + "sso_intent_options" => "SSOIntentOptions", + "sso_logout_authorize_request" => "SSOLogoutAuthorizeRequest", + "sso_logout_authorize_response" => "SSOLogoutAuthorizeResponse", + "sso_provider" => "SSOProvider", + "sso_token_response" => "SSOTokenResponse", + "sso_token_response_oauth_token" => "SSOTokenResponseOAuthToken", + "update_jwt_template" => "UpdateJWTTemplate", + "update_oauth_application" => "UpdateOAuthApplication", + "workos" => "WorkOS" +}.freeze diff --git a/lib/workos/multi_factor_auth.rb b/lib/workos/multi_factor_auth.rb index 85f78faf..93f2f6ea 100644 --- a/lib/workos/multi_factor_auth.rb +++ b/lib/workos/multi_factor_auth.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -14,7 +13,7 @@ def initialize(client) # Verify Challenge # @param id [String] The unique ID of the Authentication Challenge. # @param code [String] The one-time code to verify. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthenticationChallengeVerifyResponse] def verify_challenge( id:, @@ -24,11 +23,16 @@ def verify_challenge( body = { "code" => code }.compact - response = @client.execute_request( - request: @client.post_request(path: "/auth/challenges/#{CGI.escape(id.to_s)}/verify", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/auth/challenges/#{WorkOS::Util.encode_path(id)}/verify", + auth: true, + body: body, request_options: request_options ) - WorkOS::AuthenticationChallengeVerifyResponse.new(response.body) + result = WorkOS::AuthenticationChallengeVerifyResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Enroll Factor @@ -37,7 +41,7 @@ def verify_challenge( # @param totp_issuer [String, nil] Required when type is 'totp'. # @param totp_user [String, nil] Required when type is 'totp'. # @param user_id [String, nil] The ID of the user to associate the factor with. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthenticationFactorEnrolled] def enroll_factor( type:, @@ -54,38 +58,49 @@ def enroll_factor( "totp_user" => totp_user, "user_id" => user_id }.compact - response = @client.execute_request( - request: @client.post_request(path: "/auth/factors/enroll", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/auth/factors/enroll", + auth: true, + body: body, request_options: request_options ) - WorkOS::AuthenticationFactorEnrolled.new(response.body) + result = WorkOS::AuthenticationFactorEnrolled.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get Factor # @param id [String] The unique ID of the Factor. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthenticationFactor] def get_factor( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/auth/factors/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/auth/factors/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::AuthenticationFactor.new(response.body) + result = WorkOS::AuthenticationFactor.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete Factor # @param id [String] The unique ID of the Factor. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_factor( id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/auth/factors/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/auth/factors/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) nil @@ -94,7 +109,7 @@ def delete_factor( # Challenge Factor # @param id [String] The unique ID of the Authentication Factor to be challenged. # @param sms_template [String, nil] A custom template for the SMS message. Use the {{code}} placeholder to include the verification code. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthenticationChallenge] def challenge_factor( id:, @@ -104,11 +119,16 @@ def challenge_factor( body = { "sms_template" => sms_template }.compact - response = @client.execute_request( - request: @client.post_request(path: "/auth/factors/#{CGI.escape(id.to_s)}/challenge", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/auth/factors/#{WorkOS::Util.encode_path(id)}/challenge", + auth: true, + body: body, request_options: request_options ) - WorkOS::AuthenticationChallenge.new(response.body) + result = WorkOS::AuthenticationChallenge.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # List authentication factors @@ -117,8 +137,8 @@ def challenge_factor( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::UserManagementMultiFactorAuthenticationOrder, nil] Order the results by the creation time. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_user_auth_factors( userland_user_id:, before: nil, @@ -133,15 +153,14 @@ def list_user_auth_factors( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/user_management/users/#{CGI.escape(userland_user_id.to_s)}/auth_factors", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/users/#{WorkOS::Util.encode_path(userland_user_id)}/auth_factors", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::AuthenticationFactor.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_user_auth_factors( userland_user_id: userland_user_id, before: before, @@ -150,8 +169,13 @@ def list_user_auth_factors( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {userland_user_id: userland_user_id, before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::AuthenticationFactor, + filters: {userland_user_id: userland_user_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # Enroll an authentication factor @@ -160,7 +184,7 @@ def list_user_auth_factors( # @param totp_issuer [String, nil] Your application or company name displayed in the user's authenticator app. # @param totp_user [String, nil] The user's account name displayed in their authenticator app. # @param totp_secret [String, nil] The Base32-encoded shared secret for TOTP factors. This can be provided when creating the auth factor, otherwise it will be generated. The algorithm used to derive TOTP codes is SHA-1, the code length is 6 digits, and the timestep is 30 seconds – the secret must be compatible with these parameters. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::UserAuthenticationFactorEnrollResponse] def create_user_auth_factor( userland_user_id:, @@ -176,11 +200,16 @@ def create_user_auth_factor( "totp_user" => totp_user, "totp_secret" => totp_secret }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/users/#{CGI.escape(userland_user_id.to_s)}/auth_factors", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/users/#{WorkOS::Util.encode_path(userland_user_id)}/auth_factors", + auth: true, + body: body, request_options: request_options ) - WorkOS::UserAuthenticationFactorEnrollResponse.new(response.body) + result = WorkOS::UserAuthenticationFactorEnrollResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end end end diff --git a/lib/workos/multi_factor_auth/authentication_challenge.rb b/lib/workos/multi_factor_auth/authentication_challenge.rb index 283e52cb..d04cec17 100644 --- a/lib/workos/multi_factor_auth/authentication_challenge.rb +++ b/lib/workos/multi_factor_auth/authentication_challenge.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationChallenge - include HashProvider - + class AuthenticationChallenge < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -28,8 +24,7 @@ class AuthenticationChallenge :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @expires_at = hash[:expires_at] diff --git a/lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb b/lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb index 61218c28..65878b64 100644 --- a/lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb +++ b/lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationChallengeVerifyResponse - include HashProvider - + class AuthenticationChallengeVerifyResponse < WorkOS::Types::BaseModel HASH_ATTRS = { challenge: :challenge, valid: :valid @@ -18,8 +14,7 @@ class AuthenticationChallengeVerifyResponse :valid def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @challenge = hash[:challenge] ? WorkOS::AuthenticationChallenge.new(hash[:challenge]) : nil @valid = hash[:valid] end diff --git a/lib/workos/multi_factor_auth/authentication_challenges_verify_request.rb b/lib/workos/multi_factor_auth/authentication_challenges_verify_request.rb index 63bd5209..43d397e8 100644 --- a/lib/workos/multi_factor_auth/authentication_challenges_verify_request.rb +++ b/lib/workos/multi_factor_auth/authentication_challenges_verify_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationChallengesVerifyRequest - include HashProvider - + class AuthenticationChallengesVerifyRequest < WorkOS::Types::BaseModel HASH_ATTRS = { code: :code }.freeze @@ -15,8 +11,7 @@ class AuthenticationChallengesVerifyRequest attr_accessor :code def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @code = hash[:code] end end diff --git a/lib/workos/multi_factor_auth/authentication_factor.rb b/lib/workos/multi_factor_auth/authentication_factor.rb index 55199012..5a229119 100644 --- a/lib/workos/multi_factor_auth/authentication_factor.rb +++ b/lib/workos/multi_factor_auth/authentication_factor.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationFactor - include HashProvider - + class AuthenticationFactor < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -30,8 +26,7 @@ class AuthenticationFactor :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @type = hash[:type] diff --git a/lib/workos/multi_factor_auth/authentication_factor_enrolled.rb b/lib/workos/multi_factor_auth/authentication_factor_enrolled.rb index 06f65a8a..f8ae8c86 100644 --- a/lib/workos/multi_factor_auth/authentication_factor_enrolled.rb +++ b/lib/workos/multi_factor_auth/authentication_factor_enrolled.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationFactorEnrolled - include HashProvider - + class AuthenticationFactorEnrolled < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -30,8 +26,7 @@ class AuthenticationFactorEnrolled :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @type = hash[:type] diff --git a/lib/workos/multi_factor_auth/authentication_factor_enrolled_sms.rb b/lib/workos/multi_factor_auth/authentication_factor_enrolled_sms.rb index e1e935de..f6265c4e 100644 --- a/lib/workos/multi_factor_auth/authentication_factor_enrolled_sms.rb +++ b/lib/workos/multi_factor_auth/authentication_factor_enrolled_sms.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationFactorEnrolledSms - include HashProvider - + class AuthenticationFactorEnrolledSms < WorkOS::Types::BaseModel HASH_ATTRS = { phone_number: :phone_number }.freeze @@ -15,8 +11,7 @@ class AuthenticationFactorEnrolledSms attr_accessor :phone_number def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @phone_number = hash[:phone_number] end end diff --git a/lib/workos/multi_factor_auth/authentication_factor_enrolled_totp.rb b/lib/workos/multi_factor_auth/authentication_factor_enrolled_totp.rb index cd5fe39e..b291f215 100644 --- a/lib/workos/multi_factor_auth/authentication_factor_enrolled_totp.rb +++ b/lib/workos/multi_factor_auth/authentication_factor_enrolled_totp.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationFactorEnrolledTotp - include HashProvider - + class AuthenticationFactorEnrolledTotp < WorkOS::Types::BaseModel HASH_ATTRS = { issuer: :issuer, user: :user, @@ -24,8 +20,7 @@ class AuthenticationFactorEnrolledTotp :uri def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @issuer = hash[:issuer] @user = hash[:user] @secret = hash[:secret] diff --git a/lib/workos/multi_factor_auth/authentication_factor_totp.rb b/lib/workos/multi_factor_auth/authentication_factor_totp.rb index 2ba358ea..56a3b06d 100644 --- a/lib/workos/multi_factor_auth/authentication_factor_totp.rb +++ b/lib/workos/multi_factor_auth/authentication_factor_totp.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationFactorTotp - include HashProvider - + class AuthenticationFactorTotp < WorkOS::Types::BaseModel HASH_ATTRS = { issuer: :issuer, user: :user @@ -18,8 +14,7 @@ class AuthenticationFactorTotp :user def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @issuer = hash[:issuer] @user = hash[:user] end diff --git a/lib/workos/multi_factor_auth/authentication_factors_create_request.rb b/lib/workos/multi_factor_auth/authentication_factors_create_request.rb index 1a268384..3668f7b2 100644 --- a/lib/workos/multi_factor_auth/authentication_factors_create_request.rb +++ b/lib/workos/multi_factor_auth/authentication_factors_create_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationFactorsCreateRequest - include HashProvider - + class AuthenticationFactorsCreateRequest < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, phone_number: :phone_number, @@ -24,8 +20,7 @@ class AuthenticationFactorsCreateRequest :user_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @phone_number = hash[:phone_number] @totp_issuer = hash[:totp_issuer] diff --git a/lib/workos/multi_factor_auth/challenge_authentication_factor.rb b/lib/workos/multi_factor_auth/challenge_authentication_factor.rb index f075460a..4b327792 100644 --- a/lib/workos/multi_factor_auth/challenge_authentication_factor.rb +++ b/lib/workos/multi_factor_auth/challenge_authentication_factor.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ChallengeAuthenticationFactor - include HashProvider - + class ChallengeAuthenticationFactor < WorkOS::Types::BaseModel HASH_ATTRS = { sms_template: :sms_template }.freeze @@ -15,8 +11,7 @@ class ChallengeAuthenticationFactor attr_accessor :sms_template def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @sms_template = hash[:sms_template] end end diff --git a/lib/workos/multi_factor_auth/enroll_user_authentication_factor.rb b/lib/workos/multi_factor_auth/enroll_user_authentication_factor.rb index 98fb5c64..fefc8fd5 100644 --- a/lib/workos/multi_factor_auth/enroll_user_authentication_factor.rb +++ b/lib/workos/multi_factor_auth/enroll_user_authentication_factor.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EnrollUserAuthenticationFactor - include HashProvider - + class EnrollUserAuthenticationFactor < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, totp_issuer: :totp_issuer, @@ -22,8 +18,7 @@ class EnrollUserAuthenticationFactor :totp_secret def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @totp_issuer = hash[:totp_issuer] @totp_user = hash[:totp_user] diff --git a/lib/workos/multi_factor_auth/user_authentication_factor_enroll_response.rb b/lib/workos/multi_factor_auth/user_authentication_factor_enroll_response.rb index 8b62dee6..3be11320 100644 --- a/lib/workos/multi_factor_auth/user_authentication_factor_enroll_response.rb +++ b/lib/workos/multi_factor_auth/user_authentication_factor_enroll_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserAuthenticationFactorEnrollResponse - include HashProvider - + class UserAuthenticationFactorEnrollResponse < WorkOS::Types::BaseModel HASH_ATTRS = { authentication_factor: :authentication_factor, authentication_challenge: :authentication_challenge @@ -18,8 +14,7 @@ class UserAuthenticationFactorEnrollResponse :authentication_challenge def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @authentication_factor = hash[:authentication_factor] ? WorkOS::AuthenticationFactorEnrolled.new(hash[:authentication_factor]) : nil @authentication_challenge = hash[:authentication_challenge] ? WorkOS::AuthenticationChallenge.new(hash[:authentication_challenge]) : nil end diff --git a/lib/workos/organization_domains.rb b/lib/workos/organization_domains.rb index 611abad1..05f5861f 100644 --- a/lib/workos/organization_domains.rb +++ b/lib/workos/organization_domains.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -14,7 +13,7 @@ def initialize(client) # Create an Organization Domain # @param domain [String] The domain to add to the organization. # @param organization_id [String] The ID of the organization to add the domain to. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::OrganizationDomain] def create_organization_domain( domain:, @@ -25,38 +24,49 @@ def create_organization_domain( "domain" => domain, "organization_id" => organization_id }.compact - response = @client.execute_request( - request: @client.post_request(path: "/organization_domains", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/organization_domains", + auth: true, + body: body, request_options: request_options ) - WorkOS::OrganizationDomain.new(response.body) + result = WorkOS::OrganizationDomain.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get an Organization Domain # @param id [String] Unique identifier of the organization domain. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::OrganizationDomainStandAlone] def get_organization_domain( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/organization_domains/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/organization_domains/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::OrganizationDomainStandAlone.new(response.body) + result = WorkOS::OrganizationDomainStandAlone.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete an Organization Domain # @param id [String] Unique identifier of the organization domain. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_organization_domain( id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/organization_domains/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/organization_domains/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) nil @@ -64,17 +74,21 @@ def delete_organization_domain( # Verify an Organization Domain # @param id [String] Unique identifier of the organization domain. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::OrganizationDomainStandAlone] def verify_organization_domain( id:, request_options: {} ) - response = @client.execute_request( - request: @client.post_request(path: "/organization_domains/#{CGI.escape(id.to_s)}/verify", auth: true, request_options: request_options), + response = @client.request( + method: :post, + path: "/organization_domains/#{WorkOS::Util.encode_path(id)}/verify", + auth: true, request_options: request_options ) - WorkOS::OrganizationDomainStandAlone.new(response.body) + result = WorkOS::OrganizationDomainStandAlone.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end end end diff --git a/lib/workos/organization_domains/create_organization_domain.rb b/lib/workos/organization_domains/create_organization_domain.rb index 114a7bdf..ba3c2b77 100644 --- a/lib/workos/organization_domains/create_organization_domain.rb +++ b/lib/workos/organization_domains/create_organization_domain.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateOrganizationDomain - include HashProvider - + class CreateOrganizationDomain < WorkOS::Types::BaseModel HASH_ATTRS = { domain: :domain, organization_id: :organization_id @@ -18,8 +14,7 @@ class CreateOrganizationDomain :organization_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @domain = hash[:domain] @organization_id = hash[:organization_id] end diff --git a/lib/workos/organization_domains/organization_domain.rb b/lib/workos/organization_domains/organization_domain.rb index de072ab7..c4698d13 100644 --- a/lib/workos/organization_domains/organization_domain.rb +++ b/lib/workos/organization_domains/organization_domain.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomain - include HashProvider - + class OrganizationDomain < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class OrganizationDomain :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/organization_domains/organization_domain_created.rb b/lib/workos/organization_domains/organization_domain_created.rb index bb5a2574..6fe193ea 100644 --- a/lib/workos/organization_domains/organization_domain_created.rb +++ b/lib/workos/organization_domains/organization_domain_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainCreated - include HashProvider - + class OrganizationDomainCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationDomainCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationDomainCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/organization_domains/organization_domain_created_data.rb b/lib/workos/organization_domains/organization_domain_created_data.rb index 238ee3da..8f1627fa 100644 --- a/lib/workos/organization_domains/organization_domain_created_data.rb +++ b/lib/workos/organization_domains/organization_domain_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainCreatedData - include HashProvider - + class OrganizationDomainCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class OrganizationDomainCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/organization_domains/organization_domain_deleted.rb b/lib/workos/organization_domains/organization_domain_deleted.rb index d8a330d6..b7944ed2 100644 --- a/lib/workos/organization_domains/organization_domain_deleted.rb +++ b/lib/workos/organization_domains/organization_domain_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainDeleted - include HashProvider - + class OrganizationDomainDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationDomainDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationDomainDeletedData.new(hash[:data]) : nil diff --git a/lib/workos/organization_domains/organization_domain_deleted_data.rb b/lib/workos/organization_domains/organization_domain_deleted_data.rb index 131680b1..570802e6 100644 --- a/lib/workos/organization_domains/organization_domain_deleted_data.rb +++ b/lib/workos/organization_domains/organization_domain_deleted_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainDeletedData - include HashProvider - + class OrganizationDomainDeletedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class OrganizationDomainDeletedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/organization_domains/organization_domain_stand_alone.rb b/lib/workos/organization_domains/organization_domain_stand_alone.rb index 21cee0f4..48cc33e3 100644 --- a/lib/workos/organization_domains/organization_domain_stand_alone.rb +++ b/lib/workos/organization_domains/organization_domain_stand_alone.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainStandAlone - include HashProvider - + class OrganizationDomainStandAlone < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class OrganizationDomainStandAlone :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/organization_domains/organization_domain_updated.rb b/lib/workos/organization_domains/organization_domain_updated.rb index bd881fe6..4ef6abeb 100644 --- a/lib/workos/organization_domains/organization_domain_updated.rb +++ b/lib/workos/organization_domains/organization_domain_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainUpdated - include HashProvider - + class OrganizationDomainUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationDomainUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationDomainUpdatedData.new(hash[:data]) : nil diff --git a/lib/workos/organization_domains/organization_domain_updated_data.rb b/lib/workos/organization_domains/organization_domain_updated_data.rb index 20d2e24a..93753eca 100644 --- a/lib/workos/organization_domains/organization_domain_updated_data.rb +++ b/lib/workos/organization_domains/organization_domain_updated_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainUpdatedData - include HashProvider - + class OrganizationDomainUpdatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class OrganizationDomainUpdatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/organization_domains/organization_domain_verification_failed.rb b/lib/workos/organization_domains/organization_domain_verification_failed.rb index c04d6690..58caaca0 100644 --- a/lib/workos/organization_domains/organization_domain_verification_failed.rb +++ b/lib/workos/organization_domains/organization_domain_verification_failed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainVerificationFailed - include HashProvider - + class OrganizationDomainVerificationFailed < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationDomainVerificationFailed :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationDomainVerificationFailedData.new(hash[:data]) : nil diff --git a/lib/workos/organization_domains/organization_domain_verification_failed_data.rb b/lib/workos/organization_domains/organization_domain_verification_failed_data.rb index 75a606a0..a34a611e 100644 --- a/lib/workos/organization_domains/organization_domain_verification_failed_data.rb +++ b/lib/workos/organization_domains/organization_domain_verification_failed_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainVerificationFailedData - include HashProvider - + class OrganizationDomainVerificationFailedData < WorkOS::Types::BaseModel HASH_ATTRS = { reason: :reason, organization_domain: :organization_domain @@ -18,8 +14,7 @@ class OrganizationDomainVerificationFailedData :organization_domain def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @reason = hash[:reason] @organization_domain = hash[:organization_domain] ? WorkOS::OrganizationDomainVerificationFailedDataOrganizationDomain.new(hash[:organization_domain]) : nil end diff --git a/lib/workos/organization_domains/organization_domain_verification_failed_data_organization_domain.rb b/lib/workos/organization_domains/organization_domain_verification_failed_data_organization_domain.rb index 68bea7d4..aed6cc0e 100644 --- a/lib/workos/organization_domains/organization_domain_verification_failed_data_organization_domain.rb +++ b/lib/workos/organization_domains/organization_domain_verification_failed_data_organization_domain.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainVerificationFailedDataOrganizationDomain - include HashProvider - + class OrganizationDomainVerificationFailedDataOrganizationDomain < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class OrganizationDomainVerificationFailedDataOrganizationDomain :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/organization_domains/organization_domain_verified.rb b/lib/workos/organization_domains/organization_domain_verified.rb index ea15514b..7172f83f 100644 --- a/lib/workos/organization_domains/organization_domain_verified.rb +++ b/lib/workos/organization_domains/organization_domain_verified.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainVerified - include HashProvider - + class OrganizationDomainVerified < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationDomainVerified :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationDomainVerifiedData.new(hash[:data]) : nil diff --git a/lib/workos/organization_domains/organization_domain_verified_data.rb b/lib/workos/organization_domains/organization_domain_verified_data.rb index 46ef4071..564a9f37 100644 --- a/lib/workos/organization_domains/organization_domain_verified_data.rb +++ b/lib/workos/organization_domains/organization_domain_verified_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainVerifiedData - include HashProvider - + class OrganizationDomainVerifiedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class OrganizationDomainVerifiedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index 38abbc8f..f886ded7 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -18,8 +17,8 @@ def initialize(client) # @param order [WorkOS::Types::OrganizationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. # @param domains [Array, nil] The domains of an Organization. Any Organization with a matching domain will be returned. # @param search [String, nil] Searchable text for an Organization. Matches against the organization name. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_organizations( before: nil, after: nil, @@ -37,15 +36,14 @@ def list_organizations( "domains" => domains, "search" => search }.compact - response = @client.execute_request( - request: @client.get_request(path: "/organizations", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/organizations", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::Organization.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_organizations( before: before, after: cursor, @@ -55,8 +53,13 @@ def list_organizations( search: search, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, domains: domains, search: search}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::Organization, + filters: {before: before, limit: limit, order: order, domains: domains, search: search}, + fetch_next: fetch_next + ) end # Create an Organization @@ -66,7 +69,7 @@ def list_organizations( # @param domain_data [Array, nil] The domains associated with the organization, including verification state. # @param metadata [Hash{String => String}, nil] Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization. # @param external_id [String, nil] An external identifier for the Organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Organization] def create_organization( name:, @@ -85,41 +88,54 @@ def create_organization( "metadata" => metadata, "external_id" => external_id }.compact - response = @client.execute_request( - request: @client.post_request(path: "/organizations", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/organizations", + auth: true, + body: body, request_options: request_options ) - WorkOS::Organization.new(response.body) + result = WorkOS::Organization.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get an Organization by External ID # @param external_id [String] The external ID of the Organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Organization] def get_organization_by_external_id( external_id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/organizations/external_id/#{CGI.escape(external_id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/organizations/external_id/#{WorkOS::Util.encode_path(external_id)}", + auth: true, request_options: request_options ) - WorkOS::Organization.new(response.body) + result = WorkOS::Organization.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get an Organization # @param id [String] Unique identifier of the Organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Organization] def get_organization( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/organizations/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/organizations/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::Organization.new(response.body) + result = WorkOS::Organization.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update an Organization @@ -131,7 +147,7 @@ def get_organization( # @param stripe_customer_id [String, nil] The Stripe customer ID associated with the organization. # @param metadata [Hash{String => String}, nil] Object containing [metadata](https://workos.com/docs/authkit/metadata) key/value pairs associated with the Organization. # @param external_id [String, nil] An external identifier for the Organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Organization] def update_organization( id:, @@ -153,23 +169,30 @@ def update_organization( "metadata" => metadata, "external_id" => external_id }.compact - response = @client.execute_request( - request: @client.put_request(path: "/organizations/#{CGI.escape(id.to_s)}", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :put, + path: "/organizations/#{WorkOS::Util.encode_path(id)}", + auth: true, + body: body, request_options: request_options ) - WorkOS::Organization.new(response.body) + result = WorkOS::Organization.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete an Organization # @param id [String] Unique identifier of the Organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_organization( id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/organizations/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/organizations/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) nil @@ -177,17 +200,21 @@ def delete_organization( # Get Audit Log Configuration # @param id [String] Unique identifier of the Organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuditLogConfiguration] def get_audit_log_configuration( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/organizations/#{CGI.escape(id.to_s)}/audit_log_configuration", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/organizations/#{WorkOS::Util.encode_path(id)}/audit_log_configuration", + auth: true, request_options: request_options ) - WorkOS::AuditLogConfiguration.new(response.body) + result = WorkOS::AuditLogConfiguration.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end end end diff --git a/lib/workos/organizations/audit_log_configuration.rb b/lib/workos/organizations/audit_log_configuration.rb index 05013d13..e273e018 100644 --- a/lib/workos/organizations/audit_log_configuration.rb +++ b/lib/workos/organizations/audit_log_configuration.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogConfiguration - include HashProvider - + class AuditLogConfiguration < WorkOS::Types::BaseModel HASH_ATTRS = { organization_id: :organization_id, retention_period_in_days: :retention_period_in_days, @@ -22,8 +18,7 @@ class AuditLogConfiguration :log_stream def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @organization_id = hash[:organization_id] @retention_period_in_days = hash[:retention_period_in_days] @state = hash[:state] diff --git a/lib/workos/organizations/audit_log_configuration_log_stream.rb b/lib/workos/organizations/audit_log_configuration_log_stream.rb index bea1b609..6d05aaac 100644 --- a/lib/workos/organizations/audit_log_configuration_log_stream.rb +++ b/lib/workos/organizations/audit_log_configuration_log_stream.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogConfigurationLogStream - include HashProvider - + class AuditLogConfigurationLogStream < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, type: :type, @@ -24,8 +20,7 @@ class AuditLogConfigurationLogStream :created_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @type = hash[:type] @state = hash[:state] diff --git a/lib/workos/organizations/audit_logs_retention_json.rb b/lib/workos/organizations/audit_logs_retention_json.rb index 301c86da..f3ed1b6e 100644 --- a/lib/workos/organizations/audit_logs_retention_json.rb +++ b/lib/workos/organizations/audit_logs_retention_json.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuditLogsRetentionJson - include HashProvider - + class AuditLogsRetentionJson < WorkOS::Types::BaseModel HASH_ATTRS = { retention_period_in_days: :retention_period_in_days }.freeze @@ -15,8 +11,7 @@ class AuditLogsRetentionJson attr_accessor :retention_period_in_days def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @retention_period_in_days = hash[:retention_period_in_days] end end diff --git a/lib/workos/organizations/organization.rb b/lib/workos/organizations/organization.rb index 91aebadd..03892166 100644 --- a/lib/workos/organizations/organization.rb +++ b/lib/workos/organizations/organization.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class Organization - include HashProvider - + class Organization < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -36,15 +32,14 @@ class Organization :updated_at def allow_profiles_outside_organization - warn "[DEPRECATION] `allow_profiles_outside_organization` is deprecated. Whether the Organization allows profiles outside of its managed domains.", uplevel: 1 + warn "[DEPRECATION] `allow_profiles_outside_organization` is deprecated and will be removed in a future version.", uplevel: 1 @allow_profiles_outside_organization end attr_writer :allow_profiles_outside_organization def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @name = hash[:name] diff --git a/lib/workos/organizations/organization_created.rb b/lib/workos/organizations/organization_created.rb index 98b6d47e..b4cd5b82 100644 --- a/lib/workos/organizations/organization_created.rb +++ b/lib/workos/organizations/organization_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationCreated - include HashProvider - + class OrganizationCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/organizations/organization_created_data.rb b/lib/workos/organizations/organization_created_data.rb index a629e068..13d18eab 100644 --- a/lib/workos/organizations/organization_created_data.rb +++ b/lib/workos/organizations/organization_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationCreatedData - include HashProvider - + class OrganizationCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -32,8 +28,7 @@ class OrganizationCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @name = hash[:name] diff --git a/lib/workos/organizations/organization_created_data_domain.rb b/lib/workos/organizations/organization_created_data_domain.rb index 7e46a2a3..c6c18fd7 100644 --- a/lib/workos/organizations/organization_created_data_domain.rb +++ b/lib/workos/organizations/organization_created_data_domain.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationCreatedDataDomain - include HashProvider - + class OrganizationCreatedDataDomain < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class OrganizationCreatedDataDomain :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/organizations/organization_deleted.rb b/lib/workos/organizations/organization_deleted.rb index 9e16e031..1a2381be 100644 --- a/lib/workos/organizations/organization_deleted.rb +++ b/lib/workos/organizations/organization_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDeleted - include HashProvider - + class OrganizationDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationDeletedData.new(hash[:data]) : nil diff --git a/lib/workos/organizations/organization_deleted_data.rb b/lib/workos/organizations/organization_deleted_data.rb index 44a22980..88259c39 100644 --- a/lib/workos/organizations/organization_deleted_data.rb +++ b/lib/workos/organizations/organization_deleted_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDeletedData - include HashProvider - + class OrganizationDeletedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -32,8 +28,7 @@ class OrganizationDeletedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @name = hash[:name] diff --git a/lib/workos/organizations/organization_deleted_data_domain.rb b/lib/workos/organizations/organization_deleted_data_domain.rb index 0427bf95..bc40f61c 100644 --- a/lib/workos/organizations/organization_deleted_data_domain.rb +++ b/lib/workos/organizations/organization_deleted_data_domain.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDeletedDataDomain - include HashProvider - + class OrganizationDeletedDataDomain < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class OrganizationDeletedDataDomain :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/organizations/organization_domain_data.rb b/lib/workos/organizations/organization_domain_data.rb index 2f7f7ddc..df58b2f5 100644 --- a/lib/workos/organizations/organization_domain_data.rb +++ b/lib/workos/organizations/organization_domain_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationDomainData - include HashProvider - + class OrganizationDomainData < WorkOS::Types::BaseModel HASH_ATTRS = { domain: :domain, state: :state @@ -18,8 +14,7 @@ class OrganizationDomainData :state def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @domain = hash[:domain] @state = hash[:state] end diff --git a/lib/workos/organizations/organization_input.rb b/lib/workos/organizations/organization_input.rb index 837d47d4..b4479b36 100644 --- a/lib/workos/organizations/organization_input.rb +++ b/lib/workos/organizations/organization_input.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationInput - include HashProvider - + class OrganizationInput < WorkOS::Types::BaseModel HASH_ATTRS = { name: :name, allow_profiles_outside_organization: :allow_profiles_outside_organization, @@ -26,8 +22,7 @@ class OrganizationInput :external_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @name = hash[:name] @allow_profiles_outside_organization = hash[:allow_profiles_outside_organization] @domains = hash[:domains] || [] diff --git a/lib/workos/organizations/organization_membership_created.rb b/lib/workos/organizations/organization_membership_created.rb index 3e11e16f..64864fbc 100644 --- a/lib/workos/organizations/organization_membership_created.rb +++ b/lib/workos/organizations/organization_membership_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationMembershipCreated - include HashProvider - + class OrganizationMembershipCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationMembershipCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationMembershipCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/organizations/organization_membership_created_data.rb b/lib/workos/organizations/organization_membership_created_data.rb index 886ec4f6..79f18f08 100644 --- a/lib/workos/organizations/organization_membership_created_data.rb +++ b/lib/workos/organizations/organization_membership_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationMembershipCreatedData - include HashProvider - + class OrganizationMembershipCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -36,8 +32,7 @@ class OrganizationMembershipCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/organizations/organization_membership_deleted.rb b/lib/workos/organizations/organization_membership_deleted.rb index 2e213464..ae5f3507 100644 --- a/lib/workos/organizations/organization_membership_deleted.rb +++ b/lib/workos/organizations/organization_membership_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationMembershipDeleted - include HashProvider - + class OrganizationMembershipDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationMembershipDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationMembershipDeletedData.new(hash[:data]) : nil diff --git a/lib/workos/organizations/organization_membership_deleted_data.rb b/lib/workos/organizations/organization_membership_deleted_data.rb index 43139089..227d309a 100644 --- a/lib/workos/organizations/organization_membership_deleted_data.rb +++ b/lib/workos/organizations/organization_membership_deleted_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationMembershipDeletedData - include HashProvider - + class OrganizationMembershipDeletedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -36,8 +32,7 @@ class OrganizationMembershipDeletedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/organizations/organization_membership_updated.rb b/lib/workos/organizations/organization_membership_updated.rb index 765c34fc..3127cb78 100644 --- a/lib/workos/organizations/organization_membership_updated.rb +++ b/lib/workos/organizations/organization_membership_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationMembershipUpdated - include HashProvider - + class OrganizationMembershipUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationMembershipUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationMembershipUpdatedData.new(hash[:data]) : nil diff --git a/lib/workos/organizations/organization_membership_updated_data.rb b/lib/workos/organizations/organization_membership_updated_data.rb index e2c892a5..3c045383 100644 --- a/lib/workos/organizations/organization_membership_updated_data.rb +++ b/lib/workos/organizations/organization_membership_updated_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationMembershipUpdatedData - include HashProvider - + class OrganizationMembershipUpdatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -36,8 +32,7 @@ class OrganizationMembershipUpdatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/organizations/organization_role_created.rb b/lib/workos/organizations/organization_role_created.rb index 389af7a3..f55aa5f6 100644 --- a/lib/workos/organizations/organization_role_created.rb +++ b/lib/workos/organizations/organization_role_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationRoleCreated - include HashProvider - + class OrganizationRoleCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationRoleCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationRoleCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/organizations/organization_role_created_data.rb b/lib/workos/organizations/organization_role_created_data.rb index 95cd235a..36d295b1 100644 --- a/lib/workos/organizations/organization_role_created_data.rb +++ b/lib/workos/organizations/organization_role_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationRoleCreatedData - include HashProvider - + class OrganizationRoleCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, organization_id: :organization_id, @@ -32,8 +28,7 @@ class OrganizationRoleCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @organization_id = hash[:organization_id] @slug = hash[:slug] diff --git a/lib/workos/organizations/organization_role_deleted.rb b/lib/workos/organizations/organization_role_deleted.rb index e99ef07f..17ce8ce8 100644 --- a/lib/workos/organizations/organization_role_deleted.rb +++ b/lib/workos/organizations/organization_role_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationRoleDeleted - include HashProvider - + class OrganizationRoleDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationRoleDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationRoleDeletedData.new(hash[:data]) : nil diff --git a/lib/workos/organizations/organization_role_updated.rb b/lib/workos/organizations/organization_role_updated.rb index 2def5043..51af21bd 100644 --- a/lib/workos/organizations/organization_role_updated.rb +++ b/lib/workos/organizations/organization_role_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationRoleUpdated - include HashProvider - + class OrganizationRoleUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationRoleUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationRoleUpdatedData.new(hash[:data]) : nil diff --git a/lib/workos/organizations/organization_updated.rb b/lib/workos/organizations/organization_updated.rb index 2fda6553..c13a99bb 100644 --- a/lib/workos/organizations/organization_updated.rb +++ b/lib/workos/organizations/organization_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationUpdated - include HashProvider - + class OrganizationUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class OrganizationUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::OrganizationUpdatedData.new(hash[:data]) : nil diff --git a/lib/workos/organizations/organization_updated_data.rb b/lib/workos/organizations/organization_updated_data.rb index afbb97be..8acef2aa 100644 --- a/lib/workos/organizations/organization_updated_data.rb +++ b/lib/workos/organizations/organization_updated_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationUpdatedData - include HashProvider - + class OrganizationUpdatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -32,8 +28,7 @@ class OrganizationUpdatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @name = hash[:name] diff --git a/lib/workos/organizations/organization_updated_data_domain.rb b/lib/workos/organizations/organization_updated_data_domain.rb index 8a2dbc91..24a6d4bc 100644 --- a/lib/workos/organizations/organization_updated_data_domain.rb +++ b/lib/workos/organizations/organization_updated_data_domain.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationUpdatedDataDomain - include HashProvider - + class OrganizationUpdatedDataDomain < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,8 +30,7 @@ class OrganizationUpdatedDataDomain :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/organizations/update_audit_logs_retention.rb b/lib/workos/organizations/update_audit_logs_retention.rb index 41e81009..14e0ccfa 100644 --- a/lib/workos/organizations/update_audit_logs_retention.rb +++ b/lib/workos/organizations/update_audit_logs_retention.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UpdateAuditLogsRetention - include HashProvider - + class UpdateAuditLogsRetention < WorkOS::Types::BaseModel HASH_ATTRS = { retention_period_in_days: :retention_period_in_days }.freeze @@ -15,8 +11,7 @@ class UpdateAuditLogsRetention attr_accessor :retention_period_in_days def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @retention_period_in_days = hash[:retention_period_in_days] end end diff --git a/lib/workos/organizations/update_organization.rb b/lib/workos/organizations/update_organization.rb index cf95c4ad..30ada5a4 100644 --- a/lib/workos/organizations/update_organization.rb +++ b/lib/workos/organizations/update_organization.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UpdateOrganization - include HashProvider - + class UpdateOrganization < WorkOS::Types::BaseModel HASH_ATTRS = { name: :name, allow_profiles_outside_organization: :allow_profiles_outside_organization, @@ -30,15 +26,14 @@ class UpdateOrganization :external_id def domains - warn "[DEPRECATION] `domains` is deprecated. The domains associated with the organization. Deprecated in favor of `domain_data`.", uplevel: 1 + warn "[DEPRECATION] `domains` is deprecated and will be removed in a future version.", uplevel: 1 @domains end attr_writer :domains def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @name = hash[:name] @allow_profiles_outside_organization = hash[:allow_profiles_outside_organization] @domains = hash[:domains] || [] diff --git a/lib/workos/pipes.rb b/lib/workos/pipes.rb index 9b1ceea2..c2eefb7e 100644 --- a/lib/workos/pipes.rb +++ b/lib/workos/pipes.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -16,7 +15,7 @@ def initialize(client) # @param user_id [String] The ID of the user to authorize. # @param organization_id [String, nil] An organization ID to scope the authorization to a specific organization. # @param return_to [String, nil] The URL to redirect the user to after authorization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::DataIntegrationAuthorizeUrlResponse] def authorize_data_integration( slug:, @@ -30,18 +29,23 @@ def authorize_data_integration( "organization_id" => organization_id, "return_to" => return_to }.compact - response = @client.execute_request( - request: @client.post_request(path: "/data-integrations/#{CGI.escape(slug.to_s)}/authorize", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/authorize", + auth: true, + body: body, request_options: request_options ) - WorkOS::DataIntegrationAuthorizeUrlResponse.new(response.body) + result = WorkOS::DataIntegrationAuthorizeUrlResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get an access token for a connected account # @param slug [String] The identifier of the integration. # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier. # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to scope the connection to a specific organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::DataIntegrationAccessTokenResponse] def create_data_integration_token( slug:, @@ -53,18 +57,23 @@ def create_data_integration_token( "user_id" => user_id, "organization_id" => organization_id }.compact - response = @client.execute_request( - request: @client.post_request(path: "/data-integrations/#{CGI.escape(slug.to_s)}/token", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/data-integrations/#{WorkOS::Util.encode_path(slug)}/token", + auth: true, + body: body, request_options: request_options ) - WorkOS::DataIntegrationAccessTokenResponse.new(response.body) + result = WorkOS::DataIntegrationAccessTokenResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get a connected account # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier. # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::ConnectedAccount] def get_user_connected_account( user_id:, @@ -75,18 +84,23 @@ def get_user_connected_account( params = { "organization_id" => organization_id }.compact - response = @client.execute_request( - request: @client.get_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/connected_accounts/#{CGI.escape(slug.to_s)}", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", + auth: true, + params: params, request_options: request_options ) - WorkOS::ConnectedAccount.new(response.body) + result = WorkOS::ConnectedAccount.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete a connected account # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier. # @param slug [String] The slug identifier of the provider (e.g., `github`, `slack`, `notion`). # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter if the connection is scoped to an organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_user_connected_account( user_id:, @@ -97,8 +111,11 @@ def delete_user_connected_account( params = { "organization_id" => organization_id }.compact - @client.execute_request( - request: @client.delete_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/connected_accounts/#{CGI.escape(slug.to_s)}", auth: true, params: params, request_options: request_options), + @client.request( + method: :delete, + path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/connected_accounts/#{WorkOS::Util.encode_path(slug)}", + auth: true, + params: params, request_options: request_options ) nil @@ -107,7 +124,7 @@ def delete_user_connected_account( # List providers # @param user_id [String] A [User](https://workos.com/docs/reference/authkit/user) identifier to list providers and connected accounts for. # @param organization_id [String, nil] An [Organization](https://workos.com/docs/reference/organization) identifier. Optional parameter to filter connections for a specific organization. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::DataIntegrationsListResponse] def list_user_data_providers( user_id:, @@ -117,11 +134,16 @@ def list_user_data_providers( params = { "organization_id" => organization_id }.compact - response = @client.execute_request( - request: @client.get_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/data_providers", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/data_providers", + auth: true, + params: params, request_options: request_options ) - WorkOS::DataIntegrationsListResponse.new(response.body) + result = WorkOS::DataIntegrationsListResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end end end diff --git a/lib/workos/pipes/connected_account.rb b/lib/workos/pipes/connected_account.rb index 4b3933ca..2e496067 100644 --- a/lib/workos/pipes/connected_account.rb +++ b/lib/workos/pipes/connected_account.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectedAccount - include HashProvider - + class ConnectedAccount < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -30,8 +26,7 @@ class ConnectedAccount :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/pipes/data_integration_access_token_response.rb b/lib/workos/pipes/data_integration_access_token_response.rb index 1e54270f..25d28046 100644 --- a/lib/workos/pipes/data_integration_access_token_response.rb +++ b/lib/workos/pipes/data_integration_access_token_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DataIntegrationAccessTokenResponse - include HashProvider - + class DataIntegrationAccessTokenResponse < WorkOS::Types::BaseModel HASH_ATTRS = { active: :active, access_token: :access_token, @@ -20,8 +16,7 @@ class DataIntegrationAccessTokenResponse :error def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @active = hash[:active] @access_token = hash[:access_token] ? WorkOS::DataIntegrationAccessTokenResponseAccessToken.new(hash[:access_token]) : nil @error = hash[:error] diff --git a/lib/workos/pipes/data_integration_access_token_response_access_token.rb b/lib/workos/pipes/data_integration_access_token_response_access_token.rb index 418c71d4..e2db6ef0 100644 --- a/lib/workos/pipes/data_integration_access_token_response_access_token.rb +++ b/lib/workos/pipes/data_integration_access_token_response_access_token.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DataIntegrationAccessTokenResponseAccessToken - include HashProvider - + class DataIntegrationAccessTokenResponseAccessToken < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, access_token: :access_token, @@ -24,8 +20,7 @@ class DataIntegrationAccessTokenResponseAccessToken :missing_scopes def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @access_token = hash[:access_token] @expires_at = hash[:expires_at] diff --git a/lib/workos/pipes/data_integration_authorize_url_response.rb b/lib/workos/pipes/data_integration_authorize_url_response.rb index ff4989b9..b9f610f1 100644 --- a/lib/workos/pipes/data_integration_authorize_url_response.rb +++ b/lib/workos/pipes/data_integration_authorize_url_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DataIntegrationAuthorizeUrlResponse - include HashProvider - + class DataIntegrationAuthorizeUrlResponse < WorkOS::Types::BaseModel HASH_ATTRS = { url: :url }.freeze @@ -15,8 +11,7 @@ class DataIntegrationAuthorizeUrlResponse attr_accessor :url def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @url = hash[:url] end end diff --git a/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb b/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb index 6146416d..495c04c5 100644 --- a/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb +++ b/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DataIntegrationsGetDataIntegrationAuthorizeUrlRequest - include HashProvider - + class DataIntegrationsGetDataIntegrationAuthorizeUrlRequest < WorkOS::Types::BaseModel HASH_ATTRS = { user_id: :user_id, organization_id: :organization_id, @@ -20,8 +16,7 @@ class DataIntegrationsGetDataIntegrationAuthorizeUrlRequest :return_to def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @user_id = hash[:user_id] @organization_id = hash[:organization_id] @return_to = hash[:return_to] diff --git a/lib/workos/pipes/data_integrations_get_user_token_request.rb b/lib/workos/pipes/data_integrations_get_user_token_request.rb index acd8afe4..0aa4df76 100644 --- a/lib/workos/pipes/data_integrations_get_user_token_request.rb +++ b/lib/workos/pipes/data_integrations_get_user_token_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DataIntegrationsGetUserTokenRequest - include HashProvider - + class DataIntegrationsGetUserTokenRequest < WorkOS::Types::BaseModel HASH_ATTRS = { user_id: :user_id, organization_id: :organization_id @@ -18,8 +14,7 @@ class DataIntegrationsGetUserTokenRequest :organization_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @user_id = hash[:user_id] @organization_id = hash[:organization_id] end diff --git a/lib/workos/pipes/data_integrations_list_response.rb b/lib/workos/pipes/data_integrations_list_response.rb index 1b9df2a1..35837685 100644 --- a/lib/workos/pipes/data_integrations_list_response.rb +++ b/lib/workos/pipes/data_integrations_list_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DataIntegrationsListResponse - include HashProvider - + class DataIntegrationsListResponse < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, data: :data @@ -18,8 +14,7 @@ class DataIntegrationsListResponse :data def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @data = (hash[:data] || []).map { |item| item ? WorkOS::DataIntegrationsListResponseData.new(item) : nil } end diff --git a/lib/workos/pipes/data_integrations_list_response_data.rb b/lib/workos/pipes/data_integrations_list_response_data.rb index 60d9909b..d84f0a8a 100644 --- a/lib/workos/pipes/data_integrations_list_response_data.rb +++ b/lib/workos/pipes/data_integrations_list_response_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DataIntegrationsListResponseData - include HashProvider - + class DataIntegrationsListResponseData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -38,8 +34,7 @@ class DataIntegrationsListResponseData :connected_account def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @name = hash[:name] diff --git a/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb b/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb index 1df8b35d..e1957b5a 100644 --- a/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +++ b/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DataIntegrationsListResponseDataConnectedAccount - include HashProvider - + class DataIntegrationsListResponseDataConnectedAccount < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -34,15 +30,14 @@ class DataIntegrationsListResponseDataConnectedAccount :updated_at def userland_user_id - warn "[DEPRECATION] `userland_user_id` is deprecated. Use `user_id` instead.", uplevel: 1 + warn "[DEPRECATION] `userland_user_id` is deprecated and will be removed in a future version.", uplevel: 1 @userland_user_id end attr_writer :userland_user_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/public_client.rb b/lib/workos/public_client.rb index 3446f1b6..aa6f4fdc 100644 --- a/lib/workos/public_client.rb +++ b/lib/workos/public_client.rb @@ -16,15 +16,12 @@ module PublicClient # etc.) instead of methods that require server-side credentials. # # @param client_id [String] WorkOS client ID for the application. - # @param base_url [String] Optional override of the API base URL. - # @param timeout [Integer] HTTP timeout in seconds. + # @param opts [Hash] Additional options forwarded to {WorkOS::Client.new} + # (e.g. :base_url, :timeout, :max_retries, :logger, :log_level, :extra_headers). # @return [WorkOS::Client] - def create(client_id:, base_url: nil, timeout: nil) + def create(client_id:, **opts) raise ArgumentError, "client_id is required" if client_id.nil? || client_id.empty? - args = {client_id: client_id} - args[:base_url] = base_url if base_url - args[:timeout] = timeout if timeout - WorkOS::Client.new(**args) + WorkOS::Client.new(client_id: client_id, **opts) end end end diff --git a/lib/workos/radar.rb b/lib/workos/radar.rb index 63ba9f21..6d0da00a 100644 --- a/lib/workos/radar.rb +++ b/lib/workos/radar.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -19,7 +18,7 @@ def initialize(client) # @param action [WorkOS::Types::RadarStandaloneAssessRequestAction] The action being performed. # @param device_fingerprint [String, nil] An optional device fingerprint for the request. # @param bot_score [String, nil] An optional bot detection score for the request. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::RadarStandaloneResponse] def create_attempt( ip_address:, @@ -40,18 +39,23 @@ def create_attempt( "device_fingerprint" => device_fingerprint, "bot_score" => bot_score }.compact - response = @client.execute_request( - request: @client.post_request(path: "/radar/attempts", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/radar/attempts", + auth: true, + body: body, request_options: request_options ) - WorkOS::RadarStandaloneResponse.new(response.body) + result = WorkOS::RadarStandaloneResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update a Radar attempt # @param id [String] The unique identifier of the Radar attempt to update. # @param challenge_status [String, nil] Set to `"success"` to mark the challenge as completed. # @param attempt_status [String, nil] Set to `"success"` to mark the authentication attempt as successful. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def update_attempt( id:, @@ -63,8 +67,11 @@ def update_attempt( "challenge_status" => challenge_status, "attempt_status" => attempt_status }.compact - @client.execute_request( - request: @client.put_request(path: "/radar/attempts/#{CGI.escape(id.to_s)}", auth: true, body: body, request_options: request_options), + @client.request( + method: :put, + path: "/radar/attempts/#{WorkOS::Util.encode_path(id)}", + auth: true, + body: body, request_options: request_options ) nil @@ -74,7 +81,7 @@ def update_attempt( # @param type [WorkOS::Types::RadarType] The type of the Radar list (e.g. ip_address, domain, email). # @param action [WorkOS::Types::RadarAction] The list action indicating whether to add the entry to the allow or block list. # @param entry [String] The value to add to the list. Must match the format of the list type (e.g. a valid IP address for `ip_address`, a valid email for `email`). - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::RadarListEntryAlreadyPresentResponse] def add_list_entry( type:, @@ -85,18 +92,23 @@ def add_list_entry( body = { "entry" => entry }.compact - response = @client.execute_request( - request: @client.post_request(path: "/radar/lists/#{CGI.escape(type.to_s)}/#{CGI.escape(action.to_s)}", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/radar/lists/#{WorkOS::Util.encode_path(type)}/#{WorkOS::Util.encode_path(action)}", + auth: true, + body: body, request_options: request_options ) - WorkOS::RadarListEntryAlreadyPresentResponse.new(response.body) + result = WorkOS::RadarListEntryAlreadyPresentResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Remove an entry from a Radar list # @param type [WorkOS::Types::RadarType] The type of the Radar list (e.g. ip_address, domain, email). # @param action [WorkOS::Types::RadarAction] The list action indicating whether to remove the entry from the allow or block list. # @param entry [String] The value to remove from the list. Must match an existing entry. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def remove_list_entry( type:, @@ -107,8 +119,11 @@ def remove_list_entry( body = { "entry" => entry }.compact - @client.execute_request( - request: @client.delete_request(path: "/radar/lists/#{CGI.escape(type.to_s)}/#{CGI.escape(action.to_s)}", auth: true, body: body, request_options: request_options), + @client.request( + method: :delete, + path: "/radar/lists/#{WorkOS::Util.encode_path(type)}/#{WorkOS::Util.encode_path(action)}", + auth: true, + body: body, request_options: request_options ) nil diff --git a/lib/workos/radar/radar_list_entry_already_present_response.rb b/lib/workos/radar/radar_list_entry_already_present_response.rb index b78f934f..738ab835 100644 --- a/lib/workos/radar/radar_list_entry_already_present_response.rb +++ b/lib/workos/radar/radar_list_entry_already_present_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RadarListEntryAlreadyPresentResponse - include HashProvider - + class RadarListEntryAlreadyPresentResponse < WorkOS::Types::BaseModel HASH_ATTRS = { message: :message }.freeze @@ -15,8 +11,7 @@ class RadarListEntryAlreadyPresentResponse attr_accessor :message def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @message = hash[:message] end end diff --git a/lib/workos/radar/radar_standalone_assess_request.rb b/lib/workos/radar/radar_standalone_assess_request.rb index 7ae5ce45..a66b56de 100644 --- a/lib/workos/radar/radar_standalone_assess_request.rb +++ b/lib/workos/radar/radar_standalone_assess_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RadarStandaloneAssessRequest - include HashProvider - + class RadarStandaloneAssessRequest < WorkOS::Types::BaseModel HASH_ATTRS = { ip_address: :ip_address, user_agent: :user_agent, @@ -28,8 +24,7 @@ class RadarStandaloneAssessRequest :bot_score def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @ip_address = hash[:ip_address] @user_agent = hash[:user_agent] @email = hash[:email] diff --git a/lib/workos/radar/radar_standalone_delete_radar_list_entry_request.rb b/lib/workos/radar/radar_standalone_delete_radar_list_entry_request.rb index 00889e75..70d93caf 100644 --- a/lib/workos/radar/radar_standalone_delete_radar_list_entry_request.rb +++ b/lib/workos/radar/radar_standalone_delete_radar_list_entry_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RadarStandaloneDeleteRadarListEntryRequest - include HashProvider - + class RadarStandaloneDeleteRadarListEntryRequest < WorkOS::Types::BaseModel HASH_ATTRS = { entry: :entry }.freeze @@ -15,8 +11,7 @@ class RadarStandaloneDeleteRadarListEntryRequest attr_accessor :entry def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @entry = hash[:entry] end end diff --git a/lib/workos/radar/radar_standalone_response.rb b/lib/workos/radar/radar_standalone_response.rb index e1303abd..dc6be73b 100644 --- a/lib/workos/radar/radar_standalone_response.rb +++ b/lib/workos/radar/radar_standalone_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RadarStandaloneResponse - include HashProvider - + class RadarStandaloneResponse < WorkOS::Types::BaseModel HASH_ATTRS = { verdict: :verdict, reason: :reason, @@ -24,8 +20,7 @@ class RadarStandaloneResponse :blocklist_type def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @verdict = hash[:verdict] @reason = hash[:reason] @attempt_id = hash[:attempt_id] diff --git a/lib/workos/radar/radar_standalone_update_radar_attempt_request.rb b/lib/workos/radar/radar_standalone_update_radar_attempt_request.rb index 0bbf07a6..307a455d 100644 --- a/lib/workos/radar/radar_standalone_update_radar_attempt_request.rb +++ b/lib/workos/radar/radar_standalone_update_radar_attempt_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RadarStandaloneUpdateRadarAttemptRequest - include HashProvider - + class RadarStandaloneUpdateRadarAttemptRequest < WorkOS::Types::BaseModel HASH_ATTRS = { challenge_status: :challenge_status, attempt_status: :attempt_status @@ -18,8 +14,7 @@ class RadarStandaloneUpdateRadarAttemptRequest :attempt_status def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @challenge_status = hash[:challenge_status] @attempt_status = hash[:attempt_status] end diff --git a/lib/workos/session.rb b/lib/workos/session.rb index a705480b..809f8eec 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -38,6 +38,10 @@ def authenticate(include_expired: false, &claim_extractor) @manager.decode_jwt(session["access_token"], verify_expiration: !include_expired) rescue JWT::ExpiredSignature return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::EXPIRED_JWT) + rescue JWT::IncorrectAlgorithm + return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::INVALID_JWT_ALGORITHM) + rescue JWT::VerificationError + return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::INVALID_JWT_SIGNATURE) rescue JWT::DecodeError return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::INVALID_JWT) end @@ -108,7 +112,7 @@ def refresh(organization_id: nil, cookie_password: nil) def get_logout_url(return_to: nil) result = authenticate raise WorkOS::Error.new(message: "Failed to extract session ID for logout URL: #{result.reason}") if result.is_a?(SessionManager::AuthError) - base = @client.base_url || "https://api.workos.com" + base = @client.base_url params = {"session_id" => result.session_id} params["return_to"] = return_to if return_to uri = URI.join(base, "/user_management/sessions/logout") diff --git a/lib/workos/session_manager.rb b/lib/workos/session_manager.rb index 5fd81fa9..032c839b 100644 --- a/lib/workos/session_manager.rb +++ b/lib/workos/session_manager.rb @@ -101,6 +101,8 @@ def normalize_custom_claims(custom_claims) NO_SESSION_COOKIE_PROVIDED = "no_session_cookie_provided" INVALID_SESSION_COOKIE = "invalid_session_cookie" INVALID_JWT = "invalid_jwt" + INVALID_JWT_ALGORITHM = "invalid_jwt_algorithm" + INVALID_JWT_SIGNATURE = "invalid_jwt_signature" EXPIRED_JWT = "expired_jwt" # @param client [WorkOS::Client] diff --git a/lib/workos/shared/event_context.rb b/lib/workos/shared/event_context.rb index e9450c30..eceeeaf8 100644 --- a/lib/workos/shared/event_context.rb +++ b/lib/workos/shared/event_context.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EventContext - include HashProvider - + class EventContext < WorkOS::Types::BaseModel HASH_ATTRS = { google_analytics_client_id: :google_analytics_client_id, google_analytics_sessions: :google_analytics_sessions, @@ -26,8 +22,7 @@ class EventContext :previous_attributes def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @google_analytics_client_id = hash[:google_analytics_client_id] @google_analytics_sessions = (hash[:google_analytics_sessions] || []).map { |item| item ? WorkOS::EventContextGoogleAnalyticsSession.new(item) : nil } @ajs_anonymous_id = hash[:ajs_anonymous_id] diff --git a/lib/workos/shared/event_context_actor.rb b/lib/workos/shared/event_context_actor.rb index 089e2a2f..87bcc967 100644 --- a/lib/workos/shared/event_context_actor.rb +++ b/lib/workos/shared/event_context_actor.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EventContextActor - include HashProvider - + class EventContextActor < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, source: :source, @@ -20,8 +16,7 @@ class EventContextActor :name def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @source = hash[:source] @name = hash[:name] diff --git a/lib/workos/shared/event_context_google_analytics_session.rb b/lib/workos/shared/event_context_google_analytics_session.rb index ed422b60..db7eb102 100644 --- a/lib/workos/shared/event_context_google_analytics_session.rb +++ b/lib/workos/shared/event_context_google_analytics_session.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EventContextGoogleAnalyticsSession - include HashProvider - + class EventContextGoogleAnalyticsSession < WorkOS::Types::BaseModel HASH_ATTRS = { containerId: :container_id, sessionId: :session_id, @@ -20,8 +16,7 @@ class EventContextGoogleAnalyticsSession :session_number def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @container_id = hash[:containerId] @session_id = hash[:sessionId] @session_number = hash[:sessionNumber] diff --git a/lib/workos/shared/group.rb b/lib/workos/shared/group.rb index d8760c8b..eba34bbe 100644 --- a/lib/workos/shared/group.rb +++ b/lib/workos/shared/group.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class Group - include HashProvider - + class Group < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -28,8 +24,7 @@ class Group :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/shared/group_created.rb b/lib/workos/shared/group_created.rb index d60b40b5..0dfa881e 100644 --- a/lib/workos/shared/group_created.rb +++ b/lib/workos/shared/group_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class GroupCreated - include HashProvider - + class GroupCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class GroupCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::Group.new(hash[:data]) : nil diff --git a/lib/workos/shared/group_deleted.rb b/lib/workos/shared/group_deleted.rb index ac3698ab..3278fa6b 100644 --- a/lib/workos/shared/group_deleted.rb +++ b/lib/workos/shared/group_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class GroupDeleted - include HashProvider - + class GroupDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class GroupDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::Group.new(hash[:data]) : nil diff --git a/lib/workos/shared/group_member_added.rb b/lib/workos/shared/group_member_added.rb index 7bc966f4..b5ba86a5 100644 --- a/lib/workos/shared/group_member_added.rb +++ b/lib/workos/shared/group_member_added.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class GroupMemberAdded - include HashProvider - + class GroupMemberAdded < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class GroupMemberAdded :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::GroupMemberAddedData.new(hash[:data]) : nil diff --git a/lib/workos/shared/group_member_added_data.rb b/lib/workos/shared/group_member_added_data.rb index fd15e855..1b925980 100644 --- a/lib/workos/shared/group_member_added_data.rb +++ b/lib/workos/shared/group_member_added_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class GroupMemberAddedData - include HashProvider - + class GroupMemberAddedData < WorkOS::Types::BaseModel HASH_ATTRS = { group_id: :group_id, organization_membership_id: :organization_membership_id @@ -18,8 +14,7 @@ class GroupMemberAddedData :organization_membership_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @group_id = hash[:group_id] @organization_membership_id = hash[:organization_membership_id] end diff --git a/lib/workos/shared/group_member_removed.rb b/lib/workos/shared/group_member_removed.rb index b59aaf59..1594967b 100644 --- a/lib/workos/shared/group_member_removed.rb +++ b/lib/workos/shared/group_member_removed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class GroupMemberRemoved - include HashProvider - + class GroupMemberRemoved < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class GroupMemberRemoved :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::GroupMemberRemovedData.new(hash[:data]) : nil diff --git a/lib/workos/shared/group_updated.rb b/lib/workos/shared/group_updated.rb index 26bf93e5..d1f774d5 100644 --- a/lib/workos/shared/group_updated.rb +++ b/lib/workos/shared/group_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class GroupUpdated - include HashProvider - + class GroupUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class GroupUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::Group.new(hash[:data]) : nil diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index d141247d..9585b943 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -20,8 +19,8 @@ def initialize(client) # @param domain [String, nil] Filter Connections by their associated domain. # @param organization_id [String, nil] Filter Connections by their associated organization. # @param search [String, nil] Searchable text to match against Connection names. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_connections( before: nil, after: nil, @@ -43,15 +42,14 @@ def list_connections( "organization_id" => organization_id, "search" => search }.compact - response = @client.execute_request( - request: @client.get_request(path: "/connections", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/connections", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::Connection.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_connections( before: before, after: cursor, @@ -63,35 +61,46 @@ def list_connections( search: search, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, connection_type: connection_type, domain: domain, organization_id: organization_id, search: search}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::Connection, + filters: {before: before, limit: limit, order: order, connection_type: connection_type, domain: domain, organization_id: organization_id, search: search}, + fetch_next: fetch_next + ) end # Get a Connection # @param id [String] Unique identifier for the Connection. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Connection] def get_connection( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/connections/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/connections/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::Connection.new(response.body) + result = WorkOS::Connection.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete a Connection # @param id [String] Unique identifier for the Connection. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_connection( id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/connections/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/connections/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) nil @@ -99,7 +108,7 @@ def delete_connection( # Logout Authorize # @param profile_id [String] The unique ID of the profile to log out. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::SSOLogoutAuthorizeResponse] def authorize_logout( profile_id:, @@ -108,27 +117,36 @@ def authorize_logout( body = { "profile_id" => profile_id }.compact - response = @client.execute_request( - request: @client.post_request(path: "/sso/logout/authorize", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/sso/logout/authorize", + auth: true, + body: body, request_options: request_options ) - WorkOS::SSOLogoutAuthorizeResponse.new(response.body) + result = WorkOS::SSOLogoutAuthorizeResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get a User Profile - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Profile] def get_profile(request_options: {}) - response = @client.execute_request( - request: @client.get_request(path: "/sso/profile", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/sso/profile", + auth: true, request_options: request_options ) - WorkOS::Profile.new(response.body) + result = WorkOS::Profile.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get a Profile and Token # @param code [String] The authorization code received from the authorization callback. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::SSOTokenResponse] def get_profile_and_token( code:, @@ -140,11 +158,16 @@ def get_profile_and_token( "client_secret" => request_options[:api_key] || @client.api_key, "code" => code }.compact - response = @client.execute_request( - request: @client.post_request(path: "/sso/token", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/sso/token", + auth: true, + body: body, request_options: request_options ) - WorkOS::SSOTokenResponse.new(response.body) + result = WorkOS::SSOTokenResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # @oagen-ignore-start — non-spec helpers (hand-maintained) @@ -213,7 +236,7 @@ def build_logout_url(token:) private def build_url(path, params) - base = @client.base_url || "https://api.workos.com" + base = @client.base_url uri = URI.join(base, path) uri.query = URI.encode_www_form(params) uri.to_s diff --git a/lib/workos/sso/connection.rb b/lib/workos/sso/connection.rb index 476858da..77ac1b7a 100644 --- a/lib/workos/sso/connection.rb +++ b/lib/workos/sso/connection.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class Connection - include HashProvider - + class Connection < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -38,15 +34,14 @@ class Connection :updated_at def status - warn "[DEPRECATION] `status` is deprecated. Deprecated. Use `state` instead.", uplevel: 1 + warn "[DEPRECATION] `status` is deprecated and will be removed in a future version.", uplevel: 1 @status end attr_writer :status def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/sso/connection_activated.rb b/lib/workos/sso/connection_activated.rb index 859588e2..f33f6af7 100644 --- a/lib/workos/sso/connection_activated.rb +++ b/lib/workos/sso/connection_activated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionActivated - include HashProvider - + class ConnectionActivated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class ConnectionActivated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::ConnectionActivatedData.new(hash[:data]) : nil diff --git a/lib/workos/sso/connection_activated_data.rb b/lib/workos/sso/connection_activated_data.rb index ce2c61e2..7fb4e19a 100644 --- a/lib/workos/sso/connection_activated_data.rb +++ b/lib/workos/sso/connection_activated_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionActivatedData - include HashProvider - + class ConnectionActivatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -36,8 +32,7 @@ class ConnectionActivatedData :domains def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @state = hash[:state] diff --git a/lib/workos/sso/connection_activated_data_domain.rb b/lib/workos/sso/connection_activated_data_domain.rb index b69b5e97..1ad05087 100644 --- a/lib/workos/sso/connection_activated_data_domain.rb +++ b/lib/workos/sso/connection_activated_data_domain.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionActivatedDataDomain - include HashProvider - + class ConnectionActivatedDataDomain < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -20,8 +16,7 @@ class ConnectionActivatedDataDomain :domain def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @domain = hash[:domain] diff --git a/lib/workos/sso/connection_deactivated.rb b/lib/workos/sso/connection_deactivated.rb index 9d93f48c..00786d18 100644 --- a/lib/workos/sso/connection_deactivated.rb +++ b/lib/workos/sso/connection_deactivated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionDeactivated - include HashProvider - + class ConnectionDeactivated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class ConnectionDeactivated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::ConnectionDeactivatedData.new(hash[:data]) : nil diff --git a/lib/workos/sso/connection_deactivated_data.rb b/lib/workos/sso/connection_deactivated_data.rb index e7f277df..6e01165a 100644 --- a/lib/workos/sso/connection_deactivated_data.rb +++ b/lib/workos/sso/connection_deactivated_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionDeactivatedData - include HashProvider - + class ConnectionDeactivatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -36,8 +32,7 @@ class ConnectionDeactivatedData :domains def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @state = hash[:state] diff --git a/lib/workos/sso/connection_deleted.rb b/lib/workos/sso/connection_deleted.rb index 61ab76d1..6b30064a 100644 --- a/lib/workos/sso/connection_deleted.rb +++ b/lib/workos/sso/connection_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionDeleted - include HashProvider - + class ConnectionDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class ConnectionDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::ConnectionDeletedData.new(hash[:data]) : nil diff --git a/lib/workos/sso/connection_deleted_data.rb b/lib/workos/sso/connection_deleted_data.rb index c187d140..62a59787 100644 --- a/lib/workos/sso/connection_deleted_data.rb +++ b/lib/workos/sso/connection_deleted_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionDeletedData - include HashProvider - + class ConnectionDeletedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -30,8 +26,7 @@ class ConnectionDeletedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @state = hash[:state] diff --git a/lib/workos/sso/connection_option.rb b/lib/workos/sso/connection_option.rb index 5ede0a81..c724bcb5 100644 --- a/lib/workos/sso/connection_option.rb +++ b/lib/workos/sso/connection_option.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionOption - include HashProvider - + class ConnectionOption < WorkOS::Types::BaseModel HASH_ATTRS = { signing_cert: :signing_cert }.freeze @@ -15,8 +11,7 @@ class ConnectionOption attr_accessor :signing_cert def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @signing_cert = hash[:signing_cert] end end diff --git a/lib/workos/sso/connection_saml_certificate_renewal_required.rb b/lib/workos/sso/connection_saml_certificate_renewal_required.rb index ec08027c..441b8cfd 100644 --- a/lib/workos/sso/connection_saml_certificate_renewal_required.rb +++ b/lib/workos/sso/connection_saml_certificate_renewal_required.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionSAMLCertificateRenewalRequired - include HashProvider - + class ConnectionSAMLCertificateRenewalRequired < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class ConnectionSAMLCertificateRenewalRequired :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::ConnectionSAMLCertificateRenewalRequiredData.new(hash[:data]) : nil diff --git a/lib/workos/sso/connection_saml_certificate_renewal_required_data.rb b/lib/workos/sso/connection_saml_certificate_renewal_required_data.rb index 81aeabb5..92b64169 100644 --- a/lib/workos/sso/connection_saml_certificate_renewal_required_data.rb +++ b/lib/workos/sso/connection_saml_certificate_renewal_required_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionSAMLCertificateRenewalRequiredData - include HashProvider - + class ConnectionSAMLCertificateRenewalRequiredData < WorkOS::Types::BaseModel HASH_ATTRS = { connection: :connection, certificate: :certificate, @@ -20,8 +16,7 @@ class ConnectionSAMLCertificateRenewalRequiredData :days_until_expiry def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @connection = hash[:connection] ? WorkOS::ConnectionSAMLCertificateRenewalRequiredDataConnection.new(hash[:connection]) : nil @certificate = hash[:certificate] ? WorkOS::ConnectionSAMLCertificateRenewalRequiredDataCertificate.new(hash[:certificate]) : nil @days_until_expiry = hash[:days_until_expiry] diff --git a/lib/workos/sso/connection_saml_certificate_renewal_required_data_certificate.rb b/lib/workos/sso/connection_saml_certificate_renewal_required_data_certificate.rb index 665f0b74..f7b3903b 100644 --- a/lib/workos/sso/connection_saml_certificate_renewal_required_data_certificate.rb +++ b/lib/workos/sso/connection_saml_certificate_renewal_required_data_certificate.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionSAMLCertificateRenewalRequiredDataCertificate - include HashProvider - + class ConnectionSAMLCertificateRenewalRequiredDataCertificate < WorkOS::Types::BaseModel HASH_ATTRS = { certificate_type: :certificate_type, expiry_date: :expiry_date, @@ -20,8 +16,7 @@ class ConnectionSAMLCertificateRenewalRequiredDataCertificate :is_expired def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @certificate_type = hash[:certificate_type] @expiry_date = hash[:expiry_date] @is_expired = hash[:is_expired] diff --git a/lib/workos/sso/connection_saml_certificate_renewal_required_data_connection.rb b/lib/workos/sso/connection_saml_certificate_renewal_required_data_connection.rb index 4e145b5c..371a6a83 100644 --- a/lib/workos/sso/connection_saml_certificate_renewal_required_data_connection.rb +++ b/lib/workos/sso/connection_saml_certificate_renewal_required_data_connection.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionSAMLCertificateRenewalRequiredDataConnection - include HashProvider - + class ConnectionSAMLCertificateRenewalRequiredDataConnection < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, organization_id: :organization_id @@ -18,8 +14,7 @@ class ConnectionSAMLCertificateRenewalRequiredDataConnection :organization_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @organization_id = hash[:organization_id] end diff --git a/lib/workos/sso/connection_saml_certificate_renewed.rb b/lib/workos/sso/connection_saml_certificate_renewed.rb index a5cb2e38..42522d1a 100644 --- a/lib/workos/sso/connection_saml_certificate_renewed.rb +++ b/lib/workos/sso/connection_saml_certificate_renewed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionSAMLCertificateRenewed - include HashProvider - + class ConnectionSAMLCertificateRenewed < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class ConnectionSAMLCertificateRenewed :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::ConnectionSAMLCertificateRenewedData.new(hash[:data]) : nil diff --git a/lib/workos/sso/connection_saml_certificate_renewed_data.rb b/lib/workos/sso/connection_saml_certificate_renewed_data.rb index 4301faad..b3a0723f 100644 --- a/lib/workos/sso/connection_saml_certificate_renewed_data.rb +++ b/lib/workos/sso/connection_saml_certificate_renewed_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionSAMLCertificateRenewedData - include HashProvider - + class ConnectionSAMLCertificateRenewedData < WorkOS::Types::BaseModel HASH_ATTRS = { connection: :connection, certificate: :certificate, @@ -20,8 +16,7 @@ class ConnectionSAMLCertificateRenewedData :renewed_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @connection = hash[:connection] ? WorkOS::ConnectionSAMLCertificateRenewedDataConnection.new(hash[:connection]) : nil @certificate = hash[:certificate] ? WorkOS::ConnectionSAMLCertificateRenewedDataCertificate.new(hash[:certificate]) : nil @renewed_at = hash[:renewed_at] diff --git a/lib/workos/sso/connection_saml_certificate_renewed_data_certificate.rb b/lib/workos/sso/connection_saml_certificate_renewed_data_certificate.rb index 9af47f3e..f67edf22 100644 --- a/lib/workos/sso/connection_saml_certificate_renewed_data_certificate.rb +++ b/lib/workos/sso/connection_saml_certificate_renewed_data_certificate.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ConnectionSAMLCertificateRenewedDataCertificate - include HashProvider - + class ConnectionSAMLCertificateRenewedDataCertificate < WorkOS::Types::BaseModel HASH_ATTRS = { certificate_type: :certificate_type, expiry_date: :expiry_date @@ -18,8 +14,7 @@ class ConnectionSAMLCertificateRenewedDataCertificate :expiry_date def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @certificate_type = hash[:certificate_type] @expiry_date = hash[:expiry_date] end diff --git a/lib/workos/sso/profile.rb b/lib/workos/sso/profile.rb index b3a6b220..39b3520c 100644 --- a/lib/workos/sso/profile.rb +++ b/lib/workos/sso/profile.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class Profile - include HashProvider - + class Profile < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -42,8 +38,7 @@ class Profile :raw_attributes def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @organization_id = hash[:organization_id] diff --git a/lib/workos/sso/sso_authorize_url_response.rb b/lib/workos/sso/sso_authorize_url_response.rb index 7ffa787a..556d40e2 100644 --- a/lib/workos/sso/sso_authorize_url_response.rb +++ b/lib/workos/sso/sso_authorize_url_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SSOAuthorizeUrlResponse - include HashProvider - + class SSOAuthorizeUrlResponse < WorkOS::Types::BaseModel HASH_ATTRS = { url: :url }.freeze @@ -15,8 +11,7 @@ class SSOAuthorizeUrlResponse attr_accessor :url def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @url = hash[:url] end end diff --git a/lib/workos/sso/sso_logout_authorize_request.rb b/lib/workos/sso/sso_logout_authorize_request.rb index 30982a70..ba75fea3 100644 --- a/lib/workos/sso/sso_logout_authorize_request.rb +++ b/lib/workos/sso/sso_logout_authorize_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SSOLogoutAuthorizeRequest - include HashProvider - + class SSOLogoutAuthorizeRequest < WorkOS::Types::BaseModel HASH_ATTRS = { profile_id: :profile_id }.freeze @@ -15,8 +11,7 @@ class SSOLogoutAuthorizeRequest attr_accessor :profile_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @profile_id = hash[:profile_id] end end diff --git a/lib/workos/sso/sso_logout_authorize_response.rb b/lib/workos/sso/sso_logout_authorize_response.rb index 3557cd8a..00ac8da5 100644 --- a/lib/workos/sso/sso_logout_authorize_response.rb +++ b/lib/workos/sso/sso_logout_authorize_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SSOLogoutAuthorizeResponse - include HashProvider - + class SSOLogoutAuthorizeResponse < WorkOS::Types::BaseModel HASH_ATTRS = { logout_url: :logout_url, logout_token: :logout_token @@ -18,8 +14,7 @@ class SSOLogoutAuthorizeResponse :logout_token def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @logout_url = hash[:logout_url] @logout_token = hash[:logout_token] end diff --git a/lib/workos/sso/sso_token_response.rb b/lib/workos/sso/sso_token_response.rb index c7eec9f4..5ddd9838 100644 --- a/lib/workos/sso/sso_token_response.rb +++ b/lib/workos/sso/sso_token_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SSOTokenResponse - include HashProvider - + class SSOTokenResponse < WorkOS::Types::BaseModel HASH_ATTRS = { token_type: :token_type, access_token: :access_token, @@ -24,8 +20,7 @@ class SSOTokenResponse :oauth_tokens def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @token_type = hash[:token_type] @access_token = hash[:access_token] @expires_in = hash[:expires_in] diff --git a/lib/workos/sso/token_query.rb b/lib/workos/sso/token_query.rb index 659b74c2..4ee27dcc 100644 --- a/lib/workos/sso/token_query.rb +++ b/lib/workos/sso/token_query.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class TokenQuery - include HashProvider - + class TokenQuery < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, client_secret: :client_secret, @@ -22,8 +18,7 @@ class TokenQuery :grant_type def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @client_secret = hash[:client_secret] @code = hash[:code] diff --git a/lib/workos/types/base_model.rb b/lib/workos/types/base_model.rb new file mode 100644 index 00000000..edd1dafa --- /dev/null +++ b/lib/workos/types/base_model.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +# @oagen-ignore-file — hand-maintained runtime +require "json" + +module WorkOS + module Types + # Shared base class for all generated model classes. + # + # Provides: + # - HashProvider mixin for to_h / to_json / inspect + # - normalize(input) for JSON-vs-hash / string-vs-symbol normalization + # + # Subclasses declare HASH_ATTRS for serialization and implement their + # own initialize(json) using normalize to parse input. + # Lightweight wrapper around the raw HTTP response, exposing status, + # headers, and request-id for observability without leaking Net::HTTP. + ApiResponse = Data.define(:http_status, :http_headers, :request_id) + + class BaseModel + include HashProvider + + # The raw HTTP response metadata for this object, if available. + # Populated automatically by service methods that return models. + # @return [WorkOS::Types::ApiResponse, nil] + attr_accessor :last_response + + # Normalize an input value (JSON string or Hash) into a Hash with + # symbolized keys. Safe for already-symbolized hashes (no-op). + # + # @param json [String, Hash] JSON string or hash to normalize. + # @return [Hash{Symbol => Object}] + def self.normalize(json) + hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) + hash.transform_keys(&:to_sym) + end + end + end +end diff --git a/lib/workos/types/request_options.rb b/lib/workos/types/request_options.rb new file mode 100644 index 00000000..74fb98ea --- /dev/null +++ b/lib/workos/types/request_options.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# @oagen-ignore-file — hand-maintained runtime + +module WorkOS + module Types + # Documentation-only class describing the per-request override keys + # accepted by every generated service method via the `request_options` + # keyword argument. + # + # @!attribute [r] api_key + # @return [String, nil] Override the client-level API key for this request. + # + # @!attribute [r] timeout + # @return [Integer, nil] Override the HTTP timeout (seconds) for this request. + # + # @!attribute [r] base_url + # @return [String, nil] Override the base URL for this request. + # + # @!attribute [r] max_retries + # @return [Integer, nil] Override the maximum number of retries for this request. + # + # @!attribute [r] idempotency_key + # @return [String, nil] Set a custom Idempotency-Key header for this request. + # + # @!attribute [r] extra_headers + # @return [Hash{String => String}, nil] Additional HTTP headers to send with this request. + class RequestOptions + # This class is never instantiated — it exists solely for YARD + # documentation. Service methods accept a plain Hash. + end + end +end diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index a13ee7fd..dc561c06 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -13,17 +12,21 @@ def initialize(client) # Get JWKS # @param client_id [String] Identifies the application making the request to the WorkOS server. You can obtain your client ID from the [API Keys](https://dashboard.workos.com/api-keys) page in the dashboard. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::JwksResponse] def get_jwks( client_id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/sso/jwks/#{CGI.escape(client_id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/sso/jwks/#{WorkOS::Util.encode_path(client_id)}", + auth: true, request_options: request_options ) - WorkOS::JwksResponse.new(response.body) + result = WorkOS::JwksResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Authenticate @@ -43,7 +46,7 @@ def get_jwks( # @param pending_authentication_token [String, nil] The pending authentication token from a previous authentication attempt. # @param authentication_challenge_id [String, nil] The ID of the MFA authentication challenge. # @param device_code [String, nil] The device verification code. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthenticateResponse] def create_authenticate( client_id:, @@ -82,11 +85,16 @@ def create_authenticate( "authentication_challenge_id" => authentication_challenge_id, "device_code" => device_code }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, request_options: request_options ) - WorkOS::AuthenticateResponse.new(response.body) + result = WorkOS::AuthenticateResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Authenticate with password. @@ -118,8 +126,11 @@ def authenticate_with_password( "device_id" => device_id, "user_agent" => user_agent }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, request_options: request_options ) WorkOS::AuthenticateResponse.new(response.body) @@ -154,8 +165,11 @@ def authenticate_with_code( "device_id" => device_id, "user_agent" => user_agent }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, request_options: request_options ) WorkOS::AuthenticateResponse.new(response.body) @@ -187,8 +201,11 @@ def authenticate_with_refresh_token( "device_id" => device_id, "user_agent" => user_agent }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, request_options: request_options ) WorkOS::AuthenticateResponse.new(response.body) @@ -223,8 +240,11 @@ def authenticate_with_magic_auth( "device_id" => device_id, "user_agent" => user_agent }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, request_options: request_options ) WorkOS::AuthenticateResponse.new(response.body) @@ -256,8 +276,11 @@ def authenticate_with_email_verification( "device_id" => device_id, "user_agent" => user_agent }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, request_options: request_options ) WorkOS::AuthenticateResponse.new(response.body) @@ -292,8 +315,11 @@ def authenticate_with_totp( "device_id" => device_id, "user_agent" => user_agent }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, request_options: request_options ) WorkOS::AuthenticateResponse.new(response.body) @@ -325,8 +351,11 @@ def authenticate_with_organization_selection( "device_id" => device_id, "user_agent" => user_agent }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, request_options: request_options ) WorkOS::AuthenticateResponse.new(response.body) @@ -354,8 +383,11 @@ def authenticate_with_device_code( "device_id" => device_id, "user_agent" => user_agent }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/authenticate", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, request_options: request_options ) WorkOS::AuthenticateResponse.new(response.body) @@ -363,7 +395,7 @@ def authenticate_with_device_code( # Get device authorization URL # @param client_id [String] The WorkOS client ID for your application. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::DeviceAuthorizationResponse] def create_device( client_id:, @@ -372,17 +404,22 @@ def create_device( body = { "client_id" => client_id }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/authorize/device", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/authorize/device", + auth: true, + body: body, request_options: request_options ) - WorkOS::DeviceAuthorizationResponse.new(response.body) + result = WorkOS::DeviceAuthorizationResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Revoke Session # @param session_id [String] The ID of the session to revoke. This can be extracted from the `sid` claim of the access token. # @param return_to [String, nil] The URL to redirect the user to after session revocation. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def revoke_session( session_id:, @@ -393,8 +430,11 @@ def revoke_session( "session_id" => session_id, "return_to" => return_to }.compact - @client.execute_request( - request: @client.post_request(path: "/user_management/sessions/revoke", auth: true, body: body, request_options: request_options), + @client.request( + method: :post, + path: "/user_management/sessions/revoke", + auth: true, + body: body, request_options: request_options ) nil @@ -402,7 +442,7 @@ def revoke_session( # Create a CORS origin # @param origin [String] The origin URL to allow for CORS requests. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::CORSOriginResponse] def create_cors_origin( origin:, @@ -411,31 +451,40 @@ def create_cors_origin( body = { "origin" => origin }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/cors_origins", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/cors_origins", + auth: true, + body: body, request_options: request_options ) - WorkOS::CORSOriginResponse.new(response.body) + result = WorkOS::CORSOriginResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get an email verification code # @param id [String] The ID of the email verification code. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::EmailVerification] def get_email_verification( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/user_management/email_verification/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/email_verification/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::EmailVerification.new(response.body) + result = WorkOS::EmailVerification.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Create a password reset token # @param email [String] The email address of the user requesting a password reset. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::PasswordReset] def reset_password( email:, @@ -444,17 +493,22 @@ def reset_password( body = { "email" => email }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/password_reset", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/password_reset", + auth: true, + body: body, request_options: request_options ) - WorkOS::PasswordReset.new(response.body) + result = WorkOS::PasswordReset.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Reset the password # @param token [String] The password reset token. # @param new_password [String] The new password to set for the user. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::ResetPasswordResponse] def confirm_password_reset( token:, @@ -465,26 +519,35 @@ def confirm_password_reset( "token" => token, "new_password" => new_password }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/password_reset/confirm", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/password_reset/confirm", + auth: true, + body: body, request_options: request_options ) - WorkOS::ResetPasswordResponse.new(response.body) + result = WorkOS::ResetPasswordResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get a password reset token # @param id [String] The ID of the password reset token. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::PasswordReset] def get_password_reset( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/user_management/password_reset/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/password_reset/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::PasswordReset.new(response.body) + result = WorkOS::PasswordReset.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # List users @@ -495,8 +558,8 @@ def get_password_reset( # @param organization [String, nil] (deprecated) Filter users by the organization they are a member of. Deprecated in favor of `organization_id`. # @param organization_id [String, nil] Filter users by the organization they are a member of. # @param email [String, nil] Filter users by their email address. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_users( before: nil, after: nil, @@ -516,15 +579,14 @@ def list_users( "organization_id" => organization_id, "email" => email }.compact - response = @client.execute_request( - request: @client.get_request(path: "/user_management/users", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/users", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::User.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_users( before: before, after: cursor, @@ -535,8 +597,13 @@ def list_users( email: email, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization: organization, organization_id: organization_id, email: email}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::User, + filters: {before: before, limit: limit, order: order, organization: organization, organization_id: organization_id, email: email}, + fetch_next: fetch_next + ) end # Create a user @@ -549,7 +616,7 @@ def list_users( # @param password [String, nil] The password to set for the user. Mutually exclusive with `password_hash` and `password_hash_type`. # @param password_hash [String, nil] The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`. # @param password_hash_type [WorkOS::Types::CreateUserPasswordHashType, nil] The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::User] def create_user( email:, @@ -584,41 +651,55 @@ def create_user( "password_hash" => password_hash, "password_hash_type" => password_hash_type }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/users", auth: true, params: params, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/users", + auth: true, + params: params, + body: body, request_options: request_options ) - WorkOS::User.new(response.body) + result = WorkOS::User.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get a user by external ID # @param external_id [String] The external ID of the user. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::User] def get_user_by_external_id( external_id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/user_management/users/external_id/#{CGI.escape(external_id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/users/external_id/#{WorkOS::Util.encode_path(external_id)}", + auth: true, request_options: request_options ) - WorkOS::User.new(response.body) + result = WorkOS::User.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get a user # @param id [String] The unique ID of the user. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::User] def get_user( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/user_management/users/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/users/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::User.new(response.body) + result = WorkOS::User.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update a user @@ -633,7 +714,7 @@ def get_user( # @param password [String, nil] The password to set for the user. Mutually exclusive with `password_hash` and `password_hash_type`. # @param password_hash [String, nil] The hashed password to set for the user. Required with `password_hash_type`. Mutually exclusive with `password`. # @param password_hash_type [WorkOS::Types::UpdateUserPasswordHashType, nil] The algorithm originally used to hash the password, used when providing a `password_hash`. Required with `password_hash`. Mutually exclusive with `password`. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::User] def update_user( id:, @@ -671,23 +752,31 @@ def update_user( "password_hash" => password_hash, "password_hash_type" => password_hash_type }.compact - response = @client.execute_request( - request: @client.put_request(path: "/user_management/users/#{CGI.escape(id.to_s)}", auth: true, params: params, body: body, request_options: request_options), + response = @client.request( + method: :put, + path: "/user_management/users/#{WorkOS::Util.encode_path(id)}", + auth: true, + params: params, + body: body, request_options: request_options ) - WorkOS::User.new(response.body) + result = WorkOS::User.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete a user # @param id [String] The unique ID of the user. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_user( id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/user_management/users/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/user_management/users/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) nil @@ -696,7 +785,7 @@ def delete_user( # Confirm email change # @param id [String] The unique ID of the user. # @param code [String] The one-time code used to confirm the email change. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::EmailChangeConfirmation] def confirm_email_change( id:, @@ -706,17 +795,22 @@ def confirm_email_change( body = { "code" => code }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/email_change/confirm", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/confirm", + auth: true, + body: body, request_options: request_options ) - WorkOS::EmailChangeConfirmation.new(response.body) + result = WorkOS::EmailChangeConfirmation.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Send email change code # @param id [String] The unique ID of the user. # @param new_email [String] The new email address to change to. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::EmailChange] def send_email_change( id:, @@ -726,17 +820,22 @@ def send_email_change( body = { "new_email" => new_email }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/email_change/send", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_change/send", + auth: true, + body: body, request_options: request_options ) - WorkOS::EmailChange.new(response.body) + result = WorkOS::EmailChange.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Verify email # @param id [String] The ID of the user. # @param code [String] The one-time email verification code. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::VerifyEmailResponse] def verify_email( id:, @@ -746,38 +845,49 @@ def verify_email( body = { "code" => code }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/email_verification/confirm", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_verification/confirm", + auth: true, + body: body, request_options: request_options ) - WorkOS::VerifyEmailResponse.new(response.body) + result = WorkOS::VerifyEmailResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Send verification email # @param id [String] The ID of the user. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::SendVerificationEmailResponse] def send_verification_email( id:, request_options: {} ) - response = @client.execute_request( - request: @client.post_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/email_verification/send", auth: true, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_verification/send", + auth: true, request_options: request_options ) - WorkOS::SendVerificationEmailResponse.new(response.body) + result = WorkOS::SendVerificationEmailResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get user identities # @param id [String] The unique ID of the user. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [Array] def get_user_identities( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/identities", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/identities", + auth: true, request_options: request_options ) parsed = JSON.parse(response.body) @@ -790,8 +900,8 @@ def get_user_identities( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::UserManagementUsersOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_sessions( id:, before: nil, @@ -806,15 +916,14 @@ def list_sessions( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/user_management/users/#{CGI.escape(id.to_s)}/sessions", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/sessions", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::UserSessionsListItem.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_sessions( id: id, before: before, @@ -823,8 +932,13 @@ def list_sessions( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {id: id, before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserSessionsListItem, + filters: {id: id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # List invitations @@ -834,8 +948,8 @@ def list_sessions( # @param order [WorkOS::Types::UserManagementInvitationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) that the recipient will join. # @param email [String, nil] The email address of the recipient. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_invitations( before: nil, after: nil, @@ -853,15 +967,14 @@ def list_invitations( "organization_id" => organization_id, "email" => email }.compact - response = @client.execute_request( - request: @client.get_request(path: "/user_management/invitations", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/invitations", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::UserInvite.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_invitations( before: before, after: cursor, @@ -871,8 +984,13 @@ def list_invitations( email: email, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization_id: organization_id, email: email}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserInvite, + filters: {before: before, limit: limit, order: order, organization_id: organization_id, email: email}, + fetch_next: fetch_next + ) end # Send an invitation @@ -882,7 +1000,7 @@ def list_invitations( # @param expires_in_days [Integer, nil] How many days the invitations will be valid for. Must be between 1 and 30 days. Defaults to 7 days if not specified. # @param inviter_user_id [String, nil] The ID of the [user](https://workos.com/docs/reference/authkit/user) who invites the recipient. The invitation email will mention the name of this user. # @param locale [WorkOS::Types::CreateUserInviteOptionsLocale, nil] The locale to use when rendering the invitation email. See [supported locales](https://workos.com/docs/authkit/hosted-ui/localization). - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::UserInvite] def send_invitation( email:, @@ -901,62 +1019,79 @@ def send_invitation( "inviter_user_id" => inviter_user_id, "locale" => locale }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/invitations", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/invitations", + auth: true, + body: body, request_options: request_options ) - WorkOS::UserInvite.new(response.body) + result = WorkOS::UserInvite.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Find an invitation by token # @param token [String] The token used to accept the invitation. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::UserInvite] def find_invitation_by_token( token:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/user_management/invitations/by_token/#{CGI.escape(token.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/invitations/by_token/#{WorkOS::Util.encode_path(token)}", + auth: true, request_options: request_options ) - WorkOS::UserInvite.new(response.body) + result = WorkOS::UserInvite.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get an invitation # @param id [String] The unique ID of the invitation. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::UserInvite] def get_invitation( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/user_management/invitations/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::UserInvite.new(response.body) + result = WorkOS::UserInvite.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Accept an invitation # @param id [String] The unique ID of the invitation. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Invitation] def accept_invitation( id:, request_options: {} ) - response = @client.execute_request( - request: @client.post_request(path: "/user_management/invitations/#{CGI.escape(id.to_s)}/accept", auth: true, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/accept", + auth: true, request_options: request_options ) - WorkOS::Invitation.new(response.body) + result = WorkOS::Invitation.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Resend an invitation # @param id [String] The unique ID of the invitation. # @param locale [WorkOS::Types::ResendUserInviteOptionsLocale, nil] The locale to use when rendering the invitation email. See [supported locales](https://workos.com/docs/authkit/hosted-ui/localization). - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::UserInvite] def resend_invitation( id:, @@ -966,31 +1101,40 @@ def resend_invitation( body = { "locale" => locale }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/invitations/#{CGI.escape(id.to_s)}/resend", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/resend", + auth: true, + body: body, request_options: request_options ) - WorkOS::UserInvite.new(response.body) + result = WorkOS::UserInvite.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Revoke an invitation # @param id [String] The unique ID of the invitation. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Invitation] def revoke_invitation( id:, request_options: {} ) - response = @client.execute_request( - request: @client.post_request(path: "/user_management/invitations/#{CGI.escape(id.to_s)}/revoke", auth: true, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/invitations/#{WorkOS::Util.encode_path(id)}/revoke", + auth: true, request_options: request_options ) - WorkOS::Invitation.new(response.body) + result = WorkOS::Invitation.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update JWT template # @param content [String] The JWT template content as a Liquid template string. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::JWTTemplateResponse] def update_jwt_template( content:, @@ -999,17 +1143,22 @@ def update_jwt_template( body = { "content" => content }.compact - response = @client.execute_request( - request: @client.put_request(path: "/user_management/jwt_template", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :put, + path: "/user_management/jwt_template", + auth: true, + body: body, request_options: request_options ) - WorkOS::JWTTemplateResponse.new(response.body) + result = WorkOS::JWTTemplateResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Create a Magic Auth code # @param email [String] The email address to send the magic code to. # @param invitation_token [String, nil] The invitation token to associate with this magic code. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::MagicAuth] def create_magic_auth( email:, @@ -1020,26 +1169,35 @@ def create_magic_auth( "email" => email, "invitation_token" => invitation_token }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/magic_auth", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/magic_auth", + auth: true, + body: body, request_options: request_options ) - WorkOS::MagicAuth.new(response.body) + result = WorkOS::MagicAuth.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get Magic Auth code details # @param id [String] The unique ID of the Magic Auth code. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::MagicAuth] def get_magic_auth( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/user_management/magic_auth/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/magic_auth/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::MagicAuth.new(response.body) + result = WorkOS::MagicAuth.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # List organization memberships @@ -1050,8 +1208,8 @@ def get_magic_auth( # @param organization_id [String, nil] The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to. # @param statuses [Array, nil] Filter by the status of the organization membership. Array including any of `active`, `inactive`, or `pending`. # @param user_id [String, nil] The ID of the [user](https://workos.com/docs/reference/authkit/user). - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_organization_memberships( before: nil, after: nil, @@ -1071,15 +1229,14 @@ def list_organization_memberships( "statuses" => statuses, "user_id" => user_id }.compact - response = @client.execute_request( - request: @client.get_request(path: "/user_management/organization_memberships", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/organization_memberships", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::UserOrganizationMembership.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_organization_memberships( before: before, after: cursor, @@ -1090,8 +1247,13 @@ def list_organization_memberships( user_id: user_id, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order, organization_id: organization_id, statuses: statuses, user_id: user_id}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserOrganizationMembership, + filters: {before: before, limit: limit, order: order, organization_id: organization_id, statuses: statuses, user_id: user_id}, + fetch_next: fetch_next + ) end # Create an organization membership @@ -1099,7 +1261,7 @@ def list_organization_memberships( # @param organization_id [String] The ID of the [organization](https://workos.com/docs/reference/organization) which the user belongs to. # @param role_slug [String, nil] A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`. # @param role_slugs [Array, nil] An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::OrganizationMembership] def create_organization_membership( user_id:, @@ -1124,33 +1286,43 @@ def create_organization_membership( "role_slug" => role_slug, "role_slugs" => role_slugs }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/organization_memberships", auth: true, params: params, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/organization_memberships", + auth: true, + params: params, + body: body, request_options: request_options ) - WorkOS::OrganizationMembership.new(response.body) + result = WorkOS::OrganizationMembership.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Get an organization membership # @param id [String] The unique ID of the organization membership. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::UserOrganizationMembership] def get_organization_membership( id:, request_options: {} ) - response = @client.execute_request( - request: @client.get_request(path: "/user_management/organization_memberships/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) - WorkOS::UserOrganizationMembership.new(response.body) + result = WorkOS::UserOrganizationMembership.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update an organization membership # @param id [String] The unique ID of the organization membership. # @param role_slug [String, nil] A single role identifier. Defaults to `member` or the explicit default role. Mutually exclusive with `role_slugs`. # @param role_slugs [Array, nil] An array of role identifiers. Limited to one role when Multiple Roles is disabled. Mutually exclusive with `role_slug`. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::UserOrganizationMembership] def update_organization_membership( id:, @@ -1172,23 +1344,31 @@ def update_organization_membership( "role_slug" => role_slug, "role_slugs" => role_slugs }.compact - response = @client.execute_request( - request: @client.put_request(path: "/user_management/organization_memberships/#{CGI.escape(id.to_s)}", auth: true, params: params, body: body, request_options: request_options), + response = @client.request( + method: :put, + path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}", + auth: true, + params: params, + body: body, request_options: request_options ) - WorkOS::UserOrganizationMembership.new(response.body) + result = WorkOS::UserOrganizationMembership.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete an organization membership # @param id [String] The unique ID of the organization membership. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_organization_membership( id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/user_management/organization_memberships/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) nil @@ -1196,37 +1376,45 @@ def delete_organization_membership( # Deactivate an organization membership # @param id [String] The unique ID of the organization membership. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::OrganizationMembership] def deactivate_organization_membership( id:, request_options: {} ) - response = @client.execute_request( - request: @client.put_request(path: "/user_management/organization_memberships/#{CGI.escape(id.to_s)}/deactivate", auth: true, request_options: request_options), + response = @client.request( + method: :put, + path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}/deactivate", + auth: true, request_options: request_options ) - WorkOS::OrganizationMembership.new(response.body) + result = WorkOS::OrganizationMembership.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Reactivate an organization membership # @param id [String] The unique ID of the organization membership. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::UserOrganizationMembership] def reactivate_organization_membership( id:, request_options: {} ) - response = @client.execute_request( - request: @client.put_request(path: "/user_management/organization_memberships/#{CGI.escape(id.to_s)}/reactivate", auth: true, request_options: request_options), + response = @client.request( + method: :put, + path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(id)}/reactivate", + auth: true, request_options: request_options ) - WorkOS::UserOrganizationMembership.new(response.body) + result = WorkOS::UserOrganizationMembership.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Create a redirect URI # @param uri [String] The redirect URI to create. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::RedirectUri] def create_redirect_uri( uri:, @@ -1235,11 +1423,16 @@ def create_redirect_uri( body = { "uri" => uri }.compact - response = @client.execute_request( - request: @client.post_request(path: "/user_management/redirect_uris", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/user_management/redirect_uris", + auth: true, + body: body, request_options: request_options ) - WorkOS::RedirectUri.new(response.body) + result = WorkOS::RedirectUri.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # List authorized applications @@ -1248,8 +1441,8 @@ def create_redirect_uri( # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::UserManagementUsersAuthorizedApplicationsOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_user_authorized_applications( user_id:, before: nil, @@ -1264,15 +1457,14 @@ def list_user_authorized_applications( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/authorized_applications", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/authorized_applications", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::AuthorizedConnectApplicationListData.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_user_authorized_applications( user_id: user_id, before: before, @@ -1281,22 +1473,29 @@ def list_user_authorized_applications( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {user_id: user_id, before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::AuthorizedConnectApplicationListData, + filters: {user_id: user_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # Delete an authorized application # @param application_id [String] The ID or client ID of the application. # @param user_id [String] The ID of the user. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_user_authorized_application( application_id:, user_id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/user_management/users/#{CGI.escape(user_id.to_s)}/authorized_applications/#{CGI.escape(application_id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/authorized_applications/#{WorkOS::Util.encode_path(application_id)}", + auth: true, request_options: request_options ) nil @@ -1308,7 +1507,7 @@ def delete_user_authorized_application( def get_jwks_url(client_id: nil) cid = client_id || @client.client_id raise ArgumentError, "client_id is required" if cid.nil? || cid.empty? - base = @client.base_url || "https://api.workos.com" + base = @client.base_url URI.join(base, "/sso/jwks/#{WorkOS::Util.encode_path(cid)}").to_s end @@ -1401,7 +1600,7 @@ def get_logout_url(session_id:, return_to: nil) private def build_url(path, params) - base = @client.base_url || "https://api.workos.com" + base = @client.base_url uri = URI.join(base, path) uri.query = URI.encode_www_form(params) uri.to_s diff --git a/lib/workos/user_management/action_authentication_denied.rb b/lib/workos/user_management/action_authentication_denied.rb index b8f654c1..3a9dc236 100644 --- a/lib/workos/user_management/action_authentication_denied.rb +++ b/lib/workos/user_management/action_authentication_denied.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ActionAuthenticationDenied - include HashProvider - + class ActionAuthenticationDenied < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class ActionAuthenticationDenied :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::ActionAuthenticationDeniedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/action_authentication_denied_data.rb b/lib/workos/user_management/action_authentication_denied_data.rb index 3b6d4a63..b25a8e86 100644 --- a/lib/workos/user_management/action_authentication_denied_data.rb +++ b/lib/workos/user_management/action_authentication_denied_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ActionAuthenticationDeniedData - include HashProvider - + class ActionAuthenticationDeniedData < WorkOS::Types::BaseModel HASH_ATTRS = { action_endpoint_id: :action_endpoint_id, action_execution_id: :action_execution_id, @@ -32,8 +28,7 @@ class ActionAuthenticationDeniedData :user_agent def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @action_endpoint_id = hash[:action_endpoint_id] @action_execution_id = hash[:action_execution_id] @type = hash[:type] diff --git a/lib/workos/user_management/action_user_registration_denied.rb b/lib/workos/user_management/action_user_registration_denied.rb index 09a2528c..0a9f39b0 100644 --- a/lib/workos/user_management/action_user_registration_denied.rb +++ b/lib/workos/user_management/action_user_registration_denied.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ActionUserRegistrationDenied - include HashProvider - + class ActionUserRegistrationDenied < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class ActionUserRegistrationDenied :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::ActionUserRegistrationDeniedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/action_user_registration_denied_data.rb b/lib/workos/user_management/action_user_registration_denied_data.rb index 90ebb8b4..0b5192d5 100644 --- a/lib/workos/user_management/action_user_registration_denied_data.rb +++ b/lib/workos/user_management/action_user_registration_denied_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ActionUserRegistrationDeniedData - include HashProvider - + class ActionUserRegistrationDeniedData < WorkOS::Types::BaseModel HASH_ATTRS = { action_endpoint_id: :action_endpoint_id, action_execution_id: :action_execution_id, @@ -30,8 +26,7 @@ class ActionUserRegistrationDeniedData :user_agent def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @action_endpoint_id = hash[:action_endpoint_id] @action_execution_id = hash[:action_execution_id] @type = hash[:type] diff --git a/lib/workos/user_management/authenticate_response.rb b/lib/workos/user_management/authenticate_response.rb index 36977e25..46a2d44b 100644 --- a/lib/workos/user_management/authenticate_response.rb +++ b/lib/workos/user_management/authenticate_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticateResponse - include HashProvider - + class AuthenticateResponse < WorkOS::Types::BaseModel HASH_ATTRS = { user: :user, organization_id: :organization_id, @@ -30,8 +26,7 @@ class AuthenticateResponse :oauth_tokens def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil @organization_id = hash[:organization_id] @authkit_authorization_code = hash[:authkit_authorization_code] diff --git a/lib/workos/user_management/authenticate_response_impersonator.rb b/lib/workos/user_management/authenticate_response_impersonator.rb index 6496115e..a5bcda83 100644 --- a/lib/workos/user_management/authenticate_response_impersonator.rb +++ b/lib/workos/user_management/authenticate_response_impersonator.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticateResponseImpersonator - include HashProvider - + class AuthenticateResponseImpersonator < WorkOS::Types::BaseModel HASH_ATTRS = { email: :email, reason: :reason @@ -18,8 +14,7 @@ class AuthenticateResponseImpersonator :reason def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @email = hash[:email] @reason = hash[:reason] end diff --git a/lib/workos/user_management/authenticate_response_oauth_token.rb b/lib/workos/user_management/authenticate_response_oauth_token.rb index c0fd0d6e..80a3e093 100644 --- a/lib/workos/user_management/authenticate_response_oauth_token.rb +++ b/lib/workos/user_management/authenticate_response_oauth_token.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticateResponseOAuthToken - include HashProvider - + class AuthenticateResponseOAuthToken < WorkOS::Types::BaseModel HASH_ATTRS = { provider: :provider, refresh_token: :refresh_token, @@ -24,8 +20,7 @@ class AuthenticateResponseOAuthToken :scopes def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @provider = hash[:provider] @refresh_token = hash[:refresh_token] @access_token = hash[:access_token] diff --git a/lib/workos/user_management/authentication_email_verification_failed.rb b/lib/workos/user_management/authentication_email_verification_failed.rb index d87a458e..20e6f964 100644 --- a/lib/workos/user_management/authentication_email_verification_failed.rb +++ b/lib/workos/user_management/authentication_email_verification_failed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationEmailVerificationFailed - include HashProvider - + class AuthenticationEmailVerificationFailed < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationEmailVerificationFailed :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationEmailVerificationFailedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_email_verification_failed_data.rb b/lib/workos/user_management/authentication_email_verification_failed_data.rb index 34eaca52..5ecbea54 100644 --- a/lib/workos/user_management/authentication_email_verification_failed_data.rb +++ b/lib/workos/user_management/authentication_email_verification_failed_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationEmailVerificationFailedData - include HashProvider - + class AuthenticationEmailVerificationFailedData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -28,8 +24,7 @@ class AuthenticationEmailVerificationFailedData :error def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_email_verification_failed_data_error.rb b/lib/workos/user_management/authentication_email_verification_failed_data_error.rb index 00e4fd20..09151f5e 100644 --- a/lib/workos/user_management/authentication_email_verification_failed_data_error.rb +++ b/lib/workos/user_management/authentication_email_verification_failed_data_error.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationEmailVerificationFailedDataError - include HashProvider - + class AuthenticationEmailVerificationFailedDataError < WorkOS::Types::BaseModel HASH_ATTRS = { code: :code, message: :message @@ -18,8 +14,7 @@ class AuthenticationEmailVerificationFailedDataError :message def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @code = hash[:code] @message = hash[:message] end diff --git a/lib/workos/user_management/authentication_email_verification_succeeded.rb b/lib/workos/user_management/authentication_email_verification_succeeded.rb index 59abf4a8..c8c57a98 100644 --- a/lib/workos/user_management/authentication_email_verification_succeeded.rb +++ b/lib/workos/user_management/authentication_email_verification_succeeded.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationEmailVerificationSucceeded - include HashProvider - + class AuthenticationEmailVerificationSucceeded < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationEmailVerificationSucceeded :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationEmailVerificationSucceededData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_email_verification_succeeded_data.rb b/lib/workos/user_management/authentication_email_verification_succeeded_data.rb index a7467129..12a7bf7a 100644 --- a/lib/workos/user_management/authentication_email_verification_succeeded_data.rb +++ b/lib/workos/user_management/authentication_email_verification_succeeded_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationEmailVerificationSucceededData - include HashProvider - + class AuthenticationEmailVerificationSucceededData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -26,8 +22,7 @@ class AuthenticationEmailVerificationSucceededData :email def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_magic_auth_failed.rb b/lib/workos/user_management/authentication_magic_auth_failed.rb index 58dc7dec..38d2e6af 100644 --- a/lib/workos/user_management/authentication_magic_auth_failed.rb +++ b/lib/workos/user_management/authentication_magic_auth_failed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationMagicAuthFailed - include HashProvider - + class AuthenticationMagicAuthFailed < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationMagicAuthFailed :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationMagicAuthFailedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_magic_auth_failed_data.rb b/lib/workos/user_management/authentication_magic_auth_failed_data.rb index e62b22c4..5b96e069 100644 --- a/lib/workos/user_management/authentication_magic_auth_failed_data.rb +++ b/lib/workos/user_management/authentication_magic_auth_failed_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationMagicAuthFailedData - include HashProvider - + class AuthenticationMagicAuthFailedData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -28,8 +24,7 @@ class AuthenticationMagicAuthFailedData :error def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_magic_auth_succeeded.rb b/lib/workos/user_management/authentication_magic_auth_succeeded.rb index 946b818f..9016c31b 100644 --- a/lib/workos/user_management/authentication_magic_auth_succeeded.rb +++ b/lib/workos/user_management/authentication_magic_auth_succeeded.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationMagicAuthSucceeded - include HashProvider - + class AuthenticationMagicAuthSucceeded < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationMagicAuthSucceeded :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationMagicAuthSucceededData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_magic_auth_succeeded_data.rb b/lib/workos/user_management/authentication_magic_auth_succeeded_data.rb index d8a07507..32cb2e82 100644 --- a/lib/workos/user_management/authentication_magic_auth_succeeded_data.rb +++ b/lib/workos/user_management/authentication_magic_auth_succeeded_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationMagicAuthSucceededData - include HashProvider - + class AuthenticationMagicAuthSucceededData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -26,8 +22,7 @@ class AuthenticationMagicAuthSucceededData :email def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_mfa_failed.rb b/lib/workos/user_management/authentication_mfa_failed.rb index a50235b1..4e0a6f5a 100644 --- a/lib/workos/user_management/authentication_mfa_failed.rb +++ b/lib/workos/user_management/authentication_mfa_failed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationMFAFailed - include HashProvider - + class AuthenticationMFAFailed < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationMFAFailed :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationMFAFailedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_mfa_failed_data.rb b/lib/workos/user_management/authentication_mfa_failed_data.rb index 949d73a5..11d997ca 100644 --- a/lib/workos/user_management/authentication_mfa_failed_data.rb +++ b/lib/workos/user_management/authentication_mfa_failed_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationMFAFailedData - include HashProvider - + class AuthenticationMFAFailedData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -28,8 +24,7 @@ class AuthenticationMFAFailedData :error def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_mfa_succeeded.rb b/lib/workos/user_management/authentication_mfa_succeeded.rb index b6fd3986..34177373 100644 --- a/lib/workos/user_management/authentication_mfa_succeeded.rb +++ b/lib/workos/user_management/authentication_mfa_succeeded.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationMFASucceeded - include HashProvider - + class AuthenticationMFASucceeded < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationMFASucceeded :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationMFASucceededData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_mfa_succeeded_data.rb b/lib/workos/user_management/authentication_mfa_succeeded_data.rb index d93a8d41..bd06277a 100644 --- a/lib/workos/user_management/authentication_mfa_succeeded_data.rb +++ b/lib/workos/user_management/authentication_mfa_succeeded_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationMFASucceededData - include HashProvider - + class AuthenticationMFASucceededData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -26,8 +22,7 @@ class AuthenticationMFASucceededData :email def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_oauth_failed.rb b/lib/workos/user_management/authentication_oauth_failed.rb index 1b90b0ec..d76b5284 100644 --- a/lib/workos/user_management/authentication_oauth_failed.rb +++ b/lib/workos/user_management/authentication_oauth_failed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationOAuthFailed - include HashProvider - + class AuthenticationOAuthFailed < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationOAuthFailed :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationOAuthFailedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_oauth_failed_data.rb b/lib/workos/user_management/authentication_oauth_failed_data.rb index 41707014..a143a971 100644 --- a/lib/workos/user_management/authentication_oauth_failed_data.rb +++ b/lib/workos/user_management/authentication_oauth_failed_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationOAuthFailedData - include HashProvider - + class AuthenticationOAuthFailedData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -28,8 +24,7 @@ class AuthenticationOAuthFailedData :error def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_oauth_succeeded.rb b/lib/workos/user_management/authentication_oauth_succeeded.rb index 69c5c9ba..c224dcb2 100644 --- a/lib/workos/user_management/authentication_oauth_succeeded.rb +++ b/lib/workos/user_management/authentication_oauth_succeeded.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationOAuthSucceeded - include HashProvider - + class AuthenticationOAuthSucceeded < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationOAuthSucceeded :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationOAuthSucceededData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_oauth_succeeded_data.rb b/lib/workos/user_management/authentication_oauth_succeeded_data.rb index cc424ede..3291b4a7 100644 --- a/lib/workos/user_management/authentication_oauth_succeeded_data.rb +++ b/lib/workos/user_management/authentication_oauth_succeeded_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationOAuthSucceededData - include HashProvider - + class AuthenticationOAuthSucceededData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -26,8 +22,7 @@ class AuthenticationOAuthSucceededData :email def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_passkey_failed.rb b/lib/workos/user_management/authentication_passkey_failed.rb index 84ab926f..35608fc2 100644 --- a/lib/workos/user_management/authentication_passkey_failed.rb +++ b/lib/workos/user_management/authentication_passkey_failed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationPasskeyFailed - include HashProvider - + class AuthenticationPasskeyFailed < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationPasskeyFailed :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationPasskeyFailedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_passkey_failed_data.rb b/lib/workos/user_management/authentication_passkey_failed_data.rb index 43fac59c..69e8e55f 100644 --- a/lib/workos/user_management/authentication_passkey_failed_data.rb +++ b/lib/workos/user_management/authentication_passkey_failed_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationPasskeyFailedData - include HashProvider - + class AuthenticationPasskeyFailedData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -28,8 +24,7 @@ class AuthenticationPasskeyFailedData :error def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_passkey_succeeded.rb b/lib/workos/user_management/authentication_passkey_succeeded.rb index 0b0ea943..043610c9 100644 --- a/lib/workos/user_management/authentication_passkey_succeeded.rb +++ b/lib/workos/user_management/authentication_passkey_succeeded.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationPasskeySucceeded - include HashProvider - + class AuthenticationPasskeySucceeded < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationPasskeySucceeded :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationPasskeySucceededData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_passkey_succeeded_data.rb b/lib/workos/user_management/authentication_passkey_succeeded_data.rb index 87b0441f..63d253b6 100644 --- a/lib/workos/user_management/authentication_passkey_succeeded_data.rb +++ b/lib/workos/user_management/authentication_passkey_succeeded_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationPasskeySucceededData - include HashProvider - + class AuthenticationPasskeySucceededData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -26,8 +22,7 @@ class AuthenticationPasskeySucceededData :email def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_password_failed.rb b/lib/workos/user_management/authentication_password_failed.rb index e2a34559..de4efe20 100644 --- a/lib/workos/user_management/authentication_password_failed.rb +++ b/lib/workos/user_management/authentication_password_failed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationPasswordFailed - include HashProvider - + class AuthenticationPasswordFailed < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationPasswordFailed :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationPasswordFailedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_password_failed_data.rb b/lib/workos/user_management/authentication_password_failed_data.rb index 5ca45bdb..66ac3776 100644 --- a/lib/workos/user_management/authentication_password_failed_data.rb +++ b/lib/workos/user_management/authentication_password_failed_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationPasswordFailedData - include HashProvider - + class AuthenticationPasswordFailedData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -28,8 +24,7 @@ class AuthenticationPasswordFailedData :error def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_password_succeeded.rb b/lib/workos/user_management/authentication_password_succeeded.rb index 0900be3b..49dc4a18 100644 --- a/lib/workos/user_management/authentication_password_succeeded.rb +++ b/lib/workos/user_management/authentication_password_succeeded.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationPasswordSucceeded - include HashProvider - + class AuthenticationPasswordSucceeded < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationPasswordSucceeded :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationPasswordSucceededData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_password_succeeded_data.rb b/lib/workos/user_management/authentication_password_succeeded_data.rb index 4d60bfa8..a1aff8dd 100644 --- a/lib/workos/user_management/authentication_password_succeeded_data.rb +++ b/lib/workos/user_management/authentication_password_succeeded_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationPasswordSucceededData - include HashProvider - + class AuthenticationPasswordSucceededData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -26,8 +22,7 @@ class AuthenticationPasswordSucceededData :email def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_radar_risk_detected.rb b/lib/workos/user_management/authentication_radar_risk_detected.rb index b179e369..02a6c9c0 100644 --- a/lib/workos/user_management/authentication_radar_risk_detected.rb +++ b/lib/workos/user_management/authentication_radar_risk_detected.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationRadarRiskDetected - include HashProvider - + class AuthenticationRadarRiskDetected < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationRadarRiskDetected :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationRadarRiskDetectedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_radar_risk_detected_data.rb b/lib/workos/user_management/authentication_radar_risk_detected_data.rb index b499f58a..c2fc6c53 100644 --- a/lib/workos/user_management/authentication_radar_risk_detected_data.rb +++ b/lib/workos/user_management/authentication_radar_risk_detected_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationRadarRiskDetectedData - include HashProvider - + class AuthenticationRadarRiskDetectedData < WorkOS::Types::BaseModel HASH_ATTRS = { auth_method: :auth_method, action: :action, @@ -30,8 +26,7 @@ class AuthenticationRadarRiskDetectedData :email def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @auth_method = hash[:auth_method] @action = hash[:action] @control = hash[:control] diff --git a/lib/workos/user_management/authentication_sso_failed.rb b/lib/workos/user_management/authentication_sso_failed.rb index 4c0ef67c..52584c18 100644 --- a/lib/workos/user_management/authentication_sso_failed.rb +++ b/lib/workos/user_management/authentication_sso_failed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationSSOFailed - include HashProvider - + class AuthenticationSSOFailed < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationSSOFailed :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationSSOFailedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_sso_failed_data.rb b/lib/workos/user_management/authentication_sso_failed_data.rb index ab96924d..181894f9 100644 --- a/lib/workos/user_management/authentication_sso_failed_data.rb +++ b/lib/workos/user_management/authentication_sso_failed_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationSSOFailedData - include HashProvider - + class AuthenticationSSOFailedData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -30,8 +26,7 @@ class AuthenticationSSOFailedData :error def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_sso_failed_data_sso.rb b/lib/workos/user_management/authentication_sso_failed_data_sso.rb index c65d9b5a..3cef0f7e 100644 --- a/lib/workos/user_management/authentication_sso_failed_data_sso.rb +++ b/lib/workos/user_management/authentication_sso_failed_data_sso.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationSSOFailedDataSSO - include HashProvider - + class AuthenticationSSOFailedDataSSO < WorkOS::Types::BaseModel HASH_ATTRS = { organization_id: :organization_id, connection_id: :connection_id, @@ -20,8 +16,7 @@ class AuthenticationSSOFailedDataSSO :session_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @organization_id = hash[:organization_id] @connection_id = hash[:connection_id] @session_id = hash[:session_id] diff --git a/lib/workos/user_management/authentication_sso_started.rb b/lib/workos/user_management/authentication_sso_started.rb index e603099a..23dc9e54 100644 --- a/lib/workos/user_management/authentication_sso_started.rb +++ b/lib/workos/user_management/authentication_sso_started.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationSSOStarted - include HashProvider - + class AuthenticationSSOStarted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationSSOStarted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationSSOStartedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_sso_started_data.rb b/lib/workos/user_management/authentication_sso_started_data.rb index e57989ac..8926caea 100644 --- a/lib/workos/user_management/authentication_sso_started_data.rb +++ b/lib/workos/user_management/authentication_sso_started_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationSSOStartedData - include HashProvider - + class AuthenticationSSOStartedData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -28,8 +24,7 @@ class AuthenticationSSOStartedData :sso def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_sso_succeeded.rb b/lib/workos/user_management/authentication_sso_succeeded.rb index 46f5b830..61e48f9b 100644 --- a/lib/workos/user_management/authentication_sso_succeeded.rb +++ b/lib/workos/user_management/authentication_sso_succeeded.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationSSOSucceeded - include HashProvider - + class AuthenticationSSOSucceeded < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationSSOSucceeded :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationSSOSucceededData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_sso_succeeded_data.rb b/lib/workos/user_management/authentication_sso_succeeded_data.rb index 236d4c12..b2a37fd0 100644 --- a/lib/workos/user_management/authentication_sso_succeeded_data.rb +++ b/lib/workos/user_management/authentication_sso_succeeded_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationSSOSucceededData - include HashProvider - + class AuthenticationSSOSucceededData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -28,8 +24,7 @@ class AuthenticationSSOSucceededData :sso def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authentication_sso_timed_out.rb b/lib/workos/user_management/authentication_sso_timed_out.rb index 25b84a2c..cb52f547 100644 --- a/lib/workos/user_management/authentication_sso_timed_out.rb +++ b/lib/workos/user_management/authentication_sso_timed_out.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationSSOTimedOut - include HashProvider - + class AuthenticationSSOTimedOut < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class AuthenticationSSOTimedOut :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::AuthenticationSSOTimedOutData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/authentication_sso_timed_out_data.rb b/lib/workos/user_management/authentication_sso_timed_out_data.rb index e1300d83..906486ec 100644 --- a/lib/workos/user_management/authentication_sso_timed_out_data.rb +++ b/lib/workos/user_management/authentication_sso_timed_out_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthenticationSSOTimedOutData - include HashProvider - + class AuthenticationSSOTimedOutData < WorkOS::Types::BaseModel HASH_ATTRS = { type: :type, status: :status, @@ -30,8 +26,7 @@ class AuthenticationSSOTimedOutData :error def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @type = hash[:type] @status = hash[:status] @ip_address = hash[:ip_address] diff --git a/lib/workos/user_management/authorization_code_session_authenticate_request.rb b/lib/workos/user_management/authorization_code_session_authenticate_request.rb index 26f5da1f..76f02f11 100644 --- a/lib/workos/user_management/authorization_code_session_authenticate_request.rb +++ b/lib/workos/user_management/authorization_code_session_authenticate_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthorizationCodeSessionAuthenticateRequest - include HashProvider - + class AuthorizationCodeSessionAuthenticateRequest < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, client_secret: :client_secret, @@ -32,8 +28,7 @@ class AuthorizationCodeSessionAuthenticateRequest :user_agent def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @client_secret = hash[:client_secret] @grant_type = hash[:grant_type] diff --git a/lib/workos/user_management/authorized_connect_application_list_data.rb b/lib/workos/user_management/authorized_connect_application_list_data.rb index f00c49e8..0b3e62d8 100644 --- a/lib/workos/user_management/authorized_connect_application_list_data.rb +++ b/lib/workos/user_management/authorized_connect_application_list_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class AuthorizedConnectApplicationListData - include HashProvider - + class AuthorizedConnectApplicationListData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -24,8 +20,7 @@ class AuthorizedConnectApplicationListData :application def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @granted_scopes = hash[:granted_scopes] || [] diff --git a/lib/workos/user_management/cors_origin_response.rb b/lib/workos/user_management/cors_origin_response.rb index 83fd5a96..868bff79 100644 --- a/lib/workos/user_management/cors_origin_response.rb +++ b/lib/workos/user_management/cors_origin_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CORSOriginResponse - include HashProvider - + class CORSOriginResponse < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -24,8 +20,7 @@ class CORSOriginResponse :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @origin = hash[:origin] diff --git a/lib/workos/user_management/create_cors_origin.rb b/lib/workos/user_management/create_cors_origin.rb index c5c7e548..25136e48 100644 --- a/lib/workos/user_management/create_cors_origin.rb +++ b/lib/workos/user_management/create_cors_origin.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateCORSOrigin - include HashProvider - + class CreateCORSOrigin < WorkOS::Types::BaseModel HASH_ATTRS = { origin: :origin }.freeze @@ -15,8 +11,7 @@ class CreateCORSOrigin attr_accessor :origin def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @origin = hash[:origin] end end diff --git a/lib/workos/user_management/create_magic_code_and_return.rb b/lib/workos/user_management/create_magic_code_and_return.rb index 669e4f1e..fcc683c9 100644 --- a/lib/workos/user_management/create_magic_code_and_return.rb +++ b/lib/workos/user_management/create_magic_code_and_return.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateMagicCodeAndReturn - include HashProvider - + class CreateMagicCodeAndReturn < WorkOS::Types::BaseModel HASH_ATTRS = { email: :email, invitation_token: :invitation_token @@ -18,8 +14,7 @@ class CreateMagicCodeAndReturn :invitation_token def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @email = hash[:email] @invitation_token = hash[:invitation_token] end diff --git a/lib/workos/user_management/create_password_reset.rb b/lib/workos/user_management/create_password_reset.rb index ba9b9c0d..64bf3905 100644 --- a/lib/workos/user_management/create_password_reset.rb +++ b/lib/workos/user_management/create_password_reset.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreatePasswordReset - include HashProvider - + class CreatePasswordReset < WorkOS::Types::BaseModel HASH_ATTRS = { token: :token, new_password: :new_password @@ -18,8 +14,7 @@ class CreatePasswordReset :new_password def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @token = hash[:token] @new_password = hash[:new_password] end diff --git a/lib/workos/user_management/create_password_reset_token.rb b/lib/workos/user_management/create_password_reset_token.rb index 99e1ede5..df036baa 100644 --- a/lib/workos/user_management/create_password_reset_token.rb +++ b/lib/workos/user_management/create_password_reset_token.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreatePasswordResetToken - include HashProvider - + class CreatePasswordResetToken < WorkOS::Types::BaseModel HASH_ATTRS = { email: :email }.freeze @@ -15,8 +11,7 @@ class CreatePasswordResetToken attr_accessor :email def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @email = hash[:email] end end diff --git a/lib/workos/user_management/create_redirect_uri.rb b/lib/workos/user_management/create_redirect_uri.rb index 6ceba1b6..dcc41fe1 100644 --- a/lib/workos/user_management/create_redirect_uri.rb +++ b/lib/workos/user_management/create_redirect_uri.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateRedirectUri - include HashProvider - + class CreateRedirectUri < WorkOS::Types::BaseModel HASH_ATTRS = { uri: :uri }.freeze @@ -15,8 +11,7 @@ class CreateRedirectUri attr_accessor :uri def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @uri = hash[:uri] end end diff --git a/lib/workos/user_management/create_user.rb b/lib/workos/user_management/create_user.rb index 79432672..b729884f 100644 --- a/lib/workos/user_management/create_user.rb +++ b/lib/workos/user_management/create_user.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateUser - include HashProvider - + class CreateUser < WorkOS::Types::BaseModel HASH_ATTRS = { email: :email, first_name: :first_name, @@ -32,8 +28,7 @@ class CreateUser :password_hash_type def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] diff --git a/lib/workos/user_management/create_user_invite_options.rb b/lib/workos/user_management/create_user_invite_options.rb index 467d5926..41e38f63 100644 --- a/lib/workos/user_management/create_user_invite_options.rb +++ b/lib/workos/user_management/create_user_invite_options.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateUserInviteOptions - include HashProvider - + class CreateUserInviteOptions < WorkOS::Types::BaseModel HASH_ATTRS = { email: :email, organization_id: :organization_id, @@ -26,8 +22,7 @@ class CreateUserInviteOptions :locale def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @email = hash[:email] @organization_id = hash[:organization_id] @role_slug = hash[:role_slug] diff --git a/lib/workos/user_management/create_user_organization_membership.rb b/lib/workos/user_management/create_user_organization_membership.rb index 88cc0e47..924a71dc 100644 --- a/lib/workos/user_management/create_user_organization_membership.rb +++ b/lib/workos/user_management/create_user_organization_membership.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateUserOrganizationMembership - include HashProvider - + class CreateUserOrganizationMembership < WorkOS::Types::BaseModel HASH_ATTRS = { user_id: :user_id, organization_id: :organization_id, @@ -22,8 +18,7 @@ class CreateUserOrganizationMembership :role_slugs def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @user_id = hash[:user_id] @organization_id = hash[:organization_id] @role_slug = hash[:role_slug] diff --git a/lib/workos/user_management/device_authorization_response.rb b/lib/workos/user_management/device_authorization_response.rb index 52c3827a..b828c049 100644 --- a/lib/workos/user_management/device_authorization_response.rb +++ b/lib/workos/user_management/device_authorization_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DeviceAuthorizationResponse - include HashProvider - + class DeviceAuthorizationResponse < WorkOS::Types::BaseModel HASH_ATTRS = { device_code: :device_code, user_code: :user_code, @@ -26,8 +22,7 @@ class DeviceAuthorizationResponse :interval def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @device_code = hash[:device_code] @user_code = hash[:user_code] @verification_uri = hash[:verification_uri] diff --git a/lib/workos/user_management/device_code_session_authenticate_request.rb b/lib/workos/user_management/device_code_session_authenticate_request.rb index b4054061..de7c4b66 100644 --- a/lib/workos/user_management/device_code_session_authenticate_request.rb +++ b/lib/workos/user_management/device_code_session_authenticate_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class DeviceCodeSessionAuthenticateRequest - include HashProvider - + class DeviceCodeSessionAuthenticateRequest < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, grant_type: :grant_type, @@ -26,8 +22,7 @@ class DeviceCodeSessionAuthenticateRequest :user_agent def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @grant_type = hash[:grant_type] @device_code = hash[:device_code] diff --git a/lib/workos/user_management/email_change.rb b/lib/workos/user_management/email_change.rb index 78380fee..e2b6f5a7 100644 --- a/lib/workos/user_management/email_change.rb +++ b/lib/workos/user_management/email_change.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EmailChange - include HashProvider - + class EmailChange < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, user: :user, @@ -24,8 +20,7 @@ class EmailChange :created_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil @new_email = hash[:new_email] diff --git a/lib/workos/user_management/email_change_confirmation.rb b/lib/workos/user_management/email_change_confirmation.rb index 769b67de..fc1609ce 100644 --- a/lib/workos/user_management/email_change_confirmation.rb +++ b/lib/workos/user_management/email_change_confirmation.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EmailChangeConfirmation - include HashProvider - + class EmailChangeConfirmation < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, user: :user @@ -18,8 +14,7 @@ class EmailChangeConfirmation :user def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @user = hash[:user] ? WorkOS::EmailChangeConfirmationUser.new(hash[:user]) : nil end diff --git a/lib/workos/user_management/email_change_confirmation_user.rb b/lib/workos/user_management/email_change_confirmation_user.rb index 944287d5..b6c0ac2c 100644 --- a/lib/workos/user_management/email_change_confirmation_user.rb +++ b/lib/workos/user_management/email_change_confirmation_user.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EmailChangeConfirmationUser - include HashProvider - + class EmailChangeConfirmationUser < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -40,8 +36,7 @@ class EmailChangeConfirmationUser :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @first_name = hash[:first_name] diff --git a/lib/workos/user_management/email_verification.rb b/lib/workos/user_management/email_verification.rb index e652ca0e..7bf7312b 100644 --- a/lib/workos/user_management/email_verification.rb +++ b/lib/workos/user_management/email_verification.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EmailVerification - include HashProvider - + class EmailVerification < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -30,8 +26,7 @@ class EmailVerification :code def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/user_management/email_verification_code_session_authenticate_request.rb b/lib/workos/user_management/email_verification_code_session_authenticate_request.rb index f9a5eb8f..4774a0b5 100644 --- a/lib/workos/user_management/email_verification_code_session_authenticate_request.rb +++ b/lib/workos/user_management/email_verification_code_session_authenticate_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EmailVerificationCodeSessionAuthenticateRequest - include HashProvider - + class EmailVerificationCodeSessionAuthenticateRequest < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, client_secret: :client_secret, @@ -30,8 +26,7 @@ class EmailVerificationCodeSessionAuthenticateRequest :user_agent def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @client_secret = hash[:client_secret] @grant_type = hash[:grant_type] diff --git a/lib/workos/user_management/email_verification_created.rb b/lib/workos/user_management/email_verification_created.rb index fe7dbef4..c9472ad4 100644 --- a/lib/workos/user_management/email_verification_created.rb +++ b/lib/workos/user_management/email_verification_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EmailVerificationCreated - include HashProvider - + class EmailVerificationCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class EmailVerificationCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::EmailVerificationCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/email_verification_created_data.rb b/lib/workos/user_management/email_verification_created_data.rb index d16646bd..1bade3ee 100644 --- a/lib/workos/user_management/email_verification_created_data.rb +++ b/lib/workos/user_management/email_verification_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class EmailVerificationCreatedData - include HashProvider - + class EmailVerificationCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -28,8 +24,7 @@ class EmailVerificationCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/user_management/invitation.rb b/lib/workos/user_management/invitation.rb index 356f9b1a..12f77d58 100644 --- a/lib/workos/user_management/invitation.rb +++ b/lib/workos/user_management/invitation.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class Invitation - include HashProvider - + class Invitation < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -42,8 +38,7 @@ class Invitation :accept_invitation_url def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @email = hash[:email] diff --git a/lib/workos/user_management/invitation_accepted.rb b/lib/workos/user_management/invitation_accepted.rb index b8aae791..132f9bbe 100644 --- a/lib/workos/user_management/invitation_accepted.rb +++ b/lib/workos/user_management/invitation_accepted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class InvitationAccepted - include HashProvider - + class InvitationAccepted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class InvitationAccepted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::InvitationAcceptedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/invitation_accepted_data.rb b/lib/workos/user_management/invitation_accepted_data.rb index a008caf9..e1745237 100644 --- a/lib/workos/user_management/invitation_accepted_data.rb +++ b/lib/workos/user_management/invitation_accepted_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class InvitationAcceptedData - include HashProvider - + class InvitationAcceptedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -38,8 +34,7 @@ class InvitationAcceptedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @email = hash[:email] diff --git a/lib/workos/user_management/invitation_created.rb b/lib/workos/user_management/invitation_created.rb index b6f5cfbd..989bc023 100644 --- a/lib/workos/user_management/invitation_created.rb +++ b/lib/workos/user_management/invitation_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class InvitationCreated - include HashProvider - + class InvitationCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class InvitationCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::InvitationCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/invitation_created_data.rb b/lib/workos/user_management/invitation_created_data.rb index ba535c7a..7d0d7593 100644 --- a/lib/workos/user_management/invitation_created_data.rb +++ b/lib/workos/user_management/invitation_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class InvitationCreatedData - include HashProvider - + class InvitationCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -38,8 +34,7 @@ class InvitationCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @email = hash[:email] diff --git a/lib/workos/user_management/invitation_resent.rb b/lib/workos/user_management/invitation_resent.rb index 7b9b89d4..b89d7768 100644 --- a/lib/workos/user_management/invitation_resent.rb +++ b/lib/workos/user_management/invitation_resent.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class InvitationResent - include HashProvider - + class InvitationResent < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class InvitationResent :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::InvitationResentData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/invitation_resent_data.rb b/lib/workos/user_management/invitation_resent_data.rb index cb3e00ef..e9aae396 100644 --- a/lib/workos/user_management/invitation_resent_data.rb +++ b/lib/workos/user_management/invitation_resent_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class InvitationResentData - include HashProvider - + class InvitationResentData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -38,8 +34,7 @@ class InvitationResentData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @email = hash[:email] diff --git a/lib/workos/user_management/invitation_revoked.rb b/lib/workos/user_management/invitation_revoked.rb index b42b13f6..d0f28b55 100644 --- a/lib/workos/user_management/invitation_revoked.rb +++ b/lib/workos/user_management/invitation_revoked.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class InvitationRevoked - include HashProvider - + class InvitationRevoked < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class InvitationRevoked :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::InvitationRevokedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/invitation_revoked_data.rb b/lib/workos/user_management/invitation_revoked_data.rb index 86c09a91..4212f66c 100644 --- a/lib/workos/user_management/invitation_revoked_data.rb +++ b/lib/workos/user_management/invitation_revoked_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class InvitationRevokedData - include HashProvider - + class InvitationRevokedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -38,8 +34,7 @@ class InvitationRevokedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @email = hash[:email] diff --git a/lib/workos/user_management/jwks_response.rb b/lib/workos/user_management/jwks_response.rb index 76f3f0a4..8b616313 100644 --- a/lib/workos/user_management/jwks_response.rb +++ b/lib/workos/user_management/jwks_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class JwksResponse - include HashProvider - + class JwksResponse < WorkOS::Types::BaseModel HASH_ATTRS = { keys: :keys }.freeze @@ -15,8 +11,7 @@ class JwksResponse attr_accessor :keys def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @keys = (hash[:keys] || []).map { |item| item ? WorkOS::JwksResponseKeys.new(item) : nil } end end diff --git a/lib/workos/user_management/jwks_response_keys.rb b/lib/workos/user_management/jwks_response_keys.rb index 9a4c72f7..e7486e9c 100644 --- a/lib/workos/user_management/jwks_response_keys.rb +++ b/lib/workos/user_management/jwks_response_keys.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class JwksResponseKeys - include HashProvider - + class JwksResponseKeys < WorkOS::Types::BaseModel HASH_ATTRS = { :alg => :alg, :kty => :kty, @@ -30,8 +26,7 @@ class JwksResponseKeys :x_5_t_s_256 def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @alg = hash[:alg] @kty = hash[:kty] @use = hash[:use] diff --git a/lib/workos/user_management/jwt_template_response.rb b/lib/workos/user_management/jwt_template_response.rb index 1fcd1812..5dc65b0d 100644 --- a/lib/workos/user_management/jwt_template_response.rb +++ b/lib/workos/user_management/jwt_template_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class JWTTemplateResponse - include HashProvider - + class JWTTemplateResponse < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, content: :content, @@ -22,8 +18,7 @@ class JWTTemplateResponse :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @content = hash[:content] @created_at = hash[:created_at] diff --git a/lib/workos/user_management/magic_auth.rb b/lib/workos/user_management/magic_auth.rb index adda9f7b..00ae887a 100644 --- a/lib/workos/user_management/magic_auth.rb +++ b/lib/workos/user_management/magic_auth.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class MagicAuth - include HashProvider - + class MagicAuth < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -30,8 +26,7 @@ class MagicAuth :code def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb b/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb index 73362824..aad2df18 100644 --- a/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb +++ b/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class MagicAuthCodeSessionAuthenticateRequest - include HashProvider - + class MagicAuthCodeSessionAuthenticateRequest < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, client_secret: :client_secret, @@ -32,8 +28,7 @@ class MagicAuthCodeSessionAuthenticateRequest :user_agent def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @client_secret = hash[:client_secret] @grant_type = hash[:grant_type] diff --git a/lib/workos/user_management/magic_auth_created.rb b/lib/workos/user_management/magic_auth_created.rb index f3acec39..e356dd07 100644 --- a/lib/workos/user_management/magic_auth_created.rb +++ b/lib/workos/user_management/magic_auth_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class MagicAuthCreated - include HashProvider - + class MagicAuthCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class MagicAuthCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::MagicAuthCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/magic_auth_created_data.rb b/lib/workos/user_management/magic_auth_created_data.rb index 6f03430e..d9e0d970 100644 --- a/lib/workos/user_management/magic_auth_created_data.rb +++ b/lib/workos/user_management/magic_auth_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class MagicAuthCreatedData - include HashProvider - + class MagicAuthCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -28,8 +24,7 @@ class MagicAuthCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/user_management/mfa_totp_session_authenticate_request.rb b/lib/workos/user_management/mfa_totp_session_authenticate_request.rb index 10825b30..e05dc4a3 100644 --- a/lib/workos/user_management/mfa_totp_session_authenticate_request.rb +++ b/lib/workos/user_management/mfa_totp_session_authenticate_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class MFATotpSessionAuthenticateRequest - include HashProvider - + class MFATotpSessionAuthenticateRequest < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, client_secret: :client_secret, @@ -32,8 +28,7 @@ class MFATotpSessionAuthenticateRequest :user_agent def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @client_secret = hash[:client_secret] @grant_type = hash[:grant_type] diff --git a/lib/workos/user_management/organization_membership.rb b/lib/workos/user_management/organization_membership.rb index 880f44cf..e2d9cf95 100644 --- a/lib/workos/user_management/organization_membership.rb +++ b/lib/workos/user_management/organization_membership.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationMembership - include HashProvider - + class OrganizationMembership < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -36,8 +32,7 @@ class OrganizationMembership :role def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/user_management/organization_selection_session_authenticate_request.rb b/lib/workos/user_management/organization_selection_session_authenticate_request.rb index 809c54ac..a2ed1857 100644 --- a/lib/workos/user_management/organization_selection_session_authenticate_request.rb +++ b/lib/workos/user_management/organization_selection_session_authenticate_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class OrganizationSelectionSessionAuthenticateRequest - include HashProvider - + class OrganizationSelectionSessionAuthenticateRequest < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, client_secret: :client_secret, @@ -30,8 +26,7 @@ class OrganizationSelectionSessionAuthenticateRequest :user_agent def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @client_secret = hash[:client_secret] @grant_type = hash[:grant_type] diff --git a/lib/workos/user_management/password_reset.rb b/lib/workos/user_management/password_reset.rb index d64d7da1..f7398595 100644 --- a/lib/workos/user_management/password_reset.rb +++ b/lib/workos/user_management/password_reset.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class PasswordReset - include HashProvider - + class PasswordReset < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -30,8 +26,7 @@ class PasswordReset :password_reset_url def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/user_management/password_reset_created.rb b/lib/workos/user_management/password_reset_created.rb index 3f79e06a..1ab44295 100644 --- a/lib/workos/user_management/password_reset_created.rb +++ b/lib/workos/user_management/password_reset_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class PasswordResetCreated - include HashProvider - + class PasswordResetCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class PasswordResetCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::PasswordResetCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/password_reset_created_data.rb b/lib/workos/user_management/password_reset_created_data.rb index 70886022..85f551b9 100644 --- a/lib/workos/user_management/password_reset_created_data.rb +++ b/lib/workos/user_management/password_reset_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class PasswordResetCreatedData - include HashProvider - + class PasswordResetCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -26,8 +22,7 @@ class PasswordResetCreatedData :created_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/user_management/password_reset_succeeded.rb b/lib/workos/user_management/password_reset_succeeded.rb index b37d5f84..7865b21b 100644 --- a/lib/workos/user_management/password_reset_succeeded.rb +++ b/lib/workos/user_management/password_reset_succeeded.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class PasswordResetSucceeded - include HashProvider - + class PasswordResetSucceeded < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class PasswordResetSucceeded :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::PasswordResetSucceededData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/password_session_authenticate_request.rb b/lib/workos/user_management/password_session_authenticate_request.rb index ef55c9e6..f43f7970 100644 --- a/lib/workos/user_management/password_session_authenticate_request.rb +++ b/lib/workos/user_management/password_session_authenticate_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class PasswordSessionAuthenticateRequest - include HashProvider - + class PasswordSessionAuthenticateRequest < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, client_secret: :client_secret, @@ -32,8 +28,7 @@ class PasswordSessionAuthenticateRequest :user_agent def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @client_secret = hash[:client_secret] @grant_type = hash[:grant_type] diff --git a/lib/workos/user_management/redirect_uri.rb b/lib/workos/user_management/redirect_uri.rb index aa241eb3..a9e109f0 100644 --- a/lib/workos/user_management/redirect_uri.rb +++ b/lib/workos/user_management/redirect_uri.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RedirectUri - include HashProvider - + class RedirectUri < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -26,8 +22,7 @@ class RedirectUri :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @uri = hash[:uri] diff --git a/lib/workos/user_management/refresh_token_session_authenticate_request.rb b/lib/workos/user_management/refresh_token_session_authenticate_request.rb index be6d901d..d3d67524 100644 --- a/lib/workos/user_management/refresh_token_session_authenticate_request.rb +++ b/lib/workos/user_management/refresh_token_session_authenticate_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RefreshTokenSessionAuthenticateRequest - include HashProvider - + class RefreshTokenSessionAuthenticateRequest < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id, client_secret: :client_secret, @@ -30,8 +26,7 @@ class RefreshTokenSessionAuthenticateRequest :user_agent def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] @client_secret = hash[:client_secret] @grant_type = hash[:grant_type] diff --git a/lib/workos/user_management/resend_user_invite_options.rb b/lib/workos/user_management/resend_user_invite_options.rb index 8ef3ebdd..55493e40 100644 --- a/lib/workos/user_management/resend_user_invite_options.rb +++ b/lib/workos/user_management/resend_user_invite_options.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ResendUserInviteOptions - include HashProvider - + class ResendUserInviteOptions < WorkOS::Types::BaseModel HASH_ATTRS = { locale: :locale }.freeze @@ -15,8 +11,7 @@ class ResendUserInviteOptions attr_accessor :locale def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @locale = hash[:locale] end end diff --git a/lib/workos/user_management/reset_password_response.rb b/lib/workos/user_management/reset_password_response.rb index 9209165e..31f6b916 100644 --- a/lib/workos/user_management/reset_password_response.rb +++ b/lib/workos/user_management/reset_password_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class ResetPasswordResponse - include HashProvider - + class ResetPasswordResponse < WorkOS::Types::BaseModel HASH_ATTRS = { user: :user }.freeze @@ -15,8 +11,7 @@ class ResetPasswordResponse attr_accessor :user def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil end end diff --git a/lib/workos/user_management/revoke_session.rb b/lib/workos/user_management/revoke_session.rb index 142475fe..337432f5 100644 --- a/lib/workos/user_management/revoke_session.rb +++ b/lib/workos/user_management/revoke_session.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class RevokeSession - include HashProvider - + class RevokeSession < WorkOS::Types::BaseModel HASH_ATTRS = { session_id: :session_id, return_to: :return_to @@ -18,8 +14,7 @@ class RevokeSession :return_to def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @session_id = hash[:session_id] @return_to = hash[:return_to] end diff --git a/lib/workos/user_management/send_email_change.rb b/lib/workos/user_management/send_email_change.rb index f5f5667c..afd95bfa 100644 --- a/lib/workos/user_management/send_email_change.rb +++ b/lib/workos/user_management/send_email_change.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SendEmailChange - include HashProvider - + class SendEmailChange < WorkOS::Types::BaseModel HASH_ATTRS = { new_email: :new_email }.freeze @@ -15,8 +11,7 @@ class SendEmailChange attr_accessor :new_email def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @new_email = hash[:new_email] end end diff --git a/lib/workos/user_management/session_created.rb b/lib/workos/user_management/session_created.rb index d530f115..452066ba 100644 --- a/lib/workos/user_management/session_created.rb +++ b/lib/workos/user_management/session_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SessionCreated - include HashProvider - + class SessionCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class SessionCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::SessionCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/session_created_data.rb b/lib/workos/user_management/session_created_data.rb index 535bdf58..6a4c99d8 100644 --- a/lib/workos/user_management/session_created_data.rb +++ b/lib/workos/user_management/session_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SessionCreatedData - include HashProvider - + class SessionCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -40,8 +36,7 @@ class SessionCreatedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @impersonator = hash[:impersonator] ? WorkOS::SessionCreatedDataImpersonator.new(hash[:impersonator]) : nil diff --git a/lib/workos/user_management/session_revoked.rb b/lib/workos/user_management/session_revoked.rb index 0e93c54f..4e7c0338 100644 --- a/lib/workos/user_management/session_revoked.rb +++ b/lib/workos/user_management/session_revoked.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SessionRevoked - include HashProvider - + class SessionRevoked < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class SessionRevoked :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::SessionRevokedData.new(hash[:data]) : nil diff --git a/lib/workos/user_management/session_revoked_data.rb b/lib/workos/user_management/session_revoked_data.rb index be778d5e..88092132 100644 --- a/lib/workos/user_management/session_revoked_data.rb +++ b/lib/workos/user_management/session_revoked_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SessionRevokedData - include HashProvider - + class SessionRevokedData < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -40,8 +36,7 @@ class SessionRevokedData :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @impersonator = hash[:impersonator] ? WorkOS::SessionRevokedDataImpersonator.new(hash[:impersonator]) : nil diff --git a/lib/workos/user_management/sso_device_authorization_request.rb b/lib/workos/user_management/sso_device_authorization_request.rb index b7e10f2a..a86cccbb 100644 --- a/lib/workos/user_management/sso_device_authorization_request.rb +++ b/lib/workos/user_management/sso_device_authorization_request.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class SSODeviceAuthorizationRequest - include HashProvider - + class SSODeviceAuthorizationRequest < WorkOS::Types::BaseModel HASH_ATTRS = { client_id: :client_id }.freeze @@ -15,8 +11,7 @@ class SSODeviceAuthorizationRequest attr_accessor :client_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @client_id = hash[:client_id] end end diff --git a/lib/workos/user_management/update_jwt_template.rb b/lib/workos/user_management/update_jwt_template.rb index 850bd646..76dd4aa2 100644 --- a/lib/workos/user_management/update_jwt_template.rb +++ b/lib/workos/user_management/update_jwt_template.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UpdateJWTTemplate - include HashProvider - + class UpdateJWTTemplate < WorkOS::Types::BaseModel HASH_ATTRS = { content: :content }.freeze @@ -15,8 +11,7 @@ class UpdateJWTTemplate attr_accessor :content def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @content = hash[:content] end end diff --git a/lib/workos/user_management/update_user.rb b/lib/workos/user_management/update_user.rb index 863cfb5c..6dfb19c7 100644 --- a/lib/workos/user_management/update_user.rb +++ b/lib/workos/user_management/update_user.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UpdateUser - include HashProvider - + class UpdateUser < WorkOS::Types::BaseModel HASH_ATTRS = { email: :email, first_name: :first_name, @@ -34,8 +30,7 @@ class UpdateUser :password_hash_type def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] diff --git a/lib/workos/user_management/update_user_organization_membership.rb b/lib/workos/user_management/update_user_organization_membership.rb index 0464b378..e922b32c 100644 --- a/lib/workos/user_management/update_user_organization_membership.rb +++ b/lib/workos/user_management/update_user_organization_membership.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UpdateUserOrganizationMembership - include HashProvider - + class UpdateUserOrganizationMembership < WorkOS::Types::BaseModel HASH_ATTRS = { role_slug: :role_slug, role_slugs: :role_slugs @@ -18,8 +14,7 @@ class UpdateUserOrganizationMembership :role_slugs def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @role_slug = hash[:role_slug] @role_slugs = hash[:role_slugs] || [] end diff --git a/lib/workos/user_management/user_created.rb b/lib/workos/user_management/user_created.rb index 7506146a..946d31ed 100644 --- a/lib/workos/user_management/user_created.rb +++ b/lib/workos/user_management/user_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserCreated - include HashProvider - + class UserCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class UserCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::User.new(hash[:data]) : nil diff --git a/lib/workos/user_management/user_deleted.rb b/lib/workos/user_management/user_deleted.rb index 9ece3feb..1671fe12 100644 --- a/lib/workos/user_management/user_deleted.rb +++ b/lib/workos/user_management/user_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserDeleted - include HashProvider - + class UserDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class UserDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::User.new(hash[:data]) : nil diff --git a/lib/workos/user_management/user_identities_get_item.rb b/lib/workos/user_management/user_identities_get_item.rb index 99950b07..09f8d76e 100644 --- a/lib/workos/user_management/user_identities_get_item.rb +++ b/lib/workos/user_management/user_identities_get_item.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserIdentitiesGetItem - include HashProvider - + class UserIdentitiesGetItem < WorkOS::Types::BaseModel HASH_ATTRS = { idp_id: :idp_id, type: :type, @@ -20,8 +16,7 @@ class UserIdentitiesGetItem :provider def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @idp_id = hash[:idp_id] @type = hash[:type] @provider = hash[:provider] diff --git a/lib/workos/user_management/user_invite.rb b/lib/workos/user_management/user_invite.rb index 0a811021..7cf0f45d 100644 --- a/lib/workos/user_management/user_invite.rb +++ b/lib/workos/user_management/user_invite.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserInvite - include HashProvider - + class UserInvite < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -42,8 +38,7 @@ class UserInvite :accept_invitation_url def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @email = hash[:email] diff --git a/lib/workos/user_management/user_organization_membership.rb b/lib/workos/user_management/user_organization_membership.rb index 9d646956..ff127f31 100644 --- a/lib/workos/user_management/user_organization_membership.rb +++ b/lib/workos/user_management/user_organization_membership.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserOrganizationMembership - include HashProvider - + class UserOrganizationMembership < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -36,8 +32,7 @@ class UserOrganizationMembership :role def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @user_id = hash[:user_id] diff --git a/lib/workos/user_management/user_sessions_list_item.rb b/lib/workos/user_management/user_sessions_list_item.rb index f62a4053..11da49a7 100644 --- a/lib/workos/user_management/user_sessions_list_item.rb +++ b/lib/workos/user_management/user_sessions_list_item.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserSessionsListItem - include HashProvider - + class UserSessionsListItem < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -40,8 +36,7 @@ class UserSessionsListItem :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @impersonator = hash[:impersonator] ? WorkOS::UserSessionsImpersonator.new(hash[:impersonator]) : nil diff --git a/lib/workos/user_management/user_updated.rb b/lib/workos/user_management/user_updated.rb index 145916b9..50a1b426 100644 --- a/lib/workos/user_management/user_updated.rb +++ b/lib/workos/user_management/user_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UserUpdated - include HashProvider - + class UserUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class UserUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::User.new(hash[:data]) : nil diff --git a/lib/workos/vault.rb b/lib/workos/vault.rb index 9f906248..2780f58d 100644 --- a/lib/workos/vault.rb +++ b/lib/workos/vault.rb @@ -19,13 +19,13 @@ module WorkOS class Vault DEFAULT_RESPONSE_LIMIT = 10 - DataKey = Struct.new(:id, :key, keyword_init: true) do + DataKey = Data.define(:id, :key) do def self.from_response(hash) new(id: hash["id"], key: hash["data_key"]) end end - DataKeyPair = Struct.new(:context, :data_key, :encrypted_keys, keyword_init: true) do + DataKeyPair = Data.define(:context, :data_key, :encrypted_keys) do def self.from_response(hash) new( context: hash["context"], @@ -35,17 +35,14 @@ def self.from_response(hash) end end - ObjectUpdateBy = Struct.new(:id, :name, keyword_init: true) do + ObjectUpdateBy = Data.define(:id, :name) do def self.from_hash(hash) return nil if hash.nil? new(id: hash["id"], name: hash["name"]) end end - ObjectMetadata = Struct.new( - :context, :environment_id, :id, :key_id, :updated_at, :updated_by, :version_id, - keyword_init: true - ) do + ObjectMetadata = Data.define(:context, :environment_id, :id, :key_id, :updated_at, :updated_by, :version_id) do def self.from_hash(hash) new( context: hash["context"], @@ -59,7 +56,7 @@ def self.from_hash(hash) end end - VaultObject = Struct.new(:id, :name, :value, :metadata, keyword_init: true) do + VaultObject = Data.define(:id, :name, :value, :metadata) do def self.from_hash(hash) new( id: hash["id"], @@ -70,13 +67,13 @@ def self.from_hash(hash) end end - ObjectDigest = Struct.new(:id, :name, :updated_at, keyword_init: true) do + ObjectDigest = Data.define(:id, :name, :updated_at) do def self.from_hash(hash) new(id: hash["id"], name: hash["name"], updated_at: hash["updated_at"]) end end - ObjectVersion = Struct.new(:id, :created_at, :current_version, keyword_init: true) do + ObjectVersion = Data.define(:id, :created_at, :current_version) do def self.from_hash(hash) new(id: hash["id"], created_at: hash["created_at"], current_version: hash["current_version"]) end diff --git a/lib/workos/vault/vault_byok_key_verification_completed.rb b/lib/workos/vault/vault_byok_key_verification_completed.rb index eaf61311..5638a96d 100644 --- a/lib/workos/vault/vault_byok_key_verification_completed.rb +++ b/lib/workos/vault/vault_byok_key_verification_completed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultByokKeyVerificationCompleted - include HashProvider - + class VaultByokKeyVerificationCompleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class VaultByokKeyVerificationCompleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::VaultByokKeyVerificationCompletedData.new(hash[:data]) : nil diff --git a/lib/workos/vault/vault_byok_key_verification_completed_data.rb b/lib/workos/vault/vault_byok_key_verification_completed_data.rb index 2a01f0b5..45eeff8c 100644 --- a/lib/workos/vault/vault_byok_key_verification_completed_data.rb +++ b/lib/workos/vault/vault_byok_key_verification_completed_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultByokKeyVerificationCompletedData - include HashProvider - + class VaultByokKeyVerificationCompletedData < WorkOS::Types::BaseModel HASH_ATTRS = { organization_id: :organization_id, key_provider: :key_provider, @@ -20,8 +16,7 @@ class VaultByokKeyVerificationCompletedData :verified def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @organization_id = hash[:organization_id] @key_provider = hash[:key_provider] @verified = hash[:verified] diff --git a/lib/workos/vault/vault_data_created.rb b/lib/workos/vault/vault_data_created.rb index 81df95aa..6be3a932 100644 --- a/lib/workos/vault/vault_data_created.rb +++ b/lib/workos/vault/vault_data_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDataCreated - include HashProvider - + class VaultDataCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class VaultDataCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::VaultDataCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/vault/vault_data_created_data.rb b/lib/workos/vault/vault_data_created_data.rb index f84e271d..ff632bc7 100644 --- a/lib/workos/vault/vault_data_created_data.rb +++ b/lib/workos/vault/vault_data_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDataCreatedData - include HashProvider - + class VaultDataCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { actor_id: :actor_id, actor_source: :actor_source, @@ -26,8 +22,7 @@ class VaultDataCreatedData :key_context def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @actor_id = hash[:actor_id] @actor_source = hash[:actor_source] @actor_name = hash[:actor_name] diff --git a/lib/workos/vault/vault_data_deleted.rb b/lib/workos/vault/vault_data_deleted.rb index 456feb32..2cdff212 100644 --- a/lib/workos/vault/vault_data_deleted.rb +++ b/lib/workos/vault/vault_data_deleted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDataDeleted - include HashProvider - + class VaultDataDeleted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class VaultDataDeleted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::VaultDataDeletedData.new(hash[:data]) : nil diff --git a/lib/workos/vault/vault_data_deleted_data.rb b/lib/workos/vault/vault_data_deleted_data.rb index 83a27c81..cd620c5a 100644 --- a/lib/workos/vault/vault_data_deleted_data.rb +++ b/lib/workos/vault/vault_data_deleted_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDataDeletedData - include HashProvider - + class VaultDataDeletedData < WorkOS::Types::BaseModel HASH_ATTRS = { actor_id: :actor_id, actor_source: :actor_source, @@ -22,8 +18,7 @@ class VaultDataDeletedData :kv_name def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @actor_id = hash[:actor_id] @actor_source = hash[:actor_source] @actor_name = hash[:actor_name] diff --git a/lib/workos/vault/vault_data_read.rb b/lib/workos/vault/vault_data_read.rb index 6ea0b822..9abdeaa8 100644 --- a/lib/workos/vault/vault_data_read.rb +++ b/lib/workos/vault/vault_data_read.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDataRead - include HashProvider - + class VaultDataRead < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class VaultDataRead :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::VaultDataReadData.new(hash[:data]) : nil diff --git a/lib/workos/vault/vault_data_read_data.rb b/lib/workos/vault/vault_data_read_data.rb index c25afbc7..5ab87246 100644 --- a/lib/workos/vault/vault_data_read_data.rb +++ b/lib/workos/vault/vault_data_read_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDataReadData - include HashProvider - + class VaultDataReadData < WorkOS::Types::BaseModel HASH_ATTRS = { actor_id: :actor_id, actor_source: :actor_source, @@ -24,8 +20,7 @@ class VaultDataReadData :key_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @actor_id = hash[:actor_id] @actor_source = hash[:actor_source] @actor_name = hash[:actor_name] diff --git a/lib/workos/vault/vault_data_updated.rb b/lib/workos/vault/vault_data_updated.rb index c25771ac..dab9c3ed 100644 --- a/lib/workos/vault/vault_data_updated.rb +++ b/lib/workos/vault/vault_data_updated.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDataUpdated - include HashProvider - + class VaultDataUpdated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class VaultDataUpdated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::VaultDataUpdatedData.new(hash[:data]) : nil diff --git a/lib/workos/vault/vault_data_updated_data.rb b/lib/workos/vault/vault_data_updated_data.rb index caa00245..da2c0b37 100644 --- a/lib/workos/vault/vault_data_updated_data.rb +++ b/lib/workos/vault/vault_data_updated_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDataUpdatedData - include HashProvider - + class VaultDataUpdatedData < WorkOS::Types::BaseModel HASH_ATTRS = { actor_id: :actor_id, actor_source: :actor_source, @@ -26,8 +22,7 @@ class VaultDataUpdatedData :key_context def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @actor_id = hash[:actor_id] @actor_source = hash[:actor_source] @actor_name = hash[:actor_name] diff --git a/lib/workos/vault/vault_dek_decrypted.rb b/lib/workos/vault/vault_dek_decrypted.rb index 93eaca53..02a0f0e4 100644 --- a/lib/workos/vault/vault_dek_decrypted.rb +++ b/lib/workos/vault/vault_dek_decrypted.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDekDecrypted - include HashProvider - + class VaultDekDecrypted < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class VaultDekDecrypted :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::VaultDekDecryptedData.new(hash[:data]) : nil diff --git a/lib/workos/vault/vault_dek_decrypted_data.rb b/lib/workos/vault/vault_dek_decrypted_data.rb index 70e4dcba..8ca57bbd 100644 --- a/lib/workos/vault/vault_dek_decrypted_data.rb +++ b/lib/workos/vault/vault_dek_decrypted_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDekDecryptedData - include HashProvider - + class VaultDekDecryptedData < WorkOS::Types::BaseModel HASH_ATTRS = { actor_id: :actor_id, actor_source: :actor_source, @@ -22,8 +18,7 @@ class VaultDekDecryptedData :key_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @actor_id = hash[:actor_id] @actor_source = hash[:actor_source] @actor_name = hash[:actor_name] diff --git a/lib/workos/vault/vault_dek_read.rb b/lib/workos/vault/vault_dek_read.rb index 2a66ac16..7e283583 100644 --- a/lib/workos/vault/vault_dek_read.rb +++ b/lib/workos/vault/vault_dek_read.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDekRead - include HashProvider - + class VaultDekRead < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class VaultDekRead :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::VaultDekReadData.new(hash[:data]) : nil diff --git a/lib/workos/vault/vault_dek_read_data.rb b/lib/workos/vault/vault_dek_read_data.rb index 5c0e7c6f..c200c9f5 100644 --- a/lib/workos/vault/vault_dek_read_data.rb +++ b/lib/workos/vault/vault_dek_read_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultDekReadData - include HashProvider - + class VaultDekReadData < WorkOS::Types::BaseModel HASH_ATTRS = { actor_id: :actor_id, actor_source: :actor_source, @@ -24,8 +20,7 @@ class VaultDekReadData :key_context def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @actor_id = hash[:actor_id] @actor_source = hash[:actor_source] @actor_name = hash[:actor_name] diff --git a/lib/workos/vault/vault_kek_created.rb b/lib/workos/vault/vault_kek_created.rb index 5308ac55..459455b1 100644 --- a/lib/workos/vault/vault_kek_created.rb +++ b/lib/workos/vault/vault_kek_created.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultKekCreated - include HashProvider - + class VaultKekCreated < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class VaultKekCreated :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::VaultKekCreatedData.new(hash[:data]) : nil diff --git a/lib/workos/vault/vault_kek_created_data.rb b/lib/workos/vault/vault_kek_created_data.rb index ff39afce..e35a3ddc 100644 --- a/lib/workos/vault/vault_kek_created_data.rb +++ b/lib/workos/vault/vault_kek_created_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultKekCreatedData - include HashProvider - + class VaultKekCreatedData < WorkOS::Types::BaseModel HASH_ATTRS = { actor_id: :actor_id, actor_source: :actor_source, @@ -24,8 +20,7 @@ class VaultKekCreatedData :key_id def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @actor_id = hash[:actor_id] @actor_source = hash[:actor_source] @actor_name = hash[:actor_name] diff --git a/lib/workos/vault/vault_metadata_read.rb b/lib/workos/vault/vault_metadata_read.rb index 8fee58e0..10fb52ee 100644 --- a/lib/workos/vault/vault_metadata_read.rb +++ b/lib/workos/vault/vault_metadata_read.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultMetadataRead - include HashProvider - + class VaultMetadataRead < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class VaultMetadataRead :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::VaultMetadataReadData.new(hash[:data]) : nil diff --git a/lib/workos/vault/vault_metadata_read_data.rb b/lib/workos/vault/vault_metadata_read_data.rb index 8c7a96b8..f2e0d487 100644 --- a/lib/workos/vault/vault_metadata_read_data.rb +++ b/lib/workos/vault/vault_metadata_read_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultMetadataReadData - include HashProvider - + class VaultMetadataReadData < WorkOS::Types::BaseModel HASH_ATTRS = { actor_id: :actor_id, actor_source: :actor_source, @@ -22,8 +18,7 @@ class VaultMetadataReadData :kv_name def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @actor_id = hash[:actor_id] @actor_source = hash[:actor_source] @actor_name = hash[:actor_name] diff --git a/lib/workos/vault/vault_names_listed.rb b/lib/workos/vault/vault_names_listed.rb index 3f6ed43e..55bf8fc8 100644 --- a/lib/workos/vault/vault_names_listed.rb +++ b/lib/workos/vault/vault_names_listed.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultNamesListed - include HashProvider - + class VaultNamesListed < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, event: :event, @@ -26,8 +22,7 @@ class VaultNamesListed :object def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @id = hash[:id] @event = hash[:event] @data = hash[:data] ? WorkOS::VaultNamesListedData.new(hash[:data]) : nil diff --git a/lib/workos/vault/vault_names_listed_data.rb b/lib/workos/vault/vault_names_listed_data.rb index c6af3593..c1d4252f 100644 --- a/lib/workos/vault/vault_names_listed_data.rb +++ b/lib/workos/vault/vault_names_listed_data.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class VaultNamesListedData - include HashProvider - + class VaultNamesListedData < WorkOS::Types::BaseModel HASH_ATTRS = { actor_id: :actor_id, actor_source: :actor_source, @@ -20,8 +16,7 @@ class VaultNamesListedData :actor_name def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @actor_id = hash[:actor_id] @actor_source = hash[:actor_source] @actor_name = hash[:actor_name] diff --git a/lib/workos/webhooks.rb b/lib/workos/webhooks.rb index 5d8faa2f..0344e08f 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -16,8 +15,8 @@ def initialize(client) # @param after [String, nil] An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`. # @param limit [Integer, nil] Upper limit on the number of objects to return, between `1` and `100`. # @param order [WorkOS::Types::WebhooksOrder, nil] Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. - # @return [WorkOS::Types::ListStruct] + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] def list_webhook_endpoints( before: nil, after: nil, @@ -31,15 +30,14 @@ def list_webhook_endpoints( "limit" => limit, "order" => order }.compact - response = @client.execute_request( - request: @client.get_request(path: "/webhook_endpoints", auth: true, params: params, request_options: request_options), + response = @client.request( + method: :get, + path: "/webhook_endpoints", + auth: true, + params: params, request_options: request_options ) - parsed = JSON.parse(response.body) - items = (parsed["data"] || []).map { |item| WorkOS::WebhookEndpointJson.new(item) } - fetch_next = lambda do |metadata| - cursor = metadata.is_a?(Hash) ? (metadata["after"] || metadata[:after]) : nil - return nil if cursor.nil? || cursor.to_s.empty? + fetch_next = ->(cursor) { list_webhook_endpoints( before: before, after: cursor, @@ -47,14 +45,19 @@ def list_webhook_endpoints( order: order, request_options: request_options ) - end - WorkOS::Types::ListStruct.new(data: items, list_metadata: parsed["list_metadata"], fetch_next: fetch_next, filters: {before: before, limit: limit, order: order}) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::WebhookEndpointJson, + filters: {before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) end # Create a Webhook Endpoint # @param endpoint_url [String] The HTTPS URL where webhooks will be sent. # @param events [Array] The events that the Webhook Endpoint is subscribed to. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::WebhookEndpointJson] def create_webhook_endpoint( endpoint_url:, @@ -65,11 +68,16 @@ def create_webhook_endpoint( "endpoint_url" => endpoint_url, "events" => events }.compact - response = @client.execute_request( - request: @client.post_request(path: "/webhook_endpoints", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/webhook_endpoints", + auth: true, + body: body, request_options: request_options ) - WorkOS::WebhookEndpointJson.new(response.body) + result = WorkOS::WebhookEndpointJson.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Update a Webhook Endpoint @@ -77,7 +85,7 @@ def create_webhook_endpoint( # @param endpoint_url [String, nil] The HTTPS URL where webhooks will be sent. # @param status [WorkOS::Types::UpdateWebhookEndpointStatus, nil] Whether the Webhook Endpoint is enabled or disabled. # @param events [Array, nil] The events that the Webhook Endpoint is subscribed to. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::WebhookEndpointJson] def update_webhook_endpoint( id:, @@ -91,23 +99,30 @@ def update_webhook_endpoint( "status" => status, "events" => events }.compact - response = @client.execute_request( - request: @client.patch_request(path: "/webhook_endpoints/#{CGI.escape(id.to_s)}", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :patch, + path: "/webhook_endpoints/#{WorkOS::Util.encode_path(id)}", + auth: true, + body: body, request_options: request_options ) - WorkOS::WebhookEndpointJson.new(response.body) + result = WorkOS::WebhookEndpointJson.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end # Delete a Webhook Endpoint # @param id [String] Unique identifier of the Webhook Endpoint. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] def delete_webhook_endpoint( id:, request_options: {} ) - @client.execute_request( - request: @client.delete_request(path: "/webhook_endpoints/#{CGI.escape(id.to_s)}", auth: true, request_options: request_options), + @client.request( + method: :delete, + path: "/webhook_endpoints/#{WorkOS::Util.encode_path(id)}", + auth: true, request_options: request_options ) nil diff --git a/lib/workos/webhooks/create_webhook_endpoint.rb b/lib/workos/webhooks/create_webhook_endpoint.rb index 655e5526..8ce04034 100644 --- a/lib/workos/webhooks/create_webhook_endpoint.rb +++ b/lib/workos/webhooks/create_webhook_endpoint.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class CreateWebhookEndpoint - include HashProvider - + class CreateWebhookEndpoint < WorkOS::Types::BaseModel HASH_ATTRS = { endpoint_url: :endpoint_url, events: :events @@ -18,8 +14,7 @@ class CreateWebhookEndpoint :events def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @endpoint_url = hash[:endpoint_url] @events = hash[:events] || [] end diff --git a/lib/workos/webhooks/update_webhook_endpoint.rb b/lib/workos/webhooks/update_webhook_endpoint.rb index 988f5d8e..9d6f7c09 100644 --- a/lib/workos/webhooks/update_webhook_endpoint.rb +++ b/lib/workos/webhooks/update_webhook_endpoint.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class UpdateWebhookEndpoint - include HashProvider - + class UpdateWebhookEndpoint < WorkOS::Types::BaseModel HASH_ATTRS = { endpoint_url: :endpoint_url, status: :status, @@ -20,8 +16,7 @@ class UpdateWebhookEndpoint :events def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @endpoint_url = hash[:endpoint_url] @status = hash[:status] @events = hash[:events] || [] diff --git a/lib/workos/webhooks/webhook_endpoint_json.rb b/lib/workos/webhooks/webhook_endpoint_json.rb index c3a08851..a033e364 100644 --- a/lib/workos/webhooks/webhook_endpoint_json.rb +++ b/lib/workos/webhooks/webhook_endpoint_json.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class WebhookEndpointJson - include HashProvider - + class WebhookEndpointJson < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -30,8 +26,7 @@ class WebhookEndpointJson :updated_at def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] @endpoint_url = hash[:endpoint_url] diff --git a/lib/workos/widgets.rb b/lib/workos/widgets.rb index 2103fdc1..a0534089 100644 --- a/lib/workos/widgets.rb +++ b/lib/workos/widgets.rb @@ -2,7 +2,6 @@ # This file is auto-generated by oagen. Do not edit. -require "cgi" require "json" module WorkOS @@ -15,7 +14,7 @@ def initialize(client) # @param organization_id [String] The ID of the organization to scope the widget session to. # @param user_id [String, nil] The ID of the user to issue the widget session token for. # @param scopes [Array, nil] The scopes to grant the widget session. - # @param request_options [Hash] Per-request overrides: :api_key, :timeout, :base_url, :max_retries, :idempotency_key, :extra_headers. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::WidgetSessionTokenResponse] def create_token( organization_id:, @@ -28,11 +27,16 @@ def create_token( "user_id" => user_id, "scopes" => scopes }.compact - response = @client.execute_request( - request: @client.post_request(path: "/widgets/token", auth: true, body: body, request_options: request_options), + response = @client.request( + method: :post, + path: "/widgets/token", + auth: true, + body: body, request_options: request_options ) - WorkOS::WidgetSessionTokenResponse.new(response.body) + result = WorkOS::WidgetSessionTokenResponse.new(response.body) + result.last_response = WorkOS::Types::ApiResponse.new(http_status: response.code.to_i, http_headers: response.each_header.to_h, request_id: response["x-request-id"]) + result end end end diff --git a/lib/workos/widgets/widget_session_token.rb b/lib/workos/widgets/widget_session_token.rb index 9143a58b..f702967b 100644 --- a/lib/workos/widgets/widget_session_token.rb +++ b/lib/workos/widgets/widget_session_token.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class WidgetSessionToken - include HashProvider - + class WidgetSessionToken < WorkOS::Types::BaseModel HASH_ATTRS = { organization_id: :organization_id, user_id: :user_id, @@ -20,8 +16,7 @@ class WidgetSessionToken :scopes def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @organization_id = hash[:organization_id] @user_id = hash[:user_id] @scopes = hash[:scopes] || [] diff --git a/lib/workos/widgets/widget_session_token_response.rb b/lib/workos/widgets/widget_session_token_response.rb index e3044aa4..05c3173a 100644 --- a/lib/workos/widgets/widget_session_token_response.rb +++ b/lib/workos/widgets/widget_session_token_response.rb @@ -2,12 +2,8 @@ # This file is auto-generated by oagen. Do not edit. -require "json" - module WorkOS - class WidgetSessionTokenResponse - include HashProvider - + class WidgetSessionTokenResponse < WorkOS::Types::BaseModel HASH_ATTRS = { token: :token }.freeze @@ -15,8 +11,7 @@ class WidgetSessionTokenResponse attr_accessor :token def initialize(json) - hash = json.is_a?(Hash) ? json : JSON.parse(json, symbolize_names: true) - hash = hash.transform_keys(&:to_sym) if hash.keys.first.is_a?(String) + hash = self.class.normalize(json) @token = hash[:token] end end diff --git a/test/workos/test_admin_portal.rb b/test/workos/test_admin_portal.rb index 88eb3db8..77d1f561 100644 --- a/test/workos/test_admin_portal.rb +++ b/test/workos/test_admin_portal.rb @@ -12,17 +12,22 @@ def setup end def test_generate_link_returns_expected_result - stub_request(:post, /#{Regexp.escape("portal")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/portal/generate_link(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.admin_portal.generate_link(organization: "stub") refute_nil result end - def test_generate_link_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("portal")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.admin_portal.generate_link(organization: "stub") + # Parameterized authentication error tests (one per endpoint). + [ + {name: :generate_link, verb: :post, url: %r{\Ahttps://api\.workos\.com/portal/generate_link(\?|\z)}, args: {organization: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.admin_portal.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_api_keys.rb b/test/workos/test_api_keys.rb index 6813cec9..0e3737f2 100644 --- a/test/workos/test_api_keys.rb +++ b/test/workos/test_api_keys.rb @@ -12,62 +12,46 @@ def setup end def test_create_validation_returns_expected_result - stub_request(:post, /#{Regexp.escape("api_keys")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/api_keys/validations(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.api_keys.create_validation(value: "stub") refute_nil result end - def test_create_validation_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("api_keys")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.api_keys.create_validation(value: "stub") - end - end - def test_delete_api_key_returns_expected_result - stub_request(:delete, /#{Regexp.escape("api_keys")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/api_keys/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.api_keys.delete_api_key(id: "stub") - assert_nil result if result.nil? - end - - def test_delete_api_key_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("api_keys")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.api_keys.delete_api_key(id: "stub") - end + assert_nil result end def test_list_organization_api_keys_returns_expected_result - stub_request(:get, /#{Regexp.escape("organizations")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.api_keys.list_organization_api_keys(organization_id: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_organization_api_keys_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.api_keys.list_organization_api_keys(organization_id: "stub") - end - end - def test_create_organization_api_key_returns_expected_result - stub_request(:post, /#{Regexp.escape("organizations")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.api_keys.create_organization_api_key(organization_id: "stub", name: "stub") refute_nil result end - def test_create_organization_api_key_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.api_keys.create_organization_api_key(organization_id: "stub", name: "stub") + # Parameterized authentication error tests (one per endpoint). + [ + {name: :create_validation, verb: :post, url: %r{\Ahttps://api\.workos\.com/api_keys/validations(\?|\z)}, args: {value: "stub"}}, + {name: :delete_api_key, verb: :delete, url: %r{\Ahttps://api\.workos\.com/api_keys/stub(\?|\z)}, args: {id: "stub"}}, + {name: :list_organization_api_keys, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}, args: {organization_id: "stub"}}, + {name: :create_organization_api_key, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}, args: {organization_id: "stub", name: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.api_keys.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_audit_logs.rb b/test/workos/test_audit_logs.rb index a540074e..c449bb40 100644 --- a/test/workos/test_audit_logs.rb +++ b/test/workos/test_audit_logs.rb @@ -12,122 +12,78 @@ def setup end def test_get_organization_audit_logs_retention_returns_expected_result - stub_request(:get, /#{Regexp.escape("organizations")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/audit_logs_retention(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.audit_logs.get_organization_audit_logs_retention(id: "stub") refute_nil result end - def test_get_organization_audit_logs_retention_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.audit_logs.get_organization_audit_logs_retention(id: "stub") - end - end - def test_update_organization_audit_logs_retention_returns_expected_result - stub_request(:put, /#{Regexp.escape("organizations")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/organizations/stub/audit_logs_retention(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.audit_logs.update_organization_audit_logs_retention(id: "stub", retention_period_in_days: 1) refute_nil result end - def test_update_organization_audit_logs_retention_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.audit_logs.update_organization_audit_logs_retention(id: "stub", retention_period_in_days: 1) - end - end - def test_list_actions_returns_expected_result - stub_request(:get, /#{Regexp.escape("audit_logs")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/audit_logs/actions(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.audit_logs.list_actions assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_actions_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("audit_logs")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.audit_logs.list_actions - end - end - def test_list_action_schemas_returns_expected_result - stub_request(:get, /#{Regexp.escape("audit_logs")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/audit_logs/actions/stub/schemas(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.audit_logs.list_action_schemas(action_name: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_action_schemas_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("audit_logs")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.audit_logs.list_action_schemas(action_name: "stub") - end - end - def test_create_schema_returns_expected_result - stub_request(:post, /#{Regexp.escape("audit_logs")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/audit_logs/actions/stub/schemas(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.audit_logs.create_schema(action_name: "stub", targets: []) refute_nil result end - def test_create_schema_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("audit_logs")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.audit_logs.create_schema(action_name: "stub", targets: []) - end - end - def test_create_event_returns_expected_result - stub_request(:post, /#{Regexp.escape("audit_logs")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/audit_logs/events(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.audit_logs.create_event(organization_id: "stub", event: {}) refute_nil result end - def test_create_event_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("audit_logs")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.audit_logs.create_event(organization_id: "stub", event: {}) - end - end - def test_create_export_returns_expected_result - stub_request(:post, /#{Regexp.escape("audit_logs")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/audit_logs/exports(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.audit_logs.create_export(organization_id: "stub", range_start: "stub", range_end: "stub") refute_nil result end - def test_create_export_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("audit_logs")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.audit_logs.create_export(organization_id: "stub", range_start: "stub", range_end: "stub") - end - end - def test_get_export_returns_expected_result - stub_request(:get, /#{Regexp.escape("audit_logs")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/audit_logs/exports/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.audit_logs.get_export(audit_log_export_id: "stub") refute_nil result end - def test_get_export_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("audit_logs")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.audit_logs.get_export(audit_log_export_id: "stub") + # Parameterized authentication error tests (one per endpoint). + [ + {name: :get_organization_audit_logs_retention, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/audit_logs_retention(\?|\z)}, args: {id: "stub"}}, + {name: :update_organization_audit_logs_retention, verb: :put, url: %r{\Ahttps://api\.workos\.com/organizations/stub/audit_logs_retention(\?|\z)}, args: {id: "stub", retention_period_in_days: 1}}, + {name: :list_actions, verb: :get, url: %r{\Ahttps://api\.workos\.com/audit_logs/actions(\?|\z)}}, + {name: :list_action_schemas, verb: :get, url: %r{\Ahttps://api\.workos\.com/audit_logs/actions/stub/schemas(\?|\z)}, args: {action_name: "stub"}}, + {name: :create_schema, verb: :post, url: %r{\Ahttps://api\.workos\.com/audit_logs/actions/stub/schemas(\?|\z)}, args: {action_name: "stub", targets: []}}, + {name: :create_event, verb: :post, url: %r{\Ahttps://api\.workos\.com/audit_logs/events(\?|\z)}, args: {organization_id: "stub", event: {}}}, + {name: :create_export, verb: :post, url: %r{\Ahttps://api\.workos\.com/audit_logs/exports(\?|\z)}, args: {organization_id: "stub", range_start: "stub", range_end: "stub"}}, + {name: :get_export, verb: :get, url: %r{\Ahttps://api\.workos\.com/audit_logs/exports/stub(\?|\z)}, args: {audit_log_export_id: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.audit_logs.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_authorization.rb b/test/workos/test_authorization.rb index 37281be9..456808b2 100644 --- a/test/workos/test_authorization.rb +++ b/test/workos/test_authorization.rb @@ -12,557 +12,310 @@ def setup end def test_check_returns_expected_result - stub_request(:post, /#{Regexp.escape("authorization")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/check(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.check(organization_membership_id: "stub", permission_slug: "stub", resource_target: {type: "by_id"}) refute_nil result end - def test_check_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.check(organization_membership_id: "stub", permission_slug: "stub", resource_target: {type: "by_id"}) - end - end - def test_list_organization_membership_resources_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/resources(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.authorization.list_organization_membership_resources(organization_membership_id: "stub", permission_slug: "stub", parent_resource: {type: "by_id"}) assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_organization_membership_resources_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.list_organization_membership_resources(organization_membership_id: "stub", permission_slug: "stub", parent_resource: {type: "by_id"}) - end - end - def test_list_resource_permissions_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/resources/stub/permissions(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.authorization.list_resource_permissions(organization_membership_id: "stub", resource_id: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_resource_permissions_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.list_resource_permissions(organization_membership_id: "stub", resource_id: "stub") - end - end - def test_list_effective_permissions_by_external_id_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/resources/stub/stub/permissions(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.authorization.list_effective_permissions_by_external_id(organization_membership_id: "stub", resource_type_slug: "stub", external_id: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_effective_permissions_by_external_id_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.list_effective_permissions_by_external_id(organization_membership_id: "stub", resource_type_slug: "stub", external_id: "stub") - end - end - def test_list_organization_membership_role_assignments_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.authorization.list_organization_membership_role_assignments(organization_membership_id: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_organization_membership_role_assignments_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.list_organization_membership_role_assignments(organization_membership_id: "stub") - end - end - def test_assign_role_returns_expected_result - stub_request(:post, /#{Regexp.escape("authorization")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.assign_role(organization_membership_id: "stub", role_slug: "stub", resource_target: {type: "by_id"}) refute_nil result end - def test_assign_role_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.assign_role(organization_membership_id: "stub", role_slug: "stub", resource_target: {type: "by_id"}) - end - end - def test_remove_role_returns_expected_result - stub_request(:delete, /#{Regexp.escape("authorization")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.remove_role(organization_membership_id: "stub", role_slug: "stub", resource_target: {type: "by_id"}) - assert_nil result if result.nil? - end - - def test_remove_role_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.remove_role(organization_membership_id: "stub", role_slug: "stub", resource_target: {type: "by_id"}) - end + assert_nil result end def test_delete_organization_membership_role_assignment_returns_expected_result - stub_request(:delete, /#{Regexp.escape("authorization")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.delete_organization_membership_role_assignment(organization_membership_id: "stub", role_assignment_id: "stub") - assert_nil result if result.nil? - end - - def test_delete_organization_membership_role_assignment_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.delete_organization_membership_role_assignment(organization_membership_id: "stub", role_assignment_id: "stub") - end + assert_nil result end def test_list_organization_roles_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.list_organization_roles(organization_id: "stub") refute_nil result end - def test_list_organization_roles_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.list_organization_roles(organization_id: "stub") - end - end - def test_create_organization_role_returns_expected_result - stub_request(:post, /#{Regexp.escape("authorization")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.create_organization_role(organization_id: "stub", name: "stub") refute_nil result end - def test_create_organization_role_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.create_organization_role(organization_id: "stub", name: "stub") - end - end - def test_get_organization_role_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.get_organization_role(organization_id: "stub", slug: "stub") refute_nil result end - def test_get_organization_role_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.get_organization_role(organization_id: "stub", slug: "stub") - end - end - def test_update_organization_role_returns_expected_result - stub_request(:patch, /#{Regexp.escape("authorization")}/) + stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.update_organization_role(organization_id: "stub", slug: "stub") refute_nil result end - def test_update_organization_role_raises_authentication_error_on_401 - stub_request(:patch, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.update_organization_role(organization_id: "stub", slug: "stub") - end - end - def test_delete_organization_role_returns_expected_result - stub_request(:delete, /#{Regexp.escape("authorization")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.delete_organization_role(organization_id: "stub", slug: "stub") - assert_nil result if result.nil? - end - - def test_delete_organization_role_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.delete_organization_role(organization_id: "stub", slug: "stub") - end + assert_nil result end def test_create_role_permission_returns_expected_result - stub_request(:post, /#{Regexp.escape("authorization")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub/permissions(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.create_role_permission(organization_id: "stub", slug: "stub", body_slug: "stub") refute_nil result end - def test_create_role_permission_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.create_role_permission(organization_id: "stub", slug: "stub", body_slug: "stub") - end - end - def test_update_role_permissions_returns_expected_result - stub_request(:put, /#{Regexp.escape("authorization")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub/permissions(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.update_role_permissions(organization_id: "stub", slug: "stub", permissions: []) refute_nil result end - def test_update_role_permissions_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.update_role_permissions(organization_id: "stub", slug: "stub", permissions: []) - end - end - def test_delete_role_permission_returns_expected_result - stub_request(:delete, /#{Regexp.escape("authorization")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub/permissions/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.delete_role_permission(organization_id: "stub", slug: "stub", permission_slug: "stub") - assert_nil result if result.nil? - end - - def test_delete_role_permission_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.delete_role_permission(organization_id: "stub", slug: "stub", permission_slug: "stub") - end + refute_nil result end def test_get_organization_resource_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.get_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") refute_nil result end - def test_get_organization_resource_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.get_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") - end - end - def test_update_organization_resource_returns_expected_result - stub_request(:patch, /#{Regexp.escape("authorization")}/) + stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.update_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") refute_nil result end - def test_update_organization_resource_raises_authentication_error_on_401 - stub_request(:patch, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.update_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") - end - end - def test_delete_organization_resource_returns_expected_result - stub_request(:delete, /#{Regexp.escape("authorization")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.delete_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") - assert_nil result if result.nil? - end - - def test_delete_organization_resource_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.delete_organization_resource(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") - end + assert_nil result end def test_list_resource_organization_memberships_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub/organization_memberships(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.authorization.list_resource_organization_memberships(organization_id: "stub", resource_type_slug: "stub", external_id: "stub", permission_slug: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_resource_organization_memberships_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.list_resource_organization_memberships(organization_id: "stub", resource_type_slug: "stub", external_id: "stub", permission_slug: "stub") - end - end - def test_list_resources_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.authorization.list_resources assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_resources_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.list_resources - end - end - def test_create_resource_returns_expected_result - stub_request(:post, /#{Regexp.escape("authorization")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.create_resource(external_id: "stub", name: "stub", resource_type_slug: "stub", organization_id: "stub") refute_nil result end - def test_create_resource_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.create_resource(external_id: "stub", name: "stub", resource_type_slug: "stub", organization_id: "stub") - end - end - def test_get_resource_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.get_resource(resource_id: "stub") refute_nil result end - def test_get_resource_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.get_resource(resource_id: "stub") - end - end - def test_update_resource_returns_expected_result - stub_request(:patch, /#{Regexp.escape("authorization")}/) + stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.update_resource(resource_id: "stub") refute_nil result end - def test_update_resource_raises_authentication_error_on_401 - stub_request(:patch, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.update_resource(resource_id: "stub") - end - end - def test_delete_resource_returns_expected_result - stub_request(:delete, /#{Regexp.escape("authorization")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.delete_resource(resource_id: "stub") - assert_nil result if result.nil? - end - - def test_delete_resource_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.delete_resource(resource_id: "stub") - end + assert_nil result end def test_list_memberships_for_resource_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/resources/stub/organization_memberships(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.authorization.list_memberships_for_resource(resource_id: "stub", permission_slug: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_memberships_for_resource_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.list_memberships_for_resource(resource_id: "stub", permission_slug: "stub") - end - end - def test_list_environment_roles_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/roles(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.list_environment_roles refute_nil result end - def test_list_environment_roles_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.list_environment_roles - end - end - def test_create_environment_role_returns_expected_result - stub_request(:post, /#{Regexp.escape("authorization")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/roles(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.create_environment_role(slug: "stub", name: "stub") refute_nil result end - def test_create_environment_role_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.create_environment_role(slug: "stub", name: "stub") - end - end - def test_get_environment_role_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/roles/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.get_environment_role(slug: "stub") refute_nil result end - def test_get_environment_role_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.get_environment_role(slug: "stub") - end - end - def test_update_environment_role_returns_expected_result - stub_request(:patch, /#{Regexp.escape("authorization")}/) + stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/roles/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.update_environment_role(slug: "stub") refute_nil result end - def test_update_environment_role_raises_authentication_error_on_401 - stub_request(:patch, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.update_environment_role(slug: "stub") - end - end - def test_add_environment_role_permission_returns_expected_result - stub_request(:post, /#{Regexp.escape("authorization")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/roles/stub/permissions(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.add_environment_role_permission(slug: "stub", body_slug: "stub") refute_nil result end - def test_add_environment_role_permission_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.add_environment_role_permission(slug: "stub", body_slug: "stub") - end - end - def test_set_environment_role_permissions_returns_expected_result - stub_request(:put, /#{Regexp.escape("authorization")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/authorization/roles/stub/permissions(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.set_environment_role_permissions(slug: "stub", permissions: []) refute_nil result end - def test_set_environment_role_permissions_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.set_environment_role_permissions(slug: "stub", permissions: []) - end - end - def test_list_permissions_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/permissions(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.authorization.list_permissions assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_permissions_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.list_permissions - end - end - def test_create_permission_returns_expected_result - stub_request(:post, /#{Regexp.escape("authorization")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/permissions(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.create_permission(slug: "stub", name: "stub") refute_nil result end - def test_create_permission_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.create_permission(slug: "stub", name: "stub") - end - end - def test_get_permission_returns_expected_result - stub_request(:get, /#{Regexp.escape("authorization")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/permissions/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.get_permission(slug: "stub") refute_nil result end - def test_get_permission_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.get_permission(slug: "stub") - end - end - def test_update_permission_returns_expected_result - stub_request(:patch, /#{Regexp.escape("authorization")}/) + stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/permissions/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.update_permission(slug: "stub") refute_nil result end - def test_update_permission_raises_authentication_error_on_401 - stub_request(:patch, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.update_permission(slug: "stub") - end - end - def test_delete_permission_returns_expected_result - stub_request(:delete, /#{Regexp.escape("authorization")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/authorization/permissions/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.authorization.delete_permission(slug: "stub") - assert_nil result if result.nil? - end - - def test_delete_permission_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("authorization")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.authorization.delete_permission(slug: "stub") + assert_nil result + end + + # Parameterized authentication error tests (one per endpoint). + [ + {name: :check, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/check(\?|\z)}, args: {organization_membership_id: "stub", permission_slug: "stub", resource_target: {type: "by_id"}}}, + {name: :list_organization_membership_resources, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/resources(\?|\z)}, args: {organization_membership_id: "stub", permission_slug: "stub", parent_resource: {type: "by_id"}}}, + {name: :list_resource_permissions, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/resources/stub/permissions(\?|\z)}, args: {organization_membership_id: "stub", resource_id: "stub"}}, + {name: :list_effective_permissions_by_external_id, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/resources/stub/stub/permissions(\?|\z)}, args: {organization_membership_id: "stub", resource_type_slug: "stub", external_id: "stub"}}, + {name: :list_organization_membership_role_assignments, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments(\?|\z)}, args: {organization_membership_id: "stub"}}, + {name: :assign_role, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments(\?|\z)}, args: {organization_membership_id: "stub", role_slug: "stub", resource_target: {type: "by_id"}}}, + {name: :remove_role, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments(\?|\z)}, args: {organization_membership_id: "stub", role_slug: "stub", resource_target: {type: "by_id"}}}, + {name: :delete_organization_membership_role_assignment, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments/stub(\?|\z)}, args: {organization_membership_id: "stub", role_assignment_id: "stub"}}, + {name: :list_organization_roles, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles(\?|\z)}, args: {organization_id: "stub"}}, + {name: :create_organization_role, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles(\?|\z)}, args: {organization_id: "stub", name: "stub"}}, + {name: :get_organization_role, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}, + {name: :update_organization_role, verb: :patch, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}, + {name: :delete_organization_role, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub"}}, + {name: :create_role_permission, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub/permissions(\?|\z)}, args: {organization_id: "stub", slug: "stub", body_slug: "stub"}}, + {name: :update_role_permissions, verb: :put, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub/permissions(\?|\z)}, args: {organization_id: "stub", slug: "stub", permissions: []}}, + {name: :delete_role_permission, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub/permissions/stub(\?|\z)}, args: {organization_id: "stub", slug: "stub", permission_slug: "stub"}}, + {name: :get_organization_resource, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)}, args: {organization_id: "stub", resource_type_slug: "stub", external_id: "stub"}}, + {name: :update_organization_resource, verb: :patch, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)}, args: {organization_id: "stub", resource_type_slug: "stub", external_id: "stub"}}, + {name: :delete_organization_resource, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)}, args: {organization_id: "stub", resource_type_slug: "stub", external_id: "stub"}}, + {name: :list_resource_organization_memberships, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub/organization_memberships(\?|\z)}, args: {organization_id: "stub", resource_type_slug: "stub", external_id: "stub", permission_slug: "stub"}}, + {name: :list_resources, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}}, + {name: :create_resource, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}, args: {external_id: "stub", name: "stub", resource_type_slug: "stub", organization_id: "stub"}}, + {name: :get_resource, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}, args: {resource_id: "stub"}}, + {name: :update_resource, verb: :patch, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}, args: {resource_id: "stub"}}, + {name: :delete_resource, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}, args: {resource_id: "stub"}}, + {name: :list_memberships_for_resource, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub/organization_memberships(\?|\z)}, args: {resource_id: "stub", permission_slug: "stub"}}, + {name: :list_environment_roles, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/roles(\?|\z)}}, + {name: :create_environment_role, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/roles(\?|\z)}, args: {slug: "stub", name: "stub"}}, + {name: :get_environment_role, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/roles/stub(\?|\z)}, args: {slug: "stub"}}, + {name: :update_environment_role, verb: :patch, url: %r{\Ahttps://api\.workos\.com/authorization/roles/stub(\?|\z)}, args: {slug: "stub"}}, + {name: :add_environment_role_permission, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/roles/stub/permissions(\?|\z)}, args: {slug: "stub", body_slug: "stub"}}, + {name: :set_environment_role_permissions, verb: :put, url: %r{\Ahttps://api\.workos\.com/authorization/roles/stub/permissions(\?|\z)}, args: {slug: "stub", permissions: []}}, + {name: :list_permissions, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/permissions(\?|\z)}}, + {name: :create_permission, verb: :post, url: %r{\Ahttps://api\.workos\.com/authorization/permissions(\?|\z)}, args: {slug: "stub", name: "stub"}}, + {name: :get_permission, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/permissions/stub(\?|\z)}, args: {slug: "stub"}}, + {name: :update_permission, verb: :patch, url: %r{\Ahttps://api\.workos\.com/authorization/permissions/stub(\?|\z)}, args: {slug: "stub"}}, + {name: :delete_permission, verb: :delete, url: %r{\Ahttps://api\.workos\.com/authorization/permissions/stub(\?|\z)}, args: {slug: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.authorization.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_base_client.rb b/test/workos/test_base_client.rb index 6d58b0cc..1d6f338e 100644 --- a/test/workos/test_base_client.rb +++ b/test/workos/test_base_client.rb @@ -90,10 +90,10 @@ def test_request_dispatches_known_methods client = RecordingClient.new(api_key: "sk_test_123") assert_equal ["GET", {timeout: 5}], client.request(method: :get, path: "/get", request_options: {timeout: 5}) - assert_equal ["POST", nil], client.request(method: :post, path: "/post", body: {ok: true}) - assert_equal ["PUT", nil], client.request(method: :put, path: "/put", body: {ok: true}) - assert_equal ["PATCH", nil], client.request(method: :patch, path: "/patch", body: {ok: true}) - assert_equal ["DELETE", nil], client.request(method: :delete, path: "/delete") + assert_equal ["POST", {}], client.request(method: :post, path: "/post", body: {ok: true}) + assert_equal ["PUT", {}], client.request(method: :put, path: "/put", body: {ok: true}) + assert_equal ["PATCH", {}], client.request(method: :patch, path: "/patch", body: {ok: true}) + assert_equal ["DELETE", {}], client.request(method: :delete, path: "/delete") assert_equal %i[get post put patch delete], client.calls.map(&:first) end diff --git a/test/workos/test_connect.rb b/test/workos/test_connect.rb index 8a937853..5c1d2dbb 100644 --- a/test/workos/test_connect.rb +++ b/test/workos/test_connect.rb @@ -12,59 +12,35 @@ def setup end def test_complete_oauth2_returns_expected_result - stub_request(:post, /#{Regexp.escape("authkit")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/authkit/oauth2/complete(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.connect.complete_oauth2(external_auth_id: "stub", user: {}) refute_nil result end - def test_complete_oauth2_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("authkit")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.connect.complete_oauth2(external_auth_id: "stub", user: {}) - end - end - def test_list_applications_returns_expected_result - stub_request(:get, /#{Regexp.escape("connect")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/connect/applications(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.connect.list_applications assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_applications_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("connect")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.connect.list_applications - end - end - def test_create_application_returns_expected_result - stub_request(:post, /#{Regexp.escape("connect")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/connect/applications(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.connect.create_application(name: "stub", application_type: "oauth", is_first_party: true) refute_nil result end - def test_create_application_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("connect")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.connect.create_application(name: "stub", application_type: "oauth", is_first_party: true) - end - end - def test_create_oauth_application_returns_expected_result - stub_request(:post, /#{Regexp.escape("connect")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/connect/applications(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.connect.create_oauth_application(name: "stub", is_first_party: true) refute_nil result end def test_create_oauth_application_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("connect")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/connect/applications(\?|\z)}) .to_return(body: '{"message": "Unauthorized"}', status: 401) assert_raises(WorkOS::AuthenticationError) do @client.connect.create_oauth_application(name: "stub", is_first_party: true) @@ -72,14 +48,14 @@ def test_create_oauth_application_raises_authentication_error_on_401 end def test_create_m2m_application_returns_expected_result - stub_request(:post, /#{Regexp.escape("connect")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/connect/applications(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.connect.create_m2m_application(name: "stub", organization_id: "stub") refute_nil result end def test_create_m2m_application_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("connect")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/connect/applications(\?|\z)}) .to_return(body: '{"message": "Unauthorized"}', status: 401) assert_raises(WorkOS::AuthenticationError) do @client.connect.create_m2m_application(name: "stub", organization_id: "stub") @@ -87,92 +63,65 @@ def test_create_m2m_application_raises_authentication_error_on_401 end def test_get_application_returns_expected_result - stub_request(:get, /#{Regexp.escape("connect")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/connect/applications/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.connect.get_application(id: "stub") refute_nil result end - def test_get_application_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("connect")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.connect.get_application(id: "stub") - end - end - def test_update_application_returns_expected_result - stub_request(:put, /#{Regexp.escape("connect")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/connect/applications/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.connect.update_application(id: "stub") refute_nil result end - def test_update_application_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("connect")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.connect.update_application(id: "stub") - end - end - def test_delete_application_returns_expected_result - stub_request(:delete, /#{Regexp.escape("connect")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/connect/applications/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.connect.delete_application(id: "stub") - assert_nil result if result.nil? - end - - def test_delete_application_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("connect")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.connect.delete_application(id: "stub") - end + assert_nil result end def test_list_application_client_secrets_returns_expected_result - stub_request(:get, /#{Regexp.escape("connect")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/connect/applications/stub/client_secrets(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.connect.list_application_client_secrets(id: "stub") refute_nil result end - def test_list_application_client_secrets_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("connect")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.connect.list_application_client_secrets(id: "stub") - end - end - def test_create_application_client_secret_returns_expected_result - stub_request(:post, /#{Regexp.escape("connect")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/connect/applications/stub/client_secrets(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.connect.create_application_client_secret(id: "stub") refute_nil result end - def test_create_application_client_secret_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("connect")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.connect.create_application_client_secret(id: "stub") - end - end - def test_delete_client_secret_returns_expected_result - stub_request(:delete, /#{Regexp.escape("connect")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/connect/client_secrets/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.connect.delete_client_secret(id: "stub") - assert_nil result if result.nil? - end - - def test_delete_client_secret_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("connect")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.connect.delete_client_secret(id: "stub") + assert_nil result + end + + # Parameterized authentication error tests (one per endpoint). + [ + {name: :complete_oauth2, verb: :post, url: %r{\Ahttps://api\.workos\.com/authkit/oauth2/complete(\?|\z)}, args: {external_auth_id: "stub", user: {}}}, + {name: :list_applications, verb: :get, url: %r{\Ahttps://api\.workos\.com/connect/applications(\?|\z)}}, + {name: :create_application, verb: :post, url: %r{\Ahttps://api\.workos\.com/connect/applications(\?|\z)}, args: {name: "stub", application_type: "oauth", is_first_party: true}}, + {name: :get_application, verb: :get, url: %r{\Ahttps://api\.workos\.com/connect/applications/stub(\?|\z)}, args: {id: "stub"}}, + {name: :update_application, verb: :put, url: %r{\Ahttps://api\.workos\.com/connect/applications/stub(\?|\z)}, args: {id: "stub"}}, + {name: :delete_application, verb: :delete, url: %r{\Ahttps://api\.workos\.com/connect/applications/stub(\?|\z)}, args: {id: "stub"}}, + {name: :list_application_client_secrets, verb: :get, url: %r{\Ahttps://api\.workos\.com/connect/applications/stub/client_secrets(\?|\z)}, args: {id: "stub"}}, + {name: :create_application_client_secret, verb: :post, url: %r{\Ahttps://api\.workos\.com/connect/applications/stub/client_secrets(\?|\z)}, args: {id: "stub"}}, + {name: :delete_client_secret, verb: :delete, url: %r{\Ahttps://api\.workos\.com/connect/client_secrets/stub(\?|\z)}, args: {id: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.connect.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_directory_sync.rb b/test/workos/test_directory_sync.rb index 96105d7c..574ec0ee 100644 --- a/test/workos/test_directory_sync.rb +++ b/test/workos/test_directory_sync.rb @@ -12,107 +12,70 @@ def setup end def test_list_directories_returns_expected_result - stub_request(:get, /#{Regexp.escape("directories")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/directories(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.directory_sync.list_directories assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_directories_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("directories")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.directory_sync.list_directories - end - end - def test_get_directory_returns_expected_result - stub_request(:get, /#{Regexp.escape("directories")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/directories/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.directory_sync.get_directory(id: "stub") refute_nil result end - def test_get_directory_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("directories")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.directory_sync.get_directory(id: "stub") - end - end - def test_delete_directory_returns_expected_result - stub_request(:delete, /#{Regexp.escape("directories")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/directories/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.directory_sync.delete_directory(id: "stub") - assert_nil result if result.nil? - end - - def test_delete_directory_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("directories")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.directory_sync.delete_directory(id: "stub") - end + assert_nil result end def test_list_groups_returns_expected_result - stub_request(:get, /#{Regexp.escape("directory_groups")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/directory_groups(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.directory_sync.list_groups assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_groups_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("directory_groups")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.directory_sync.list_groups - end - end - def test_get_group_returns_expected_result - stub_request(:get, /#{Regexp.escape("directory_groups")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/directory_groups/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.directory_sync.get_group(id: "stub") refute_nil result end - def test_get_group_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("directory_groups")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.directory_sync.get_group(id: "stub") - end - end - def test_list_users_returns_expected_result - stub_request(:get, /#{Regexp.escape("directory_users")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/directory_users(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.directory_sync.list_users assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_users_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("directory_users")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.directory_sync.list_users - end - end - def test_get_user_returns_expected_result - stub_request(:get, /#{Regexp.escape("directory_users")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/directory_users/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.directory_sync.get_user(id: "stub") refute_nil result end - def test_get_user_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("directory_users")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.directory_sync.get_user(id: "stub") + # Parameterized authentication error tests (one per endpoint). + [ + {name: :list_directories, verb: :get, url: %r{\Ahttps://api\.workos\.com/directories(\?|\z)}}, + {name: :get_directory, verb: :get, url: %r{\Ahttps://api\.workos\.com/directories/stub(\?|\z)}, args: {id: "stub"}}, + {name: :delete_directory, verb: :delete, url: %r{\Ahttps://api\.workos\.com/directories/stub(\?|\z)}, args: {id: "stub"}}, + {name: :list_groups, verb: :get, url: %r{\Ahttps://api\.workos\.com/directory_groups(\?|\z)}}, + {name: :get_group, verb: :get, url: %r{\Ahttps://api\.workos\.com/directory_groups/stub(\?|\z)}, args: {id: "stub"}}, + {name: :list_users, verb: :get, url: %r{\Ahttps://api\.workos\.com/directory_users(\?|\z)}}, + {name: :get_user, verb: :get, url: %r{\Ahttps://api\.workos\.com/directory_users/stub(\?|\z)}, args: {id: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.directory_sync.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_events.rb b/test/workos/test_events.rb index af71a303..5e9b92ec 100644 --- a/test/workos/test_events.rb +++ b/test/workos/test_events.rb @@ -12,17 +12,22 @@ def setup end def test_list_events_returns_expected_result - stub_request(:get, /#{Regexp.escape("events")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/events(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.events.list_events assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_events_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("events")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.events.list_events + # Parameterized authentication error tests (one per endpoint). + [ + {name: :list_events, verb: :get, url: %r{\Ahttps://api\.workos\.com/events(\?|\z)}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.events.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_feature_flags.rb b/test/workos/test_feature_flags.rb index 3d9a1fd5..0a231e52 100644 --- a/test/workos/test_feature_flags.rb +++ b/test/workos/test_feature_flags.rb @@ -12,122 +12,78 @@ def setup end def test_list_feature_flags_returns_expected_result - stub_request(:get, /#{Regexp.escape("feature-flags")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/feature-flags(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.feature_flags.list_feature_flags assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_feature_flags_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("feature-flags")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.feature_flags.list_feature_flags - end - end - def test_get_feature_flag_returns_expected_result - stub_request(:get, /#{Regexp.escape("feature-flags")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/feature-flags/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.feature_flags.get_feature_flag(slug: "stub") refute_nil result end - def test_get_feature_flag_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("feature-flags")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.feature_flags.get_feature_flag(slug: "stub") - end - end - def test_disable_feature_flag_returns_expected_result - stub_request(:put, /#{Regexp.escape("feature-flags")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/feature-flags/stub/disable(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.feature_flags.disable_feature_flag(slug: "stub") refute_nil result end - def test_disable_feature_flag_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("feature-flags")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.feature_flags.disable_feature_flag(slug: "stub") - end - end - def test_enable_feature_flag_returns_expected_result - stub_request(:put, /#{Regexp.escape("feature-flags")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/feature-flags/stub/enable(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.feature_flags.enable_feature_flag(slug: "stub") refute_nil result end - def test_enable_feature_flag_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("feature-flags")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.feature_flags.enable_feature_flag(slug: "stub") - end - end - def test_add_flag_target_returns_expected_result - stub_request(:post, /#{Regexp.escape("feature-flags")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/feature-flags/stub/targets/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.feature_flags.add_flag_target(resource_id: "stub", slug: "stub") - assert_nil result if result.nil? - end - - def test_add_flag_target_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("feature-flags")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.feature_flags.add_flag_target(resource_id: "stub", slug: "stub") - end + assert_nil result end def test_remove_flag_target_returns_expected_result - stub_request(:delete, /#{Regexp.escape("feature-flags")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/feature-flags/stub/targets/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.feature_flags.remove_flag_target(resource_id: "stub", slug: "stub") - assert_nil result if result.nil? - end - - def test_remove_flag_target_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("feature-flags")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.feature_flags.remove_flag_target(resource_id: "stub", slug: "stub") - end + assert_nil result end def test_list_organization_feature_flags_returns_expected_result - stub_request(:get, /#{Regexp.escape("organizations")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/feature-flags(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.feature_flags.list_organization_feature_flags(organization_id: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_organization_feature_flags_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.feature_flags.list_organization_feature_flags(organization_id: "stub") - end - end - def test_list_user_feature_flags_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/feature-flags(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.feature_flags.list_user_feature_flags(user_id: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_user_feature_flags_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.feature_flags.list_user_feature_flags(user_id: "stub") + # Parameterized authentication error tests (one per endpoint). + [ + {name: :list_feature_flags, verb: :get, url: %r{\Ahttps://api\.workos\.com/feature-flags(\?|\z)}}, + {name: :get_feature_flag, verb: :get, url: %r{\Ahttps://api\.workos\.com/feature-flags/stub(\?|\z)}, args: {slug: "stub"}}, + {name: :disable_feature_flag, verb: :put, url: %r{\Ahttps://api\.workos\.com/feature-flags/stub/disable(\?|\z)}, args: {slug: "stub"}}, + {name: :enable_feature_flag, verb: :put, url: %r{\Ahttps://api\.workos\.com/feature-flags/stub/enable(\?|\z)}, args: {slug: "stub"}}, + {name: :add_flag_target, verb: :post, url: %r{\Ahttps://api\.workos\.com/feature-flags/stub/targets/stub(\?|\z)}, args: {resource_id: "stub", slug: "stub"}}, + {name: :remove_flag_target, verb: :delete, url: %r{\Ahttps://api\.workos\.com/feature-flags/stub/targets/stub(\?|\z)}, args: {resource_id: "stub", slug: "stub"}}, + {name: :list_organization_feature_flags, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/feature-flags(\?|\z)}, args: {organization_id: "stub"}}, + {name: :list_user_feature_flags, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/feature-flags(\?|\z)}, args: {user_id: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.feature_flags.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_model_round_trip.rb b/test/workos/test_model_round_trip.rb index 8a2cf24c..79adf9e7 100644 --- a/test/workos/test_model_round_trip.rb +++ b/test/workos/test_model_round_trip.rb @@ -18,6 +18,7 @@ def test_user_object_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_consent_option_round_trip @@ -32,6 +33,7 @@ def test_user_consent_option_round_trip assert_kind_of Hash, json assert_equal fixture["claim"], json[:claim] assert_equal fixture["label"], json[:label] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_management_login_request_round_trip @@ -44,6 +46,7 @@ def test_user_management_login_request_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["external_auth_id"], json[:external_auth_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_validate_api_key_round_trip @@ -54,6 +57,7 @@ def test_validate_api_key_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["value"], json[:value] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_redirect_uri_input_round_trip @@ -65,6 +69,7 @@ def test_redirect_uri_input_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["uri"], json[:uri] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_oauth_application_round_trip @@ -83,6 +88,7 @@ def test_create_oauth_application_round_trip assert_kind_of Hash, json assert_equal fixture["name"], json[:name] assert_equal fixture["is_first_party"], json[:is_first_party] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_m2m_application_round_trip @@ -98,6 +104,7 @@ def test_create_m2m_application_round_trip assert_kind_of Hash, json assert_equal fixture["name"], json[:name] assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_update_oauth_application_round_trip @@ -110,6 +117,7 @@ def test_update_oauth_application_round_trip model = WorkOS::UpdateOAuthApplication.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_application_secret_round_trip @@ -130,6 +138,7 @@ def test_audit_log_event_actor_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["type"], json[:type] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_event_target_round_trip @@ -144,6 +153,7 @@ def test_audit_log_event_target_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["type"], json[:type] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_event_context_round_trip @@ -155,6 +165,7 @@ def test_audit_log_event_context_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["location"], json[:location] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_event_round_trip @@ -172,6 +183,7 @@ def test_audit_log_event_round_trip assert_kind_of Hash, json assert_equal fixture["action"], json[:action] assert_equal fixture["occurred_at"], json[:occurred_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_event_ingestion_round_trip @@ -183,6 +195,7 @@ def test_audit_log_event_ingestion_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_export_creation_round_trip @@ -202,6 +215,7 @@ def test_audit_log_export_creation_round_trip assert_equal fixture["organization_id"], json[:organization_id] assert_equal fixture["range_start"], json[:range_start] assert_equal fixture["range_end"], json[:range_end] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_update_audit_logs_retention_round_trip @@ -212,6 +226,7 @@ def test_update_audit_logs_retention_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["retention_period_in_days"], json[:retention_period_in_days] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_schema_actor_round_trip @@ -221,6 +236,7 @@ def test_audit_log_schema_actor_round_trip model = WorkOS::AuditLogSchemaActor.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_schema_target_round_trip @@ -232,6 +248,7 @@ def test_audit_log_schema_target_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["type"], json[:type] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_schema_round_trip @@ -243,6 +260,7 @@ def test_audit_log_schema_round_trip model = WorkOS::AuditLogSchema.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_challenge_authentication_factor_round_trip @@ -252,6 +270,7 @@ def test_challenge_authentication_factor_round_trip model = WorkOS::ChallengeAuthenticationFactor.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_check_authorization_round_trip @@ -265,6 +284,7 @@ def test_check_authorization_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["permission_slug"], json[:permission_slug] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_assign_role_round_trip @@ -278,6 +298,7 @@ def test_assign_role_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["role_slug"], json[:role_slug] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_remove_role_round_trip @@ -291,6 +312,7 @@ def test_remove_role_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["role_slug"], json[:role_slug] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_set_role_permissions_round_trip @@ -300,6 +322,7 @@ def test_set_role_permissions_round_trip model = WorkOS::SetRolePermissions.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_add_role_permission_round_trip @@ -310,6 +333,7 @@ def test_add_role_permission_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["slug"], json[:slug] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_organization_role_round_trip @@ -323,6 +347,7 @@ def test_create_organization_role_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["name"], json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_update_organization_role_round_trip @@ -333,6 +358,7 @@ def test_update_organization_role_round_trip model = WorkOS::UpdateOrganizationRole.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_authorization_permission_round_trip @@ -347,6 +373,7 @@ def test_create_authorization_permission_round_trip assert_kind_of Hash, json assert_equal fixture["slug"], json[:slug] assert_equal fixture["name"], json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_update_authorization_permission_round_trip @@ -357,6 +384,7 @@ def test_update_authorization_permission_round_trip model = WorkOS::UpdateAuthorizationPermission.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_role_round_trip @@ -371,6 +399,7 @@ def test_create_role_round_trip assert_kind_of Hash, json assert_equal fixture["slug"], json[:slug] assert_equal fixture["name"], json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_update_role_round_trip @@ -381,6 +410,7 @@ def test_update_role_round_trip model = WorkOS::UpdateRole.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_update_authorization_resource_round_trip @@ -394,6 +424,7 @@ def test_update_authorization_resource_round_trip model = WorkOS::UpdateAuthorizationResource.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_authorization_resource_round_trip @@ -414,6 +445,7 @@ def test_create_authorization_resource_round_trip assert_equal fixture["name"], json[:name] assert_equal fixture["resource_type_slug"], json[:resource_type_slug] assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_cors_origin_round_trip @@ -424,6 +456,7 @@ def test_create_cors_origin_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["origin"], json[:origin] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_update_jwt_template_round_trip @@ -434,6 +467,7 @@ def test_update_jwt_template_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["content"], json[:content] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_organization_domain_round_trip @@ -446,6 +480,7 @@ def test_create_organization_domain_round_trip assert_kind_of Hash, json assert_equal fixture["domain"], json[:domain] assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_organization_api_key_round_trip @@ -457,6 +492,7 @@ def test_create_organization_api_key_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["name"], json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_data_round_trip @@ -468,6 +504,7 @@ def test_organization_domain_data_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["domain"], json[:domain] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_input_round_trip @@ -483,6 +520,7 @@ def test_organization_input_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["name"], json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_update_organization_round_trip @@ -498,6 +536,7 @@ def test_update_organization_round_trip model = WorkOS::UpdateOrganization.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_sso_intent_options_round_trip @@ -508,6 +547,7 @@ def test_sso_intent_options_round_trip model = WorkOS::SSOIntentOptions.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_intent_options_round_trip @@ -517,6 +557,7 @@ def test_intent_options_round_trip model = WorkOS::IntentOptions.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_generate_link_round_trip @@ -532,6 +573,7 @@ def test_generate_link_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["organization"], json[:organization] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_redirect_uri_round_trip @@ -542,6 +584,7 @@ def test_create_redirect_uri_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["uri"], json[:uri] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_enroll_user_authentication_factor_round_trip @@ -554,6 +597,7 @@ def test_enroll_user_authentication_factor_round_trip model = WorkOS::EnrollUserAuthenticationFactor.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_magic_code_and_return_round_trip @@ -565,6 +609,7 @@ def test_create_magic_code_and_return_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_user_invite_options_round_trip @@ -580,6 +625,7 @@ def test_create_user_invite_options_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_resend_user_invite_options_round_trip @@ -589,6 +635,7 @@ def test_resend_user_invite_options_round_trip model = WorkOS::ResendUserInviteOptions.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_user_organization_membership_round_trip @@ -603,6 +650,7 @@ def test_create_user_organization_membership_round_trip assert_kind_of Hash, json assert_equal fixture["user_id"], json[:user_id] assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_update_user_organization_membership_round_trip @@ -613,6 +661,7 @@ def test_update_user_organization_membership_round_trip model = WorkOS::UpdateUserOrganizationMembership.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_user_round_trip @@ -631,6 +680,7 @@ def test_create_user_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_update_user_round_trip @@ -649,6 +699,7 @@ def test_update_user_round_trip model = WorkOS::UpdateUser.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_verify_email_address_round_trip @@ -659,6 +710,7 @@ def test_verify_email_address_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["code"], json[:code] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_password_reset_token_round_trip @@ -669,6 +721,7 @@ def test_create_password_reset_token_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_password_reset_round_trip @@ -681,6 +734,7 @@ def test_create_password_reset_round_trip assert_kind_of Hash, json assert_equal fixture["token"], json[:token] assert_equal fixture["new_password"], json[:new_password] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_send_email_change_round_trip @@ -691,6 +745,7 @@ def test_send_email_change_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["new_email"], json[:new_email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_confirm_email_change_round_trip @@ -701,6 +756,7 @@ def test_confirm_email_change_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["code"], json[:code] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_revoke_session_round_trip @@ -712,6 +768,7 @@ def test_revoke_session_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["session_id"], json[:session_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_create_webhook_endpoint_round_trip @@ -723,6 +780,7 @@ def test_create_webhook_endpoint_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["endpoint_url"], json[:endpoint_url] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_update_webhook_endpoint_round_trip @@ -734,6 +792,7 @@ def test_update_webhook_endpoint_round_trip model = WorkOS::UpdateWebhookEndpoint.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_widget_session_token_round_trip @@ -746,6 +805,7 @@ def test_widget_session_token_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_token_query_round_trip @@ -761,6 +821,7 @@ def test_token_query_round_trip assert_equal fixture["client_id"], json[:client_id] assert_equal fixture["client_secret"], json[:client_secret] assert_equal fixture["code"], json[:code] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_external_auth_complete_response_round_trip @@ -771,6 +832,7 @@ def test_external_auth_complete_response_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["redirect_uri"], json[:redirect_uri] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_api_key_round_trip @@ -794,6 +856,7 @@ def test_api_key_round_trip assert_nil json[:last_used_at] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_api_key_validation_response_round_trip @@ -803,6 +866,7 @@ def test_api_key_validation_response_round_trip model = WorkOS::ApiKeyValidationResponse.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connect_application_round_trip @@ -827,6 +891,7 @@ def test_connect_application_round_trip assert_equal fixture["name"], json[:name] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_new_connect_application_secret_round_trip @@ -848,6 +913,7 @@ def test_new_connect_application_secret_round_trip assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["secret"], json[:secret] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_event_create_response_round_trip @@ -858,6 +924,7 @@ def test_audit_log_event_create_response_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["success"], json[:success] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_export_json_round_trip @@ -875,6 +942,7 @@ def test_audit_log_export_json_round_trip assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_logs_retention_json_round_trip @@ -885,6 +953,7 @@ def test_audit_logs_retention_json_round_trip json = model.to_h assert_kind_of Hash, json assert_nil json[:retention_period_in_days] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_schema_json_round_trip @@ -901,6 +970,7 @@ def test_audit_log_schema_json_round_trip assert_kind_of Hash, json assert_equal fixture["version"], json[:version] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_action_json_round_trip @@ -917,6 +987,7 @@ def test_audit_log_action_json_round_trip assert_equal fixture["name"], json[:name] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_challenge_round_trip @@ -936,6 +1007,7 @@ def test_authentication_challenge_round_trip assert_equal fixture["authentication_factor_id"], json[:authentication_factor_id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_challenge_verify_response_round_trip @@ -947,6 +1019,7 @@ def test_authentication_challenge_verify_response_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["valid"], json[:valid] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_factor_enrolled_round_trip @@ -966,6 +1039,7 @@ def test_authentication_factor_enrolled_round_trip assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_factor_round_trip @@ -985,6 +1059,7 @@ def test_authentication_factor_round_trip assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authorization_check_round_trip @@ -995,6 +1070,7 @@ def test_authorization_check_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["authorized"], json[:authorized] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authorization_resource_round_trip @@ -1022,6 +1098,7 @@ def test_authorization_resource_round_trip assert_equal fixture["resource_type_slug"], json[:resource_type_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authorization_permission_round_trip @@ -1047,6 +1124,7 @@ def test_authorization_permission_round_trip assert_equal fixture["resource_type_slug"], json[:resource_type_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_slim_role_round_trip @@ -1057,6 +1135,7 @@ def test_slim_role_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["slug"], json[:slug] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_role_assignment_round_trip @@ -1074,6 +1153,7 @@ def test_role_assignment_round_trip assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_role_round_trip @@ -1099,6 +1179,7 @@ def test_role_round_trip assert_equal fixture["resource_type_slug"], json[:resource_type_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_role_list_round_trip @@ -1109,6 +1190,7 @@ def test_role_list_round_trip model = WorkOS::RoleList.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_round_trip @@ -1132,6 +1214,7 @@ def test_connection_round_trip assert_equal fixture["name"], json[:name] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_cors_origin_response_round_trip @@ -1149,6 +1232,7 @@ def test_cors_origin_response_round_trip assert_equal fixture["origin"], json[:origin] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_directory_round_trip @@ -1174,6 +1258,7 @@ def test_directory_round_trip assert_equal fixture["name"], json[:name] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_directory_group_round_trip @@ -1198,6 +1283,7 @@ def test_directory_group_round_trip assert_equal fixture["name"], json[:name] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_directory_user_with_groups_round_trip @@ -1232,6 +1318,7 @@ def test_directory_user_with_groups_round_trip assert_nil json[:email] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_event_context_actor_round_trip @@ -1245,6 +1332,7 @@ def test_event_context_actor_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_nil json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_event_context_round_trip @@ -1259,6 +1347,7 @@ def test_event_context_round_trip model = WorkOS::EventContext.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_directory_user_round_trip @@ -1292,6 +1381,7 @@ def test_directory_user_round_trip assert_nil json[:email] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_group_round_trip @@ -1313,6 +1403,7 @@ def test_group_round_trip assert_nil json[:description] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_round_trip @@ -1344,6 +1435,7 @@ def test_user_round_trip assert_nil json[:last_sign_in_at] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_event_schema_round_trip @@ -1361,6 +1453,7 @@ def test_event_schema_round_trip assert_equal fixture["id"], json[:id] assert_equal fixture["event"], json[:event] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_action_authentication_denied_round_trip @@ -1377,6 +1470,7 @@ def test_action_authentication_denied_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_action_authentication_denied_data_round_trip @@ -1401,6 +1495,7 @@ def test_action_authentication_denied_data_round_trip assert_equal fixture["email"], json[:email] assert_nil json[:ip_address] assert_nil json[:user_agent] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_action_user_registration_denied_round_trip @@ -1417,6 +1512,7 @@ def test_action_user_registration_denied_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_action_user_registration_denied_data_round_trip @@ -1439,6 +1535,7 @@ def test_action_user_registration_denied_data_round_trip assert_equal fixture["email"], json[:email] assert_nil json[:ip_address] assert_nil json[:user_agent] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_api_key_created_round_trip @@ -1455,6 +1552,7 @@ def test_api_key_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_api_key_created_data_round_trip @@ -1478,6 +1576,7 @@ def test_api_key_created_data_round_trip assert_nil json[:last_used_at] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_api_key_created_data_owner_round_trip @@ -1489,6 +1588,7 @@ def test_api_key_created_data_owner_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_api_key_revoked_round_trip @@ -1505,6 +1605,7 @@ def test_api_key_revoked_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_api_key_revoked_data_round_trip @@ -1528,6 +1629,7 @@ def test_api_key_revoked_data_round_trip assert_nil json[:last_used_at] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_api_key_revoked_data_owner_round_trip @@ -1539,6 +1641,7 @@ def test_api_key_revoked_data_owner_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_email_verification_failed_round_trip @@ -1555,6 +1658,7 @@ def test_authentication_email_verification_failed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_email_verification_failed_data_round_trip @@ -1574,6 +1678,7 @@ def test_authentication_email_verification_failed_data_round_trip assert_nil json[:user_agent] assert_nil json[:user_id] assert_nil json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_email_verification_failed_data_error_round_trip @@ -1586,6 +1691,7 @@ def test_authentication_email_verification_failed_data_error_round_trip assert_kind_of Hash, json assert_equal fixture["code"], json[:code] assert_equal fixture["message"], json[:message] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_email_verification_succeeded_round_trip @@ -1602,6 +1708,7 @@ def test_authentication_email_verification_succeeded_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_email_verification_succeeded_data_round_trip @@ -1620,6 +1727,7 @@ def test_authentication_email_verification_succeeded_data_round_trip assert_nil json[:user_agent] assert_equal fixture["user_id"], json[:user_id] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_magic_auth_failed_round_trip @@ -1636,6 +1744,7 @@ def test_authentication_magic_auth_failed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_magic_auth_failed_data_round_trip @@ -1655,6 +1764,7 @@ def test_authentication_magic_auth_failed_data_round_trip assert_nil json[:user_agent] assert_nil json[:user_id] assert_nil json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_magic_auth_failed_data_error_round_trip @@ -1667,6 +1777,7 @@ def test_authentication_magic_auth_failed_data_error_round_trip assert_kind_of Hash, json assert_equal fixture["code"], json[:code] assert_equal fixture["message"], json[:message] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_magic_auth_succeeded_round_trip @@ -1683,6 +1794,7 @@ def test_authentication_magic_auth_succeeded_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_magic_auth_succeeded_data_round_trip @@ -1701,6 +1813,7 @@ def test_authentication_magic_auth_succeeded_data_round_trip assert_nil json[:user_agent] assert_equal fixture["user_id"], json[:user_id] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_mfa_failed_round_trip @@ -1717,6 +1830,7 @@ def test_authentication_mfa_failed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_mfa_failed_data_round_trip @@ -1736,6 +1850,7 @@ def test_authentication_mfa_failed_data_round_trip assert_nil json[:user_agent] assert_nil json[:user_id] assert_nil json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_mfa_failed_data_error_round_trip @@ -1748,6 +1863,7 @@ def test_authentication_mfa_failed_data_error_round_trip assert_kind_of Hash, json assert_equal fixture["code"], json[:code] assert_equal fixture["message"], json[:message] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_mfa_succeeded_round_trip @@ -1764,6 +1880,7 @@ def test_authentication_mfa_succeeded_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_mfa_succeeded_data_round_trip @@ -1782,6 +1899,7 @@ def test_authentication_mfa_succeeded_data_round_trip assert_nil json[:user_agent] assert_equal fixture["user_id"], json[:user_id] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_oauth_failed_round_trip @@ -1798,6 +1916,7 @@ def test_authentication_oauth_failed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_oauth_failed_data_round_trip @@ -1817,6 +1936,7 @@ def test_authentication_oauth_failed_data_round_trip assert_nil json[:user_agent] assert_nil json[:user_id] assert_nil json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_oauth_failed_data_error_round_trip @@ -1829,6 +1949,7 @@ def test_authentication_oauth_failed_data_error_round_trip assert_kind_of Hash, json assert_equal fixture["code"], json[:code] assert_equal fixture["message"], json[:message] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_oauth_succeeded_round_trip @@ -1845,6 +1966,7 @@ def test_authentication_oauth_succeeded_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_oauth_succeeded_data_round_trip @@ -1863,6 +1985,7 @@ def test_authentication_oauth_succeeded_data_round_trip assert_nil json[:user_agent] assert_nil json[:user_id] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_passkey_failed_round_trip @@ -1879,6 +2002,7 @@ def test_authentication_passkey_failed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_passkey_failed_data_round_trip @@ -1898,6 +2022,7 @@ def test_authentication_passkey_failed_data_round_trip assert_nil json[:user_agent] assert_nil json[:user_id] assert_nil json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_passkey_failed_data_error_round_trip @@ -1910,6 +2035,7 @@ def test_authentication_passkey_failed_data_error_round_trip assert_kind_of Hash, json assert_equal fixture["code"], json[:code] assert_equal fixture["message"], json[:message] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_passkey_succeeded_round_trip @@ -1926,6 +2052,7 @@ def test_authentication_passkey_succeeded_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_passkey_succeeded_data_round_trip @@ -1944,6 +2071,7 @@ def test_authentication_passkey_succeeded_data_round_trip assert_nil json[:user_agent] assert_equal fixture["user_id"], json[:user_id] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_password_failed_round_trip @@ -1960,6 +2088,7 @@ def test_authentication_password_failed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_password_failed_data_round_trip @@ -1979,6 +2108,7 @@ def test_authentication_password_failed_data_round_trip assert_nil json[:user_agent] assert_nil json[:user_id] assert_nil json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_password_failed_data_error_round_trip @@ -1991,6 +2121,7 @@ def test_authentication_password_failed_data_error_round_trip assert_kind_of Hash, json assert_equal fixture["code"], json[:code] assert_equal fixture["message"], json[:message] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_password_succeeded_round_trip @@ -2007,6 +2138,7 @@ def test_authentication_password_succeeded_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_password_succeeded_data_round_trip @@ -2025,6 +2157,7 @@ def test_authentication_password_succeeded_data_round_trip assert_nil json[:user_agent] assert_equal fixture["user_id"], json[:user_id] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_radar_risk_detected_round_trip @@ -2041,6 +2174,7 @@ def test_authentication_radar_risk_detected_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_radar_risk_detected_data_round_trip @@ -2064,6 +2198,7 @@ def test_authentication_radar_risk_detected_data_round_trip assert_nil json[:user_agent] assert_equal fixture["user_id"], json[:user_id] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_failed_round_trip @@ -2080,6 +2215,7 @@ def test_authentication_sso_failed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_failed_data_round_trip @@ -2100,6 +2236,7 @@ def test_authentication_sso_failed_data_round_trip assert_nil json[:user_agent] assert_nil json[:user_id] assert_nil json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_failed_data_sso_round_trip @@ -2114,6 +2251,7 @@ def test_authentication_sso_failed_data_sso_round_trip assert_nil json[:organization_id] assert_nil json[:connection_id] assert_nil json[:session_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_failed_data_error_round_trip @@ -2126,6 +2264,7 @@ def test_authentication_sso_failed_data_error_round_trip assert_kind_of Hash, json assert_equal fixture["code"], json[:code] assert_equal fixture["message"], json[:message] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_started_round_trip @@ -2142,6 +2281,7 @@ def test_authentication_sso_started_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_started_data_round_trip @@ -2161,6 +2301,7 @@ def test_authentication_sso_started_data_round_trip assert_nil json[:user_agent] assert_nil json[:user_id] assert_nil json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_started_data_sso_round_trip @@ -2175,6 +2316,7 @@ def test_authentication_sso_started_data_sso_round_trip assert_nil json[:organization_id] assert_nil json[:connection_id] assert_nil json[:session_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_succeeded_round_trip @@ -2191,6 +2333,7 @@ def test_authentication_sso_succeeded_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_succeeded_data_round_trip @@ -2210,6 +2353,7 @@ def test_authentication_sso_succeeded_data_round_trip assert_nil json[:user_agent] assert_nil json[:user_id] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_succeeded_data_sso_round_trip @@ -2224,6 +2368,7 @@ def test_authentication_sso_succeeded_data_sso_round_trip assert_nil json[:organization_id] assert_nil json[:connection_id] assert_nil json[:session_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_timed_out_round_trip @@ -2240,6 +2385,7 @@ def test_authentication_sso_timed_out_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_timed_out_data_round_trip @@ -2260,6 +2406,7 @@ def test_authentication_sso_timed_out_data_round_trip assert_nil json[:user_agent] assert_nil json[:user_id] assert_nil json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_timed_out_data_sso_round_trip @@ -2274,6 +2421,7 @@ def test_authentication_sso_timed_out_data_sso_round_trip assert_nil json[:organization_id] assert_nil json[:connection_id] assert_nil json[:session_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_sso_timed_out_data_error_round_trip @@ -2286,6 +2434,7 @@ def test_authentication_sso_timed_out_data_error_round_trip assert_kind_of Hash, json assert_equal fixture["code"], json[:code] assert_equal fixture["message"], json[:message] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_activated_round_trip @@ -2302,6 +2451,7 @@ def test_connection_activated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_activated_data_round_trip @@ -2326,6 +2476,7 @@ def test_connection_activated_data_round_trip assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["external_key"], json[:external_key] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_activated_data_domain_round_trip @@ -2339,6 +2490,7 @@ def test_connection_activated_data_domain_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["domain"], json[:domain] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_deactivated_round_trip @@ -2355,6 +2507,7 @@ def test_connection_deactivated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_deactivated_data_round_trip @@ -2379,6 +2532,7 @@ def test_connection_deactivated_data_round_trip assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["external_key"], json[:external_key] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_deactivated_data_domain_round_trip @@ -2392,6 +2546,7 @@ def test_connection_deactivated_data_domain_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["domain"], json[:domain] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_deleted_round_trip @@ -2408,6 +2563,7 @@ def test_connection_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_deleted_data_round_trip @@ -2428,6 +2584,7 @@ def test_connection_deleted_data_round_trip assert_equal fixture["name"], json[:name] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_saml_certificate_renewal_required_round_trip @@ -2444,6 +2601,7 @@ def test_connection_saml_certificate_renewal_required_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_saml_certificate_renewal_required_data_round_trip @@ -2456,6 +2614,7 @@ def test_connection_saml_certificate_renewal_required_data_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["days_until_expiry"], json[:days_until_expiry] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_saml_certificate_renewal_required_data_connection_round_trip @@ -2467,6 +2626,7 @@ def test_connection_saml_certificate_renewal_required_data_connection_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_saml_certificate_renewal_required_data_certificate_round_trip @@ -2480,6 +2640,7 @@ def test_connection_saml_certificate_renewal_required_data_certificate_round_tri assert_kind_of Hash, json assert_equal fixture["expiry_date"], json[:expiry_date] assert_equal fixture["is_expired"], json[:is_expired] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_saml_certificate_renewed_round_trip @@ -2496,6 +2657,7 @@ def test_connection_saml_certificate_renewed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_saml_certificate_renewed_data_round_trip @@ -2508,6 +2670,7 @@ def test_connection_saml_certificate_renewed_data_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["renewed_at"], json[:renewed_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_saml_certificate_renewed_data_connection_round_trip @@ -2519,6 +2682,7 @@ def test_connection_saml_certificate_renewed_data_connection_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_saml_certificate_renewed_data_certificate_round_trip @@ -2530,6 +2694,7 @@ def test_connection_saml_certificate_renewed_data_certificate_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["expiry_date"], json[:expiry_date] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_activated_round_trip @@ -2546,6 +2711,7 @@ def test_dsync_activated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_activated_data_round_trip @@ -2569,6 +2735,7 @@ def test_dsync_activated_data_round_trip assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["external_key"], json[:external_key] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_activated_data_domain_round_trip @@ -2582,6 +2749,7 @@ def test_dsync_activated_data_domain_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["domain"], json[:domain] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_deactivated_round_trip @@ -2598,6 +2766,7 @@ def test_dsync_deactivated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_deactivated_data_round_trip @@ -2621,6 +2790,7 @@ def test_dsync_deactivated_data_round_trip assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["external_key"], json[:external_key] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_deactivated_data_domain_round_trip @@ -2634,6 +2804,7 @@ def test_dsync_deactivated_data_domain_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["domain"], json[:domain] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_deleted_round_trip @@ -2650,6 +2821,7 @@ def test_dsync_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_deleted_data_round_trip @@ -2670,6 +2842,7 @@ def test_dsync_deleted_data_round_trip assert_equal fixture["name"], json[:name] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_group_created_round_trip @@ -2686,6 +2859,7 @@ def test_dsync_group_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_group_deleted_round_trip @@ -2702,6 +2876,7 @@ def test_dsync_group_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_group_updated_round_trip @@ -2718,6 +2893,7 @@ def test_dsync_group_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_group_updated_data_round_trip @@ -2743,6 +2919,7 @@ def test_dsync_group_updated_data_round_trip assert_equal fixture["name"], json[:name] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_group_user_added_round_trip @@ -2759,6 +2936,7 @@ def test_dsync_group_user_added_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_group_user_added_data_round_trip @@ -2771,6 +2949,7 @@ def test_dsync_group_user_added_data_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["directory_id"], json[:directory_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_user_created_round_trip @@ -2787,6 +2966,7 @@ def test_dsync_user_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_user_deleted_round_trip @@ -2803,6 +2983,7 @@ def test_dsync_user_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_group_user_removed_round_trip @@ -2819,6 +3000,7 @@ def test_dsync_group_user_removed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_group_user_removed_data_round_trip @@ -2831,6 +3013,7 @@ def test_dsync_group_user_removed_data_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["directory_id"], json[:directory_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_user_updated_round_trip @@ -2847,6 +3030,7 @@ def test_dsync_user_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_user_updated_data_round_trip @@ -2881,6 +3065,7 @@ def test_dsync_user_updated_data_round_trip assert_nil json[:email] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_dsync_user_updated_data_email_round_trip @@ -2892,6 +3077,7 @@ def test_dsync_user_updated_data_email_round_trip model = WorkOS::DsyncUserUpdatedDataEmail.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_email_verification_created_round_trip @@ -2908,6 +3094,7 @@ def test_email_verification_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_email_verification_created_data_round_trip @@ -2929,6 +3116,7 @@ def test_email_verification_created_data_round_trip assert_equal fixture["expires_at"], json[:expires_at] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_created_round_trip @@ -2945,6 +3133,7 @@ def test_flag_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_created_data_round_trip @@ -2974,6 +3163,7 @@ def test_flag_created_data_round_trip assert_equal fixture["default_value"], json[:default_value] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_created_data_owner_round_trip @@ -2988,6 +3178,7 @@ def test_flag_created_data_owner_round_trip assert_equal fixture["email"], json[:email] assert_nil json[:first_name] assert_nil json[:last_name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_created_context_round_trip @@ -2999,6 +3190,7 @@ def test_flag_created_context_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["client_id"], json[:client_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_created_context_actor_round_trip @@ -3012,6 +3204,7 @@ def test_flag_created_context_actor_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_nil json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_deleted_round_trip @@ -3028,6 +3221,7 @@ def test_flag_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_deleted_data_round_trip @@ -3057,6 +3251,7 @@ def test_flag_deleted_data_round_trip assert_equal fixture["default_value"], json[:default_value] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_deleted_data_owner_round_trip @@ -3071,6 +3266,7 @@ def test_flag_deleted_data_owner_round_trip assert_equal fixture["email"], json[:email] assert_nil json[:first_name] assert_nil json[:last_name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_deleted_context_round_trip @@ -3082,6 +3278,7 @@ def test_flag_deleted_context_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["client_id"], json[:client_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_deleted_context_actor_round_trip @@ -3095,6 +3292,7 @@ def test_flag_deleted_context_actor_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_nil json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_round_trip @@ -3111,6 +3309,7 @@ def test_flag_rule_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_data_round_trip @@ -3140,6 +3339,7 @@ def test_flag_rule_updated_data_round_trip assert_equal fixture["default_value"], json[:default_value] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_data_owner_round_trip @@ -3154,6 +3354,7 @@ def test_flag_rule_updated_data_owner_round_trip assert_equal fixture["email"], json[:email] assert_nil json[:first_name] assert_nil json[:last_name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_context_round_trip @@ -3168,6 +3369,7 @@ def test_flag_rule_updated_context_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["client_id"], json[:client_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_context_actor_round_trip @@ -3181,6 +3383,7 @@ def test_flag_rule_updated_context_actor_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_nil json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_context_configured_target_round_trip @@ -3191,6 +3394,7 @@ def test_flag_rule_updated_context_configured_target_round_trip model = WorkOS::FlagRuleUpdatedContextConfiguredTarget.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_context_configured_target_organization_round_trip @@ -3203,6 +3407,7 @@ def test_flag_rule_updated_context_configured_target_organization_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["name"], json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_context_configured_target_user_round_trip @@ -3215,6 +3420,7 @@ def test_flag_rule_updated_context_configured_target_user_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_context_previous_attribute_round_trip @@ -3225,6 +3431,7 @@ def test_flag_rule_updated_context_previous_attribute_round_trip model = WorkOS::FlagRuleUpdatedContextPreviousAttribute.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_context_previous_attribute_data_round_trip @@ -3235,6 +3442,7 @@ def test_flag_rule_updated_context_previous_attribute_data_round_trip model = WorkOS::FlagRuleUpdatedContextPreviousAttributeData.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_context_previous_attribute_context_round_trip @@ -3245,6 +3453,7 @@ def test_flag_rule_updated_context_previous_attribute_context_round_trip model = WorkOS::FlagRuleUpdatedContextPreviousAttributeContext.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_context_previous_attribute_context_configured_target_round_trip @@ -3255,6 +3464,7 @@ def test_flag_rule_updated_context_previous_attribute_context_configured_target_ model = WorkOS::FlagRuleUpdatedContextPreviousAttributeContextConfiguredTarget.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_context_previous_attribute_context_configured_target_organization_round_trip @@ -3267,6 +3477,7 @@ def test_flag_rule_updated_context_previous_attribute_context_configured_target_ assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["name"], json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_rule_updated_context_previous_attribute_context_configured_target_user_round_trip @@ -3279,6 +3490,7 @@ def test_flag_rule_updated_context_previous_attribute_context_configured_target_ assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_updated_round_trip @@ -3295,6 +3507,7 @@ def test_flag_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_updated_data_round_trip @@ -3324,6 +3537,7 @@ def test_flag_updated_data_round_trip assert_equal fixture["default_value"], json[:default_value] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_updated_data_owner_round_trip @@ -3338,6 +3552,7 @@ def test_flag_updated_data_owner_round_trip assert_equal fixture["email"], json[:email] assert_nil json[:first_name] assert_nil json[:last_name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_updated_context_round_trip @@ -3350,6 +3565,7 @@ def test_flag_updated_context_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["client_id"], json[:client_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_updated_context_actor_round_trip @@ -3363,6 +3579,7 @@ def test_flag_updated_context_actor_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_nil json[:name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_updated_context_previous_attribute_round_trip @@ -3372,6 +3589,7 @@ def test_flag_updated_context_previous_attribute_round_trip model = WorkOS::FlagUpdatedContextPreviousAttribute.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_updated_context_previous_attribute_data_round_trip @@ -3385,6 +3603,7 @@ def test_flag_updated_context_previous_attribute_data_round_trip model = WorkOS::FlagUpdatedContextPreviousAttributeData.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_group_created_round_trip @@ -3401,6 +3620,7 @@ def test_group_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_group_deleted_round_trip @@ -3417,6 +3637,7 @@ def test_group_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_group_member_added_round_trip @@ -3433,6 +3654,7 @@ def test_group_member_added_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_group_member_added_data_round_trip @@ -3445,6 +3667,7 @@ def test_group_member_added_data_round_trip assert_kind_of Hash, json assert_equal fixture["group_id"], json[:group_id] assert_equal fixture["organization_membership_id"], json[:organization_membership_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_group_member_removed_round_trip @@ -3461,6 +3684,7 @@ def test_group_member_removed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_group_member_removed_data_round_trip @@ -3473,6 +3697,7 @@ def test_group_member_removed_data_round_trip assert_kind_of Hash, json assert_equal fixture["group_id"], json[:group_id] assert_equal fixture["organization_membership_id"], json[:organization_membership_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_group_updated_round_trip @@ -3489,6 +3714,7 @@ def test_group_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_invitation_accepted_round_trip @@ -3505,6 +3731,7 @@ def test_invitation_accepted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_invitation_accepted_data_round_trip @@ -3535,6 +3762,7 @@ def test_invitation_accepted_data_round_trip assert_nil json[:accepted_user_id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_invitation_created_round_trip @@ -3551,6 +3779,7 @@ def test_invitation_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_invitation_created_data_round_trip @@ -3581,6 +3810,7 @@ def test_invitation_created_data_round_trip assert_nil json[:accepted_user_id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_invitation_resent_round_trip @@ -3597,6 +3827,7 @@ def test_invitation_resent_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_invitation_resent_data_round_trip @@ -3627,6 +3858,7 @@ def test_invitation_resent_data_round_trip assert_nil json[:accepted_user_id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_invitation_revoked_round_trip @@ -3643,6 +3875,7 @@ def test_invitation_revoked_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_invitation_revoked_data_round_trip @@ -3673,6 +3906,7 @@ def test_invitation_revoked_data_round_trip assert_nil json[:accepted_user_id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_magic_auth_created_round_trip @@ -3689,6 +3923,7 @@ def test_magic_auth_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_magic_auth_created_data_round_trip @@ -3710,6 +3945,7 @@ def test_magic_auth_created_data_round_trip assert_equal fixture["expires_at"], json[:expires_at] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_created_round_trip @@ -3726,6 +3962,7 @@ def test_organization_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_created_data_round_trip @@ -3748,6 +3985,7 @@ def test_organization_created_data_round_trip assert_nil json[:external_id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_created_data_domain_round_trip @@ -3771,6 +4009,7 @@ def test_organization_created_data_domain_round_trip assert_equal fixture["domain"], json[:domain] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_deleted_round_trip @@ -3787,6 +4026,7 @@ def test_organization_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_deleted_data_round_trip @@ -3809,6 +4049,7 @@ def test_organization_deleted_data_round_trip assert_nil json[:external_id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_deleted_data_domain_round_trip @@ -3832,6 +4073,7 @@ def test_organization_deleted_data_domain_round_trip assert_equal fixture["domain"], json[:domain] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_created_round_trip @@ -3848,6 +4090,7 @@ def test_organization_domain_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_created_data_round_trip @@ -3871,6 +4114,7 @@ def test_organization_domain_created_data_round_trip assert_equal fixture["domain"], json[:domain] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_deleted_round_trip @@ -3887,6 +4131,7 @@ def test_organization_domain_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_deleted_data_round_trip @@ -3910,6 +4155,7 @@ def test_organization_domain_deleted_data_round_trip assert_equal fixture["domain"], json[:domain] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_updated_round_trip @@ -3926,6 +4172,7 @@ def test_organization_domain_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_updated_data_round_trip @@ -3949,6 +4196,7 @@ def test_organization_domain_updated_data_round_trip assert_equal fixture["domain"], json[:domain] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_verification_failed_round_trip @@ -3965,6 +4213,7 @@ def test_organization_domain_verification_failed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_verification_failed_data_round_trip @@ -3975,6 +4224,7 @@ def test_organization_domain_verification_failed_data_round_trip model = WorkOS::OrganizationDomainVerificationFailedData.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_verification_failed_data_organization_domain_round_trip @@ -3998,6 +4248,7 @@ def test_organization_domain_verification_failed_data_organization_domain_round_ assert_equal fixture["domain"], json[:domain] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_verified_round_trip @@ -4014,6 +4265,7 @@ def test_organization_domain_verified_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_verified_data_round_trip @@ -4037,6 +4289,7 @@ def test_organization_domain_verified_data_round_trip assert_equal fixture["domain"], json[:domain] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_membership_created_round_trip @@ -4053,6 +4306,7 @@ def test_organization_membership_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_membership_created_data_round_trip @@ -4078,6 +4332,7 @@ def test_organization_membership_created_data_round_trip assert_equal fixture["directory_managed"], json[:directory_managed] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_membership_deleted_round_trip @@ -4094,6 +4349,7 @@ def test_organization_membership_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_membership_deleted_data_round_trip @@ -4119,6 +4375,7 @@ def test_organization_membership_deleted_data_round_trip assert_equal fixture["directory_managed"], json[:directory_managed] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_membership_updated_round_trip @@ -4135,6 +4392,7 @@ def test_organization_membership_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_membership_updated_data_round_trip @@ -4160,6 +4418,7 @@ def test_organization_membership_updated_data_round_trip assert_equal fixture["directory_managed"], json[:directory_managed] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_role_created_round_trip @@ -4176,6 +4435,7 @@ def test_organization_role_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_role_created_data_round_trip @@ -4200,6 +4460,7 @@ def test_organization_role_created_data_round_trip assert_equal fixture["resource_type_slug"], json[:resource_type_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_role_deleted_round_trip @@ -4216,6 +4477,7 @@ def test_organization_role_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_role_deleted_data_round_trip @@ -4240,6 +4502,7 @@ def test_organization_role_deleted_data_round_trip assert_equal fixture["resource_type_slug"], json[:resource_type_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_role_updated_round_trip @@ -4256,6 +4519,7 @@ def test_organization_role_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_role_updated_data_round_trip @@ -4280,6 +4544,7 @@ def test_organization_role_updated_data_round_trip assert_equal fixture["resource_type_slug"], json[:resource_type_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_updated_round_trip @@ -4296,6 +4561,7 @@ def test_organization_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_updated_data_round_trip @@ -4318,6 +4584,7 @@ def test_organization_updated_data_round_trip assert_nil json[:external_id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_updated_data_domain_round_trip @@ -4341,6 +4608,7 @@ def test_organization_updated_data_domain_round_trip assert_equal fixture["domain"], json[:domain] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_password_reset_created_round_trip @@ -4357,6 +4625,7 @@ def test_password_reset_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_password_reset_created_data_round_trip @@ -4376,6 +4645,7 @@ def test_password_reset_created_data_round_trip assert_equal fixture["email"], json[:email] assert_equal fixture["expires_at"], json[:expires_at] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_password_reset_succeeded_round_trip @@ -4392,6 +4662,7 @@ def test_password_reset_succeeded_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_password_reset_succeeded_data_round_trip @@ -4411,6 +4682,7 @@ def test_password_reset_succeeded_data_round_trip assert_equal fixture["email"], json[:email] assert_equal fixture["expires_at"], json[:expires_at] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_permission_created_round_trip @@ -4427,6 +4699,7 @@ def test_permission_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_permission_created_data_round_trip @@ -4450,6 +4723,7 @@ def test_permission_created_data_round_trip assert_equal fixture["system"], json[:system] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_permission_deleted_round_trip @@ -4466,6 +4740,7 @@ def test_permission_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_permission_deleted_data_round_trip @@ -4489,6 +4764,7 @@ def test_permission_deleted_data_round_trip assert_equal fixture["system"], json[:system] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_permission_updated_round_trip @@ -4505,6 +4781,7 @@ def test_permission_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_permission_updated_data_round_trip @@ -4528,6 +4805,7 @@ def test_permission_updated_data_round_trip assert_equal fixture["system"], json[:system] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_role_created_round_trip @@ -4544,6 +4822,7 @@ def test_role_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_role_created_data_round_trip @@ -4562,6 +4841,7 @@ def test_role_created_data_round_trip assert_equal fixture["resource_type_slug"], json[:resource_type_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_role_deleted_round_trip @@ -4578,6 +4858,7 @@ def test_role_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_role_deleted_data_round_trip @@ -4596,6 +4877,7 @@ def test_role_deleted_data_round_trip assert_equal fixture["resource_type_slug"], json[:resource_type_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_role_updated_round_trip @@ -4612,6 +4894,7 @@ def test_role_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_role_updated_data_round_trip @@ -4630,6 +4913,7 @@ def test_role_updated_data_round_trip assert_equal fixture["resource_type_slug"], json[:resource_type_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_session_created_round_trip @@ -4646,6 +4930,7 @@ def test_session_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_session_created_data_round_trip @@ -4675,6 +4960,7 @@ def test_session_created_data_round_trip assert_nil json[:ended_at] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_session_created_data_impersonator_round_trip @@ -4687,6 +4973,7 @@ def test_session_created_data_impersonator_round_trip assert_kind_of Hash, json assert_equal fixture["email"], json[:email] assert_nil json[:reason] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_session_revoked_round_trip @@ -4703,6 +4990,7 @@ def test_session_revoked_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_session_revoked_data_round_trip @@ -4732,6 +5020,7 @@ def test_session_revoked_data_round_trip assert_nil json[:ended_at] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_session_revoked_data_impersonator_round_trip @@ -4744,6 +5033,7 @@ def test_session_revoked_data_impersonator_round_trip assert_kind_of Hash, json assert_equal fixture["email"], json[:email] assert_nil json[:reason] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_created_round_trip @@ -4760,6 +5050,7 @@ def test_user_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_deleted_round_trip @@ -4776,6 +5067,7 @@ def test_user_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_updated_round_trip @@ -4792,6 +5084,7 @@ def test_user_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_byok_key_verification_completed_round_trip @@ -4808,6 +5101,7 @@ def test_vault_byok_key_verification_completed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_byok_key_verification_completed_data_round_trip @@ -4821,6 +5115,7 @@ def test_vault_byok_key_verification_completed_data_round_trip assert_kind_of Hash, json assert_equal fixture["organization_id"], json[:organization_id] assert_equal fixture["verified"], json[:verified] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_data_created_round_trip @@ -4837,6 +5132,7 @@ def test_vault_data_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_data_created_data_round_trip @@ -4855,6 +5151,7 @@ def test_vault_data_created_data_round_trip assert_equal fixture["actor_name"], json[:actor_name] assert_equal fixture["kv_name"], json[:kv_name] assert_equal fixture["key_id"], json[:key_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_data_deleted_round_trip @@ -4871,6 +5168,7 @@ def test_vault_data_deleted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_data_deleted_data_round_trip @@ -4886,6 +5184,7 @@ def test_vault_data_deleted_data_round_trip assert_equal fixture["actor_id"], json[:actor_id] assert_equal fixture["actor_name"], json[:actor_name] assert_equal fixture["kv_name"], json[:kv_name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_data_read_round_trip @@ -4902,6 +5201,7 @@ def test_vault_data_read_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_data_read_data_round_trip @@ -4919,6 +5219,7 @@ def test_vault_data_read_data_round_trip assert_equal fixture["actor_name"], json[:actor_name] assert_equal fixture["kv_name"], json[:kv_name] assert_equal fixture["key_id"], json[:key_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_data_updated_round_trip @@ -4935,6 +5236,7 @@ def test_vault_data_updated_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_data_updated_data_round_trip @@ -4953,6 +5255,7 @@ def test_vault_data_updated_data_round_trip assert_equal fixture["actor_name"], json[:actor_name] assert_equal fixture["kv_name"], json[:kv_name] assert_equal fixture["key_id"], json[:key_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_dek_decrypted_round_trip @@ -4969,6 +5272,7 @@ def test_vault_dek_decrypted_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_dek_decrypted_data_round_trip @@ -4984,6 +5288,7 @@ def test_vault_dek_decrypted_data_round_trip assert_equal fixture["actor_id"], json[:actor_id] assert_equal fixture["actor_name"], json[:actor_name] assert_equal fixture["key_id"], json[:key_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_dek_read_round_trip @@ -5000,6 +5305,7 @@ def test_vault_dek_read_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_dek_read_data_round_trip @@ -5015,6 +5321,7 @@ def test_vault_dek_read_data_round_trip assert_kind_of Hash, json assert_equal fixture["actor_id"], json[:actor_id] assert_equal fixture["actor_name"], json[:actor_name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_kek_created_round_trip @@ -5031,6 +5338,7 @@ def test_vault_kek_created_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_kek_created_data_round_trip @@ -5048,6 +5356,7 @@ def test_vault_kek_created_data_round_trip assert_equal fixture["actor_name"], json[:actor_name] assert_equal fixture["key_name"], json[:key_name] assert_equal fixture["key_id"], json[:key_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_metadata_read_round_trip @@ -5064,6 +5373,7 @@ def test_vault_metadata_read_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_metadata_read_data_round_trip @@ -5079,6 +5389,7 @@ def test_vault_metadata_read_data_round_trip assert_equal fixture["actor_id"], json[:actor_id] assert_equal fixture["actor_name"], json[:actor_name] assert_equal fixture["kv_name"], json[:kv_name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_names_listed_round_trip @@ -5095,6 +5406,7 @@ def test_vault_names_listed_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_vault_names_listed_data_round_trip @@ -5108,6 +5420,7 @@ def test_vault_names_listed_data_round_trip assert_kind_of Hash, json assert_equal fixture["actor_id"], json[:actor_id] assert_equal fixture["actor_name"], json[:actor_name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_jwt_template_response_round_trip @@ -5123,6 +5436,7 @@ def test_jwt_template_response_round_trip assert_equal fixture["content"], json[:content] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_stand_alone_round_trip @@ -5146,6 +5460,7 @@ def test_organization_domain_stand_alone_round_trip assert_equal fixture["domain"], json[:domain] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_round_trip @@ -5173,6 +5488,7 @@ def test_flag_round_trip assert_equal fixture["default_value"], json[:default_value] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_api_key_with_value_round_trip @@ -5198,6 +5514,7 @@ def test_api_key_with_value_round_trip assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["value"], json[:value] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_round_trip @@ -5221,6 +5538,7 @@ def test_organization_round_trip assert_nil json[:external_id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_configuration_round_trip @@ -5235,6 +5553,7 @@ def test_audit_log_configuration_round_trip assert_kind_of Hash, json assert_equal fixture["organization_id"], json[:organization_id] assert_equal fixture["retention_period_in_days"], json[:retention_period_in_days] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_data_integration_authorize_url_response_round_trip @@ -5245,6 +5564,7 @@ def test_data_integration_authorize_url_response_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["url"], json[:url] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_data_integration_access_token_response_round_trip @@ -5256,6 +5576,7 @@ def test_data_integration_access_token_response_round_trip model = WorkOS::DataIntegrationAccessTokenResponse.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connected_account_round_trip @@ -5277,6 +5598,7 @@ def test_connected_account_round_trip assert_nil json[:organization_id] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_data_integrations_list_response_round_trip @@ -5287,6 +5609,7 @@ def test_data_integrations_list_response_round_trip model = WorkOS::DataIntegrationsListResponse.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_portal_link_response_round_trip @@ -5297,6 +5620,7 @@ def test_portal_link_response_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["link"], json[:link] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_radar_standalone_response_round_trip @@ -5312,6 +5636,7 @@ def test_radar_standalone_response_round_trip assert_kind_of Hash, json assert_equal fixture["reason"], json[:reason] assert_equal fixture["attempt_id"], json[:attempt_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_radar_list_entry_already_present_response_round_trip @@ -5322,6 +5647,7 @@ def test_radar_list_entry_already_present_response_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["message"], json[:message] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_redirect_uri_round_trip @@ -5341,6 +5667,7 @@ def test_redirect_uri_round_trip assert_equal fixture["default"], json[:default] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_authentication_factor_enroll_response_round_trip @@ -5351,6 +5678,7 @@ def test_user_authentication_factor_enroll_response_round_trip model = WorkOS::UserAuthenticationFactorEnrollResponse.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_magic_auth_round_trip @@ -5374,6 +5702,7 @@ def test_magic_auth_round_trip assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["code"], json[:code] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_invite_round_trip @@ -5408,6 +5737,7 @@ def test_user_invite_round_trip assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["token"], json[:token] assert_equal fixture["accept_invitation_url"], json[:accept_invitation_url] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_organization_membership_round_trip @@ -5433,6 +5763,7 @@ def test_user_organization_membership_round_trip assert_equal fixture["directory_managed"], json[:directory_managed] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_email_verification_round_trip @@ -5456,6 +5787,7 @@ def test_email_verification_round_trip assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["code"], json[:code] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_send_verification_email_response_round_trip @@ -5465,6 +5797,7 @@ def test_send_verification_email_response_round_trip model = WorkOS::SendVerificationEmailResponse.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_verify_email_response_round_trip @@ -5474,6 +5807,7 @@ def test_verify_email_response_round_trip model = WorkOS::VerifyEmailResponse.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_password_reset_round_trip @@ -5497,6 +5831,7 @@ def test_password_reset_round_trip assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["password_reset_token"], json[:password_reset_token] assert_equal fixture["password_reset_url"], json[:password_reset_url] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_reset_password_response_round_trip @@ -5506,6 +5841,7 @@ def test_reset_password_response_round_trip model = WorkOS::ResetPasswordResponse.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_email_change_round_trip @@ -5522,6 +5858,7 @@ def test_email_change_round_trip assert_equal fixture["new_email"], json[:new_email] assert_equal fixture["expires_at"], json[:expires_at] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authenticate_response_round_trip @@ -5540,6 +5877,7 @@ def test_authenticate_response_round_trip assert_kind_of Hash, json assert_equal fixture["access_token"], json[:access_token] assert_equal fixture["refresh_token"], json[:refresh_token] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_device_authorization_response_round_trip @@ -5558,6 +5896,7 @@ def test_device_authorization_response_round_trip assert_equal fixture["user_code"], json[:user_code] assert_equal fixture["verification_uri"], json[:verification_uri] assert_equal fixture["expires_in"], json[:expires_in] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_webhook_endpoint_json_round_trip @@ -5579,6 +5918,7 @@ def test_webhook_endpoint_json_round_trip assert_equal fixture["secret"], json[:secret] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_widget_session_token_response_round_trip @@ -5589,6 +5929,7 @@ def test_widget_session_token_response_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["token"], json[:token] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_sso_authorize_url_response_round_trip @@ -5599,6 +5940,7 @@ def test_sso_authorize_url_response_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["url"], json[:url] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_profile_round_trip @@ -5628,6 +5970,7 @@ def test_profile_round_trip assert_equal fixture["email"], json[:email] assert_nil json[:first_name] assert_nil json[:last_name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_sso_token_response_round_trip @@ -5643,6 +5986,7 @@ def test_sso_token_response_round_trip assert_kind_of Hash, json assert_equal fixture["access_token"], json[:access_token] assert_equal fixture["expires_in"], json[:expires_in] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_sso_logout_authorize_response_round_trip @@ -5655,6 +5999,7 @@ def test_sso_logout_authorize_response_round_trip assert_kind_of Hash, json assert_equal fixture["logout_url"], json[:logout_url] assert_equal fixture["logout_token"], json[:logout_token] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_jwks_response_round_trip @@ -5664,6 +6009,7 @@ def test_jwks_response_round_trip model = WorkOS::JwksResponse.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_jwks_response_keys_round_trip @@ -5684,6 +6030,7 @@ def test_jwks_response_keys_round_trip assert_equal fixture["e"], json[:e] assert_equal fixture["kid"], json[:kid] assert_equal fixture["x5t#S256"], json["x5t#S256"] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_sso_token_response_oauth_token_round_trip @@ -5701,6 +6048,7 @@ def test_sso_token_response_oauth_token_round_trip assert_equal fixture["refresh_token"], json[:refresh_token] assert_equal fixture["access_token"], json[:access_token] assert_equal fixture["expires_at"], json[:expires_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authenticate_response_impersonator_round_trip @@ -5713,6 +6061,7 @@ def test_authenticate_response_impersonator_round_trip assert_kind_of Hash, json assert_equal fixture["email"], json[:email] assert_nil json[:reason] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authenticate_response_oauth_token_round_trip @@ -5730,6 +6079,7 @@ def test_authenticate_response_oauth_token_round_trip assert_equal fixture["refresh_token"], json[:refresh_token] assert_equal fixture["access_token"], json[:access_token] assert_equal fixture["expires_at"], json[:expires_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_data_integrations_list_response_data_round_trip @@ -5758,6 +6108,7 @@ def test_data_integrations_list_response_data_round_trip assert_equal fixture["credentials_type"], json[:credentials_type] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_data_integration_access_token_response_access_token_round_trip @@ -5773,6 +6124,7 @@ def test_data_integration_access_token_response_access_token_round_trip assert_kind_of Hash, json assert_equal fixture["access_token"], json[:access_token] assert_nil json[:expires_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_configuration_log_stream_round_trip @@ -5789,6 +6141,7 @@ def test_audit_log_configuration_log_stream_round_trip assert_equal fixture["id"], json[:id] assert_nil json[:last_synced_at] assert_equal fixture["created_at"], json[:created_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_domain_round_trip @@ -5812,6 +6165,7 @@ def test_organization_domain_round_trip assert_equal fixture["domain"], json[:domain] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_api_key_with_value_owner_round_trip @@ -5823,6 +6177,7 @@ def test_api_key_with_value_owner_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_flag_owner_round_trip @@ -5837,6 +6192,7 @@ def test_flag_owner_round_trip assert_equal fixture["email"], json[:email] assert_nil json[:first_name] assert_nil json[:last_name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_event_list_list_metadata_round_trip @@ -5847,6 +6203,7 @@ def test_event_list_list_metadata_round_trip json = model.to_h assert_kind_of Hash, json assert_nil json[:after] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_directory_user_email_round_trip @@ -5858,6 +6215,7 @@ def test_directory_user_email_round_trip model = WorkOS::DirectoryUserEmail.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_event_context_google_analytics_session_round_trip @@ -5870,6 +6228,7 @@ def test_event_context_google_analytics_session_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["containerId"], json[:containerId] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_directory_user_with_groups_email_round_trip @@ -5881,6 +6240,7 @@ def test_directory_user_with_groups_email_round_trip model = WorkOS::DirectoryUserWithGroupsEmail.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_directory_metadata_round_trip @@ -5892,6 +6252,7 @@ def test_directory_metadata_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["groups"], json[:groups] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_domain_round_trip @@ -5905,6 +6266,7 @@ def test_connection_domain_round_trip assert_kind_of Hash, json assert_equal fixture["id"], json[:id] assert_equal fixture["domain"], json[:domain] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_connection_option_round_trip @@ -5915,6 +6277,7 @@ def test_connection_option_round_trip json = model.to_h assert_kind_of Hash, json assert_nil json[:signing_cert] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_organization_membership_base_list_data_round_trip @@ -5939,6 +6302,7 @@ def test_user_organization_membership_base_list_data_round_trip assert_equal fixture["directory_managed"], json[:directory_managed] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_role_assignment_resource_round_trip @@ -5953,6 +6317,7 @@ def test_role_assignment_resource_round_trip assert_equal fixture["id"], json[:id] assert_equal fixture["external_id"], json[:external_id] assert_equal fixture["resource_type_slug"], json[:resource_type_slug] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_factor_sms_round_trip @@ -5963,6 +6328,7 @@ def test_authentication_factor_sms_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["phone_number"], json[:phone_number] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_factor_totp_round_trip @@ -5975,6 +6341,7 @@ def test_authentication_factor_totp_round_trip assert_kind_of Hash, json assert_equal fixture["issuer"], json[:issuer] assert_equal fixture["user"], json[:user] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_factor_enrolled_sms_round_trip @@ -5985,6 +6352,7 @@ def test_authentication_factor_enrolled_sms_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["phone_number"], json[:phone_number] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_factor_enrolled_totp_round_trip @@ -6003,6 +6371,7 @@ def test_authentication_factor_enrolled_totp_round_trip assert_equal fixture["secret"], json[:secret] assert_equal fixture["qr_code"], json[:qr_code] assert_equal fixture["uri"], json[:uri] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_schema_json_actor_round_trip @@ -6012,6 +6381,7 @@ def test_audit_log_schema_json_actor_round_trip model = WorkOS::AuditLogSchemaJsonActor.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_audit_log_schema_json_target_round_trip @@ -6023,6 +6393,7 @@ def test_audit_log_schema_json_target_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["type"], json[:type] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authorized_connect_application_list_data_round_trip @@ -6037,6 +6408,7 @@ def test_authorized_connect_application_list_data_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_api_key_owner_round_trip @@ -6048,6 +6420,7 @@ def test_api_key_owner_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_consent_option_choice_round_trip @@ -6058,6 +6431,7 @@ def test_user_consent_option_choice_round_trip model = WorkOS::UserConsentOptionChoice.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_challenges_verify_request_round_trip @@ -6068,6 +6442,7 @@ def test_authentication_challenges_verify_request_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["code"], json[:code] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authentication_factors_create_request_round_trip @@ -6081,6 +6456,7 @@ def test_authentication_factors_create_request_round_trip model = WorkOS::AuthenticationFactorsCreateRequest.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_permission_round_trip @@ -6106,6 +6482,7 @@ def test_permission_round_trip assert_equal fixture["resource_type_slug"], json[:resource_type_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_application_credentials_list_item_round_trip @@ -6125,6 +6502,7 @@ def test_application_credentials_list_item_round_trip assert_nil json[:last_used_at] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_data_integrations_get_data_integration_authorize_url_request_round_trip @@ -6137,6 +6515,7 @@ def test_data_integrations_get_data_integration_authorize_url_request_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["user_id"], json[:user_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_data_integrations_get_user_token_request_round_trip @@ -6148,6 +6527,7 @@ def test_data_integrations_get_user_token_request_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["user_id"], json[:user_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_feature_flag_round_trip @@ -6175,6 +6555,7 @@ def test_feature_flag_round_trip assert_equal fixture["default_value"], json[:default_value] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_feature_flag_owner_round_trip @@ -6189,6 +6570,7 @@ def test_feature_flag_owner_round_trip assert_equal fixture["email"], json[:email] assert_nil json[:first_name] assert_nil json[:last_name] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_radar_standalone_assess_request_round_trip @@ -6207,6 +6589,7 @@ def test_radar_standalone_assess_request_round_trip assert_equal fixture["ip_address"], json[:ip_address] assert_equal fixture["user_agent"], json[:user_agent] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_radar_standalone_update_radar_attempt_request_round_trip @@ -6217,6 +6600,7 @@ def test_radar_standalone_update_radar_attempt_request_round_trip model = WorkOS::RadarStandaloneUpdateRadarAttemptRequest.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_radar_standalone_update_radar_list_request_round_trip @@ -6227,6 +6611,7 @@ def test_radar_standalone_update_radar_list_request_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["entry"], json[:entry] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_radar_standalone_delete_radar_list_entry_request_round_trip @@ -6237,6 +6622,7 @@ def test_radar_standalone_delete_radar_list_entry_request_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["entry"], json[:entry] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_sso_logout_authorize_request_round_trip @@ -6247,6 +6633,7 @@ def test_sso_logout_authorize_request_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["profile_id"], json[:profile_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_authorization_code_session_authenticate_request_round_trip @@ -6267,6 +6654,7 @@ def test_authorization_code_session_authenticate_request_round_trip assert_equal fixture["client_id"], json[:client_id] assert_equal fixture["client_secret"], json[:client_secret] assert_equal fixture["code"], json[:code] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_password_session_authenticate_request_round_trip @@ -6288,6 +6676,7 @@ def test_password_session_authenticate_request_round_trip assert_equal fixture["client_secret"], json[:client_secret] assert_equal fixture["email"], json[:email] assert_equal fixture["password"], json[:password] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_refresh_token_session_authenticate_request_round_trip @@ -6307,6 +6696,7 @@ def test_refresh_token_session_authenticate_request_round_trip assert_equal fixture["client_id"], json[:client_id] assert_equal fixture["client_secret"], json[:client_secret] assert_equal fixture["refresh_token"], json[:refresh_token] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_magic_auth_code_session_authenticate_request_round_trip @@ -6328,6 +6718,7 @@ def test_magic_auth_code_session_authenticate_request_round_trip assert_equal fixture["client_secret"], json[:client_secret] assert_equal fixture["code"], json[:code] assert_equal fixture["email"], json[:email] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_email_verification_code_session_authenticate_request_round_trip @@ -6348,6 +6739,7 @@ def test_email_verification_code_session_authenticate_request_round_trip assert_equal fixture["client_secret"], json[:client_secret] assert_equal fixture["code"], json[:code] assert_equal fixture["pending_authentication_token"], json[:pending_authentication_token] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_mfa_totp_session_authenticate_request_round_trip @@ -6370,6 +6762,7 @@ def test_mfa_totp_session_authenticate_request_round_trip assert_equal fixture["code"], json[:code] assert_equal fixture["pending_authentication_token"], json[:pending_authentication_token] assert_equal fixture["authentication_challenge_id"], json[:authentication_challenge_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_selection_session_authenticate_request_round_trip @@ -6390,6 +6783,7 @@ def test_organization_selection_session_authenticate_request_round_trip assert_equal fixture["client_secret"], json[:client_secret] assert_equal fixture["pending_authentication_token"], json[:pending_authentication_token] assert_equal fixture["organization_id"], json[:organization_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_device_code_session_authenticate_request_round_trip @@ -6406,6 +6800,7 @@ def test_device_code_session_authenticate_request_round_trip assert_kind_of Hash, json assert_equal fixture["client_id"], json[:client_id] assert_equal fixture["device_code"], json[:device_code] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_sso_device_authorization_request_round_trip @@ -6416,6 +6811,7 @@ def test_sso_device_authorization_request_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["client_id"], json[:client_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_invitation_round_trip @@ -6450,6 +6846,7 @@ def test_invitation_round_trip assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["token"], json[:token] assert_equal fixture["accept_invitation_url"], json[:accept_invitation_url] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_organization_membership_round_trip @@ -6475,6 +6872,7 @@ def test_organization_membership_round_trip assert_equal fixture["directory_managed"], json[:directory_managed] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_email_change_confirmation_round_trip @@ -6485,6 +6883,7 @@ def test_email_change_confirmation_round_trip model = WorkOS::EmailChangeConfirmation.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_email_change_confirmation_user_round_trip @@ -6516,6 +6915,7 @@ def test_email_change_confirmation_user_round_trip assert_nil json[:last_sign_in_at] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_identities_get_item_round_trip @@ -6528,6 +6928,7 @@ def test_user_identities_get_item_round_trip json = model.to_h assert_kind_of Hash, json assert_equal fixture["idp_id"], json[:idp_id] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_sessions_list_item_round_trip @@ -6557,6 +6958,7 @@ def test_user_sessions_list_item_round_trip assert_nil json[:ended_at] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_user_sessions_impersonator_round_trip @@ -6569,6 +6971,7 @@ def test_user_sessions_impersonator_round_trip assert_kind_of Hash, json assert_equal fixture["email"], json[:email] assert_nil json[:reason] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_directory_metadata_user_round_trip @@ -6581,6 +6984,7 @@ def test_directory_metadata_user_round_trip assert_kind_of Hash, json assert_equal fixture["active"], json[:active] assert_equal fixture["inactive"], json[:inactive] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end def test_data_integrations_list_response_data_connected_account_round_trip @@ -6604,5 +7008,6 @@ def test_data_integrations_list_response_data_connected_account_round_trip assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] assert_nil json[:userlandUserId] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end end diff --git a/test/workos/test_multi_factor_auth.rb b/test/workos/test_multi_factor_auth.rb index 71a506a6..73cf661d 100644 --- a/test/workos/test_multi_factor_auth.rb +++ b/test/workos/test_multi_factor_auth.rb @@ -12,107 +12,70 @@ def setup end def test_verify_challenge_returns_expected_result - stub_request(:post, /#{Regexp.escape("auth")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/auth/challenges/stub/verify(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.multi_factor_auth.verify_challenge(id: "stub", code: "stub") refute_nil result end - def test_verify_challenge_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("auth")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.multi_factor_auth.verify_challenge(id: "stub", code: "stub") - end - end - def test_enroll_factor_returns_expected_result - stub_request(:post, /#{Regexp.escape("auth")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/auth/factors/enroll(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.multi_factor_auth.enroll_factor(type: "stub") refute_nil result end - def test_enroll_factor_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("auth")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.multi_factor_auth.enroll_factor(type: "stub") - end - end - def test_get_factor_returns_expected_result - stub_request(:get, /#{Regexp.escape("auth")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/auth/factors/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.multi_factor_auth.get_factor(id: "stub") refute_nil result end - def test_get_factor_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("auth")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.multi_factor_auth.get_factor(id: "stub") - end - end - def test_delete_factor_returns_expected_result - stub_request(:delete, /#{Regexp.escape("auth")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/auth/factors/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.multi_factor_auth.delete_factor(id: "stub") - assert_nil result if result.nil? - end - - def test_delete_factor_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("auth")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.multi_factor_auth.delete_factor(id: "stub") - end + assert_nil result end def test_challenge_factor_returns_expected_result - stub_request(:post, /#{Regexp.escape("auth")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/auth/factors/stub/challenge(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.multi_factor_auth.challenge_factor(id: "stub") refute_nil result end - def test_challenge_factor_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("auth")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.multi_factor_auth.challenge_factor(id: "stub") - end - end - def test_list_user_auth_factors_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/auth_factors(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.multi_factor_auth.list_user_auth_factors(userland_user_id: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_user_auth_factors_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.multi_factor_auth.list_user_auth_factors(userland_user_id: "stub") - end - end - def test_create_user_auth_factor_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users/stub/auth_factors(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.multi_factor_auth.create_user_auth_factor(userland_user_id: "stub", type: "totp") refute_nil result end - def test_create_user_auth_factor_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.multi_factor_auth.create_user_auth_factor(userland_user_id: "stub", type: "totp") + # Parameterized authentication error tests (one per endpoint). + [ + {name: :verify_challenge, verb: :post, url: %r{\Ahttps://api\.workos\.com/auth/challenges/stub/verify(\?|\z)}, args: {id: "stub", code: "stub"}}, + {name: :enroll_factor, verb: :post, url: %r{\Ahttps://api\.workos\.com/auth/factors/enroll(\?|\z)}, args: {type: "stub"}}, + {name: :get_factor, verb: :get, url: %r{\Ahttps://api\.workos\.com/auth/factors/stub(\?|\z)}, args: {id: "stub"}}, + {name: :delete_factor, verb: :delete, url: %r{\Ahttps://api\.workos\.com/auth/factors/stub(\?|\z)}, args: {id: "stub"}}, + {name: :challenge_factor, verb: :post, url: %r{\Ahttps://api\.workos\.com/auth/factors/stub/challenge(\?|\z)}, args: {id: "stub"}}, + {name: :list_user_auth_factors, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/auth_factors(\?|\z)}, args: {userland_user_id: "stub"}}, + {name: :create_user_auth_factor, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/auth_factors(\?|\z)}, args: {userland_user_id: "stub", type: "totp"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.multi_factor_auth.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_organization_domains.rb b/test/workos/test_organization_domains.rb index 0f807681..aa20584c 100644 --- a/test/workos/test_organization_domains.rb +++ b/test/workos/test_organization_domains.rb @@ -12,62 +12,46 @@ def setup end def test_create_organization_domain_returns_expected_result - stub_request(:post, /#{Regexp.escape("organization_domains")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/organization_domains(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.organization_domains.create_organization_domain(domain: "stub", organization_id: "stub") refute_nil result end - def test_create_organization_domain_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("organization_domains")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organization_domains.create_organization_domain(domain: "stub", organization_id: "stub") - end - end - def test_get_organization_domain_returns_expected_result - stub_request(:get, /#{Regexp.escape("organization_domains")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/organization_domains/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.organization_domains.get_organization_domain(id: "stub") refute_nil result end - def test_get_organization_domain_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("organization_domains")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organization_domains.get_organization_domain(id: "stub") - end - end - def test_delete_organization_domain_returns_expected_result - stub_request(:delete, /#{Regexp.escape("organization_domains")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/organization_domains/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.organization_domains.delete_organization_domain(id: "stub") - assert_nil result if result.nil? - end - - def test_delete_organization_domain_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("organization_domains")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organization_domains.delete_organization_domain(id: "stub") - end + assert_nil result end def test_verify_organization_domain_returns_expected_result - stub_request(:post, /#{Regexp.escape("organization_domains")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/organization_domains/stub/verify(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.organization_domains.verify_organization_domain(id: "stub") refute_nil result end - def test_verify_organization_domain_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("organization_domains")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organization_domains.verify_organization_domain(id: "stub") + # Parameterized authentication error tests (one per endpoint). + [ + {name: :create_organization_domain, verb: :post, url: %r{\Ahttps://api\.workos\.com/organization_domains(\?|\z)}, args: {domain: "stub", organization_id: "stub"}}, + {name: :get_organization_domain, verb: :get, url: %r{\Ahttps://api\.workos\.com/organization_domains/stub(\?|\z)}, args: {id: "stub"}}, + {name: :delete_organization_domain, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organization_domains/stub(\?|\z)}, args: {id: "stub"}}, + {name: :verify_organization_domain, verb: :post, url: %r{\Ahttps://api\.workos\.com/organization_domains/stub/verify(\?|\z)}, args: {id: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organization_domains.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_organizations.rb b/test/workos/test_organizations.rb index a4884218..4ee3c2b7 100644 --- a/test/workos/test_organizations.rb +++ b/test/workos/test_organizations.rb @@ -12,107 +12,70 @@ def setup end def test_list_organizations_returns_expected_result - stub_request(:get, /#{Regexp.escape("organizations")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.organizations.list_organizations assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_organizations_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organizations.list_organizations - end - end - def test_create_organization_returns_expected_result - stub_request(:post, /#{Regexp.escape("organizations")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.organizations.create_organization(name: "stub") refute_nil result end - def test_create_organization_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organizations.create_organization(name: "stub") - end - end - def test_get_organization_by_external_id_returns_expected_result - stub_request(:get, /#{Regexp.escape("organizations")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/external_id/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.organizations.get_organization_by_external_id(external_id: "stub") refute_nil result end - def test_get_organization_by_external_id_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organizations.get_organization_by_external_id(external_id: "stub") - end - end - def test_get_organization_returns_expected_result - stub_request(:get, /#{Regexp.escape("organizations")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.organizations.get_organization(id: "stub") refute_nil result end - def test_get_organization_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organizations.get_organization(id: "stub") - end - end - def test_update_organization_returns_expected_result - stub_request(:put, /#{Regexp.escape("organizations")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/organizations/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.organizations.update_organization(id: "stub") refute_nil result end - def test_update_organization_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organizations.update_organization(id: "stub") - end - end - def test_delete_organization_returns_expected_result - stub_request(:delete, /#{Regexp.escape("organizations")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/organizations/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.organizations.delete_organization(id: "stub") - assert_nil result if result.nil? - end - - def test_delete_organization_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organizations.delete_organization(id: "stub") - end + assert_nil result end def test_get_audit_log_configuration_returns_expected_result - stub_request(:get, /#{Regexp.escape("organizations")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/audit_log_configuration(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.organizations.get_audit_log_configuration(id: "stub") refute_nil result end - def test_get_audit_log_configuration_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("organizations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.organizations.get_audit_log_configuration(id: "stub") + # Parameterized authentication error tests (one per endpoint). + [ + {name: :list_organizations, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations(\?|\z)}}, + {name: :create_organization, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations(\?|\z)}, args: {name: "stub"}}, + {name: :get_organization_by_external_id, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/external_id/stub(\?|\z)}, args: {external_id: "stub"}}, + {name: :get_organization, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub(\?|\z)}, args: {id: "stub"}}, + {name: :update_organization, verb: :put, url: %r{\Ahttps://api\.workos\.com/organizations/stub(\?|\z)}, args: {id: "stub"}}, + {name: :delete_organization, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organizations/stub(\?|\z)}, args: {id: "stub"}}, + {name: :get_audit_log_configuration, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/audit_log_configuration(\?|\z)}, args: {id: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.organizations.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_pipes.rb b/test/workos/test_pipes.rb index 71b55e49..a085fc40 100644 --- a/test/workos/test_pipes.rb +++ b/test/workos/test_pipes.rb @@ -12,77 +12,54 @@ def setup end def test_authorize_data_integration_returns_expected_result - stub_request(:post, /#{Regexp.escape("data-integrations")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations/stub/authorize(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.pipes.authorize_data_integration(slug: "stub", user_id: "stub") refute_nil result end - def test_authorize_data_integration_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("data-integrations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.pipes.authorize_data_integration(slug: "stub", user_id: "stub") - end - end - def test_create_data_integration_token_returns_expected_result - stub_request(:post, /#{Regexp.escape("data-integrations")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.pipes.create_data_integration_token(slug: "stub", user_id: "stub") refute_nil result end - def test_create_data_integration_token_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("data-integrations")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.pipes.create_data_integration_token(slug: "stub", user_id: "stub") - end - end - def test_get_user_connected_account_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.pipes.get_user_connected_account(user_id: "stub", slug: "stub") refute_nil result end - def test_get_user_connected_account_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.pipes.get_user_connected_account(user_id: "stub", slug: "stub") - end - end - def test_delete_user_connected_account_returns_expected_result - stub_request(:delete, /#{Regexp.escape("user_management")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.pipes.delete_user_connected_account(user_id: "stub", slug: "stub") - assert_nil result if result.nil? - end - - def test_delete_user_connected_account_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.pipes.delete_user_connected_account(user_id: "stub", slug: "stub") - end + assert_nil result end def test_list_user_data_providers_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/data_providers(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.pipes.list_user_data_providers(user_id: "stub") refute_nil result end - def test_list_user_data_providers_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.pipes.list_user_data_providers(user_id: "stub") + # Parameterized authentication error tests (one per endpoint). + [ + {name: :authorize_data_integration, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/authorize(\?|\z)}, args: {slug: "stub", user_id: "stub"}}, + {name: :create_data_integration_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/data-integrations/stub/token(\?|\z)}, args: {slug: "stub", user_id: "stub"}}, + {name: :get_user_connected_account, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}}, + {name: :delete_user_connected_account, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/connected_accounts/stub(\?|\z)}, args: {user_id: "stub", slug: "stub"}}, + {name: :list_user_data_providers, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/data_providers(\?|\z)}, args: {user_id: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.pipes.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_radar.rb b/test/workos/test_radar.rb index 86114494..017deea2 100644 --- a/test/workos/test_radar.rb +++ b/test/workos/test_radar.rb @@ -12,62 +12,46 @@ def setup end def test_create_attempt_returns_expected_result - stub_request(:post, /#{Regexp.escape("radar")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/radar/attempts(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.radar.create_attempt(ip_address: "stub", user_agent: "stub", email: "stub", auth_method: "stub", action: "stub") refute_nil result end - def test_create_attempt_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("radar")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.radar.create_attempt(ip_address: "stub", user_agent: "stub", email: "stub", auth_method: "stub", action: "stub") - end - end - def test_update_attempt_returns_expected_result - stub_request(:put, /#{Regexp.escape("radar")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/radar/attempts/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.radar.update_attempt(id: "stub") - assert_nil result if result.nil? - end - - def test_update_attempt_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("radar")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.radar.update_attempt(id: "stub") - end + assert_nil result end def test_add_list_entry_returns_expected_result - stub_request(:post, /#{Regexp.escape("radar")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/radar/lists/stub/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.radar.add_list_entry(type: "stub", action: "stub", entry: "stub") refute_nil result end - def test_add_list_entry_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("radar")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.radar.add_list_entry(type: "stub", action: "stub", entry: "stub") - end - end - def test_remove_list_entry_returns_expected_result - stub_request(:delete, /#{Regexp.escape("radar")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/radar/lists/stub/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.radar.remove_list_entry(type: "stub", action: "stub", entry: "stub") - assert_nil result if result.nil? - end - - def test_remove_list_entry_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("radar")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.radar.remove_list_entry(type: "stub", action: "stub", entry: "stub") + assert_nil result + end + + # Parameterized authentication error tests (one per endpoint). + [ + {name: :create_attempt, verb: :post, url: %r{\Ahttps://api\.workos\.com/radar/attempts(\?|\z)}, args: {ip_address: "stub", user_agent: "stub", email: "stub", auth_method: "stub", action: "stub"}}, + {name: :update_attempt, verb: :put, url: %r{\Ahttps://api\.workos\.com/radar/attempts/stub(\?|\z)}, args: {id: "stub"}}, + {name: :add_list_entry, verb: :post, url: %r{\Ahttps://api\.workos\.com/radar/lists/stub/stub(\?|\z)}, args: {type: "stub", action: "stub", entry: "stub"}}, + {name: :remove_list_entry, verb: :delete, url: %r{\Ahttps://api\.workos\.com/radar/lists/stub/stub(\?|\z)}, args: {type: "stub", action: "stub", entry: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.radar.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_session.rb b/test/workos/test_session.rb index 669063ea..ad9db804 100644 --- a/test/workos/test_session.rb +++ b/test/workos/test_session.rb @@ -154,7 +154,7 @@ def test_authenticate_returns_invalid_jwt_on_bad_signature .to_return(status: 200, body: jwks_payload(rsa.public_key).to_json) result = @sm.authenticate(seal_data: sealed, cookie_password: PASSWORD) - assert_equal WorkOS::SessionManager::INVALID_JWT, result.reason + assert_equal WorkOS::SessionManager::INVALID_JWT_SIGNATURE, result.reason end def test_authenticate_returns_expired_jwt_when_expired_and_include_expired_is_false diff --git a/test/workos/test_sso.rb b/test/workos/test_sso.rb index 8a542a05..f6e16efb 100644 --- a/test/workos/test_sso.rb +++ b/test/workos/test_sso.rb @@ -12,92 +12,62 @@ def setup end def test_list_connections_returns_expected_result - stub_request(:get, /#{Regexp.escape("connections")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/connections(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.sso.list_connections assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_connections_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("connections")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.sso.list_connections - end - end - def test_get_connection_returns_expected_result - stub_request(:get, /#{Regexp.escape("connections")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/connections/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.sso.get_connection(id: "stub") refute_nil result end - def test_get_connection_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("connections")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.sso.get_connection(id: "stub") - end - end - def test_delete_connection_returns_expected_result - stub_request(:delete, /#{Regexp.escape("connections")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/connections/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.sso.delete_connection(id: "stub") - assert_nil result if result.nil? - end - - def test_delete_connection_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("connections")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.sso.delete_connection(id: "stub") - end + assert_nil result end def test_authorize_logout_returns_expected_result - stub_request(:post, /#{Regexp.escape("sso")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/sso/logout/authorize(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.sso.authorize_logout(profile_id: "stub") refute_nil result end - def test_authorize_logout_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("sso")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.sso.authorize_logout(profile_id: "stub") - end - end - def test_get_profile_returns_expected_result - stub_request(:get, /#{Regexp.escape("sso")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/sso/profile(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.sso.get_profile refute_nil result end - def test_get_profile_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("sso")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.sso.get_profile - end - end - def test_get_profile_and_token_returns_expected_result - stub_request(:post, /#{Regexp.escape("sso")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/sso/token(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.sso.get_profile_and_token(code: "stub") refute_nil result end - def test_get_profile_and_token_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("sso")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.sso.get_profile_and_token(code: "stub") + # Parameterized authentication error tests (one per endpoint). + [ + {name: :list_connections, verb: :get, url: %r{\Ahttps://api\.workos\.com/connections(\?|\z)}}, + {name: :get_connection, verb: :get, url: %r{\Ahttps://api\.workos\.com/connections/stub(\?|\z)}, args: {id: "stub"}}, + {name: :delete_connection, verb: :delete, url: %r{\Ahttps://api\.workos\.com/connections/stub(\?|\z)}, args: {id: "stub"}}, + {name: :authorize_logout, verb: :post, url: %r{\Ahttps://api\.workos\.com/sso/logout/authorize(\?|\z)}, args: {profile_id: "stub"}}, + {name: :get_profile, verb: :get, url: %r{\Ahttps://api\.workos\.com/sso/profile(\?|\z)}}, + {name: :get_profile_and_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/sso/token(\?|\z)}, args: {code: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.sso.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_user_management.rb b/test/workos/test_user_management.rb index 674cde65..6456408a 100644 --- a/test/workos/test_user_management.rb +++ b/test/workos/test_user_management.rb @@ -12,44 +12,28 @@ def setup end def test_get_jwks_returns_expected_result - stub_request(:get, /#{Regexp.escape("sso")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/sso/jwks/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.get_jwks(client_id: "stub") refute_nil result end - def test_get_jwks_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("sso")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.get_jwks(client_id: "stub") - end - end - def test_create_authenticate_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.create_authenticate(client_id: "stub", client_secret: "stub", grant_type: "authorization_code", code: "stub") refute_nil result end - def test_create_authenticate_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.create_authenticate(client_id: "stub", client_secret: "stub", grant_type: "authorization_code", code: "stub") - end - end - def test_authenticate_with_password_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.authenticate_with_password(email: "stub", password: "stub") refute_nil result end def test_authenticate_with_password_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: '{"message": "Unauthorized"}', status: 401) assert_raises(WorkOS::AuthenticationError) do @client.user_management.authenticate_with_password(email: "stub", password: "stub") @@ -57,14 +41,14 @@ def test_authenticate_with_password_raises_authentication_error_on_401 end def test_authenticate_with_code_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.authenticate_with_code(code: "stub") refute_nil result end def test_authenticate_with_code_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: '{"message": "Unauthorized"}', status: 401) assert_raises(WorkOS::AuthenticationError) do @client.user_management.authenticate_with_code(code: "stub") @@ -72,14 +56,14 @@ def test_authenticate_with_code_raises_authentication_error_on_401 end def test_authenticate_with_refresh_token_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.authenticate_with_refresh_token(refresh_token: "stub") refute_nil result end def test_authenticate_with_refresh_token_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: '{"message": "Unauthorized"}', status: 401) assert_raises(WorkOS::AuthenticationError) do @client.user_management.authenticate_with_refresh_token(refresh_token: "stub") @@ -87,14 +71,14 @@ def test_authenticate_with_refresh_token_raises_authentication_error_on_401 end def test_authenticate_with_magic_auth_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.authenticate_with_magic_auth(code: "stub", email: "stub") refute_nil result end def test_authenticate_with_magic_auth_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: '{"message": "Unauthorized"}', status: 401) assert_raises(WorkOS::AuthenticationError) do @client.user_management.authenticate_with_magic_auth(code: "stub", email: "stub") @@ -102,14 +86,14 @@ def test_authenticate_with_magic_auth_raises_authentication_error_on_401 end def test_authenticate_with_email_verification_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.authenticate_with_email_verification(code: "stub", pending_authentication_token: "stub") refute_nil result end def test_authenticate_with_email_verification_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: '{"message": "Unauthorized"}', status: 401) assert_raises(WorkOS::AuthenticationError) do @client.user_management.authenticate_with_email_verification(code: "stub", pending_authentication_token: "stub") @@ -117,14 +101,14 @@ def test_authenticate_with_email_verification_raises_authentication_error_on_401 end def test_authenticate_with_totp_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.authenticate_with_totp(code: "stub", pending_authentication_token: "stub", authentication_challenge_id: "stub") refute_nil result end def test_authenticate_with_totp_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: '{"message": "Unauthorized"}', status: 401) assert_raises(WorkOS::AuthenticationError) do @client.user_management.authenticate_with_totp(code: "stub", pending_authentication_token: "stub", authentication_challenge_id: "stub") @@ -132,14 +116,14 @@ def test_authenticate_with_totp_raises_authentication_error_on_401 end def test_authenticate_with_organization_selection_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.authenticate_with_organization_selection(pending_authentication_token: "stub", organization_id: "stub") refute_nil result end def test_authenticate_with_organization_selection_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: '{"message": "Unauthorized"}', status: 401) assert_raises(WorkOS::AuthenticationError) do @client.user_management.authenticate_with_organization_selection(pending_authentication_token: "stub", organization_id: "stub") @@ -147,14 +131,14 @@ def test_authenticate_with_organization_selection_raises_authentication_error_on end def test_authenticate_with_device_code_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.authenticate_with_device_code(device_code: "stub") refute_nil result end def test_authenticate_with_device_code_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}) .to_return(body: '{"message": "Unauthorized"}', status: 401) assert_raises(WorkOS::AuthenticationError) do @client.user_management.authenticate_with_device_code(device_code: "stub") @@ -162,587 +146,328 @@ def test_authenticate_with_device_code_raises_authentication_error_on_401 end def test_create_device_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authorize/device(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.create_device(client_id: "stub") refute_nil result end - def test_create_device_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.create_device(client_id: "stub") - end - end - def test_revoke_session_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/sessions/revoke(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.revoke_session(session_id: "stub") - assert_nil result if result.nil? - end - - def test_revoke_session_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.revoke_session(session_id: "stub") - end + assert_nil result end def test_create_cors_origin_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/cors_origins(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.create_cors_origin(origin: "stub") refute_nil result end - def test_create_cors_origin_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.create_cors_origin(origin: "stub") - end - end - def test_get_email_verification_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/email_verification/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.get_email_verification(id: "stub") refute_nil result end - def test_get_email_verification_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.get_email_verification(id: "stub") - end - end - def test_reset_password_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/password_reset(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.reset_password(email: "stub") refute_nil result end - def test_reset_password_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.reset_password(email: "stub") - end - end - def test_confirm_password_reset_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/password_reset/confirm(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.confirm_password_reset(token: "stub", new_password: "stub") refute_nil result end - def test_confirm_password_reset_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.confirm_password_reset(token: "stub", new_password: "stub") - end - end - def test_get_password_reset_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/password_reset/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.get_password_reset(id: "stub") refute_nil result end - def test_get_password_reset_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.get_password_reset(id: "stub") - end - end - def test_list_users_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.user_management.list_users assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_users_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.list_users - end - end - def test_create_user_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.create_user(email: "stub") refute_nil result end - def test_create_user_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.create_user(email: "stub") - end - end - def test_get_user_by_external_id_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/external_id/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.get_user_by_external_id(external_id: "stub") refute_nil result end - def test_get_user_by_external_id_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.get_user_by_external_id(external_id: "stub") - end - end - def test_get_user_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.get_user(id: "stub") refute_nil result end - def test_get_user_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.get_user(id: "stub") - end - end - def test_update_user_returns_expected_result - stub_request(:put, /#{Regexp.escape("user_management")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/users/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.update_user(id: "stub") refute_nil result end - def test_update_user_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.update_user(id: "stub") - end - end - def test_delete_user_returns_expected_result - stub_request(:delete, /#{Regexp.escape("user_management")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/user_management/users/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.delete_user(id: "stub") - assert_nil result if result.nil? - end - - def test_delete_user_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.delete_user(id: "stub") - end + assert_nil result end def test_confirm_email_change_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users/stub/email_change/confirm(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.confirm_email_change(id: "stub", code: "stub") refute_nil result end - def test_confirm_email_change_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.confirm_email_change(id: "stub", code: "stub") - end - end - def test_send_email_change_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users/stub/email_change/send(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.send_email_change(id: "stub", new_email: "stub") refute_nil result end - def test_send_email_change_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.send_email_change(id: "stub", new_email: "stub") - end - end - def test_verify_email_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users/stub/email_verification/confirm(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.verify_email(id: "stub", code: "stub") refute_nil result end - def test_verify_email_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.verify_email(id: "stub", code: "stub") - end - end - def test_send_verification_email_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users/stub/email_verification/send(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.send_verification_email(id: "stub") refute_nil result end - def test_send_verification_email_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.send_verification_email(id: "stub") - end - end - def test_get_user_identities_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/identities(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.get_user_identities(id: "stub") refute_nil result end - def test_get_user_identities_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.get_user_identities(id: "stub") - end - end - def test_list_sessions_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/sessions(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.user_management.list_sessions(id: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_sessions_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.list_sessions(id: "stub") - end - end - def test_list_invitations_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/invitations(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.user_management.list_invitations assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_invitations_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.list_invitations - end - end - def test_send_invitation_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/invitations(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.send_invitation(email: "stub") refute_nil result end - def test_send_invitation_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.send_invitation(email: "stub") - end - end - def test_find_invitation_by_token_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/invitations/by_token/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.find_invitation_by_token(token: "stub") refute_nil result end - def test_find_invitation_by_token_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.find_invitation_by_token(token: "stub") - end - end - def test_get_invitation_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/invitations/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.get_invitation(id: "stub") refute_nil result end - def test_get_invitation_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.get_invitation(id: "stub") - end - end - def test_accept_invitation_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/invitations/stub/accept(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.accept_invitation(id: "stub") refute_nil result end - def test_accept_invitation_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.accept_invitation(id: "stub") - end - end - def test_resend_invitation_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/invitations/stub/resend(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.resend_invitation(id: "stub") refute_nil result end - def test_resend_invitation_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.resend_invitation(id: "stub") - end - end - def test_revoke_invitation_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/invitations/stub/revoke(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.revoke_invitation(id: "stub") refute_nil result end - def test_revoke_invitation_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.revoke_invitation(id: "stub") - end - end - def test_update_jwt_template_returns_expected_result - stub_request(:put, /#{Regexp.escape("user_management")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/jwt_template(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.update_jwt_template(content: "stub") refute_nil result end - def test_update_jwt_template_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.update_jwt_template(content: "stub") - end - end - def test_create_magic_auth_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/magic_auth(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.create_magic_auth(email: "stub") refute_nil result end - def test_create_magic_auth_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.create_magic_auth(email: "stub") - end - end - def test_get_magic_auth_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/magic_auth/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.get_magic_auth(id: "stub") refute_nil result end - def test_get_magic_auth_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.get_magic_auth(id: "stub") - end - end - def test_list_organization_memberships_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.user_management.list_organization_memberships assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_organization_memberships_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.list_organization_memberships - end - end - def test_create_organization_membership_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.create_organization_membership(user_id: "stub", organization_id: "stub") refute_nil result end - def test_create_organization_membership_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.create_organization_membership(user_id: "stub", organization_id: "stub") - end - end - def test_get_organization_membership_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.get_organization_membership(id: "stub") refute_nil result end - def test_get_organization_membership_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.get_organization_membership(id: "stub") - end - end - def test_update_organization_membership_returns_expected_result - stub_request(:put, /#{Regexp.escape("user_management")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.update_organization_membership(id: "stub") refute_nil result end - def test_update_organization_membership_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.update_organization_membership(id: "stub") - end - end - def test_delete_organization_membership_returns_expected_result - stub_request(:delete, /#{Regexp.escape("user_management")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.delete_organization_membership(id: "stub") - assert_nil result if result.nil? - end - - def test_delete_organization_membership_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.delete_organization_membership(id: "stub") - end + assert_nil result end def test_deactivate_organization_membership_returns_expected_result - stub_request(:put, /#{Regexp.escape("user_management")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub/deactivate(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.deactivate_organization_membership(id: "stub") refute_nil result end - def test_deactivate_organization_membership_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.deactivate_organization_membership(id: "stub") - end - end - def test_reactivate_organization_membership_returns_expected_result - stub_request(:put, /#{Regexp.escape("user_management")}/) + stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub/reactivate(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.reactivate_organization_membership(id: "stub") refute_nil result end - def test_reactivate_organization_membership_raises_authentication_error_on_401 - stub_request(:put, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.reactivate_organization_membership(id: "stub") - end - end - def test_create_redirect_uri_returns_expected_result - stub_request(:post, /#{Regexp.escape("user_management")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/redirect_uris(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.create_redirect_uri(uri: "stub") refute_nil result end - def test_create_redirect_uri_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.create_redirect_uri(uri: "stub") - end - end - def test_list_user_authorized_applications_returns_expected_result - stub_request(:get, /#{Regexp.escape("user_management")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.user_management.list_user_authorized_applications(user_id: "stub") assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_user_authorized_applications_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.list_user_authorized_applications(user_id: "stub") - end - end - def test_delete_user_authorized_application_returns_expected_result - stub_request(:delete, /#{Regexp.escape("user_management")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.user_management.delete_user_authorized_application(application_id: "stub", user_id: "stub") - assert_nil result if result.nil? - end - - def test_delete_user_authorized_application_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("user_management")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.user_management.delete_user_authorized_application(application_id: "stub", user_id: "stub") + assert_nil result + end + + # Parameterized authentication error tests (one per endpoint). + [ + {name: :get_jwks, verb: :get, url: %r{\Ahttps://api\.workos\.com/sso/jwks/stub(\?|\z)}, args: {client_id: "stub"}}, + {name: :create_authenticate, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/authenticate(\?|\z)}, args: {client_id: "stub", client_secret: "stub", grant_type: "authorization_code", code: "stub"}}, + {name: :create_device, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/authorize/device(\?|\z)}, args: {client_id: "stub"}}, + {name: :revoke_session, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/sessions/revoke(\?|\z)}, args: {session_id: "stub"}}, + {name: :create_cors_origin, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/cors_origins(\?|\z)}, args: {origin: "stub"}}, + {name: :get_email_verification, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/email_verification/stub(\?|\z)}, args: {id: "stub"}}, + {name: :reset_password, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/password_reset(\?|\z)}, args: {email: "stub"}}, + {name: :confirm_password_reset, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/password_reset/confirm(\?|\z)}, args: {token: "stub", new_password: "stub"}}, + {name: :get_password_reset, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/password_reset/stub(\?|\z)}, args: {id: "stub"}}, + {name: :list_users, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users(\?|\z)}}, + {name: :create_user, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users(\?|\z)}, args: {email: "stub"}}, + {name: :get_user_by_external_id, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/external_id/stub(\?|\z)}, args: {external_id: "stub"}}, + {name: :get_user, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub(\?|\z)}, args: {id: "stub"}}, + {name: :update_user, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub(\?|\z)}, args: {id: "stub"}}, + {name: :delete_user, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub(\?|\z)}, args: {id: "stub"}}, + {name: :confirm_email_change, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/email_change/confirm(\?|\z)}, args: {id: "stub", code: "stub"}}, + {name: :send_email_change, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/email_change/send(\?|\z)}, args: {id: "stub", new_email: "stub"}}, + {name: :verify_email, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/email_verification/confirm(\?|\z)}, args: {id: "stub", code: "stub"}}, + {name: :send_verification_email, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/email_verification/send(\?|\z)}, args: {id: "stub"}}, + {name: :get_user_identities, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/identities(\?|\z)}, args: {id: "stub"}}, + {name: :list_sessions, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/sessions(\?|\z)}, args: {id: "stub"}}, + {name: :list_invitations, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/invitations(\?|\z)}}, + {name: :send_invitation, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/invitations(\?|\z)}, args: {email: "stub"}}, + {name: :find_invitation_by_token, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/invitations/by_token/stub(\?|\z)}, args: {token: "stub"}}, + {name: :get_invitation, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/invitations/stub(\?|\z)}, args: {id: "stub"}}, + {name: :accept_invitation, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/invitations/stub/accept(\?|\z)}, args: {id: "stub"}}, + {name: :resend_invitation, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/invitations/stub/resend(\?|\z)}, args: {id: "stub"}}, + {name: :revoke_invitation, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/invitations/stub/revoke(\?|\z)}, args: {id: "stub"}}, + {name: :update_jwt_template, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/jwt_template(\?|\z)}, args: {content: "stub"}}, + {name: :create_magic_auth, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/magic_auth(\?|\z)}, args: {email: "stub"}}, + {name: :get_magic_auth, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/magic_auth/stub(\?|\z)}, args: {id: "stub"}}, + {name: :list_organization_memberships, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/organization_memberships(\?|\z)}}, + {name: :create_organization_membership, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/organization_memberships(\?|\z)}, args: {user_id: "stub", organization_id: "stub"}}, + {name: :get_organization_membership, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub(\?|\z)}, args: {id: "stub"}}, + {name: :update_organization_membership, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub(\?|\z)}, args: {id: "stub"}}, + {name: :delete_organization_membership, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub(\?|\z)}, args: {id: "stub"}}, + {name: :deactivate_organization_membership, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub/deactivate(\?|\z)}, args: {id: "stub"}}, + {name: :reactivate_organization_membership, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub/reactivate(\?|\z)}, args: {id: "stub"}}, + {name: :create_redirect_uri, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/redirect_uris(\?|\z)}, args: {uri: "stub"}}, + {name: :list_user_authorized_applications, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications(\?|\z)}, args: {user_id: "stub"}}, + {name: :delete_user_authorized_application, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications/stub(\?|\z)}, args: {application_id: "stub", user_id: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.user_management.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_webhooks.rb b/test/workos/test_webhooks.rb index d8ac200f..ddf268f0 100644 --- a/test/workos/test_webhooks.rb +++ b/test/workos/test_webhooks.rb @@ -12,62 +12,46 @@ def setup end def test_list_webhook_endpoints_returns_expected_result - stub_request(:get, /#{Regexp.escape("webhook_endpoints")}/) + stub_request(:get, %r{\Ahttps://api\.workos\.com/webhook_endpoints(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) result = @client.webhooks.list_webhook_endpoints assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_webhook_endpoints_raises_authentication_error_on_401 - stub_request(:get, /#{Regexp.escape("webhook_endpoints")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.webhooks.list_webhook_endpoints - end - end - def test_create_webhook_endpoint_returns_expected_result - stub_request(:post, /#{Regexp.escape("webhook_endpoints")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/webhook_endpoints(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.webhooks.create_webhook_endpoint(endpoint_url: "stub", events: []) refute_nil result end - def test_create_webhook_endpoint_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("webhook_endpoints")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.webhooks.create_webhook_endpoint(endpoint_url: "stub", events: []) - end - end - def test_update_webhook_endpoint_returns_expected_result - stub_request(:patch, /#{Regexp.escape("webhook_endpoints")}/) + stub_request(:patch, %r{\Ahttps://api\.workos\.com/webhook_endpoints/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.webhooks.update_webhook_endpoint(id: "stub") refute_nil result end - def test_update_webhook_endpoint_raises_authentication_error_on_401 - stub_request(:patch, /#{Regexp.escape("webhook_endpoints")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.webhooks.update_webhook_endpoint(id: "stub") - end - end - def test_delete_webhook_endpoint_returns_expected_result - stub_request(:delete, /#{Regexp.escape("webhook_endpoints")}/) + stub_request(:delete, %r{\Ahttps://api\.workos\.com/webhook_endpoints/stub(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.webhooks.delete_webhook_endpoint(id: "stub") - assert_nil result if result.nil? - end - - def test_delete_webhook_endpoint_raises_authentication_error_on_401 - stub_request(:delete, /#{Regexp.escape("webhook_endpoints")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.webhooks.delete_webhook_endpoint(id: "stub") + assert_nil result + end + + # Parameterized authentication error tests (one per endpoint). + [ + {name: :list_webhook_endpoints, verb: :get, url: %r{\Ahttps://api\.workos\.com/webhook_endpoints(\?|\z)}}, + {name: :create_webhook_endpoint, verb: :post, url: %r{\Ahttps://api\.workos\.com/webhook_endpoints(\?|\z)}, args: {endpoint_url: "stub", events: []}}, + {name: :update_webhook_endpoint, verb: :patch, url: %r{\Ahttps://api\.workos\.com/webhook_endpoints/stub(\?|\z)}, args: {id: "stub"}}, + {name: :delete_webhook_endpoint, verb: :delete, url: %r{\Ahttps://api\.workos\.com/webhook_endpoints/stub(\?|\z)}, args: {id: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.webhooks.send(spec[:name], **(spec[:args] || {})) + end end end end diff --git a/test/workos/test_widgets.rb b/test/workos/test_widgets.rb index 662baa81..f8270c1e 100644 --- a/test/workos/test_widgets.rb +++ b/test/workos/test_widgets.rb @@ -12,17 +12,22 @@ def setup end def test_create_token_returns_expected_result - stub_request(:post, /#{Regexp.escape("widgets")}/) + stub_request(:post, %r{\Ahttps://api\.workos\.com/widgets/token(\?|\z)}) .to_return(body: "{}", status: 200) result = @client.widgets.create_token(organization_id: "stub") refute_nil result end - def test_create_token_raises_authentication_error_on_401 - stub_request(:post, /#{Regexp.escape("widgets")}/) - .to_return(body: '{"message": "Unauthorized"}', status: 401) - assert_raises(WorkOS::AuthenticationError) do - @client.widgets.create_token(organization_id: "stub") + # Parameterized authentication error tests (one per endpoint). + [ + {name: :create_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/widgets/token(\?|\z)}, args: {organization_id: "stub"}} + ].each do |spec| + define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do + stub_request(spec[:verb], spec[:url]) + .to_return(body: '{"message": "Unauthorized"}', status: 401) + assert_raises(WorkOS::AuthenticationError) do + @client.widgets.send(spec[:name], **(spec[:args] || {})) + end end end end From 408370bcf2142d640588b9a3c8f8f45581c5cce6 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Mon, 20 Apr 2026 09:32:22 -0400 Subject: [PATCH 11/12] add handmaintained types --- rbi/workos/actions.rbi | 48 +++++++++ rbi/workos/base_client.rbi | 132 +++++++++++++++++++++++ rbi/workos/configuration.rbi | 68 ++++++++++++ rbi/workos/encryptors/aes_gcm.rbi | 19 ++++ rbi/workos/errors.rbi | 43 ++++++++ rbi/workos/hash_provider.rbi | 18 ++++ rbi/workos/passwordless.rbi | 47 ++++++++ rbi/workos/public_client.rbi | 12 +++ rbi/workos/session.rbi | 43 ++++++++ rbi/workos/session_manager.rbi | 154 +++++++++++++++++++++++++++ rbi/workos/types/api_response.rbi | 29 +++++ rbi/workos/types/base_model.rbi | 22 ++++ rbi/workos/types/list_struct.rbi | 89 ++++++++++++++++ rbi/workos/types/request_options.rbi | 12 +++ rbi/workos/util.rbi | 12 +++ rbi/workos/vault.rbi | 137 ++++++++++++++++++++++++ 16 files changed, 885 insertions(+) create mode 100644 rbi/workos/actions.rbi create mode 100644 rbi/workos/base_client.rbi create mode 100644 rbi/workos/configuration.rbi create mode 100644 rbi/workos/encryptors/aes_gcm.rbi create mode 100644 rbi/workos/errors.rbi create mode 100644 rbi/workos/hash_provider.rbi create mode 100644 rbi/workos/passwordless.rbi create mode 100644 rbi/workos/public_client.rbi create mode 100644 rbi/workos/session.rbi create mode 100644 rbi/workos/session_manager.rbi create mode 100644 rbi/workos/types/api_response.rbi create mode 100644 rbi/workos/types/base_model.rbi create mode 100644 rbi/workos/types/list_struct.rbi create mode 100644 rbi/workos/types/request_options.rbi create mode 100644 rbi/workos/util.rbi create mode 100644 rbi/workos/vault.rbi diff --git a/rbi/workos/actions.rbi b/rbi/workos/actions.rbi new file mode 100644 index 00000000..76c17acf --- /dev/null +++ b/rbi/workos/actions.rbi @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + module Actions + DEFAULT_TOLERANCE_SECONDS = T.let(30, Integer) + ACTION_TYPE_TO_RESPONSE_OBJECT = T.let(T.unsafe(nil), T::Hash[String, String]) + + sig do + params( + payload: String, + sig_header: String, + secret: String, + tolerance: Integer + ).returns(T::Boolean) + end + def self.verify_header(payload:, sig_header:, secret:, tolerance: DEFAULT_TOLERANCE_SECONDS); end + + sig do + params( + payload: String, + sig_header: String, + secret: String, + tolerance: Integer + ).returns(T::Hash[String, T.untyped]) + end + def self.construct_action(payload:, sig_header:, secret:, tolerance: DEFAULT_TOLERANCE_SECONDS); end + + sig do + params( + action_type: String, + verdict: String, + secret: String, + error_message: T.nilable(String) + ).returns(T::Hash[String, T.untyped]) + end + def self.sign_response(action_type:, verdict:, secret:, error_message: nil); end + + sig { params(payload: String, timestamp: T.any(String, Integer), secret: String).returns(String) } + def self.compute_signature(payload:, timestamp:, secret:); end + + sig { params(sig_header: String).returns([String, String]) } + def self.parse_signature_header(sig_header); end + end +end diff --git a/rbi/workos/base_client.rbi b/rbi/workos/base_client.rbi new file mode 100644 index 00000000..66c870a2 --- /dev/null +++ b/rbi/workos/base_client.rbi @@ -0,0 +1,132 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class BaseClient + DEFAULT_BASE_URL = T.let("https://api.workos.com", String) + DEFAULT_TIMEOUT = T.let(30, Integer) + DEFAULT_MAX_RETRIES = T.let(2, Integer) + RETRYABLE_STATUSES = T.let([408, 409, 429, 500, 502, 503, 504].freeze, T::Array[Integer]) + MAX_CACHED_CONNECTIONS = T.let(8, Integer) + RETRY_BACKOFF_BASE = T.let(0.5, Float) + LOG_SEVERITY = T.let({debug: 0, info: 1, warn: 2, error: 3, unknown: 4}.freeze, T::Hash[Symbol, Integer]) + USER_AGENT = T.let(T.unsafe(nil), String) + + sig { returns(T.nilable(String)) } + def api_key; end + + sig { returns(String) } + def base_url; end + + sig { returns(T.nilable(String)) } + def client_id; end + + sig { returns(Integer) } + def timeout; end + + sig { returns(Integer) } + def max_retries; end + + sig { returns(T.nilable(Logger)) } + def logger; end + + sig { returns(T.nilable(Symbol)) } + def log_level; end + + sig do + params( + api_key: T.nilable(String), + base_url: String, + client_id: T.nilable(String), + timeout: Integer, + max_retries: Integer, + logger: T.nilable(Logger), + log_level: T.nilable(Symbol), + random: Random + ).void + end + def initialize(api_key: nil, base_url: DEFAULT_BASE_URL, client_id: nil, + timeout: DEFAULT_TIMEOUT, max_retries: DEFAULT_MAX_RETRIES, + logger: nil, log_level: nil, random: Random.new); end + + sig do + params( + path: String, + auth: T::Boolean, + params: T::Hash[T.any(String, Symbol), T.untyped], + request_options: T.nilable(T::Hash[Symbol, T.untyped]) + ).returns(Net::HTTPRequest) + end + def get_request(path:, auth: false, params: {}, request_options: nil); end + + sig do + params( + path: String, + auth: T::Boolean, + body: T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), + params: T::Hash[T.any(String, Symbol), T.untyped], + request_options: T.nilable(T::Hash[Symbol, T.untyped]) + ).returns(Net::HTTPRequest) + end + def post_request(path:, auth: false, body: {}, params: {}, request_options: nil); end + + sig do + params( + path: String, + auth: T::Boolean, + body: T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), + params: T::Hash[T.any(String, Symbol), T.untyped], + request_options: T.nilable(T::Hash[Symbol, T.untyped]) + ).returns(Net::HTTPRequest) + end + def put_request(path:, auth: false, body: {}, params: {}, request_options: nil); end + + sig do + params( + path: String, + auth: T::Boolean, + body: T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), + params: T::Hash[T.any(String, Symbol), T.untyped], + request_options: T.nilable(T::Hash[Symbol, T.untyped]) + ).returns(Net::HTTPRequest) + end + def patch_request(path:, auth: false, body: {}, params: {}, request_options: nil); end + + sig do + params( + path: String, + auth: T::Boolean, + body: T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), + params: T::Hash[T.any(String, Symbol), T.untyped], + request_options: T.nilable(T::Hash[Symbol, T.untyped]) + ).returns(Net::HTTPRequest) + end + def delete_request(path:, auth: false, body: nil, params: {}, request_options: nil); end + + sig do + params( + method: Symbol, + path: String, + auth: T::Boolean, + params: T::Hash[T.any(String, Symbol), T.untyped], + body: T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(Net::HTTPResponse) + end + def request(method:, path:, auth: true, params: {}, body: nil, request_options: {}); end + + sig do + params( + request: Net::HTTPRequest, + request_options: T.nilable(T::Hash[Symbol, T.untyped]) + ).returns(Net::HTTPResponse) + end + def execute_request(request:, request_options: nil); end + + sig { void } + def shutdown; end + end +end diff --git a/rbi/workos/configuration.rbi b/rbi/workos/configuration.rbi new file mode 100644 index 00000000..ada9a54a --- /dev/null +++ b/rbi/workos/configuration.rbi @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Configuration + sig { returns(T.nilable(String)) } + def api_key; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def api_key=(value); end + + sig { returns(T.nilable(String)) } + def base_url; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def base_url=(value); end + + sig { returns(T.nilable(String)) } + def client_id; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def client_id=(value); end + + sig { returns(T.nilable(Integer)) } + def timeout; end + + sig { params(value: T.nilable(Integer)).returns(T.nilable(Integer)) } + def timeout=(value); end + + sig { returns(T.nilable(Integer)) } + def max_retries; end + + sig { params(value: T.nilable(Integer)).returns(T.nilable(Integer)) } + def max_retries=(value); end + + sig { returns(T.nilable(Logger)) } + def logger; end + + sig { params(value: T.nilable(Logger)).returns(T.nilable(Logger)) } + def logger=(value); end + + sig { returns(T.nilable(Symbol)) } + def log_level; end + + sig { params(value: T.nilable(Symbol)).returns(T.nilable(Symbol)) } + def log_level=(value); end + + sig { void } + def initialize; end + end + + class << self + sig { params(block: T.proc.params(config: WorkOS::Configuration).void).void } + def configure(&block); end + + sig { returns(WorkOS::Configuration) } + def configuration; end + + sig { returns(WorkOS::Client) } + def client; end + + sig { void } + def reset_client; end + end +end diff --git a/rbi/workos/encryptors/aes_gcm.rbi b/rbi/workos/encryptors/aes_gcm.rbi new file mode 100644 index 00000000..6d510fc5 --- /dev/null +++ b/rbi/workos/encryptors/aes_gcm.rbi @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + module Encryptors + class AesGcm + SEAL_VERSION = T.let(0x01, Integer) + + sig { params(data: T.any(String, T::Hash[T.untyped, T.untyped]), key: String).returns(String) } + def seal(data, key); end + + sig { params(sealed: String, key: String).returns(T.any(T::Hash[String, T.untyped], String)) } + def unseal(sealed, key); end + end + end +end diff --git a/rbi/workos/errors.rbi b/rbi/workos/errors.rbi new file mode 100644 index 00000000..b962556f --- /dev/null +++ b/rbi/workos/errors.rbi @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Error < StandardError + sig { returns(T.nilable(Integer)) } + def http_status; end + + sig { returns(T.nilable(String)) } + def request_id; end + + sig { returns(T.nilable(String)) } + def code; end + + sig { returns(T.nilable(T::Hash[String, T.untyped])) } + def body; end + + sig do + params( + message: String, + http_status: T.nilable(Integer), + request_id: T.nilable(String), + code: T.nilable(String), + body: T.nilable(T::Hash[String, T.untyped]) + ).void + end + def initialize(message:, http_status: nil, request_id: nil, code: nil, body: nil); end + end + + class APIError < Error; end + class APIConnectionError < Error; end + class AuthenticationError < APIError; end + class ForbiddenRequestError < APIError; end + class IdempotencyError < APIError; end + class InvalidRequestError < APIError; end + class NotFoundError < APIError; end + class RateLimitExceededError < APIError; end + class UnprocessableEntityError < APIError; end + class SignatureVerificationError < Error; end +end diff --git a/rbi/workos/hash_provider.rbi b/rbi/workos/hash_provider.rbi new file mode 100644 index 00000000..84ddb8ae --- /dev/null +++ b/rbi/workos/hash_provider.rbi @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + module HashProvider + sig { returns(T::Hash[String, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + + sig { returns(String) } + def inspect; end + end +end diff --git a/rbi/workos/passwordless.rbi b/rbi/workos/passwordless.rbi new file mode 100644 index 00000000..f058554e --- /dev/null +++ b/rbi/workos/passwordless.rbi @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Passwordless + class PasswordlessSession < T::Struct + const :id, T.nilable(String) + const :email, T.nilable(String) + const :expires_at, T.nilable(String) + const :link, T.nilable(String) + const :object, T.nilable(String) + + sig { params(hash: T::Hash[String, T.untyped]).returns(WorkOS::Passwordless::PasswordlessSession) } + def self.from_hash(hash); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + end + + sig { params(client: WorkOS::Client).void } + def initialize(client); end + + sig do + params( + email: String, + type: String, + redirect_uri: T.nilable(String), + state: T.nilable(String), + connection: T.nilable(String), + expires_in: T.nilable(Integer), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Passwordless::PasswordlessSession) + end + def create_session(email:, type: "MagicLink", redirect_uri: nil, state: nil, connection: nil, expires_in: nil, request_options: {}); end + + sig do + params( + session_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(T::Hash[String, T.untyped]) + end + def send_session(session_id, request_options: {}); end + end +end diff --git a/rbi/workos/public_client.rbi b/rbi/workos/public_client.rbi new file mode 100644 index 00000000..58f6f7ea --- /dev/null +++ b/rbi/workos/public_client.rbi @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + module PublicClient + sig { params(client_id: String, opts: T.untyped).returns(WorkOS::Client) } + def self.create(client_id:, **opts); end + end +end diff --git a/rbi/workos/session.rbi b/rbi/workos/session.rbi new file mode 100644 index 00000000..74d7355d --- /dev/null +++ b/rbi/workos/session.rbi @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Session + sig { returns(T.nilable(String)) } + def seal_data; end + + sig { returns(String) } + def cookie_password; end + + sig do + params( + manager: WorkOS::SessionManager, + seal_data: T.nilable(String), + cookie_password: String + ).void + end + def initialize(manager, seal_data:, cookie_password:); end + + sig do + params( + include_expired: T::Boolean, + claim_extractor: T.nilable(T.proc.params(decoded: T::Hash[String, T.untyped]).returns(T.nilable(T::Hash[Symbol, T.untyped]))) + ).returns(T.any(WorkOS::SessionManager::AuthSuccess, WorkOS::SessionManager::AuthError)) + end + def authenticate(include_expired: false, &claim_extractor); end + + sig do + params( + organization_id: T.nilable(String), + cookie_password: T.nilable(String) + ).returns(T.any(WorkOS::SessionManager::RefreshSuccess, WorkOS::SessionManager::RefreshError)) + end + def refresh(organization_id: nil, cookie_password: nil); end + + sig { params(return_to: T.nilable(String)).returns(String) } + def get_logout_url(return_to: nil); end + end +end diff --git a/rbi/workos/session_manager.rbi b/rbi/workos/session_manager.rbi new file mode 100644 index 00000000..00bba0f5 --- /dev/null +++ b/rbi/workos/session_manager.rbi @@ -0,0 +1,154 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class SessionManager + JWK_ALGORITHMS = T.let(["RS256"].freeze, T::Array[String]) + + NO_SESSION_COOKIE_PROVIDED = T.let("no_session_cookie_provided", String) + INVALID_SESSION_COOKIE = T.let("invalid_session_cookie", String) + INVALID_JWT = T.let("invalid_jwt", String) + INVALID_JWT_ALGORITHM = T.let("invalid_jwt_algorithm", String) + INVALID_JWT_SIGNATURE = T.let("invalid_jwt_signature", String) + EXPIRED_JWT = T.let("expired_jwt", String) + + class AuthSuccess + RESERVED_KEYS = T.let(T.unsafe(nil), T::Array[Symbol]) + + sig { returns(T::Boolean) } + def authenticated; end + + sig { returns(T.nilable(String)) } + def reason; end + + sig { returns(T.nilable(String)) } + def session_id; end + + sig { returns(T.nilable(String)) } + def organization_id; end + + sig { returns(T.nilable(String)) } + def role; end + + sig { returns(T.nilable(T::Array[String])) } + def roles; end + + sig { returns(T.nilable(T::Array[String])) } + def permissions; end + + sig { returns(T.nilable(T::Array[String])) } + def entitlements; end + + sig { returns(T.untyped) } + def user; end + + sig { returns(T.untyped) } + def impersonator; end + + sig { returns(T.untyped) } + def feature_flags; end + + sig do + params( + authenticated: T::Boolean, + session_id: T.nilable(String), + organization_id: T.nilable(String), + role: T.nilable(String), + roles: T.nilable(T::Array[String]), + permissions: T.nilable(T::Array[String]), + entitlements: T.nilable(T::Array[String]), + user: T.untyped, + impersonator: T.untyped, + feature_flags: T.untyped, + reason: T.nilable(String), + custom_claims: T.nilable(T::Hash[Symbol, T.untyped]) + ).void + end + def initialize(authenticated:, session_id:, organization_id:, role:, roles:, permissions:, entitlements:, user:, impersonator:, feature_flags:, reason: nil, custom_claims: nil); end + + sig { params(key: T.any(String, Symbol)).returns(T.untyped) } + def [](key); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def to_h; end + end + + class AuthError < T::Struct + const :authenticated, T::Boolean + const :reason, T.nilable(String) + end + + class RefreshSuccess < T::Struct + const :authenticated, T::Boolean + const :sealed_session, T.nilable(String) + const :session_id, T.nilable(String) + const :organization_id, T.nilable(String) + const :role, T.nilable(String) + const :roles, T.nilable(T::Array[String]) + const :permissions, T.nilable(T::Array[String]) + const :entitlements, T.nilable(T::Array[String]) + const :user, T.untyped + const :impersonator, T.untyped + const :feature_flags, T.untyped + end + + class RefreshError < T::Struct + const :authenticated, T::Boolean + const :reason, T.nilable(String) + end + + sig { returns(WorkOS::Client) } + def client; end + + sig { params(client: WorkOS::Client, encryptor: T.nilable(T.untyped)).void } + def initialize(client, encryptor: nil); end + + sig { params(seal_data: String, cookie_password: String).returns(WorkOS::Session) } + def load(seal_data:, cookie_password:); end + + sig do + params( + seal_data: String, + cookie_password: String, + include_expired: T::Boolean, + claim_extractor: T.nilable(T.proc.params(decoded: T::Hash[String, T.untyped]).returns(T.nilable(T::Hash[Symbol, T.untyped]))) + ).returns(T.any(WorkOS::SessionManager::AuthSuccess, WorkOS::SessionManager::AuthError)) + end + def authenticate(seal_data:, cookie_password:, include_expired: false, &claim_extractor); end + + sig do + params( + seal_data: String, + cookie_password: String, + organization_id: T.nilable(String) + ).returns(T.any(WorkOS::SessionManager::RefreshSuccess, WorkOS::SessionManager::RefreshError)) + end + def refresh(seal_data:, cookie_password:, organization_id: nil); end + + sig { params(data: T.any(String, T::Hash[T.untyped, T.untyped]), key: String).returns(String) } + def seal_data(data, key); end + + sig { params(sealed: String, key: String).returns(T.any(T::Hash[String, T.untyped], String)) } + def unseal_data(sealed, key); end + + sig do + params( + access_token: String, + refresh_token: String, + cookie_password: String, + user: T.untyped, + impersonator: T.untyped + ).returns(String) + end + def seal_session_from_auth_response(access_token:, refresh_token:, cookie_password:, user: nil, impersonator: nil); end + + sig { params(access_token: String, verify_expiration: T::Boolean).returns(T::Hash[String, T.untyped]) } + def decode_jwt(access_token, verify_expiration: true); end + + sig { params(now: Time).returns(T::Hash[String, T.untyped]) } + def fetch_jwks(now: Time.now); end + end +end diff --git a/rbi/workos/types/api_response.rbi b/rbi/workos/types/api_response.rbi new file mode 100644 index 00000000..375f9049 --- /dev/null +++ b/rbi/workos/types/api_response.rbi @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + module Types + class ApiResponse + sig { returns(Integer) } + def http_status; end + + sig { returns(T::Hash[String, String]) } + def http_headers; end + + sig { returns(T.nilable(String)) } + def request_id; end + + sig do + params( + http_status: Integer, + http_headers: T::Hash[String, String], + request_id: T.nilable(String) + ).returns(WorkOS::Types::ApiResponse) + end + def self.new(http_status:, http_headers:, request_id:); end + end + end +end diff --git a/rbi/workos/types/base_model.rbi b/rbi/workos/types/base_model.rbi new file mode 100644 index 00000000..726391dd --- /dev/null +++ b/rbi/workos/types/base_model.rbi @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + module Types + class BaseModel + include WorkOS::HashProvider + + sig { returns(T.nilable(WorkOS::Types::ApiResponse)) } + def last_response; end + + sig { params(value: T.nilable(WorkOS::Types::ApiResponse)).returns(T.nilable(WorkOS::Types::ApiResponse)) } + def last_response=(value); end + + sig { params(json: T.any(String, T::Hash[T.untyped, T.untyped])).returns(T::Hash[Symbol, T.untyped]) } + def self.normalize(json); end + end + end +end diff --git a/rbi/workos/types/list_struct.rbi b/rbi/workos/types/list_struct.rbi new file mode 100644 index 00000000..1b8fe05d --- /dev/null +++ b/rbi/workos/types/list_struct.rbi @@ -0,0 +1,89 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + module Types + class ListStruct + include Enumerable + + sig { returns(T::Array[T.untyped]) } + def data; end + + sig { params(value: T::Array[T.untyped]).returns(T::Array[T.untyped]) } + def data=(value); end + + sig { returns(T::Hash[String, T.untyped]) } + def list_metadata; end + + sig { params(value: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) } + def list_metadata=(value); end + + sig { returns(T.nilable(T.proc.params(cursor: String).returns(WorkOS::Types::ListStruct))) } + def fetch_next; end + + sig { params(value: T.nilable(T.proc.params(cursor: String).returns(WorkOS::Types::ListStruct))).returns(T.nilable(T.proc.params(cursor: String).returns(WorkOS::Types::ListStruct))) } + def fetch_next=(value); end + + sig { returns(T.nilable(T.proc.params(cursor: String).returns(WorkOS::Types::ListStruct))) } + def fetch_previous; end + + sig { params(value: T.nilable(T.proc.params(cursor: String).returns(WorkOS::Types::ListStruct))).returns(T.nilable(T.proc.params(cursor: String).returns(WorkOS::Types::ListStruct))) } + def fetch_previous=(value); end + + sig { returns(T::Hash[Symbol, T.untyped]) } + def filters; end + + sig { params(value: T::Hash[Symbol, T.untyped]).returns(T::Hash[Symbol, T.untyped]) } + def filters=(value); end + + sig { returns(T.nilable(WorkOS::Types::ApiResponse)) } + def last_response; end + + sig { params(value: T.nilable(WorkOS::Types::ApiResponse)).returns(T.nilable(WorkOS::Types::ApiResponse)) } + def last_response=(value); end + + sig do + params( + data: T::Array[T.untyped], + list_metadata: T::Hash[String, T.untyped], + fetch_next: T.nilable(T.proc.params(cursor: String).returns(WorkOS::Types::ListStruct)), + fetch_previous: T.nilable(T.proc.params(cursor: String).returns(WorkOS::Types::ListStruct)), + filters: T::Hash[Symbol, T.untyped] + ).void + end + def initialize(data:, list_metadata:, fetch_next: nil, fetch_previous: nil, filters: {}); end + + sig do + params( + response: Net::HTTPResponse, + model: T.nilable(T.class_of(WorkOS::Types::BaseModel)), + filters: T::Hash[Symbol, T.untyped], + fetch_next: T.nilable(T.proc.params(cursor: String).returns(WorkOS::Types::ListStruct)), + fetch_previous: T.nilable(T.proc.params(cursor: String).returns(WorkOS::Types::ListStruct)) + ).returns(WorkOS::Types::ListStruct) + end + def self.from_response(response, model: nil, filters: {}, fetch_next: nil, fetch_previous: nil); end + + sig { params(block: T.proc.params(item: T.untyped).void).returns(T.untyped) } + def each(&block); end + + sig { returns(T::Boolean) } + def has_more?; end + + sig { returns(T.nilable(WorkOS::Types::ListStruct)) } + def next_page; end + + sig { returns(T.nilable(WorkOS::Types::ListStruct)) } + def previous_page; end + + sig { params(block: T.proc.params(item: T.untyped).void).returns(T.untyped) } + def auto_paging_each(&block); end + + sig { params(block: T.proc.params(page: WorkOS::Types::ListStruct).void).returns(T.untyped) } + def each_page(&block); end + end + end +end diff --git a/rbi/workos/types/request_options.rbi b/rbi/workos/types/request_options.rbi new file mode 100644 index 00000000..dc92c319 --- /dev/null +++ b/rbi/workos/types/request_options.rbi @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + module Types + class RequestOptions + end + end +end diff --git a/rbi/workos/util.rbi b/rbi/workos/util.rbi new file mode 100644 index 00000000..8fce5436 --- /dev/null +++ b/rbi/workos/util.rbi @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + module Util + sig { params(value: T.any(String, Symbol, Integer)).returns(String) } + def self.encode_path(value); end + end +end diff --git a/rbi/workos/vault.rbi b/rbi/workos/vault.rbi new file mode 100644 index 00000000..24cb2709 --- /dev/null +++ b/rbi/workos/vault.rbi @@ -0,0 +1,137 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Vault + DEFAULT_RESPONSE_LIMIT = T.let(10, Integer) + + class DataKey < T::Struct + const :id, T.nilable(String) + const :key, T.nilable(String) + + sig { params(hash: T::Hash[String, T.untyped]).returns(WorkOS::Vault::DataKey) } + def self.from_response(hash); end + end + + class DataKeyPair < T::Struct + const :context, T.untyped + const :data_key, WorkOS::Vault::DataKey + const :encrypted_keys, T.nilable(String) + + sig { params(hash: T::Hash[String, T.untyped]).returns(WorkOS::Vault::DataKeyPair) } + def self.from_response(hash); end + end + + class ObjectUpdateBy < T::Struct + const :id, T.nilable(String) + const :name, T.nilable(String) + + sig { params(hash: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(WorkOS::Vault::ObjectUpdateBy)) } + def self.from_hash(hash); end + end + + class ObjectMetadata < T::Struct + const :context, T.untyped + const :environment_id, T.nilable(String) + const :id, T.nilable(String) + const :key_id, T.nilable(String) + const :updated_at, T.nilable(String) + const :updated_by, T.nilable(WorkOS::Vault::ObjectUpdateBy) + const :version_id, T.nilable(String) + + sig { params(hash: T::Hash[String, T.untyped]).returns(WorkOS::Vault::ObjectMetadata) } + def self.from_hash(hash); end + end + + class VaultObject < T::Struct + const :id, T.nilable(String) + const :name, T.nilable(String) + const :value, T.nilable(String) + const :metadata, T.nilable(WorkOS::Vault::ObjectMetadata) + + sig { params(hash: T::Hash[String, T.untyped]).returns(WorkOS::Vault::VaultObject) } + def self.from_hash(hash); end + end + + class ObjectDigest < T::Struct + const :id, T.nilable(String) + const :name, T.nilable(String) + const :updated_at, T.nilable(String) + + sig { params(hash: T::Hash[String, T.untyped]).returns(WorkOS::Vault::ObjectDigest) } + def self.from_hash(hash); end + end + + class ObjectVersion < T::Struct + const :id, T.nilable(String) + const :created_at, T.nilable(String) + const :current_version, T.nilable(T::Boolean) + + sig { params(hash: T::Hash[String, T.untyped]).returns(WorkOS::Vault::ObjectVersion) } + def self.from_hash(hash); end + end + + sig { params(client: WorkOS::Client).void } + def initialize(client); end + + sig { params(object_id: String, request_options: T::Hash[Symbol, T.untyped]).returns(WorkOS::Vault::VaultObject) } + def read_object(object_id:, request_options: {}); end + + sig { params(name: String, request_options: T::Hash[Symbol, T.untyped]).returns(WorkOS::Vault::VaultObject) } + def read_object_by_name(name:, request_options: {}); end + + sig { params(object_id: String, request_options: T::Hash[Symbol, T.untyped]).returns(WorkOS::Vault::VaultObject) } + def get_object_metadata(object_id:, request_options: {}); end + + sig do + params( + limit: Integer, + before: T.nilable(String), + after: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(T::Array[WorkOS::Vault::ObjectDigest]) + end + def list_objects(limit: DEFAULT_RESPONSE_LIMIT, before: nil, after: nil, request_options: {}); end + + sig { params(object_id: String, request_options: T::Hash[Symbol, T.untyped]).returns(T::Array[WorkOS::Vault::ObjectVersion]) } + def list_object_versions(object_id:, request_options: {}); end + + sig do + params( + name: String, + value: String, + key_context: T::Hash[String, T.untyped], + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Vault::ObjectMetadata) + end + def create_object(name:, value:, key_context:, request_options: {}); end + + sig do + params( + object_id: String, + value: String, + version_check: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Vault::VaultObject) + end + def update_object(object_id:, value:, version_check: nil, request_options: {}); end + + sig { params(object_id: String, request_options: T::Hash[Symbol, T.untyped]).void } + def delete_object(object_id:, request_options: {}); end + + sig { params(key_context: T::Hash[String, T.untyped], request_options: T::Hash[Symbol, T.untyped]).returns(WorkOS::Vault::DataKeyPair) } + def create_data_key(key_context:, request_options: {}); end + + sig { params(keys: String, request_options: T::Hash[Symbol, T.untyped]).returns(WorkOS::Vault::DataKey) } + def decrypt_data_key(keys:, request_options: {}); end + + sig { params(data: String, key_context: T::Hash[String, T.untyped], associated_data: T.nilable(String)).returns(String) } + def encrypt(data:, key_context:, associated_data: nil); end + + sig { params(encrypted_data: String, associated_data: T.nilable(String)).returns(String) } + def decrypt(encrypted_data:, associated_data: nil); end + end +end From 0710b894334bbc9a74ab104b97c21b8ca89dbf2d Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Mon, 20 Apr 2026 09:36:21 -0400 Subject: [PATCH 12/12] update documentation --- docs/V7_MIGRATION_GUIDE.md | 145 +++++++++++++++++++++++++++++-- lib/workos/base_client.rb | 25 ++++-- lib/workos/configuration.rb | 10 ++- lib/workos/session.rb | 20 ++++- lib/workos/session_manager.rb | 34 +++++--- lib/workos/types/api_response.rb | 10 +++ lib/workos/types/base_model.rb | 4 - lib/workos/types/list_struct.rb | 11 ++- lib/workos/vault.rb | 8 +- lib/workos/webhooks.rb | 42 +++++++-- 10 files changed, 264 insertions(+), 45 deletions(-) create mode 100644 lib/workos/types/api_response.rb diff --git a/docs/V7_MIGRATION_GUIDE.md b/docs/V7_MIGRATION_GUIDE.md index cde8d445..ed9e1873 100644 --- a/docs/V7_MIGRATION_GUIDE.md +++ b/docs/V7_MIGRATION_GUIDE.md @@ -17,7 +17,6 @@ The biggest change is architectural: the SDK is now centered around an instantia ```ruby require "workos" - require "workos/configuration" WorkOS.configure do |config| config.api_key = ENV.fetch("WORKOS_API_KEY") @@ -97,6 +96,7 @@ Methods now consistently accept: ```ruby request_options: { + api_key: "sk_...", # per-request API key override (useful for multi-tenant) timeout: 10, base_url: "https://api.workos.com", max_retries: 1, @@ -157,13 +157,30 @@ After: ```ruby WorkOS.configure do |config| config.api_key = ENV.fetch("WORKOS_API_KEY") - config.base_url = "https://api.workos.com" + config.base_url = "https://api.workos.com" # default config.client_id = ENV["WORKOS_CLIENT_ID"] - config.timeout = 30 - config.max_retries = 2 + config.timeout = 30 # default; seconds per request + config.max_retries = 2 # default; set to 0 to disable retries + config.logger = Logger.new($stdout) # optional; enables request logging + config.log_level = :info # optional; :debug, :info, :warn, :error end ``` +**Note:** In v6, `Configuration` auto-populated `api_key` from `ENV["WORKOS_API_KEY"]` (and legacy `ENV["WORKOS_KEY"]`). In v7 you must set `config.api_key` explicitly. + +#### Fork safety: `reset_client` and `shutdown` + +If you run a forking web server (Puma, Unicorn), reset the cached client in the worker boot hook to avoid sharing sockets across forked processes: + +```ruby +# config/puma.rb +on_worker_boot do + WorkOS.reset_client +end +``` + +If you manage your own `WorkOS::Client` instance, call `client.shutdown` before forking to close persistent connections on the current fiber/thread. + #### Direct module-style service access is no longer the default integration pattern Code like this should be removed: @@ -267,6 +284,23 @@ Review all usages of: - `authenticate_with_refresh_token` - `authenticate_with_magic_auth` - `authenticate_with_email_verification` +- `authenticate_with_totp` +- `authenticate_with_organization_selection` +- `authenticate_with_device_code` +- `authenticate_with_code_pkce` (hand-maintained) + +#### `get_jwks_url` signature changed + +`get_jwks_url` changed from a positional argument to a keyword argument: + +```ruby +# Before +url = WorkOS::UserManagement.get_jwks_url("client_123") + +# After +url = client.user_management.get_jwks_url(client_id: "client_123") +# client_id defaults to the client instance's client_id if omitted +``` #### Authorization URL helpers were renamed @@ -317,11 +351,15 @@ If your code expects a raw string or hash, check the return type again. Examples: - `WorkOS::AuthenticationResponse` -> `WorkOS::AuthenticateResponse` +- `WorkOS::RefreshAuthenticationResponse` -> folded into `WorkOS::AuthenticateResponse` +- `WorkOS::ProfileAndToken` -> `WorkOS::SSOTokenResponse` - `WorkOS::Factor` -> `WorkOS::AuthenticationFactor` - `WorkOS::Challenge` -> `WorkOS::AuthenticationChallenge` - `WorkOS::VerifyChallenge` -> `WorkOS::AuthenticationChallengeVerifyResponse` +- `WorkOS::AuthenticationFactorAndChallenge` -> `WorkOS::AuthenticationFactorEnrolled` (factor fields) + `WorkOS::AuthenticationChallenge` (challenge fields) +- `WorkOS::WorkOSError` -> `WorkOS::Error` -If your code imports, type-checks, or pattern matches on these classes, update those references. +If your code imports, type-checks, or pattern matches on these classes, update those references. In particular, any `rescue WorkOS::WorkOSError` must become `rescue WorkOS::Error`. #### Response models no longer inherit from `Hash` @@ -353,6 +391,7 @@ Update call sites accordingly: - Replace `user.to_hash` with `user.to_h`. - If you relied on passing a model into `**splat` or `Hash#merge` (which used the implicit `to_hash` coercion), call `.to_h` explicitly: `merge(user.to_h)`, `some_method(**user.to_h)`. - If you called `.to_h` and expected a JSON string, use `.to_json` instead. +- If you passed a model to `JSON.generate(user)`, use `JSON.generate(user.to_h)` instead -- `JSON.generate` no longer traverses hash keys on models. - Any `rescue`/log/assertion that inspects a model with `is_a?(Hash)` needs to be updated. The `DeprecatedHashWrapper` class and its deprecation warnings have been removed. @@ -387,8 +426,10 @@ end Important differences: +- the base error class was renamed from `WorkOS::WorkOSError` to `WorkOS::Error` -- any `rescue WorkOS::WorkOSError` must be updated - transport failures now raise `WorkOS::APIConnectionError` - the old `WorkOS::TimeoutError` is no longer part of the new error surface +- the old `e.data` field is now `e.body`, and `e.errors`, `e.error_description`, `e.retry_after` were removed - the old extra fields like `retry_after`, `errors`, `error_description`, and `data` are not exposed the same way If your code rescues specific exception types or reads fields from exceptions, review every rescue path. @@ -419,6 +460,41 @@ end This is mostly an improvement, but if you implemented your own pagination assumptions around the old response shape, test those code paths again. +`ListStruct` no longer masquerades as a `Hash`. If any caller did `result.is_a?(Hash)` or `result[:data]` on a list response, use `result.data` and `result.list_metadata` instead. + +Additional pagination helpers available in v7: + +- `result.next_page` / `result.previous_page` -- programmatic cursor walks (returns a new `ListStruct` or `nil`) +- `result.each_page { |page| ... }` -- iterate one page at a time (useful for bulk upserts) +- `result.has_more?` -- check if a next page exists +- Some list endpoints now accept `order: "normal"` as a third option alongside `"asc"` / `"desc"` (descending with reversed cursor semantics) + +### Webhook verification + +Webhook signature verification moved from module-style calls to the client instance. + +Before: + +```ruby +event = WorkOS::Webhooks.construct_event( + payload: request.body.read, + sig_header: request.headers["WorkOS-Signature"], + secret: ENV["WORKOS_WEBHOOK_SECRET"] +) +``` + +After: + +```ruby +event = client.webhooks.construct_event( + payload: request.body.read, + sig_header: request.headers["WorkOS-Signature"], + secret: ENV["WORKOS_WEBHOOK_SECRET"] +) +``` + +The same applies to `verify_event`, `verify_header`, `compute_signature`, and `parse_signature_header`. All are now instance methods on `client.webhooks`. + ### AuthKit sessions and cookies Session management was one of the largest refactors in v7. The old `WorkOS::Session`, the `session:` kwarg on `authenticate_with_*`, and the class-level `seal_data` / `unseal_data` helpers were all replaced by a dedicated `WorkOS::SessionManager` on the client. The behavior is similar, but the surface area, return types, parameter names, and reason strings all changed. @@ -498,6 +574,8 @@ Notable changes: WorkOS::SessionManager.new(client, encryptor: custom_encryptor) ``` + **Note:** Calling `client.session_manager(encryptor: x)` replaces the cached manager instance. Call it once at boot, or construct `WorkOS::SessionManager.new(client, encryptor: ...)` explicitly if you need per-request encryptors. + #### Authenticating a loaded session The return type changed from a `Hash` to a typed result object. **Any code that reads `result[:authenticated]` or `result[:reason]` needs to be updated.** @@ -641,11 +719,62 @@ sealed = client.session_manager.seal_data(payload, key) client.session_manager.unseal_data(sealed, key) ``` -A custom encryptor passed to `client.session_manager(encryptor: ...)` is used by these helpers as well. +A custom encryptor passed to `client.session_manager(encryptor: ...)` is used by these helpers as well. A custom encryptor must respond to `seal(data, key) -> String` and `unseal(sealed_string, key) -> Hash`. The `encryptor` gem is no longer a dependency; if your `Gemfile.lock` pinned it transitively, you may remove it unless your custom encryptor requires it. #### Deprecations to clean up -- `WorkOS::SessionManager::SEAL_VERSION` is deprecated in favor of `WorkOS::Encryptors::AesGcm::SEAL_VERSION`. Update any code reading the constant off the manager. -- `WorkOS::Session.new(...)` is still callable but its constructor signature changed (`Session.new(manager, seal_data:, cookie_password:)`). Prefer `client.session_manager.load(...)` — direct instantiation is no longer part of the public contract. +- `WorkOS::SessionManager::SEAL_VERSION` has been removed. Use `WorkOS::Encryptors::AesGcm::SEAL_VERSION` if you need the seal-version constant. +- Direct instantiation of `WorkOS::Session.new` now requires a `SessionManager` instance as its first positional argument and is not part of the public contract. Always use `client.session_manager.load(seal_data:, cookie_password:)` instead. If your app relies on session sealing or cookie refresh behavior, verify those flows carefully in integration tests. + +--- + +## New in v7 + +### Device code flow + +v7 adds device-code authorization via two methods: + +```ruby +# Start device authorization +device = client.user_management.authorize_device(redirect_uri: "https://app.example.com/callback") +device.device_code # poll with this +device.user_code # display to the user +device.interval # polling interval + +# Poll for completion +response = client.user_management.authenticate_with_device_code( + device_code: device.device_code +) +``` + +### Public / PKCE clients + +If you're running in a context that cannot store an API key (browser, mobile, CLI), construct a public client: + +```ruby +client = WorkOS::PublicClient.create(client_id: "client_...") +url, verifier, state = client.user_management.get_authorization_url_with_pkce( + redirect_uri: "https://app.example.com/callback" +) +# user authenticates, you get `code` on the callback +response = client.user_management.authenticate_with_code_pkce( + code: code, code_verifier: verifier +) +``` + +### Observability: `last_response` on all responses + +Every model and list response now exposes `last_response` with HTTP metadata: + +```ruby +org = client.organizations.get_organization(id: "org_123") +org.last_response.http_status # => 200 +org.last_response.request_id # => "req_..." +org.last_response.http_headers # => { "x-request-id" => "...", ... } + +# Also available on paginated responses: +result = client.organizations.list_organizations +result.last_response.http_status +``` diff --git a/lib/workos/base_client.rb b/lib/workos/base_client.rb index 8c1d1dde..d5192d9e 100644 --- a/lib/workos/base_client.rb +++ b/lib/workos/base_client.rb @@ -12,6 +12,19 @@ module WorkOS # Instance-scoped HTTP runtime that implements request execution, # retry policy with exponential backoff + jitter, error translation, # and per-request option overrides. + # + # @example Create a client with custom settings + # client = WorkOS::Client.new( + # api_key: "sk_...", + # client_id: "client_...", + # timeout: 60, + # max_retries: 3, + # logger: Logger.new($stdout), + # log_level: :info + # ) + # + # @example Shut down connections before forking + # client.shutdown class BaseClient DEFAULT_BASE_URL = "https://api.workos.com" DEFAULT_TIMEOUT = 30 @@ -89,6 +102,7 @@ def delete_request(path:, auth: false, body: nil, params: {}, request_options: n # request_options twice. def request(method:, path:, auth: true, params: {}, body: nil, request_options: {}) raise ArgumentError, "unsupported method" unless %i[get post put patch delete].include?(method) + request_options = (request_options || {}).transform_keys(&:to_sym) req = case method when :get @@ -221,15 +235,11 @@ def thread_connections Fiber[:workos_connections] ||= {} end - def resolve_option(opts, key) - return nil unless opts.is_a?(Hash) - opts[key] || opts[key.to_s] - end - def build_request(klass, path, auth:, request_options:) + opts = request_options.is_a?(Hash) ? request_options : {} request = klass.new(path) if auth - key = resolve_option(request_options, :api_key) || @api_key + key = opts[:api_key] || opts["api_key"] || @api_key request["Authorization"] = "Bearer #{key}" if key && !key.empty? end request["User-Agent"] = USER_AGENT @@ -249,7 +259,8 @@ def apply_extra_headers(request, request_options) end def inject_idempotency_key(request, request_options) - key = resolve_option(request_options, :idempotency_key) + opts = request_options.is_a?(Hash) ? request_options : {} + key = opts[:idempotency_key] || opts["idempotency_key"] return if key.nil? || key.to_s.empty? request["Idempotency-Key"] ||= key diff --git a/lib/workos/configuration.rb b/lib/workos/configuration.rb index 8aaa5e31..a96f9e8f 100644 --- a/lib/workos/configuration.rb +++ b/lib/workos/configuration.rb @@ -2,7 +2,15 @@ # @oagen-ignore-file — hand-maintained runtime module WorkOS - # Simple holder for configuration parameters. + # Global configuration holder for `WorkOS.configure`. + # + # @example + # WorkOS.configure do |config| + # config.api_key = ENV.fetch("WORKOS_API_KEY") + # config.client_id = ENV["WORKOS_CLIENT_ID"] + # config.logger = Logger.new($stdout) + # config.log_level = :info + # end class Configuration attr_accessor :api_key, :base_url, :client_id, :timeout, :max_retries, :logger, :log_level diff --git a/lib/workos/session.rb b/lib/workos/session.rb index 809f8eec..d2d49d9b 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -8,7 +8,18 @@ require "uri" module WorkOS - # The Session class provides helper methods for working with WorkOS sessions + # Wraps a sealed session cookie for authentication, refresh, and logout. + # Constructed by {SessionManager#load}; not intended for direct instantiation. + # + # @example Authenticate and refresh + # session = client.session_manager.load(seal_data: cookie, cookie_password: pw) + # result = session.authenticate + # if result.is_a?(SessionManager::AuthError) && result.reason == SessionManager::EXPIRED_JWT + # refresh = session.refresh + # end + # + # @example Build a logout URL + # url = session.get_logout_url(return_to: "https://app.example.com") class Session def initialize(manager, seal_data:, cookie_password:) raise ArgumentError, "cookie_password is required" if cookie_password.nil? || cookie_password.empty? @@ -74,16 +85,17 @@ def refresh(organization_id: nil, cookie_password: nil) end return SessionManager::RefreshError.new(authenticated: false, reason: SessionManager::INVALID_SESSION_COOKIE) unless session.is_a?(Hash) && session["refresh_token"] + # Uses auth: true (Bearer token) to match authenticate_with_refresh_token. + # client_id is included in the body as required by the OAuth2 token exchange. body = { "grant_type" => "refresh_token", "client_id" => @client.client_id, - "client_secret" => @client.api_key, "refresh_token" => session["refresh_token"], "session" => {"seal_session" => true, "cookie_password" => effective_password} } body["organization_id"] = organization_id if organization_id - response = @client.request(method: :post, path: "/user_management/authenticate", auth: false, body: body) + response = @client.request(method: :post, path: "/user_management/authenticate", auth: true, body: body) auth_response = JSON.parse(response.body) sealed = auth_response["sealed_session"].to_s @seal_data = sealed @@ -103,7 +115,7 @@ def refresh(organization_id: nil, cookie_password: nil) impersonator: auth_response["impersonator"], feature_flags: decoded["feature_flags"] ) - rescue WorkOS::Error => e + rescue WorkOS::AuthenticationError, WorkOS::InvalidRequestError => e SessionManager::RefreshError.new(authenticated: false, reason: e.message) end diff --git a/lib/workos/session_manager.rb b/lib/workos/session_manager.rb index 032c839b..7d787536 100644 --- a/lib/workos/session_manager.rb +++ b/lib/workos/session_manager.rb @@ -16,12 +16,25 @@ require "jwt" module WorkOS + # Manages sealed-session lifecycle: loading, authenticating, refreshing, + # and sealing sessions from authentication responses. + # + # @example Load and authenticate a session + # session = client.session_manager.load( + # seal_data: cookies["wos-session"], + # cookie_password: ENV["COOKIE_PASSWORD"] + # ) + # result = session.authenticate + # + # @example Seal a session from an auth response + # sealed = client.session_manager.seal_session_from_auth_response( + # access_token: response.access_token, + # refresh_token: response.refresh_token, + # cookie_password: ENV["COOKIE_PASSWORD"] + # ) class SessionManager JWK_ALGORITHMS = ["RS256"].freeze - # @deprecated Use {WorkOS::Encryptors::AesGcm::SEAL_VERSION} instead. - SEAL_VERSION = 0x01 - # H04 success / failure shapes — kept minimal & frozen. class AuthSuccess RESERVED_KEYS = [ @@ -48,6 +61,7 @@ def initialize( @impersonator = impersonator @feature_flags = feature_flags @custom_claims = normalize_custom_claims(custom_claims) + define_custom_claim_readers(@custom_claims) end def [](key) @@ -61,18 +75,16 @@ def to_h RESERVED_KEYS.to_h { |key| [key, public_send(key)] }.merge(@custom_claims) end - def method_missing(name, *args, &block) - return @custom_claims[name] if args.empty? && @custom_claims.key?(name) + private - super - end + def define_custom_claim_readers(claims) + claims.each_key do |key| + next if respond_to?(key) - def respond_to_missing?(name, include_private = false) - @custom_claims.key?(name) || super + define_singleton_method(key) { @custom_claims[key] } + end end - private - def normalize_custom_claims(custom_claims) return {} if custom_claims.nil? raise ArgumentError, "claim_extractor must return a Hash" unless custom_claims.is_a?(Hash) diff --git a/lib/workos/types/api_response.rb b/lib/workos/types/api_response.rb new file mode 100644 index 00000000..d1bcee13 --- /dev/null +++ b/lib/workos/types/api_response.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +# @oagen-ignore-file — hand-maintained runtime +module WorkOS + module Types + # Lightweight wrapper around the raw HTTP response, exposing status, + # headers, and request-id for observability without leaking Net::HTTP. + ApiResponse = Data.define(:http_status, :http_headers, :request_id) + end +end diff --git a/lib/workos/types/base_model.rb b/lib/workos/types/base_model.rb index edd1dafa..accc8126 100644 --- a/lib/workos/types/base_model.rb +++ b/lib/workos/types/base_model.rb @@ -13,10 +13,6 @@ module Types # # Subclasses declare HASH_ATTRS for serialization and implement their # own initialize(json) using normalize to parse input. - # Lightweight wrapper around the raw HTTP response, exposing status, - # headers, and request-id for observability without leaking Net::HTTP. - ApiResponse = Data.define(:http_status, :http_headers, :request_id) - class BaseModel include HashProvider diff --git a/lib/workos/types/list_struct.rb b/lib/workos/types/list_struct.rb index 9e15dde5..9f3c772d 100644 --- a/lib/workos/types/list_struct.rb +++ b/lib/workos/types/list_struct.rb @@ -12,7 +12,7 @@ module Types class ListStruct include Enumerable - attr_accessor :data, :list_metadata, :fetch_next, :fetch_previous, :filters + attr_accessor :data, :list_metadata, :fetch_next, :fetch_previous, :filters, :last_response def initialize(data:, list_metadata:, fetch_next: nil, fetch_previous: nil, filters: {}) @data = data || [] @@ -26,6 +26,7 @@ def initialize(data:, list_metadata:, fetch_next: nil, fetch_previous: nil, filt # an optional model class and wiring cursor-based auto-pagination. # # @param response [Net::HTTPResponse] Raw HTTP response with JSON body. + # `model.new` accepts a JSON String or a Hash (see {BaseModel.normalize}). # @param model [Class, nil] Model class whose `.new` accepts a Hash. # When nil, items are returned as raw Hashes. # @param filters [Hash] Filter state forwarded to the next page. @@ -38,13 +39,19 @@ def self.from_response(response, model: nil, filters: {}, fetch_next: nil, fetch parsed = JSON.parse(response.body) items = parsed["data"] || [] items = items.map { |item| model.new(item) } if model - new( + result = new( data: items, list_metadata: parsed["list_metadata"], filters: filters, fetch_next: fetch_next, fetch_previous: fetch_previous ) + result.last_response = ApiResponse.new( + http_status: response.code.to_i, + http_headers: response.each_header.to_h, + request_id: response["x-request-id"] + ) + result end # Iterates the current page only. Use `auto_paging_each` to span pages. diff --git a/lib/workos/vault.rb b/lib/workos/vault.rb index 2780f58d..75624c6b 100644 --- a/lib/workos/vault.rb +++ b/lib/workos/vault.rb @@ -14,8 +14,14 @@ module WorkOS # WorkOS Vault: KV secret storage, server-managed key wrapping, and # client-side AES-GCM encrypt/decrypt. # + # @example Store and retrieve a secret # client.vault.create_object(name: "api-key", value: "sk_...", key_context: { "tenant" => "t1" }) - # client.vault.encrypt(data: "plaintext", key_context: { "tenant" => "t1" }) + # obj = client.vault.read_object_by_name(name: "api-key") + # obj.value # => "sk_..." + # + # @example Client-side encrypt/decrypt + # encrypted = client.vault.encrypt(data: "plaintext", key_context: { "tenant" => "t1" }) + # client.vault.decrypt(encrypted_data: encrypted) class Vault DEFAULT_RESPONSE_LIMIT = 10 diff --git a/lib/workos/webhooks.rb b/lib/workos/webhooks.rb index 0344e08f..d2303d53 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -135,12 +135,33 @@ def delete_webhook_endpoint( # Verify a webhook signature and return a typed event struct. # - # @param payload [String] Raw webhook request body. - # @param sig_header [String] Value of the WorkOS-Signature header. - # @param secret [String] Webhook endpoint secret. - # @param tolerance [Integer] Maximum event age in seconds. - # @return [WorkOS::WebhookEvent] Typed event with .event, .data, .id, .created_at. - # @raise [WorkOS::SignatureVerificationError] if verification fails. + # Parses the `WorkOS-Signature` header, validates the HMAC-SHA256 + # signature against the endpoint secret, checks that the event + # timestamp is within the tolerance window, and returns a typed + # {WorkOS::WebhookEvent}. + # + # @example Rack / Sinatra + # post "/webhooks" do + # event = client.webhooks.construct_event( + # payload: request.body.read, + # sig_header: request.env["HTTP_WORKOS_SIGNATURE"], + # secret: ENV["WORKOS_WEBHOOK_SECRET"] + # ) + # case event.event + # when "user.created" then handle_user_created(event.data) + # end + # end + # + # @param payload [String] Raw webhook request body (must be the + # exact bytes received; do not re-serialize). + # @param sig_header [String] Value of the `WorkOS-Signature` header + # (format: `"t=, v1="`). + # @param secret [String] Webhook endpoint secret from the WorkOS dashboard. + # @param tolerance [Integer] Maximum event age in seconds (default: 180). + # Events older than this are rejected to guard against replay attacks. + # @return [WorkOS::WebhookEvent] Typed event with `.event`, `.data`, `.id`, `.created_at`. + # @raise [WorkOS::SignatureVerificationError] if the signature does not + # match, the header is malformed, or the timestamp exceeds the tolerance. def construct_event(payload:, sig_header:, secret:, tolerance: DEFAULT_TOLERANCE_SECONDS) raw = verify_event(payload: payload, sig_header: sig_header, secret: secret, tolerance: tolerance) WebhookEvent.new(raw) @@ -160,7 +181,14 @@ def verify_event(payload:, sig_header:, secret:, tolerance: DEFAULT_TOLERANCE_SE JSON.parse(payload) end - # Verify the signature without deserializing. Raises on failure. + # Verify the webhook signature without deserializing the payload. + # + # @param payload [String] Raw webhook request body. + # @param sig_header [String] Value of the `WorkOS-Signature` header. + # @param secret [String] Webhook endpoint secret. + # @param tolerance [Integer] Maximum event age in seconds (default: 180). + # @return [true] Returns `true` on success. + # @raise [WorkOS::SignatureVerificationError] if verification fails. def verify_header(payload:, sig_header:, secret:, tolerance: DEFAULT_TOLERANCE_SECONDS) timestamp_ms, signature_hash = parse_signature_header(sig_header) max_age = tolerance.to_i