From d6c8c4f2f23eac813b200521481ff830290083b3 Mon Sep 17 00:00:00 2001 From: amadeo <165715960+amadeo-workos@users.noreply.github.com> Date: Thu, 25 Apr 2024 08:17:48 -0400 Subject: [PATCH 001/159] Add section about Beta releases in the README.md (#288) * Add section about Beta releases in the README.md * Improvement to README.md * Update README.md --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index d365e4b2..47758011 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,19 @@ end For our SDKs WorkOS follows a Semantic Versioning ([SemVer](https://semver.org/)) process where all releases will have a version X.Y.Z (like 1.0.0) pattern wherein Z would be a bug fix (e.g., 1.0.1), Y would be a minor release (1.1.0) and X would be a major release (2.0.0). We permit any breaking changes to only be released in major versions and strongly recommend reading changelogs before making any major version upgrades. +## Beta Releases + +WorkOS has features in Beta that can be accessed via Beta releases. We would love for you to try these +and share feedback with us before these features reach general availability (GA). To install a Beta version, +please follow the [installation steps](#installation) above using the Beta release version. + +> Note: there can be breaking changes between Beta versions. Therefore, we recommend pinning the package version to a +> specific version. This way you can install the same version each time without breaking changes unless you are +> intentionally looking for the latest Beta version. + +We highly recommend keeping an eye on when the Beta feature you are interested in goes from Beta to stable so that you +can move to using the stable version. + ## More Information * [Single Sign-On Guide](https://workos.com/docs/sso/guide) From 13f0dcfa1986764884b425551406d0786d861260 Mon Sep 17 00:00:00 2001 From: alisherry Date: Fri, 26 Apr 2024 16:00:05 -0400 Subject: [PATCH 002/159] Add additional spec for organization_id support in `events` (#289) * Add spec for organization * typo * rubocop --- lib/workos/events.rb | 2 +- spec/lib/workos/event_spec.rb | 22 +++++ .../list_events_with_organization_id.yml | 80 +++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml diff --git a/lib/workos/events.rb b/lib/workos/events.rb index 25e28d96..6c46ae0a 100644 --- a/lib/workos/events.rb +++ b/lib/workos/events.rb @@ -15,7 +15,7 @@ class << self # # @param [Hash] options An options hash # @option options [String] event The type of event - # retrieved. + # @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. diff --git a/spec/lib/workos/event_spec.rb b/spec/lib/workos/event_spec.rb index 8fc96503..d67d29ac 100644 --- a/spec/lib/workos/event_spec.rb +++ b/spec/lib/workos/event_spec.rb @@ -83,5 +83,27 @@ end end end + + context 'with the organization_id option' do + it 'forms the proper request to the API' do + request_args = [ + '/events?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( + organization_id: 'org_1234', + ) + + expect(events.data.size).to eq(1) + end + end + end end end diff --git a/spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml b/spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml new file mode 100644 index 00000000..1c9906fc --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml @@ -0,0 +1,80 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.workos.com/events?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 From f9035ff1e0860f2e0245edcca2ac54fcafafa67f Mon Sep 17 00:00:00 2001 From: alisherry Date: Mon, 29 Apr 2024 13:47:13 -0400 Subject: [PATCH 003/159] Bump version (#290) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 82bba0eb..56ce71d0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (4.2.1) + workos (4.3.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 88ce2c29..d83136f1 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '4.2.1' + VERSION = '4.3.0' end From 2766178ee86a1611e55c66739a972a6f7ad20685 Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Tue, 30 Apr 2024 16:45:17 -0700 Subject: [PATCH 004/159] Add `domain_data` to Organizations Create and Update methods to replace `domains` (#291) * Add `domain_data` and mark `domains` as deprecated * Fix development warnings and other test noise * Rubocop fixes * Replace with `any_args` These assertions don't really care about the internal behavior of `WorkOS::Deprecation`. * Rubocop --- lib/workos.rb | 1 + lib/workos/deprecation.rb | 16 ++++ lib/workos/mfa.rb | 5 +- lib/workos/organizations.rb | 28 ++++-- lib/workos/sso.rb | 4 +- spec/lib/workos/mfa_spec.rb | 21 +++-- spec/lib/workos/organizations_spec.rb | 53 ++++++++++++ .../organization/create_with_domain_data.yml | 82 ++++++++++++++++++ .../organization/create_with_domains.yml | 81 +++++++++++++++++ .../organization/create_without_domains.yml | 86 +++++++++++++++++++ .../{client_spec.rb => client.rb} | 0 11 files changed, 360 insertions(+), 17 deletions(-) create mode 100644 lib/workos/deprecation.rb create mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_with_domain_data.yml create mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_with_domains.yml create mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_without_domains.yml rename spec/support/shared_examples/{client_spec.rb => client.rb} (100%) diff --git a/lib/workos.rb b/lib/workos.rb index d8d6507f..2ab6c5ee 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -49,6 +49,7 @@ def self.key 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' diff --git a/lib/workos/deprecation.rb b/lib/workos/deprecation.rb new file mode 100644 index 00000000..3c348349 --- /dev/null +++ b/lib/workos/deprecation.rb @@ -0,0 +1,16 @@ +# 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/mfa.rb b/lib/workos/mfa.rb index 1f3d43ac..3cf729c2 100644 --- a/lib/workos/mfa.rb +++ b/lib/workos/mfa.rb @@ -8,7 +8,8 @@ module WorkOS # MFA platform. You'll need a valid API key module MFA class << self - include Client + include Client, Deprecation + def delete_factor(id:) response = execute_request( request: delete_request( @@ -101,7 +102,7 @@ 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, diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index 2c1282c2..0760e2f8 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -7,6 +7,7 @@ module WorkOS module Organizations class << self include Client + include Deprecation # Retrieve a list of organizations that have connections configured # within your WorkOS dashboard. @@ -70,16 +71,28 @@ def get_organization(id:) # Create an organization # - # @param [Array] domains List of domains that belong to the - # organization + # @param [Array] domain_data List of domain hashes describing an orgnaization 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 [Array] domains List of domains that belong to the organization. + # Deprecated: Use domain_data instead. # @param [String] name A unique, descriptive name for the organization # @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. # @param [String] idempotency_key An idempotency key - def create_organization(domains:, name:, allow_profiles_outside_organization: nil, idempotency_key: nil) + def create_organization( + domain_data: nil, + domains: nil, + name:, + allow_profiles_outside_organization: nil, + idempotency_key: nil + ) + warn_deprecation '`domains` is deprecated. Use `domain_data` instead.' if domains + request = post_request( auth: true, body: { + domain_data: domain_data, domains: domains, name: name, allow_profiles_outside_organization: allow_profiles_outside_organization, @@ -97,12 +110,17 @@ def create_organization(domains:, name:, allow_profiles_outside_organization: ni # Update an organization # # @param [String] organization Organization unique identifier - # @param [Array] domains List of domains that belong to the - # organization + # @param [Array] domain_data List of domain hashes describing an orgnaization 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 [Array] domains List of domains that belong to the organization. + # Deprecated: Use domain_data instead. # @param [String] name A unique, descriptive name for the organization # @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. def update_organization(organization:, domains:, name:, allow_profiles_outside_organization: nil) + warn_deprecation '`domains` is deprecated. Use `domain_data` instead.' if domains + request = put_request( auth: true, body: { diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index 567544c8..698b9d1f 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -11,7 +11,7 @@ module WorkOS # @see https://docs.workos.com/sso/overview module SSO class << self - include Client + include Client, Deprecation PROVIDERS = WorkOS::Types::Provider::ALL @@ -65,7 +65,7 @@ def authorization_url( state: '' ) if domain - warn '[DEPRECATION] `domain` is deprecated. + warn_deprecation '[DEPRECATION] `domain` is deprecated. Please use `organization` instead.' end diff --git a/spec/lib/workos/mfa_spec.rb b/spec/lib/workos/mfa_spec.rb index 6262a72b..83fd89e5 100644 --- a/spec/lib/workos/mfa_spec.rb +++ b/spec/lib/workos/mfa_spec.rb @@ -130,14 +130,19 @@ describe '.verify_factor' do it 'throws a warning' do - expect do - VCR.use_cassette 'mfa/verify_challenge_generic_valid' do - described_class.verify_factor( - authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J', - code: '897792', - ) - end - end.to output("[DEPRECATION] `verify_factor` is deprecated. Please use `verify_challenge` instead.\n").to_stderr + 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 diff --git a/spec/lib/workos/organizations_spec.rb b/spec/lib/workos/organizations_spec.rb index c10c63fc..909c7b2c 100644 --- a/spec/lib/workos/organizations_spec.rb +++ b/spec/lib/workos/organizations_spec.rb @@ -18,6 +18,59 @@ 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 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 diff --git a/spec/support/fixtures/vcr_cassettes/organization/create_with_domain_data.yml b/spec/support/fixtures/vcr_cassettes/organization/create_with_domain_data.yml new file mode 100644 index 00000000..6d38c424 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/organization/create_with_domain_data.yml @@ -0,0 +1,82 @@ +--- +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/spec/support/fixtures/vcr_cassettes/organization/create_with_domains.yml b/spec/support/fixtures/vcr_cassettes/organization/create_with_domains.yml new file mode 100644 index 00000000..a08052e9 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/organization/create_with_domains.yml @@ -0,0 +1,81 @@ +--- +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/spec/support/fixtures/vcr_cassettes/organization/create_without_domains.yml b/spec/support/fixtures/vcr_cassettes/organization/create_without_domains.yml new file mode 100644 index 00000000..424ba948 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/organization/create_without_domains.yml @@ -0,0 +1,86 @@ +--- +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/spec/support/shared_examples/client_spec.rb b/spec/support/shared_examples/client.rb similarity index 100% rename from spec/support/shared_examples/client_spec.rb rename to spec/support/shared_examples/client.rb From f2ebd2fcdb639c7cf4ab9701f57ce89afa6f96c1 Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Wed, 1 May 2024 11:37:03 -0700 Subject: [PATCH 005/159] `v4.4.0` (#292) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 56ce71d0..653538cf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (4.3.0) + workos (4.4.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index d83136f1..3a0f7365 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '4.3.0' + VERSION = '4.4.0' end From 1255b3314d84e78579724bd7ab85c43642f48d6d Mon Sep 17 00:00:00 2001 From: Blair Lunceford <74257063+blairlunceford@users.noreply.github.com> Date: Fri, 3 May 2024 13:59:38 -0600 Subject: [PATCH 006/159] Add API changes for invitations and Magic Auth (#293) * Add events and API changes for invitations and Magic Auth * Update deprecation message --- lib/workos.rb | 1 + lib/workos/invitation.rb | 4 +- lib/workos/magic_auth.rb | 37 +++++++++ lib/workos/user_management.rb | 42 +++++++++- spec/lib/workos/user_management_spec.rb | 40 ++++++++++ .../create_magic_auth/valid.yml | 80 +++++++++++++++++++ .../user_management/get_invitation/valid.yml | 2 +- .../get_magic_auth/invalid.yml | 80 +++++++++++++++++++ .../user_management/get_magic_auth/valid.yml | 80 +++++++++++++++++++ .../list_invitations/with_after.yml | 2 +- .../list_invitations/with_before.yml | 2 +- .../list_invitations/with_limit.yml | 2 +- .../list_invitations/with_no_options.yml | 2 +- .../list_invitations/with_organization_id.yml | 2 +- .../revoke_invitation/valid.yml | 2 +- .../user_management/send_invitation/valid.yml | 2 +- 16 files changed, 370 insertions(+), 10 deletions(-) create mode 100644 lib/workos/magic_auth.rb create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml diff --git a/lib/workos.rb b/lib/workos.rb index 2ab6c5ee..16c01837 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -59,6 +59,7 @@ def self.key autoload :Factor, 'workos/factor' autoload :Impersonator, 'workos/impersonator' autoload :Invitation, 'workos/invitation' + autoload :MagicAuth, 'workos/magic_auth' autoload :MFA, 'workos/mfa' autoload :Organization, 'workos/organization' autoload :Organizations, 'workos/organizations' diff --git a/lib/workos/invitation.rb b/lib/workos/invitation.rb index a18f1c57..81b06327 100644 --- a/lib/workos/invitation.rb +++ b/lib/workos/invitation.rb @@ -7,7 +7,7 @@ module WorkOS class Invitation include HashProvider - attr_accessor :id, :email, :state, :accepted_at, :revoked_at, + attr_accessor :id, :email, :state, :accepted_at, :revoked_at, :accept_invitation_url, :expires_at, :token, :organization_id, :created_at, :updated_at def initialize(json) @@ -17,6 +17,7 @@ def initialize(json) @email = hash[:email] @state = hash[:state] @token = hash[:token] + @accept_invitation_url = hash[:accept_invitation_url] @organization_id = hash[:organization_id] @accepted_at = hash[:accepted_at] @revoked_at = hash[:revoked_at] @@ -31,6 +32,7 @@ def to_json(*) email: email, state: state, token: token, + accept_invitation_url: accept_invitation_url, organization_id: organization_id, accepted_at: accepted_at, revoked_at: revoked_at, diff --git a/lib/workos/magic_auth.rb b/lib/workos/magic_auth.rb new file mode 100644 index 00000000..e05aad12 --- /dev/null +++ b/lib/workos/magic_auth.rb @@ -0,0 +1,37 @@ +# 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/user_management.rb b/lib/workos/user_management.rb index 53472c2b..4720f5d1 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -31,7 +31,7 @@ class AuthFactorType end class << self - include Client + include Client, Deprecation PROVIDERS = WorkOS::UserManagement::Types::Provider::ALL AUTH_FACTOR_TYPES = WorkOS::UserManagement::Types::AuthFactorType::ALL @@ -537,12 +537,52 @@ def get_jwks_url(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, + ), + ) + + WorkOS::MagicAuth.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, + }, + auth: true, + ), + ) + + WorkOS::MagicAuth.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.' + response = execute_request( request: post_request( path: '/user_management/magic_auth/send', diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 09ed937f..11f17df6 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -618,6 +618,46 @@ 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::APIError, /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 diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml new file mode 100644 index 00000000..7f095046 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml @@ -0,0 +1,80 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml index 4cd2766c..8a287c2a 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml @@ -76,7 +76,7 @@ http_interactions: - 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","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' + 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/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml new file mode 100644 index 00000000..e7dd9544 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml @@ -0,0 +1,80 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml new file mode 100644 index 00000000..5ea68f1b --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml @@ -0,0 +1,80 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml index 1023acc2..e9dd5900 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml @@ -77,7 +77,7 @@ http_interactions: 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","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","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}' + 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/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml index 311c35de..069d63a0 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml @@ -77,7 +77,7 @@ http_interactions: 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","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","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}' + 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/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml index 0de8e454..b1eff258 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml @@ -77,7 +77,7 @@ http_interactions: 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","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","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","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}' + 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/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml index b86f264b..794b4fd0 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml @@ -77,7 +77,7 @@ http_interactions: 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","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","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","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","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","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":"before_id","after":null}}' + 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/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml index 4ab7f8fb..f8c9e2b3 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml @@ -77,7 +77,7 @@ http_interactions: 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","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}' + 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/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml index a50bf876..5770353e 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml @@ -76,7 +76,7 @@ http_interactions: - 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","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' + 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/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml index 9a0ed704..290ad88d 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml @@ -76,7 +76,7 @@ http_interactions: - 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","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' + 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 From cdf473b31e9ec04e0abe07df50e63a12aa23c5e7 Mon Sep 17 00:00:00 2001 From: Blair Lunceford <74257063+blairlunceford@users.noreply.github.com> Date: Fri, 3 May 2024 14:08:52 -0600 Subject: [PATCH 007/159] v4.5.0 (#294) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 653538cf..25fd77f4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (4.4.0) + workos (4.5.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 3a0f7365..b16ec8af 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '4.4.0' + VERSION = '4.5.0' end From fa1ce8240277a32efb860c1aeebc99664072d38f Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Tue, 21 May 2024 08:52:41 -0400 Subject: [PATCH 008/159] Add organization membership deactivate and reactivate API methods (#295) * Add organization membership deactivate and reactivate API methods. --- lib/workos/user_management.rb | 35 ++++++++- spec/lib/workos/user_management_spec.rb | 77 +++++++++++++++++++ .../deactivate_organization_membership.yml | 64 +++++++++++++++ .../with_statuses_option.yml | 64 +++++++++++++++ .../reactivate_organization_membership.yml | 64 +++++++++++++++ 5 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 4720f5d1..2b7716bd 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -748,7 +748,8 @@ def get_organization_membership(id:) # # @param [Hash] options # @option options [String] user_id The ID of the User. - # @option options [String] organization_id Filter Users by the organization they are members of. + # @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 @@ -816,6 +817,38 @@ def delete_organization_membership(id:) 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, + ), + ) + + 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, + ), + ) + + WorkOS::OrganizationMembership.new(response.body) + end + # Gets an Invitation # # @param [String] id The unique ID of the Invitation. diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 11f17df6..8e519bd7 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -933,6 +933,33 @@ 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 @@ -988,6 +1015,56 @@ 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 diff --git a/spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml b/spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml new file mode 100644 index 00000000..a83a8632 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml @@ -0,0 +1,64 @@ +--- +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"},"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/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml new file mode 100644 index 00000000..0fc4af43 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml @@ -0,0 +1,64 @@ +--- +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"},"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/spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml b/spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml new file mode 100644 index 00000000..ffa48a2a --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml @@ -0,0 +1,64 @@ +--- +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"},"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 From 6ea0004dd7dfef4fc388f6905206a3ee4b99d8d2 Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Tue, 21 May 2024 11:35:38 -0400 Subject: [PATCH 009/159] Bump to version 4.6.0. (#297) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 25fd77f4..d5494bbf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (4.5.0) + workos (4.6.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index b16ec8af..eec6aa03 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '4.5.0' + VERSION = '4.6.0' end From 0d4956de7bdd843653edc8e7336c1fe51c63269c Mon Sep 17 00:00:00 2001 From: Blair Lunceford <74257063+blairlunceford@users.noreply.github.com> Date: Fri, 24 May 2024 14:19:44 -0600 Subject: [PATCH 010/159] Add methods and events for email verification and password reset (#298) --- lib/workos.rb | 2 + lib/workos/email_verification.rb | 37 +++++++++ lib/workos/invitation.rb | 6 +- lib/workos/password_reset.rb | 37 +++++++++ lib/workos/user_management.rb | 54 +++++++++++++ spec/lib/workos/user_management_spec.rb | 65 +++++++++++++++ .../create_password_reset/valid.yml | 80 +++++++++++++++++++ .../get_email_verification/invalid.yml | 80 +++++++++++++++++++ .../get_email_verification/valid.yml | 80 +++++++++++++++++++ .../get_password_reset/invalid.yml | 80 +++++++++++++++++++ .../get_password_reset/valid.yml | 80 +++++++++++++++++++ 11 files changed, 600 insertions(+), 1 deletion(-) create mode 100644 lib/workos/email_verification.rb create mode 100644 lib/workos/password_reset.rb create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml diff --git a/lib/workos.rb b/lib/workos.rb index 16c01837..70c8b49b 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -54,6 +54,7 @@ def self.key autoload :DirectoryGroup, 'workos/directory_group' autoload :DirectorySync, 'workos/directory_sync' autoload :DirectoryUser, 'workos/directory_user' + autoload :EmailVerification, 'workos/email_verification' autoload :Event, 'workos/event' autoload :Events, 'workos/events' autoload :Factor, 'workos/factor' @@ -65,6 +66,7 @@ def self.key 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' diff --git a/lib/workos/email_verification.rb b/lib/workos/email_verification.rb new file mode 100644 index 00000000..8d205c94 --- /dev/null +++ b/lib/workos/email_verification.rb @@ -0,0 +1,37 @@ +# 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/invitation.rb b/lib/workos/invitation.rb index 81b06327..9e182a67 100644 --- a/lib/workos/invitation.rb +++ b/lib/workos/invitation.rb @@ -8,8 +8,9 @@ class Invitation include HashProvider attr_accessor :id, :email, :state, :accepted_at, :revoked_at, :accept_invitation_url, - :expires_at, :token, :organization_id, :created_at, :updated_at + :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) @@ -19,12 +20,14 @@ def initialize(json) @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(*) { @@ -34,6 +37,7 @@ def to_json(*) 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, diff --git a/lib/workos/password_reset.rb b/lib/workos/password_reset.rb new file mode 100644 index 00000000..be7db0cc --- /dev/null +++ b/lib/workos/password_reset.rb @@ -0,0 +1,37 @@ +# 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/user_management.rb b/lib/workos/user_management.rb index 2b7716bd..caabf1e7 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -650,6 +650,22 @@ def list_auth_factors(user_id:) ) 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, + ), + ) + + WorkOS::EmailVerification.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. @@ -686,6 +702,41 @@ def verify_email(user_id:, code:) WorkOS::UserResponse.new(response.body) 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, + ), + ) + + 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, + ), + ) + + 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. @@ -693,6 +744,9 @@ def verify_email(user_id:, code:) # # @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.' + request = post_request( path: '/user_management/password_reset/send', body: { diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 8e519bd7..ef2a38ba 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -736,6 +736,31 @@ 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::APIError, /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 @@ -804,6 +829,46 @@ 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::APIError, /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 diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml new file mode 100644 index 00000000..d6f523ed --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml @@ -0,0 +1,80 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml new file mode 100644 index 00000000..28003c8f --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml @@ -0,0 +1,80 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml new file mode 100644 index 00000000..41ade083 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml @@ -0,0 +1,80 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml new file mode 100644 index 00000000..27ca3be9 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml @@ -0,0 +1,80 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml new file mode 100644 index 00000000..031fa605 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml @@ -0,0 +1,80 @@ +--- +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 From d006d4924891400a6d7fec28e824f6998932e471 Mon Sep 17 00:00:00 2001 From: Blair Lunceford <74257063+blairlunceford@users.noreply.github.com> Date: Fri, 24 May 2024 14:54:52 -0600 Subject: [PATCH 011/159] v4.7.0 (#299) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d5494bbf..2b1f69a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (4.6.0) + workos (4.7.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index eec6aa03..4a4050cc 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '4.6.0' + VERSION = '4.7.0' end From 48baa8c3cffacdf8bb52ac35af8c06ac709dcf93 Mon Sep 17 00:00:00 2001 From: Blair Lunceford <74257063+blairlunceford@users.noreply.github.com> Date: Tue, 4 Jun 2024 07:26:52 -0600 Subject: [PATCH 012/159] Add find invitation by token method (#301) --- lib/workos/user_management.rb | 16 ++++ spec/lib/workos/user_management_spec.rb | 25 ++++++ .../find_invitation_by_token/invalid.yml | 80 +++++++++++++++++++ .../find_invitation_by_token/valid.yml | 80 +++++++++++++++++++ 4 files changed, 201 insertions(+) create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index caabf1e7..d616fb46 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -919,6 +919,22 @@ def get_invitation(id:) WorkOS::Invitation.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, + ), + ) + + WorkOS::Invitation.new(response.body) + end + # Retrieve a list of invitations. # # @param [Hash] options diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index ef2a38ba..1d9c4ed5 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -1155,6 +1155,31 @@ 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::APIError, /Invitation not found/) + end + end + end + end + describe '.list_invitations' do context 'with no options' do it 'returns invitations and metadata' do diff --git a/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml new file mode 100644 index 00000000..ada1c41d --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml @@ -0,0 +1,80 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml new file mode 100644 index 00000000..1fae0433 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml @@ -0,0 +1,80 @@ +--- +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 From c0a26bf745fb49ebaac7c5241e99d51188b886bb Mon Sep 17 00:00:00 2001 From: Maxwell Hammad Date: Tue, 4 Jun 2024 11:45:38 -0400 Subject: [PATCH 013/159] feat: add support for totp_secret (#300) * feat: add support for totp_secret * lint * bump version --- Gemfile.lock | 2 +- lib/workos/user_management.rb | 5 ++++- lib/workos/version.rb | 2 +- spec/lib/workos/user_management_spec.rb | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2b1f69a3..2de9ecaf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (4.7.0) + workos (4.8.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index d616fb46..d083b11a 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -603,9 +603,11 @@ def send_magic_auth_code(email:) # @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) + def enroll_auth_factor(user_id:, type:, totp_issuer: nil, totp_user: nil, totp_secret: nil) validate_auth_factor_type( type: type, ) @@ -617,6 +619,7 @@ def enroll_auth_factor(user_id:, type:, totp_issuer: nil, totp_user: nil) type: type, totp_issuer: totp_issuer, totp_user: totp_user, + totp_secret: totp_secret, }, auth: true, ), diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 4a4050cc..7cf0e2f1 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '4.7.0' + VERSION = '4.8.0' end diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 1d9c4ed5..85d1fb19 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -677,6 +677,7 @@ 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') From c3d70ba89545307cfdee65bc53ea70e7b7feaf9f Mon Sep 17 00:00:00 2001 From: Paul Asjes <108872335+PaulAsjes@users.noreply.github.com> Date: Thu, 6 Jun 2024 18:22:06 +0300 Subject: [PATCH 014/159] Add new error types and add data to error response (#303) * Add new error types and add data to error response * Shut up rubocop * Reverting this so ruby 2.7 still works * Added tests for client.rb * I said shut up rubocop --- lib/workos.rb | 3 + lib/workos/client.rb | 20 ++- lib/workos/errors.rb | 19 ++- spec/lib/workos/client.rb | 67 ++++++++++ spec/lib/workos/directory_sync_spec.rb | 10 +- spec/lib/workos/mfa_spec.rb | 6 +- spec/lib/workos/organizations_spec.rb | 4 +- spec/lib/workos/passwordless_spec.rb | 4 +- spec/lib/workos/sso_spec.rb | 4 +- spec/lib/workos/user_management_spec.rb | 36 ++--- .../base/execute_request_unauthenticated.yml | 126 +++++++++--------- 11 files changed, 199 insertions(+), 100 deletions(-) create mode 100644 spec/lib/workos/client.rb diff --git a/lib/workos.rb b/lib/workos.rb index 70c8b49b..03ecefc9 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -87,4 +87,7 @@ def self.key autoload :InvalidRequestError, '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/client.rb b/lib/workos/client.rb index a946b0e8..184856b2 100644 --- a/lib/workos/client.rb +++ b/lib/workos/client.rb @@ -86,7 +86,7 @@ def user_agent ].join('; ') end - # rubocop:disable Metrics/MethodLength, Metrics/AbcSize + # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity: def handle_error_response(response:) http_status = response.code.to_i json = JSON.parse(response.body) @@ -99,6 +99,9 @@ def handle_error_response(response:) 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( @@ -107,7 +110,7 @@ def handle_error_response(response:) request_id: response['x-request-id'], ) when 404 - raise APIError.new( + raise NotFoundError.new( message: json['message'], http_status: http_status, request_id: response['x-request-id'], @@ -118,12 +121,21 @@ def handle_error_response(response:) errors = extract_error(json['errors']) if json['errors'] message += " (#{errors})" if errors - raise InvalidRequestError.new( + 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'], @@ -132,7 +144,7 @@ def handle_error_response(response:) ) end end - # rubocop:enable Metrics/MethodLength, Metrics/AbcSize + # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity: private diff --git a/lib/workos/errors.rb b/lib/workos/errors.rb index d6b1f096..37e86730 100644 --- a/lib/workos/errors.rb +++ b/lib/workos/errors.rb @@ -7,6 +7,10 @@ class WorkOSError < StandardError attr_reader :request_id attr_reader :code attr_reader :errors + attr_reader :error + attr_reader :error_description + attr_reader :data + attr_reader :retry_after # rubocop:disable Metrics/ParameterLists def initialize( @@ -16,7 +20,9 @@ def initialize( http_status: nil, request_id: nil, code: nil, - errors: nil + errors: nil, + data: nil, + retry_after: nil ) @message = message @error = error @@ -25,6 +31,8 @@ def initialize( @request_id = request_id @code = code @errors = errors + @data = data + @retry_after = retry_after end # rubocop:enable Metrics/ParameterLists @@ -62,4 +70,13 @@ 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 end diff --git a/spec/lib/workos/client.rb b/spec/lib/workos/client.rb new file mode 100644 index 00000000..24d630a5 --- /dev/null +++ b/spec/lib/workos/client.rb @@ -0,0 +1,67 @@ +# 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/directory_sync_spec.rb b/spec/lib/workos/directory_sync_spec.rb index 786ac0b2..ded4ef20 100644 --- a/spec/lib/workos/directory_sync_spec.rb +++ b/spec/lib/workos/directory_sync_spec.rb @@ -171,7 +171,7 @@ expect do WorkOS::DirectorySync.get_directory(id: 'invalid') end.to raise_error( - WorkOS::APIError, + WorkOS::NotFoundError, "Status 404, Directory not found: 'invalid'. - request ID: ", ) end @@ -185,7 +185,7 @@ VCR.use_cassette('directory_sync/list_groups/with_no_options') do expect do WorkOS::DirectorySync.list_groups - end.to raise_error(WorkOS::InvalidRequestError) + end.to raise_error(WorkOS::UnprocessableEntityError) end end end @@ -319,7 +319,7 @@ VCR.use_cassette('directory_sync/list_users/with_no_options') do expect do WorkOS::DirectorySync.list_users - end.to raise_error(WorkOS::InvalidRequestError) + end.to raise_error(WorkOS::UnprocessableEntityError) end end end @@ -471,7 +471,7 @@ VCR.use_cassette('directory_sync/get_group_with_invalid_id') do expect do WorkOS::DirectorySync.get_group('invalid') - end.to raise_error(WorkOS::APIError) + end.to raise_error(WorkOS:: NotFoundError) end end end @@ -498,7 +498,7 @@ VCR.use_cassette('directory_sync/get_user_with_invalid_id') do expect do WorkOS::DirectorySync.get_user('invalid') - end.to raise_error(WorkOS::APIError) + end.to raise_error(WorkOS::NotFoundError) end end end diff --git a/spec/lib/workos/mfa_spec.rb b/spec/lib/workos/mfa_spec.rb index 83fd89e5..e13412ad 100644 --- a/spec/lib/workos/mfa_spec.rb +++ b/spec/lib/workos/mfa_spec.rb @@ -188,7 +188,7 @@ authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J', code: '897792', ) - end.to raise_error(WorkOS::InvalidRequestError) + end.to raise_error(WorkOS::UnprocessableEntityError) end end end @@ -201,7 +201,7 @@ authentication_challenge_id: 'auth_challenge_01FZ4YVRBMXP5ZM0A7BP4AJ12J', code: '897792', ) - end.to raise_error(WorkOS::InvalidRequestError) + end.to raise_error(WorkOS::UnprocessableEntityError) end end end @@ -264,7 +264,7 @@ described_class.get_factor( id: 'auth_factor_invalid', ) - end.to raise_error(WorkOS::APIError) + end.to raise_error(WorkOS::NotFoundError) end end end diff --git a/spec/lib/workos/organizations_spec.rb b/spec/lib/workos/organizations_spec.rb index 909c7b2c..7754d816 100644 --- a/spec/lib/workos/organizations_spec.rb +++ b/spec/lib/workos/organizations_spec.rb @@ -257,7 +257,7 @@ expect do described_class.get_organization(id: 'invalid') end.to raise_error( - WorkOS::APIError, + WorkOS::NotFoundError, 'Status 404, Not Found - request ID: ', ) end @@ -302,7 +302,7 @@ expect do described_class.delete_organization(id: 'invalid') end.to raise_error( - WorkOS::APIError, + WorkOS::NotFoundError, 'Status 404, Not Found - request ID: ', ) end diff --git a/spec/lib/workos/passwordless_spec.rb b/spec/lib/workos/passwordless_spec.rb index 38c6c628..d3d5fe19 100644 --- a/spec/lib/workos/passwordless_spec.rb +++ b/spec/lib/workos/passwordless_spec.rb @@ -32,7 +32,7 @@ expect do described_class.create_session(invalid_options) end.to raise_error( - WorkOS::InvalidRequestError, + WorkOS::UnprocessableEntityError, /Status 422, Validation failed \(email: email must be a string; type: type must be a valid enum value\)/, ) end @@ -66,7 +66,7 @@ expect do described_class.send_session('session_123') end.to raise_error( - WorkOS::InvalidRequestError, + WorkOS::UnprocessableEntityError, /Status 422, The passwordless session 'session_123' has expired or is invalid./, ) end diff --git a/spec/lib/workos/sso_spec.rb b/spec/lib/workos/sso_spec.rb index 9a1098bf..3dea8e32 100644 --- a/spec/lib/workos/sso_spec.rb +++ b/spec/lib/workos/sso_spec.rb @@ -618,7 +618,7 @@ expect do WorkOS::SSO.get_connection(id: 'invalid') end.to raise_error( - WorkOS::APIError, + WorkOS::NotFoundError, 'Status 404, Not Found - request ID: ', ) end @@ -645,7 +645,7 @@ expect do WorkOS::SSO.delete_connection(id: 'invalid') end.to raise_error( - WorkOS::APIError, + WorkOS::NotFoundError, 'Status 404, Not Found - request ID: ', ) end diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 85d1fb19..b55c209f 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -312,7 +312,7 @@ expect do described_class.create_user(email: '') end.to raise_error( - WorkOS::InvalidRequestError, + WorkOS::UnprocessableEntityError, /email_string_required/, ) end @@ -342,7 +342,7 @@ VCR.use_cassette 'user_management/update_user/invalid' do expect do described_class.update_user(id: 'invalid') - end.to raise_error(WorkOS::APIError, /User not found/) + end.to raise_error(WorkOS::NotFoundError, /User not found/) end end end @@ -367,7 +367,7 @@ VCR.use_cassette('user_management/delete_user/invalid') do expect do WorkOS::UserManagement.delete_user(id: 'invalid') - end.to raise_error(WorkOS::APIError, /User not found/) + end.to raise_error(WorkOS::NotFoundError, /User not found/) end end end @@ -400,7 +400,7 @@ 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::APIError, /User not found/) + end.to raise_error(WorkOS::NotFoundError, /User not found/) end end end @@ -512,7 +512,7 @@ client_id: 'client_123', email: 'test@workos.com', ) - end.to raise_error(WorkOS::APIError, /User not found/) + end.to raise_error(WorkOS::NotFoundError, /User not found/) end end end @@ -637,7 +637,7 @@ VCR.use_cassette('user_management/get_magic_auth/invalid') do expect do WorkOS::UserManagement.get_magic_auth(id: 'invalid') - end.to raise_error(WorkOS::APIError, /MagicAuth not found/) + end.to raise_error(WorkOS::NotFoundError, /MagicAuth not found/) end end end @@ -756,7 +756,7 @@ VCR.use_cassette('user_management/get_email_verification/invalid') do expect do WorkOS::UserManagement.get_email_verification(id: 'invalid') - end.to raise_error(WorkOS::APIError, /Email Verification not found/) + end.to raise_error(WorkOS::NotFoundError, /Email Verification not found/) end end end @@ -781,7 +781,7 @@ described_class.send_verification_email( user_id: 'bad_id', ) - end.to raise_error(WorkOS::APIError, /User not found/) + end.to raise_error(WorkOS::NotFoundError, /User not found/) end end end @@ -810,7 +810,7 @@ code: '659770', user_id: 'bad_id', ) - end.to raise_error(WorkOS::APIError, /User not found/) + end.to raise_error(WorkOS::NotFoundError, /User not found/) end end end @@ -849,7 +849,7 @@ VCR.use_cassette('user_management/get_password_reset/invalid') do expect do WorkOS::UserManagement.get_password_reset(id: 'invalid') - end.to raise_error(WorkOS::APIError, /Password Reset not found/) + end.to raise_error(WorkOS::NotFoundError, /Password Reset not found/) end end end @@ -893,7 +893,7 @@ password_reset_url: '', ) end.to raise_error( - WorkOS::InvalidRequestError, + WorkOS::UnprocessableEntityError, /password_reset_url_string_required/, ) end @@ -924,7 +924,7 @@ new_password: 'new_password', ) end.to raise_error( - WorkOS::APIError, + WorkOS::NotFoundError, /Could not locate user with provided token/, ) end @@ -1048,7 +1048,7 @@ expect do described_class.create_organization_membership(user_id: '', organization_id: '') end.to raise_error( - WorkOS::InvalidRequestError, + WorkOS::UnprocessableEntityError, /user_id_string_required/, ) end @@ -1075,7 +1075,7 @@ VCR.use_cassette('user_management/delete_organization_membership/invalid') do expect do WorkOS::UserManagement.delete_organization_membership(id: 'invalid') - end.to raise_error(WorkOS::APIError, /Organization Membership not found/) + end.to raise_error(WorkOS::NotFoundError, /Organization Membership not found/) end end end @@ -1150,7 +1150,7 @@ VCR.use_cassette('user_management/get_invitation/invalid') do expect do WorkOS::UserManagement.get_invitation(id: 'invalid') - end.to raise_error(WorkOS::APIError, /Invitation not found/) + end.to raise_error(WorkOS::NotFoundError, /Invitation not found/) end end end @@ -1175,7 +1175,7 @@ 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::APIError, /Invitation not found/) + end.to raise_error(WorkOS::NotFoundError, /Invitation not found/) end end end @@ -1346,7 +1346,7 @@ id: 'invalid_id', ) end.to raise_error( - WorkOS::APIError, + WorkOS::NotFoundError, /Invitation not found/, ) end @@ -1375,7 +1375,7 @@ session_id: 'session_01H5JQDV7R7ATEYZDEG0W5PRYS', ) end.to raise_error( - WorkOS::APIError, + WorkOS::NotFoundError, /Session not found/, ) end diff --git a/spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml b/spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml index ca4bbfa2..1e2acb5e 100644 --- a/spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml +++ b/spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml @@ -1,66 +1,66 @@ --- http_interactions: -- request: - method: post - uri: https://api.workos.com/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 + - 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 From 519531af4b726a7be78db1aaddda3c63bc305255 Mon Sep 17 00:00:00 2001 From: Ameesha Isaac Date: Thu, 6 Jun 2024 11:23:15 -0400 Subject: [PATCH 015/159] remove domain from directory query params (#259) --- lib/workos/directory_sync.rb | 2 -- spec/lib/workos/directory_sync_spec.rb | 23 ----------------------- 2 files changed, 25 deletions(-) diff --git a/lib/workos/directory_sync.rb b/lib/workos/directory_sync.rb index 999fdfce..0a652b8b 100644 --- a/lib/workos/directory_sync.rb +++ b/lib/workos/directory_sync.rb @@ -15,8 +15,6 @@ class << self # Retrieve directories. # # @param [Hash] options An options hash - # @option options [String] domain The domain of the directory to be - # retrieved. # @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 diff --git a/spec/lib/workos/directory_sync_spec.rb b/spec/lib/workos/directory_sync_spec.rb index ded4ef20..72856d6e 100644 --- a/spec/lib/workos/directory_sync_spec.rb +++ b/spec/lib/workos/directory_sync_spec.rb @@ -20,29 +20,6 @@ end end - context 'with domain option' do - it 'forms the proper request to the API' do - request_args = [ - '/directories?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 'directory_sync/list_directories/with_domain' do - directories = described_class.list_directories( - domain: 'foo-corp.com', - ) - - expect(directories.data.size).to eq(1) - end - end - end - context 'with search option' do it 'forms the proper request to the API' do request_args = [ From a2cabff26a235beaa98011a6b42eb5d569381a0e Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:23:33 -0400 Subject: [PATCH 016/159] Make events parameter required for list_events (#282) --- lib/workos/events.rb | 2 + spec/lib/workos/event_spec.rb | 23 ++++----- .../events/list_events_with_after.yml | 2 +- .../events/list_events_with_no_options.yml | 51 ++++++++++--------- .../events/list_events_with_range.yml | 2 +- 5 files changed, 41 insertions(+), 39 deletions(-) diff --git a/lib/workos/events.rb b/lib/workos/events.rb index 6c46ae0a..3f39e1dc 100644 --- a/lib/workos/events.rb +++ b/lib/workos/events.rb @@ -22,6 +22,8 @@ class << self # # @return [Hash] def list_events(options = {}) + raise ArgumentError, 'Events parameter is required.' if options[:events].nil? + response = execute_request( request: get_request( path: '/events', diff --git a/spec/lib/workos/event_spec.rb b/spec/lib/workos/event_spec.rb index d67d29ac..f07a29c9 100644 --- a/spec/lib/workos/event_spec.rb +++ b/spec/lib/workos/event_spec.rb @@ -5,16 +5,11 @@ describe '.list_events' do context 'with no options' do - it 'returns events and metadata' do - expected_metadata = { - 'after' => nil, - } - + it 'raises ArgumentError' do VCR.use_cassette 'events/list_events_with_no_options' do - events = described_class.list_events - - expect(events.data.size).to eq(1) - expect(events.list_metadata).to eq(expected_metadata) + expect do + described_class.list_events + end.to raise_error(ArgumentError) end end end @@ -44,7 +39,7 @@ context 'with the after option' do it 'forms the proper request to the API' do request_args = [ - '/events?after=event_01FGCPNV312FHFRCX0BYWHVSE1', + '/events?after=event_01FGCPNV312FHFRCX0BYWHVSE1&events=dsync.user.created', 'Content-Type' => 'application/json' ] @@ -54,7 +49,10 @@ and_return(expected_request) VCR.use_cassette 'events/list_events_with_after' do - events = described_class.list_events(after: 'event_01FGCPNV312FHFRCX0BYWHVSE1') + events = described_class.list_events( + after: 'event_01FGCPNV312FHFRCX0BYWHVSE1', + events: ['dsync.user.created'], + ) expect(events.data.size).to eq(1) end @@ -64,7 +62,7 @@ context 'with the range_start and range_end options' do it 'forms the proper request to the API' do request_args = [ - '/events?range_start=2023-01-01T00%3A00%3A00Z&range_end=2023-01-03T00%3A00%3A00Z', + '/events?events=dsync.user.created&range_start=2023-01-01T00%3A00%3A00Z&range_end=2023-01-03T00%3A00%3A00Z', 'Content-Type' => 'application/json' ] @@ -75,6 +73,7 @@ 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', ) diff --git a/spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml b/spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml index 66ff30c5..dd4a45f8 100644 --- a/spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml +++ b/spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://api.workos.com/events?after=event_01FGCPNV312FHFRCX0BYWHVSE1 + uri: https://api.workos.com/events?after=event_01FGCPNV312FHFRCX0BYWHVSE1&events=dsync.user.created body: encoding: US-ASCII string: '' diff --git a/spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml b/spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml index 2df7324a..9e1efab8 100644 --- a/spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml +++ b/spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml @@ -14,40 +14,42 @@ http_interactions: Accept: - "*/*" User-Agent: - - WorkOS; ruby/2.7.2; arm64-darwin21; v2.3.0 + - WorkOS; ruby/3.3.0; arm64-darwin23; v4.1.0 Authorization: - Bearer response: status: - code: 200 - message: OK + code: 400 + message: Bad Request headers: Date: - - Thu, 14 Jul 2022 16:46:23 GMT + - Thu, 11 Apr 2024 15:44:49 GMT Content-Type: - application/json; charset=utf-8 Content-Length: - - '616' + - '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' - 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: @@ -59,22 +61,21 @@ http_interactions: X-Permitted-Cross-Domain-Policies: - none X-Request-Id: - - 51a82273-b413-cead-b968-c07ba4d6fd08 + - 660c0035-b70d-4939-a0d3-2b0917535e7f 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}' + 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 - 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}}' + 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, 14 Jul 2022 16:46:23 GMT + recorded_at: Thu, 11 Apr 2024 15:44:49 GMT recorded_with: VCR 5.0.0 diff --git a/spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml b/spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml index 574c3949..bec211c4 100644 --- a/spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml +++ b/spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://api.workos.com/events?range_end=2023-01-03T00:00:00Z&range_start=2023-01-01T00:00:00Z + 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: '' From 73b2687c1d2ad3d28f51f6ccb631320490f647ad Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:24:35 -0400 Subject: [PATCH 017/159] Major bump to version 5.0.0. (#304) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2de9ecaf..30bfb0b6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (4.8.0) + workos (5.0.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 7cf0e2f1..57724de1 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '4.8.0' + VERSION = '5.0.0' end From 7d5335f4b2ca1a24f3babacac04938c33d31ddcb Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:41:40 -0400 Subject: [PATCH 018/159] Add missing events parameter to test (#305) --- spec/lib/workos/event_spec.rb | 3 ++- .../vcr_cassettes/events/list_events_with_organization_id.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/lib/workos/event_spec.rb b/spec/lib/workos/event_spec.rb index f07a29c9..213464dc 100644 --- a/spec/lib/workos/event_spec.rb +++ b/spec/lib/workos/event_spec.rb @@ -86,7 +86,7 @@ context 'with the organization_id option' do it 'forms the proper request to the API' do request_args = [ - '/events?organization_id=org_1234', + '/events?events=dsync.user.created&organization_id=org_1234', 'Content-Type' => 'application/json' ] @@ -97,6 +97,7 @@ VCR.use_cassette 'events/list_events_with_organization_id' do events = described_class.list_events( + events: ['dsync.user.created'], organization_id: 'org_1234', ) diff --git a/spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml b/spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml index 1c9906fc..83339061 100644 --- a/spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml +++ b/spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://api.workos.com/events?organization_id=org_1234 + uri: https://api.workos.com/events?events=dsync.user.created&organization_id=org_1234 body: encoding: US-ASCII string: '' From d0756d9b870cb192fb678b245029200bcf5bc1fa Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Thu, 20 Jun 2024 14:31:46 -0700 Subject: [PATCH 019/159] Mark `allow_profiles_outside_organization` as deprecated (#307) * Mark `allow_profiles_outside_organization` as deprecated * Remove redundant condition --- lib/workos/organizations.rb | 65 +++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index 0760e2f8..0c7fda72 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -74,12 +74,13 @@ def get_organization(id:) # @param [Array] domain_data List of domain hashes describing an orgnaization 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 [Array] domains List of domains that belong to the organization. - # Deprecated: Use domain_data instead. # @param [String] name A unique, descriptive name for the organization - # @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. # @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( domain_data: nil, domains: nil, @@ -87,16 +88,23 @@ def create_organization( allow_profiles_outside_organization: nil, idempotency_key: nil ) - warn_deprecation '`domains` is deprecated. Use `domain_data` instead.' if domains + body = { name: name } + body[:domain_data] = domain_data if domain_data + + 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: { - domain_data: domain_data, - domains: domains, - name: name, - allow_profiles_outside_organization: allow_profiles_outside_organization, - }, + body: body, path: '/organizations', idempotency_key: idempotency_key, ) @@ -113,21 +121,36 @@ def create_organization( # @param [Array] domain_data List of domain hashes describing an orgnaization 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 [Array] domains List of domains that belong to the organization. - # Deprecated: Use domain_data instead. # @param [String] name A unique, descriptive name for the organization # @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. - def update_organization(organization:, domains:, name:, allow_profiles_outside_organization: nil) - warn_deprecation '`domains` is deprecated. Use `domain_data` instead.' if domains + # 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 update_organization( + organization:, + domain_data: nil, + domains: nil, + name:, + allow_profiles_outside_organization: nil + ) + body = { name: name } + body[:domain_data] = domain_data if domain_data + + 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: { - domains: domains, - name: name, - allow_profiles_outside_organization: allow_profiles_outside_organization, - }, + body: body, path: "/organizations/#{organization}", ) From 15c2449db6d1448f11f6f3d62b242001ecf13dbc Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Thu, 20 Jun 2024 15:46:20 -0700 Subject: [PATCH 020/159] v5.1.0 (#308) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 30bfb0b6..41803bad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.0.0) + workos (5.1.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 57724de1..557d352e 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.0.0' + VERSION = '5.1.0' end From 14285a260fc7678457331b4e6ea2365ab9e5e716 Mon Sep 17 00:00:00 2001 From: Ameesha Isaac Date: Mon, 24 Jun 2024 07:00:05 -0400 Subject: [PATCH 021/159] Add "role" to organization membership and directory sync user (#309) --- lib/workos/directory_user.rb | 4 +- lib/workos/organization_membership.rb | 4 +- lib/workos/user_management.rb | 25 ++++++++++++- spec/lib/workos/directory_sync_spec.rb | 4 +- spec/lib/workos/directory_user_spec.rb | 28 +++++++++++--- spec/lib/workos/user_management_spec.rb | 37 ++++++++++++++----- .../vcr_cassettes/directory_sync/get_user.yml | 6 +-- .../directory_sync/list_users/with_before.yml | 4 +- .../list_users/with_directory.yml | 4 +- .../create_organization_membership/valid.yml | 2 +- .../get_organization_membership.yml | 2 +- .../no_options.yml | 2 +- .../with_options.yml | 2 +- 13 files changed, 92 insertions(+), 32 deletions(-) diff --git a/lib/workos/directory_user.rb b/lib/workos/directory_user.rb index 1868efac..602666f6 100644 --- a/lib/workos/directory_user.rb +++ b/lib/workos/directory_user.rb @@ -8,7 +8,7 @@ class DirectoryUser < DeprecatedHashWrapper include HashProvider attr_accessor :id, :idp_id, :emails, :first_name, :last_name, :job_title, :username, :state, - :groups, :custom_attributes, :raw_attributes, :directory_id, :organization_id, + :groups, :role, :custom_attributes, :raw_attributes, :directory_id, :organization_id, :created_at, :updated_at # rubocop:disable Metrics/AbcSize @@ -26,6 +26,7 @@ def initialize(json) @username = hash[:username] @state = hash[:state] @groups = hash[:groups] + @role = hash[:role] @custom_attributes = hash[:custom_attributes] @raw_attributes = hash[:raw_attributes] @created_at = hash[:created_at] @@ -48,6 +49,7 @@ def to_json(*) username: username, state: state, groups: groups, + role: role, custom_attributes: custom_attributes, raw_attributes: raw_attributes, created_at: created_at, diff --git a/lib/workos/organization_membership.rb b/lib/workos/organization_membership.rb index 946ac6f7..daf04f09 100644 --- a/lib/workos/organization_membership.rb +++ b/lib/workos/organization_membership.rb @@ -7,7 +7,7 @@ module WorkOS class OrganizationMembership include HashProvider - attr_accessor :id, :user_id, :organization_id, :status, :created_at, :updated_at + attr_accessor :id, :user_id, :organization_id, :status, :role, :created_at, :updated_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -16,6 +16,7 @@ def initialize(json) @user_id = hash[:user_id] @organization_id = hash[:organization_id] @status = hash[:status] + @role = hash[:role] @created_at = hash[:created_at] @updated_at = hash[:updated_at] end @@ -26,6 +27,7 @@ def to_json(*) user_id: user_id, organization_id: organization_id, status: status, + role: role, created_at: created_at, updated_at: updated_at, } diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index d083b11a..1a3c2b48 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -841,14 +841,37 @@ def list_organization_memberships(options = {}) # # @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) # # @return [WorkOS::OrganizationMembership] - def create_organization_membership(user_id:, organization_id:) + def create_organization_membership(user_id:, organization_id:, role_slug: nil) request = post_request( path: '/user_management/organization_memberships', body: { user_id: user_id, organization_id: organization_id, + role_slug: role_slug, + }, + auth: true, + ) + + response = execute_request(request: request) + + WorkOS::OrganizationMembership.new(response.body) + end + + # Update an Organization Membership + # + # @param [String] organization_membership_id The ID of the Organization Membership. + # @param [String] role_slug The slug of the role to grant to this membership. + # + # @return [WorkOS::OrganizationMembership] + def update_organization_membership(organization_membership_id:, role_slug:) + request = put_request( + path: "/user_management/organization_memberships/#{id}", + body: { + organization_membership_id: organization_membership_id, + role_slug: role_slug, }, auth: true, ) diff --git a/spec/lib/workos/directory_sync_spec.rb b/spec/lib/workos/directory_sync_spec.rb index 72856d6e..2a2ad704 100644 --- a/spec/lib/workos/directory_sync_spec.rb +++ b/spec/lib/workos/directory_sync_spec.rb @@ -462,10 +462,10 @@ 'directory_user_01FAZYNPC8M0HRYTKFP2GNX852', ) - expect(user['first_name']).to eq('Logan') + 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('Logan') + expect(user.first_name).to eq('Bob') end end end diff --git a/spec/lib/workos/directory_user_spec.rb b/spec/lib/workos/directory_user_spec.rb index a4497905..013c2613 100644 --- a/spec/lib/workos/directory_user_spec.rb +++ b/spec/lib/workos/directory_user_spec.rb @@ -5,31 +5,47 @@ 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":"logan@workos.com","emails":[{"primary":true,"value":"logan@workos.com"}, {"primary":false,"value":"logan@gmail.com"}],"first_name":"Logan","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.primary_email).to eq('logan@workos.com') + 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":"logan@workos.com","emails":[{"primary":true,"value":"logan@workos.com"}, {"primary":true,"value":"logan@gmail.com"}],"first_name":"Logan","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.primary_email).to eq('logan@workos.com') + 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":"logan@workos.com","emails":[{"primary":false,"value":"logan@gmail.com"}],"first_name":"Logan","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"}') + 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":"logan@workos.com","emails":[],"first_name":"Logan","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"}') + 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) + end + end + + context 'with a role' do + it 'returns the role slug' 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"},"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') + expect(user.role).to eq({ slug: 'member' }) + end + end + end # rubocop:enable Layout/LineLength end diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index b55c209f..052d6d45 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -1039,19 +1039,36 @@ 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 + 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 diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml index e00625b4..9c8fe356 100644 --- a/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml +++ b/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml @@ -74,10 +74,10 @@ http_interactions: - 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":"logan@workos.com","emails":[{"primary":true,"value":"logan@workos.com"}],"first_name":"Logan","last_name":"Gingerich","job_title":"Developer Success Engineer","state":"active","raw_attributes":{"id":"6092c280a3f1e19ef6d8cef8","name":"Logan - Paul Gingerich","teams":["5f696c8e9a63a60e965aaca8"],"spokeId":null,"lastName":"Gingerich","created_at":"2021-05-05T16:06:24+0000","firstName":"Logan","updated_at":"2021-11-11T05:08:14+0000","workEmail":"logan@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 + 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","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","created_at":"2021-07-19T17:57:55.893Z","updated_at":"2022-01-24T11:23:01.333Z","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae4a","name":"Infra","parent":"5f27ada9a5e9bc0001a0ae48"}}]}' + - 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/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml index 78504603..8dc6c865 100644 --- a/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml +++ b/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml @@ -77,8 +77,8 @@ http_interactions: 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":"logan@workos.com","emails":[{"primary":true,"value":"logan@workos.com"}],"first_name":"Logan","last_name":"Gingerich","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":"Logan - Paul Gingerich","teams":["5f696c8e9a63a60e965aaca8"],"spokeId":null,"lastName":"Gingerich","firstName":"Logan","workEmail":"logan@workos.com","department":"Infra","departmentId":"5f27ada9a5e9bc0001a0ae4a"},"custom_attributes":{"department":"Infra"},"groups":[{"object":"directory_group","id":"directory_group_01FAZYNN1NZWMBRAXXDSTB5NFH","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department + 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 diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml index fa943f99..c2de5b1c 100644 --- a/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml +++ b/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml @@ -183,8 +183,8 @@ http_interactions: - 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":"logan@workos.com","emails":[{"primary":true,"value":"logan@workos.com"}],"first_name":"Logan","last_name":"Gingerich","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":"Logan - Paul Gingerich","teams":["5f696c8e9a63a60e965aaca8"],"spokeId":null,"lastName":"Gingerich","firstName":"Logan","workEmail":"logan@workos.com","department":"Infra","departmentId":"5f27ada9a5e9bc0001a0ae4a"},"custom_attributes":{"department":"Infra"},"groups":[{"object":"directory_group","id":"directory_group_01FAZYNN1NZWMBRAXXDSTB5NFH","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 diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml index 63bd3bb2..12eace78 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml @@ -76,7 +76,7 @@ http_interactions: - cloudflare body: encoding: UTF-8 - string: '{"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status":"active","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' + string: '{"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status":"active","role":{"slug":"member"},"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/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml index 8945d140..3579b0d4 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml @@ -76,7 +76,7 @@ http_interactions: - cloudflare body: encoding: ASCII-8BIT - string: '{"object": "organization_membership", "id": "om_01H5JQDV7R7ATEYZDEG0W5PRYS", "user_id": "user_01H5JQDV7R7ATEYZDEG0W5PRYS", "organization_id": "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", "status": "active", "created_at": "2023-07-18T02:07:19.911Z", "updated_at": "2023-07-18T02:07:19.911Z"}' + string: '{"object": "organization_membership", "id": "om_01H5JQDV7R7ATEYZDEG0W5PRYS", "user_id": "user_01H5JQDV7R7ATEYZDEG0W5PRYS", "organization_id": "organization_01H5JQDV7R7ATEYZDEG0W5PRYS", "status": "active", "role": {"slug": "member"}, "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/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml index 4ef7a878..359efd62 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml @@ -76,7 +76,7 @@ http_interactions: - 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","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","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":"before-id","after":null}}' + string: '{"object":"list","data":[{"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status": "active","role":{"slug":"member"},"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"},"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/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml index 8d2aec8a..ec9eea14 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml @@ -76,7 +76,7 @@ http_interactions: - 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","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}' + string: '{"object":"list","data":[{"object":"organization_membership","id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","user_id":"user_01H5JQDV7R7ATEYZDEG0W5PRYS","organization_id":"organization_01H5JQDV7R7ATEYZDEG0W5PRYS","status": "active","role":{"slug":"member"},"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 From 936a57adbaff11f428d3ab24fec1936c790d5ef1 Mon Sep 17 00:00:00 2001 From: Ameesha Isaac Date: Mon, 24 Jun 2024 07:29:35 -0400 Subject: [PATCH 022/159] v5.2.0 (#310) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 41803bad..7a15f7c7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.1.0) + workos (5.2.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 557d352e..aeacf624 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.1.0' + VERSION = '5.2.0' end From f81e3412c2a8e2630168ea92aec267dda2c81292 Mon Sep 17 00:00:00 2001 From: Ameesha Isaac Date: Wed, 26 Jun 2024 10:39:35 +0100 Subject: [PATCH 023/159] fix update organization membership and tests (#312) --- lib/workos/user_management.rb | 4 +- spec/lib/workos/user_management_spec.rb | 27 ++++++ .../invalid.yml | 82 ++++++++++++++++++ .../update_organization_membership/valid.yml | 83 +++++++++++++++++++ 4 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 1a3c2b48..b8f25ccb 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -866,11 +866,11 @@ def create_organization_membership(user_id:, organization_id:, role_slug: nil) # @param [String] role_slug The slug of the role to grant to this membership. # # @return [WorkOS::OrganizationMembership] - def update_organization_membership(organization_membership_id:, role_slug:) + def update_organization_membership(id:, role_slug:) request = put_request( path: "/user_management/organization_memberships/#{id}", body: { - organization_membership_id: organization_membership_id, + id: id, role_slug: role_slug, }, auth: true, diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 052d6d45..d2f3616b 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -1074,6 +1074,33 @@ 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 + end + describe '.delete_organization_membership' do context 'with a valid id' do it 'returns true' do diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml new file mode 100644 index 00000000..00574817 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml @@ -0,0 +1,82 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml new file mode 100644 index 00000000..fc9f705c --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml @@ -0,0 +1,83 @@ +--- + 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"},"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 From f685bbd51361525ccb63dca420e0828e5e63f7f7 Mon Sep 17 00:00:00 2001 From: Ameesha Isaac Date: Wed, 26 Jun 2024 10:45:32 +0100 Subject: [PATCH 024/159] v5.2.1 (#313) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7a15f7c7..9c557829 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.2.0) + workos (5.2.1) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index aeacf624..087b0264 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.2.0' + VERSION = '5.2.1' end From fddbe12a8b7c707a6ebf5fd49a28fae81ba8fb02 Mon Sep 17 00:00:00 2001 From: Giovanni Carvelli Date: Mon, 15 Jul 2024 12:32:16 -0400 Subject: [PATCH 025/159] Add AppleOAuth constants (#306) * Add AppleOAuth constants * better alphabet * Hub --- lib/workos/sso.rb | 4 ++-- lib/workos/types/provider.rb | 1 + lib/workos/user_management.rb | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index 698b9d1f..bd7f52e9 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -28,8 +28,8 @@ class << self # 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 'GoogleOAuth' and - # 'MicrosoftOAuth' are supported. + # 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 diff --git a/lib/workos/types/provider.rb b/lib/workos/types/provider.rb index 1c8e4018..65aba393 100644 --- a/lib/workos/types/provider.rb +++ b/lib/workos/types/provider.rb @@ -5,6 +5,7 @@ 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' diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index b8f25ccb..4a162a33 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -13,6 +13,7 @@ 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' @@ -44,7 +45,8 @@ class << self # 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 ,'GoogleOAuth' and 'MicrosoftOAuth' are supported. + # 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 From ae64c0e67865f5f10feee9200e93cfcee72768cb Mon Sep 17 00:00:00 2001 From: Giovanni Carvelli Date: Fri, 19 Jul 2024 17:02:42 -0400 Subject: [PATCH 026/159] 5.3.0 (#315) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9c557829..82b19b83 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.2.1) + workos (5.3.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 087b0264..6f91fce1 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.2.1' + VERSION = '5.3.0' end From 0f1402644e2bdd2fee26e44c66611f2332b7598a Mon Sep 17 00:00:00 2001 From: Maxwell Hammad Date: Mon, 5 Aug 2024 11:58:34 -0400 Subject: [PATCH 027/159] Make name optional when updating an Organization (#319) * Make name optional when updating an Organization * cleanup * 5.4.0 --- Gemfile.lock | 2 +- lib/workos/organizations.rb | 2 +- lib/workos/version.rb | 2 +- spec/lib/workos/organizations_spec.rb | 16 +++- .../organization/update_without_name.yml | 85 +++++++++++++++++++ 5 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml diff --git a/Gemfile.lock b/Gemfile.lock index 82b19b83..88c7ee39 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.3.0) + workos (5.4.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index 0c7fda72..bedf28ef 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -131,7 +131,7 @@ def update_organization( organization:, domain_data: nil, domains: nil, - name:, + name: nil, allow_profiles_outside_organization: nil ) body = { name: name } diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 6f91fce1..17e23576 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.3.0' + VERSION = '5.4.0' end diff --git a/spec/lib/workos/organizations_spec.rb b/spec/lib/workos/organizations_spec.rb index 7754d816..bf9deb91 100644 --- a/spec/lib/workos/organizations_spec.rb +++ b/spec/lib/workos/organizations_spec.rb @@ -267,7 +267,7 @@ describe '.update_organization' do context 'with valid payload' do - it 'creates an organization' do + it 'updates the organization' do VCR.use_cassette 'organization/update' do organization = described_class.update_organization( organization: 'org_01F6Q6TFP7RD2PF6J03ANNWDKV', @@ -275,6 +275,20 @@ 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') diff --git a/spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml b/spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml new file mode 100644 index 00000000..8f8a49e5 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml @@ -0,0 +1,85 @@ +--- +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 From 9137e4931051580ad8959dbe86b44c2c26b882b0 Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Wed, 7 Aug 2024 13:26:20 -0700 Subject: [PATCH 028/159] Add `organization_id` parameter to `authenticate_with_refresh_token` (#321) --- lib/workos/user_management.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 4a162a33..d145591d 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -318,6 +318,7 @@ def authenticate_with_code( # # @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. # @@ -325,6 +326,7 @@ def authenticate_with_code( def authenticate_with_refresh_token( refresh_token:, client_id:, + organization_id: nil, ip_address: nil, user_agent: nil ) @@ -338,6 +340,7 @@ def authenticate_with_refresh_token( ip_address: ip_address, user_agent: user_agent, grant_type: 'refresh_token', + organization_id: organization_id, }, ), ) From 840c7956da7407efd06e9d66b5d908668e89667c Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Thu, 8 Aug 2024 15:18:28 -0700 Subject: [PATCH 029/159] v5.5.0 (#322) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 88c7ee39..7a04ed3a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.4.0) + workos (5.5.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 17e23576..dfaa13a9 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.4.0' + VERSION = '5.5.0' end From ef7c82d7e67bd9be68e795cbea2bfd8ebfeef884 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 9 Aug 2024 01:21:53 +0100 Subject: [PATCH 030/159] Add Apple to list of providers. (#323) * user_management: add Apple to list of providers. This may be me completely understanding this code but: this looked like an omission here so I thought I'd open a PR for discussion. * types/provider: add another missing Apple addition. * Fix specs * Fix Rubocop offense --------- Co-authored-by: Michael Hadley --- lib/workos/types/provider.rb | 2 +- lib/workos/user_management.rb | 2 +- spec/lib/workos/sso_spec.rb | 3 ++- spec/lib/workos/user_management_spec.rb | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/workos/types/provider.rb b/lib/workos/types/provider.rb index 65aba393..c0bbd2c0 100644 --- a/lib/workos/types/provider.rb +++ b/lib/workos/types/provider.rb @@ -10,7 +10,7 @@ module Provider Google = 'GoogleOAuth' Microsoft = 'MicrosoftOAuth' - ALL = [GitHub, Google, Microsoft].freeze + ALL = [Apple, GitHub, Google, Microsoft].freeze end end end diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index d145591d..361c239c 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -19,7 +19,7 @@ class Provider Microsoft = 'MicrosoftOAuth' AuthKit = 'authkit' - ALL = [GitHub, Google, Microsoft, AuthKit].freeze + ALL = [Apple, GitHub, Google, Microsoft, AuthKit].freeze end # The AuthFactorType is a declaration of a diff --git a/spec/lib/workos/sso_spec.rb b/spec/lib/workos/sso_spec.rb index 3dea8e32..591e83d9 100644 --- a/spec/lib/workos/sso_spec.rb +++ b/spec/lib/workos/sso_spec.rb @@ -281,7 +281,8 @@ described_class.authorization_url(**args) end.to raise_error( ArgumentError, - 'Okta is not a valid value. `provider` must be in ["GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth"]', + 'Okta is not a valid value. `provider` must be in ' \ + '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth"]', ) end end diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index d2f3616b..bea5b56a 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -213,7 +213,7 @@ end.to raise_error( ArgumentError, 'Okta is not a valid value. `provider` must be in ' \ - '["GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth", "authkit"]', + '["AppleOAuth", "GitHubOAuth", "GoogleOAuth", "MicrosoftOAuth", "authkit"]', ) end end From f817ca35001b3412812cfee32f9b8a8266e4402d Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Fri, 9 Aug 2024 09:12:48 -0700 Subject: [PATCH 031/159] v5.5.1 (#324) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7a04ed3a..980be8c6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.5.0) + workos (5.5.1) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index dfaa13a9..0ab54adc 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.5.0' + VERSION = '5.5.1' end From c77987a170b0a9ac925ac932a4a02de1a48e5b78 Mon Sep 17 00:00:00 2001 From: alisherry Date: Mon, 19 Aug 2024 17:56:19 -0400 Subject: [PATCH 032/159] Add certificate renewal intent (#326) * Add certificate renewal intent * alphabetical --- lib/workos/types/intent.rb | 3 +- spec/lib/workos/portal_spec.rb | 15 ++++ .../generate_link_certificate_renewal.yml | 72 +++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 spec/support/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml diff --git a/lib/workos/types/intent.rb b/lib/workos/types/intent.rb index 810e6040..501b484c 100644 --- a/lib/workos/types/intent.rb +++ b/lib/workos/types/intent.rb @@ -6,11 +6,12 @@ module Types # intents while generating an Admin Portal link. module Intent AUDIT_LOGS = 'audit_logs' + CERTIFICATE_RENEWAL = 'certificate_renewal' DSYNC = 'dsync' LOG_STREAMS = 'log_streams' SSO = 'sso' - ALL = [AUDIT_LOGS, DSYNC, LOG_STREAMS, SSO].freeze + ALL = [AUDIT_LOGS, CERTIFICATE_RENEWAL, DSYNC, LOG_STREAMS, SSO].freeze end end end diff --git a/spec/lib/workos/portal_spec.rb b/spec/lib/workos/portal_spec.rb index 0f093c1d..3bf20a71 100644 --- a/spec/lib/workos/portal_spec.rb +++ b/spec/lib/workos/portal_spec.rb @@ -51,6 +51,21 @@ 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 an invalid organization' do diff --git a/spec/support/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml b/spec/support/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml new file mode 100644 index 00000000..543078f0 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml @@ -0,0 +1,72 @@ +--- +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 From 47beee9a3fc3cbedfb97ecb948fdc26ab805bfa4 Mon Sep 17 00:00:00 2001 From: alisherry Date: Mon, 19 Aug 2024 18:05:05 -0400 Subject: [PATCH 033/159] Bump version to 5.6.0 (#327) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 980be8c6..5c1da633 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.5.1) + workos (5.6.0) GEM remote: https://rubygems.org/ diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 0ab54adc..9da4e0f4 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.5.1' + VERSION = '5.6.0' end From f3b7bcebec6049f028ad135322acdd800310cb0c Mon Sep 17 00:00:00 2001 From: Paul Asjes Date: Wed, 28 Aug 2024 08:30:34 -0400 Subject: [PATCH 034/159] Session helper class (#328) * Session helpers * Add tests * Rubocop * Put ruby back where it was * And the gemfile * move gems to gemspec * rubocop again --- Gemfile.lock | 6 + lib/workos.rb | 1 + lib/workos/authentication_response.rb | 29 ++- lib/workos/refresh_authentication_response.rb | 27 ++- lib/workos/session.rb | 183 +++++++++++++++ lib/workos/user_management.rb | 38 +++- spec/lib/workos/session_spec.rb | 214 ++++++++++++++++++ spec/lib/workos/user_management_spec.rb | 1 + .../authenticate_with_refresh_token/valid.yml | 157 ++++++------- workos.gemspec | 3 + 10 files changed, 571 insertions(+), 88 deletions(-) create mode 100644 lib/workos/session.rb create mode 100644 spec/lib/workos/session_spec.rb diff --git a/Gemfile.lock b/Gemfile.lock index 5c1da633..559de6fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,6 +2,8 @@ PATH remote: . specs: workos (5.6.0) + encryptor (~> 3.0) + jwt (~> 2.8) GEM remote: https://rubygems.org/ @@ -9,12 +11,16 @@ GEM addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) + base64 (0.2.0) bigdecimal (3.1.7) crack (1.0.0) bigdecimal rexml diff-lcs (1.5.1) + encryptor (3.0.0) hashdiff (1.1.0) + jwt (2.8.2) + base64 parallel (1.24.0) parser (3.3.0.5) ast (~> 2.4.1) diff --git a/lib/workos.rb b/lib/workos.rb index 03ecefc9..f492f4c2 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -71,6 +71,7 @@ def self.key autoload :Profile, 'workos/profile' autoload :ProfileAndToken, 'workos/profile_and_token' autoload :RefreshAuthenticationResponse, 'workos/refresh_authentication_response' + autoload :Session, 'workos/session' autoload :SSO, 'workos/sso' autoload :Types, 'workos/types' autoload :User, 'workos/user' diff --git a/lib/workos/authentication_response.rb b/lib/workos/authentication_response.rb index 3bba0040..84642790 100644 --- a/lib/workos/authentication_response.rb +++ b/lib/workos/authentication_response.rb @@ -6,10 +6,19 @@ module WorkOS class AuthenticationResponse include HashProvider - attr_accessor :user, :organization_id, :impersonator, :access_token, :refresh_token + attr_accessor :user, + :organization_id, + :impersonator, + :access_token, + :refresh_token, + :authentication_method, + :sealed_session - def initialize(authentication_response_json) + # 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 = @@ -17,9 +26,19 @@ def initialize(authentication_response_json) Impersonator.new(email: impersonator_json[:email], reason: impersonator_json[:reason],) end - @access_token = json[:access_token] - @refresh_token = json[:refresh_token] + @authentication_method = json[:authentication_method] + @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],) + end end + # rubocop:enable Metrics/AbcSize def to_json(*) { @@ -28,6 +47,8 @@ def to_json(*) impersonator: impersonator.to_json, access_token: access_token, refresh_token: refresh_token, + authentication_method: authentication_method, + sealed_session: sealed_session, } end end diff --git a/lib/workos/refresh_authentication_response.rb b/lib/workos/refresh_authentication_response.rb index 4885e404..76d7ce73 100644 --- a/lib/workos/refresh_authentication_response.rb +++ b/lib/workos/refresh_authentication_response.rb @@ -6,18 +6,41 @@ module WorkOS class RefreshAuthenticationResponse include HashProvider - attr_accessor :access_token, :refresh_token + attr_accessor :user, :organization_id, :impersonator, :access_token, :refresh_token, :sealed_session - def initialize(authentication_response_json) + # 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],) + 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 diff --git a/lib/workos/session.rb b/lib/workos/session.rb new file mode 100644 index 00000000..7a23b03b --- /dev/null +++ b/lib/workos/session.rb @@ -0,0 +1,183 @@ +# frozen_string_literal: true + +require 'jwt' +require 'uri' +require 'net/http' +require 'encryptor' +require 'securerandom' +require 'json' +require 'uri' + +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. + # rubocop:disable Metrics/ClassLength + class Session + attr_accessor :jwks, :jwks_algorithms, :user_management, :cookie_password, :session_data, :client_id + + def initialize(user_management:, client_id:, session_data:, cookie_password:) + raise ArgumentError, 'cookiePassword is required' if cookie_password.nil? || cookie_password.empty? + + @user_management = user_management + @cookie_password = cookie_password + @session_data = session_data + @client_id = client_id + + @jwks = create_remote_jwk_set(URI(@user_management.get_jwks_url(client_id))) + @jwks_algorithms = @jwks.map { |key| key[:alg] }.compact.uniq + end + + # Authenticates the user based on the session data + # @return [Hash] A hash containing the authentication response and a reason if the authentication failed + def authenticate + return { authenticated: false, reason: 'NO_SESSION_COOKIE_PROVIDED' } if @session_data.nil? + + begin + session = Session.unseal_data(@session_data, @cookie_password) + rescue StandardError + return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } + end + + return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } unless session[:access_token] + return { authenticated: false, reason: 'INVALID_JWT' } unless is_valid_jwt(session[:access_token]) + + decoded = JWT.decode(session[:access_token], nil, true, algorithms: @jwks_algorithms, jwks: @jwks).first + + { + authenticated: true, + session_id: decoded['sid'], + organization_id: decoded['org_id'], + role: decoded['role'], + permissions: decoded['permissions'], + user: session[:user], + impersonator: session[:impersonator], + reason: nil, + } + 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 + # rubocop:disable Metrics/AbcSize + # rubocop:disable Metrics/CyclomaticComplexity + # rubocop:disable Metrics/PerceivedComplexity + def refresh(options = nil) + cookie_password = options.nil? || options[:cookie_password].nil? ? @cookie_password : options[:cookie_password] + + begin + session = Session.unseal_data(@session_data, cookie_password) + rescue StandardError + return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } + 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 }, + ) + + @session_data = auth_response.sealed_session + @cookie_password = cookie_password + + { + authenticated: true, + sealed_session: auth_response.sealed_session, + session: auth_response, + reason: nil, + } + rescue StandardError => e + { authenticated: false, reason: e.message } + end + end + # rubocop:enable Metrics/AbcSize + # rubocop:enable Metrics/CyclomaticComplexity + # rubocop:enable Metrics/PerceivedComplexity + + # Returns a URL to redirect the user to for logging out + # @return [String] The URL to redirect the user to for logging out + # rubocop:disable Naming/AccessorMethodName + def get_logout_url + auth_response = authenticate + + unless auth_response[:authenticated] + raise "Failed to extract session ID for logout URL: #{auth_response[:reason]}" + end + + @user_management.get_logout_url(session_id: auth_response[:session_id]) + end + # rubocop:enable Naming/AccessorMethodName + + # Encrypts and seals data using AES-256-GCM + # @param data [Hash] The data to seal + # @param key [String] The key to use for encryption + # @return [String] The sealed data + def self.seal_data(data, 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) # Combine IV with encrypted data and encode as base64 + end + + # Decrypts and unseals data using AES-256-GCM + # @param sealed_data [String] The sealed data to unseal + # @param key [String] The key to use for decryption + # @return [Hash] The unsealed data + def self.unseal_data(sealed_data, key) + decoded_data = Base64.decode64(sealed_data) + iv = decoded_data[0..11] # Extract the IV (first 12 bytes) + encrypted_data = decoded_data[12..-1] # Extract the encrypted data + + decrypted_data = Encryptor.decrypt( + value: encrypted_data, + key: key, + iv: iv, + algorithm: 'aes-256-gcm', + ) + + JSON.parse(decrypted_data, symbolize_names: true) # Parse the decrypted JSON string back to original data + end + + private + + # 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 + end + + # Validates a JWT token using the JWKS set + # @param token [String] The JWT token to validate + # @return [Boolean] True if the token is valid, false otherwise + # rubocop:disable Naming/PredicateName + def is_valid_jwt(token) + JWT.decode(token, nil, true, algorithms: @jwks_algorithms, jwks: @jwks) + true + rescue StandardError + false + end + # rubocop:enable Naming/PredicateName + end + # rubocop:enable Metrics/ClassLength +end diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 361c239c..ae6fcaca 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -37,6 +37,22 @@ class << self 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 + # + # @return WorkOS::Session + def load_sealed_session(client_id:, session_data:, cookie_password:) + WorkOS::Session.new( + user_management: self, + client_id: client_id, + session_data: session_data, + cookie_password: cookie_password, + ) + end + # Generate an OAuth 2.0 authorization URL that automatically directs a user # to their Identity Provider. # @@ -289,14 +305,21 @@ def authenticate_with_password(email:, password:, client_id:, ip_address: nil, u # @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 [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 + user_agent: nil, + session: nil ) + if session && (session[:seal_session] == true) && session[:cookie_password].nil? + raise ArgumentError, 'cookie_password is required when sealing session' + end + response = execute_request( request: post_request( path: '/user_management/authenticate', @@ -311,7 +334,7 @@ def authenticate_with_code( ), ) - WorkOS::AuthenticationResponse.new(response.body) + WorkOS::AuthenticationResponse.new(response.body, session) end # Authenticate a user using a refresh token. @@ -321,6 +344,8 @@ def authenticate_with_code( # @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( @@ -328,8 +353,13 @@ def authenticate_with_refresh_token( client_id:, organization_id: nil, ip_address: nil, - user_agent: nil + user_agent: nil, + session: nil ) + if session && (session[:seal_session] == true) && session[:cookie_password].nil? + raise ArgumentError, 'cookie_password is required when sealing session' + end + response = execute_request( request: post_request( path: '/user_management/authenticate', @@ -345,7 +375,7 @@ def authenticate_with_refresh_token( ), ) - WorkOS::RefreshAuthenticationResponse.new(response.body) + WorkOS::RefreshAuthenticationResponse.new(response.body, session) end # Authenticate user by Magic Auth Code. diff --git a/spec/lib/workos/session_spec.rb b/spec/lib/workos/session_spec.rb new file mode 100644 index 00000000..1c0035a3 --- /dev/null +++ b/spec/lib/workos/session_spec.rb @@ -0,0 +1,214 @@ +# frozen_string_literal: true + +describe WorkOS::Session do + let(:user_management) { instance_double('UserManagement') } + 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(:jwks_hash) { '{"keys":[{"alg":"RS256","kty":"RSA","use":"sig","n":"test_n","e":"AQAB","kid":"sso_oidc_key_pair_123","x5c":["test"],"x5t#S256":"test"}]}' } # rubocop:disable all + let(:jwk) { JWT::JWK.new(OpenSSL::PKey::RSA.new(2048), { kid: 'sso_oidc_key_pair_123', use: 'sig', alg: 'RS256' }) } + + before do + allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url) + allow(Net::HTTP).to receive(:get).and_return(jwks_hash) + end + + describe 'initialize' 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, + ) + 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(:valid_access_token) do + payload = { + sid: 'session_id', + org_id: 'org_id', + role: 'role', + permissions: ['read'], + exp: Time.now.to_i + 3600, + } + headers = { kid: jwk[:kid] } + JWT.encode(payload, jwk.signing_key, jwk[:alg], headers) + end + let(:session_data) do + WorkOS::Session.seal_data({ + access_token: valid_access_token, + user: 'user', + impersonator: 'impersonator', + }, cookie_password,) +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 '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(session).to receive(:is_valid_jwt).and_return(true) + allow(JWT).to receive(:decode).and_return([{ + 'sid' => 'session_id', + 'org_id' => 'org_id', + 'role' => 'role', + 'permissions' => ['read'], + }]) + + result = session.authenticate + expect(result).to eq({ + authenticated: true, + session_id: 'session_id', + organization_id: 'org_id', + role: 'role', + permissions: ['read'], + user: 'user', + impersonator: 'impersonator', + reason: nil, + }) + end + end + + describe '.refresh' do + 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(: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: user_management, + 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_id', + reason: nil, + }) + allow(user_management).to receive(:get_logout_url).with(session_id: 'session_id').and_return('https://example.com/logout') + end + + it 'returns the logout URL' do + expect(session.get_logout_url).to eq('https://example.com/logout') + 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 +end diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index bea5b56a..a7723cbb 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -467,6 +467,7 @@ ) 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 diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml index e8381d6a..dd1b3328 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml @@ -1,81 +1,82 @@ --- 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: '{"access_token":"","refresh_token":""}' - http_version: - recorded_at: Mon, 18 Mar 2024 19:00:53 GMT + - 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/workos.gemspec b/workos.gemspec index 524c5a28..98d092b9 100644 --- a/workos.gemspec +++ b/workos.gemspec @@ -21,6 +21,9 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] + spec.add_dependency 'encryptor', '~> 3.0' + spec.add_dependency 'jwt', '~> 2.8' + spec.add_development_dependency 'bundler', '>= 2.0.1' spec.add_development_dependency 'rspec', '~> 3.9.0' spec.add_development_dependency 'rubocop', '~> 0.77' From bd9d9ef841f76c9fad9fb131ea07dc4485740141 Mon Sep 17 00:00:00 2001 From: Paul Asjes Date: Thu, 29 Aug 2024 10:13:19 -0400 Subject: [PATCH 035/159] Update version to 5.7.0 (#329) * Update version * update gemfile.lock --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 559de6fc..10c781f3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.6.0) + workos (5.7.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 9da4e0f4..823b0354 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.6.0' + VERSION = '5.7.0' end From a437b1a93fe9fccc4b339c4337347180484fbc1a Mon Sep 17 00:00:00 2001 From: Kendall Strautman Swarthout <36613477+kendallstrautman@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:54:04 -0700 Subject: [PATCH 036/159] Add "role" to profile (#330) * Add role to profile * Exclud 'it' method for max block length --- .rubocop.yml | 2 +- lib/workos/profile.rb | 4 +++- spec/lib/workos/sso_spec.rb | 6 ++++++ spec/support/fixtures/vcr_cassettes/sso/profile.yml | 2 +- spec/support/profile.txt | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 655716e2..950d663f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,7 +12,7 @@ Layout/LineLength: - 'VCR\.use_cassette' - '(\A|\s)/.*?/' Metrics/BlockLength: - ExcludedMethods: ['describe', 'context', 'before'] + ExcludedMethods: ['describe', 'context', 'before', 'it'] Metrics/MethodLength: Max: 30 Metrics/ModuleLength: diff --git a/lib/workos/profile.rb b/lib/workos/profile.rb index 92fbe518..f3c075a0 100644 --- a/lib/workos/profile.rb +++ b/lib/workos/profile.rb @@ -9,7 +9,7 @@ module WorkOS class Profile include HashProvider - attr_accessor :id, :email, :first_name, :last_name, :groups, :organization_id, + attr_accessor :id, :email, :first_name, :last_name, :role, :groups, :organization_id, :connection_id, :connection_type, :idp_id, :raw_attributes def initialize(profile_json) @@ -19,6 +19,7 @@ def initialize(profile_json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] + @role = hash[:role] @groups = hash[:groups] @organization_id = hash[:organization_id] @connection_id = hash[:connection_id] @@ -37,6 +38,7 @@ def to_json(*) email: email, first_name: first_name, last_name: last_name, + role: role, groups: groups, organization_id: organization_id, connection_id: connection_id, diff --git a/spec/lib/workos/sso_spec.rb b/spec/lib/workos/sso_spec.rb index 591e83d9..2703e358 100644 --- a/spec/lib/workos/sso_spec.rb +++ b/spec/lib/workos/sso_spec.rb @@ -302,6 +302,9 @@ id: 'prof_01EEJTY9SZ1R350RB7B73SNBKF', idp_id: '116485463307139932699', last_name: 'Loblaw', + role: { + slug: 'member', + }, groups: nil, organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB', raw_attributes: { @@ -373,6 +376,9 @@ id: 'prof_01DRA1XNSJDZ19A31F183ECQW5', idp_id: '00u1klkowm8EGah2H357', last_name: 'Demo', + role: { + slug: 'admin', + }, groups: %w[Admins Developers], organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB', raw_attributes: { diff --git a/spec/support/fixtures/vcr_cassettes/sso/profile.yml b/spec/support/fixtures/vcr_cassettes/sso/profile.yml index 585f6991..70e29abf 100644 --- a/spec/support/fixtures/vcr_cassettes/sso/profile.yml +++ b/spec/support/fixtures/vcr_cassettes/sso/profile.yml @@ -67,7 +67,7 @@ http_interactions: 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","raw_attributes":{"hd":"workos.com","id":"116485463307139932699","name":"Bob + '{"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"},"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 diff --git a/spec/support/profile.txt b/spec/support/profile.txt index 79deaa1d..796a201e 100644 --- a/spec/support/profile.txt +++ b/spec/support/profile.txt @@ -1 +1 @@ -{"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","groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357","raw_attributes":{"id":"prof_01DRA1XNSJDZ19A31F183ECQW5","email":"demo@workos-okta.com","first_name":"WorkOS","last_name":"Demo","groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357"}},"access_token":"01DVX6QBS3EG6FHY2ESAA5Q65X"} +{"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"},"groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357","raw_attributes":{"id":"prof_01DRA1XNSJDZ19A31F183ECQW5","email":"demo@workos-okta.com","first_name":"WorkOS","last_name":"Demo","groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357"}},"access_token":"01DVX6QBS3EG6FHY2ESAA5Q65X"} From 000f584b6f838110dc2960266d94c3adaaa9199d Mon Sep 17 00:00:00 2001 From: Kendall Strautman Swarthout <36613477+kendallstrautman@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:23:44 -0700 Subject: [PATCH 037/159] bump minor version 5.8.0 (#331) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 10c781f3..62bda493 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.7.0) + workos (5.8.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 823b0354..32d67c77 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.7.0' + VERSION = '5.8.0' end From 46041b611688b7c8cbdabb399cd56652590f620d Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Fri, 15 Nov 2024 08:37:22 -0500 Subject: [PATCH 038/159] Add get widget token API support. (#332) --- lib/workos.rb | 1 + lib/workos/types.rb | 1 + lib/workos/types/widget_scope.rb | 13 +++ lib/workos/widgets.rb | 46 +++++++++++ spec/lib/workos/widgets_spec.rb | 73 +++++++++++++++++ .../vcr_cassettes/widgets/get_token.yml | 82 +++++++++++++++++++ .../get_token_invalid_organization_id.yml | 74 +++++++++++++++++ .../widgets/get_token_invalid_user_id.yml | 74 +++++++++++++++++ 8 files changed, 364 insertions(+) create mode 100644 lib/workos/types/widget_scope.rb create mode 100644 lib/workos/widgets.rb create mode 100644 spec/lib/workos/widgets_spec.rb create mode 100644 spec/support/fixtures/vcr_cassettes/widgets/get_token.yml create mode 100644 spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml create mode 100644 spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml diff --git a/lib/workos.rb b/lib/workos.rb index f492f4c2..ae959d5c 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -81,6 +81,7 @@ def self.key autoload :VerifyChallenge, 'workos/verify_challenge' autoload :Webhook, 'workos/webhook' autoload :Webhooks, 'workos/webhooks' + autoload :Widgets, 'workos/widgets' # Errors autoload :APIError, 'workos/errors' diff --git a/lib/workos/types.rb b/lib/workos/types.rb index e912eaac..6b8cef87 100644 --- a/lib/workos/types.rb +++ b/lib/workos/types.rb @@ -7,5 +7,6 @@ module Types 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/widget_scope.rb b/lib/workos/types/widget_scope.rb new file mode 100644 index 00000000..d3ba05a5 --- /dev/null +++ b/lib/workos/types/widget_scope.rb @@ -0,0 +1,13 @@ +# 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' + + ALL = [USERS_TABLE_MANAGE].freeze + end + end +end diff --git a/lib/workos/widgets.rb b/lib/workos/widgets.rb new file mode 100644 index 00000000..bd1e7bd5 --- /dev/null +++ b/lib/workos/widgets.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +require 'net/http' + +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) + + JSON.parse(response.body)['token'] + end + + private + + def validate_scopes(scopes) + return if scopes.all? { |scope| WIDGET_SCOPES.include?(scope) } + + raise ArgumentError, 'scopes contains an invalid value.' \ + " Every item in `scopes` must be in #{WIDGET_SCOPES}" + end + end + end +end diff --git a/spec/lib/workos/widgets_spec.rb b/spec/lib/workos/widgets_spec.rb new file mode 100644 index 00000000..80bb328d --- /dev/null +++ b/spec/lib/workos/widgets_spec.rb @@ -0,0 +1,73 @@ +# 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/support/fixtures/vcr_cassettes/widgets/get_token.yml b/spec/support/fixtures/vcr_cassettes/widgets/get_token.yml new file mode 100644 index 00000000..1c9c42f6 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/widgets/get_token.yml @@ -0,0 +1,82 @@ +--- +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/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml b/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml new file mode 100644 index 00000000..83721e1b --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml @@ -0,0 +1,74 @@ +--- +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/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml b/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml new file mode 100644 index 00000000..8ca40c91 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml @@ -0,0 +1,74 @@ +--- +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 From 8c401c2774be8fb073ba8334222ca06edd52d7a0 Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:47:00 -0500 Subject: [PATCH 039/159] Bump to version 5.9.0. (#333) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 62bda493..bb959091 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.8.0) + workos (5.9.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 32d67c77..0303112b 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.8.0' + VERSION = '5.9.0' end From 19e477b7e8acf3e4b12c56644f39c4061fa562e6 Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Tue, 31 Dec 2024 14:02:20 -0500 Subject: [PATCH 040/159] Add GET /organization/:orgId/roles support (#338) --- lib/workos.rb | 1 + lib/workos/organizations.rb | 26 ++++++ lib/workos/role.rb | 36 ++++++++ spec/lib/workos/organizations_spec.rb | 18 ++++ .../organization/list_organization_roles.yml | 82 +++++++++++++++++++ 5 files changed, 163 insertions(+) create mode 100644 lib/workos/role.rb create mode 100644 spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml diff --git a/lib/workos.rb b/lib/workos.rb index ae959d5c..37b8d83b 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -71,6 +71,7 @@ def self.key 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' diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index bedf28ef..d8ecb5c5 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -180,6 +180,32 @@ def delete_organization(id:) response.is_a? Net::HTTPSuccess end + # Retrieve a list of roles for the given organization. + # + # @param [String] organizationId The ID of the organization to fetch roles for. + def list_organization_roles(organization_id:) + response = execute_request( + request: get_request( + path: "/organizations/#{organization_id}/roles", + auth: true, + ), + ) + + 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: { + after: nil, + before: nil, + }, + ) + end + private def check_and_raise_organization_error(response:) diff --git a/lib/workos/role.rb b/lib/workos/role.rb new file mode 100644 index 00000000..5838cb41 --- /dev/null +++ b/lib/workos/role.rb @@ -0,0 +1,36 @@ +# 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, :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] + @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, + type: type, + created_at: created_at, + updated_at: updated_at, + } + end + end +end diff --git a/spec/lib/workos/organizations_spec.rb b/spec/lib/workos/organizations_spec.rb index bf9deb91..30be9337 100644 --- a/spec/lib/workos/organizations_spec.rb +++ b/spec/lib/workos/organizations_spec.rb @@ -323,4 +323,22 @@ 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 + end + end end diff --git a/spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml b/spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml new file mode 100644 index 00000000..c07d5690 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml @@ -0,0 +1,82 @@ +--- +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","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","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","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","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","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","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","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 From c71db365715304977b4b4a64d591a81661792996 Mon Sep 17 00:00:00 2001 From: Paul Asjes Date: Mon, 6 Jan 2025 15:12:26 +0100 Subject: [PATCH 041/159] Add new ForbiddenRequestError (#339) --- lib/workos.rb | 1 + lib/workos/client.rb | 8 ++ lib/workos/errors.rb | 4 + spec/lib/workos/user_management_spec.rb | 14 ++++ .../authenticate_with_password/unverified.yml | 82 +++++++++++++++++++ 5 files changed, 109 insertions(+) create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml diff --git a/lib/workos.rb b/lib/workos.rb index 37b8d83b..2486f9a7 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -88,6 +88,7 @@ def self.key 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' diff --git a/lib/workos/client.rb b/lib/workos/client.rb index 184856b2..40ac4ee6 100644 --- a/lib/workos/client.rb +++ b/lib/workos/client.rb @@ -109,6 +109,14 @@ def handle_error_response(response:) 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'], diff --git a/lib/workos/errors.rb b/lib/workos/errors.rb index 37e86730..c7c2acd7 100644 --- a/lib/workos/errors.rb +++ b/lib/workos/errors.rb @@ -64,6 +64,10 @@ class AuthenticationError < WorkOSError; end # 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 diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index a7723cbb..c26ab5ba 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -404,6 +404,20 @@ 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 end describe '.authenticate_with_code' do diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml new file mode 100644 index 00000000..aa2fc1f5 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml @@ -0,0 +1,82 @@ +--- +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 From bcbf8f71516861c190d2c602d5bf148364d71f0b Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Mon, 6 Jan 2025 09:12:46 -0500 Subject: [PATCH 042/159] Bump to version 5.10.0. (#340) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bb959091..085d4425 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.9.0) + workos (5.10.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 0303112b..7178c675 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.9.0' + VERSION = '5.10.0' end From 1e8e6a52cf31300a669d1714b1eb3346782565d2 Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Wed, 15 Jan 2025 13:15:47 -0800 Subject: [PATCH 043/159] Add `return_to` param to `UserManagement.get_logout_url` (#343) * Backfill test for `.get_logout_url` * Add `return_to` param to `UserManagement.get_logout_url` * Also update `Session#get_logout_url` --- lib/workos/session.rb | 7 ++--- lib/workos/user_management.rb | 8 +++-- spec/lib/workos/session_spec.rb | 42 ++++++++++++++++++------- spec/lib/workos/user_management_spec.rb | 21 +++++++++++++ 4 files changed, 60 insertions(+), 18 deletions(-) diff --git a/lib/workos/session.rb b/lib/workos/session.rb index 7a23b03b..11be446c 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -101,18 +101,17 @@ def refresh(options = nil) # 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 - # rubocop:disable Naming/AccessorMethodName - def get_logout_url + def get_logout_url(return_to: nil) auth_response = authenticate unless auth_response[:authenticated] raise "Failed to extract session ID for logout URL: #{auth_response[:reason]}" end - @user_management.get_logout_url(session_id: auth_response[:session_id]) + @user_management.get_logout_url(session_id: auth_response[:session_id], return_to: return_to) end - # rubocop:enable Naming/AccessorMethodName # Encrypts and seals data using AES-256-GCM # @param data [Hash] The data to seal diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index ae6fcaca..62c2dbdd 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -530,13 +530,17 @@ def authenticate_with_email_verification( # # @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:) + 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: "session_id=#{session_id}", + query: URI.encode_www_form(params), ).to_s end diff --git a/spec/lib/workos/session_spec.rb b/spec/lib/workos/session_spec.rb index 1c0035a3..960f8b93 100644 --- a/spec/lib/workos/session_spec.rb +++ b/spec/lib/workos/session_spec.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true describe WorkOS::Session do - let(:user_management) { instance_double('UserManagement') } let(:client_id) { 'test_client_id' } let(:cookie_password) { 'test_very_long_cookie_password__' } let(:session_data) { 'test_session_data' } @@ -10,11 +9,16 @@ let(:jwk) { JWT::JWK.new(OpenSSL::PKey::RSA.new(2048), { kid: 'sso_oidc_key_pair_123', use: 'sig', alg: 'RS256' }) } before do - allow(user_management).to receive(:get_jwks_url).with(client_id).and_return(jwks_url) 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 + it 'raises an error if cookie_password is nil or empty' do expect do WorkOS::Session.new( @@ -52,6 +56,7 @@ end describe '.authenticate' do + let(:user_management) { instance_double('UserManagement') } let(:valid_access_token) do payload = { sid: 'session_id', @@ -71,6 +76,10 @@ }, 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, @@ -135,11 +144,13 @@ 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 @@ -173,26 +184,33 @@ describe '.get_logout_url' do let(:session) do - WorkOS::Session.new( - user_management: user_management, - client_id: client_id, - session_data: session_data, - cookie_password: cookie_password, - ) - end + 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_id', + session_id: 'session_123abc', reason: nil, }) - allow(user_management).to receive(:get_logout_url).with(session_id: 'session_id').and_return('https://example.com/logout') end it 'returns the logout URL' do - expect(session.get_logout_url).to eq('https://example.com/logout') + 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 diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index c26ab5ba..659b1a0c 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -1441,4 +1441,25 @@ 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 From 7b22b636a82aabdebb5c76928df63fe7ae1d81c8 Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Wed, 15 Jan 2025 15:08:10 -0800 Subject: [PATCH 044/159] v5.11.0 (#344) --- Gemfile.lock | 4 ++-- lib/workos/version.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 085d4425..e61febd5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.10.0) + workos (5.11.0) encryptor (~> 3.0) jwt (~> 2.8) @@ -19,7 +19,7 @@ GEM diff-lcs (1.5.1) encryptor (3.0.0) hashdiff (1.1.0) - jwt (2.8.2) + jwt (2.10.1) base64 parallel (1.24.0) parser (3.3.0.5) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 7178c675..1930fcb4 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.10.0' + VERSION = '5.11.0' end From f2f06e112e990dc71777e11e66bd39e470290f4c Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Thu, 16 Jan 2025 09:08:09 -0700 Subject: [PATCH 045/159] Add caching to remote JWKS fetch (#342) * feat: add in-memory cache module for storing jwk set * add tests for cache implementation * add test to confirm jwks is cached * add doc comments to cache.rb * specify the time increment (seconds) --- lib/workos.rb | 1 + lib/workos/cache.rb | 94 +++++++++++++++++++++++++++++++++ lib/workos/session.rb | 4 +- spec/lib/workos/cache_spec.rb | 94 +++++++++++++++++++++++++++++++++ spec/lib/workos/session_spec.rb | 46 ++++++++++++++++ 5 files changed, 238 insertions(+), 1 deletion(-) create mode 100644 lib/workos/cache.rb create mode 100644 spec/lib/workos/cache_spec.rb diff --git a/lib/workos.rb b/lib/workos.rb index 2486f9a7..f1c36fbc 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -45,6 +45,7 @@ def self.key 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' diff --git a/lib/workos/cache.rb b/lib/workos/cache.rb new file mode 100644 index 00000000..7bd594ca --- /dev/null +++ b/lib/workos/cache.rb @@ -0,0 +1,94 @@ +# 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/session.rb b/lib/workos/session.rb index 11be446c..348b09fa 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -23,7 +23,9 @@ def initialize(user_management:, client_id:, session_data:, cookie_password:) @session_data = session_data @client_id = client_id - @jwks = create_remote_jwk_set(URI(@user_management.get_jwks_url(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 diff --git a/spec/lib/workos/cache_spec.rb b/spec/lib/workos/cache_spec.rb new file mode 100644 index 00000000..0c301cb7 --- /dev/null +++ b/spec/lib/workos/cache_spec.rb @@ -0,0 +1,94 @@ +# 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/session_spec.rb b/spec/lib/workos/session_spec.rb index 960f8b93..08d567e5 100644 --- a/spec/lib/workos/session_spec.rb +++ b/spec/lib/workos/session_spec.rb @@ -19,6 +19,52 @@ 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( From 3ba8ec0f7dcab3155da6ac935b70f4445dff93ba Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Thu, 16 Jan 2025 09:43:59 -0700 Subject: [PATCH 046/159] v5.11.1 (#345) * bump patch version to include new JWKS caching functionality * add Gemfile.lock change for version update --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e61febd5..125ad336 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.11.0) + workos (5.11.1) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 1930fcb4..a3dac792 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.11.0' + VERSION = '5.11.1' end From 1b72250a6d71306bcabea04fa4c207ccb53e7792 Mon Sep 17 00:00:00 2001 From: Teyler Date: Wed, 22 Jan 2025 12:40:53 -0700 Subject: [PATCH 047/159] update_organization stripe_customer_id param + .rbenv update (#346) * Update .ruby-version Problem: Upon opening this repo, I tried to run `rbenv install` to install the ruby version required for this project. I was met with the following error as Ruby 3.0.2 is EOL. `BUILD FAILED (macOS 15.2 on arm64 using ruby-build 20250115)` Solution: I noticed in one of the vcr tests that the user agent was using Ruby 3.1.4. After updating the .ruby-version to 3.1.4 (Which is what I am assuming the last engineer used), `rbenv install` worked properly and I was able to bundle and begin contribution. * Add stripe_customer_id to update_organization Adds stripe_customer_id as an optional param to update_organization. This was added in a similar fashion to the node js implementation (https://workos.com/docs/reference/organization/update) and to match the initial entitlements documentation (https://workos.com/docs/user-management/entitlements/use-the-entitlements-in-your-application). Consumers should now be able to simply call WorkOS::Organization.update_organization() with a stripe_customer_id to setup stipe entitlements with their WorkOS orgs. --- .ruby-version | 2 +- lib/workos/organization.rb | 12 ++- lib/workos/organizations.rb | 7 +- spec/lib/workos/organizations_spec.rb | 15 ++++ .../update_with_stripe_customer_id.yml | 78 +++++++++++++++++++ 5 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 spec/support/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml diff --git a/.ruby-version b/.ruby-version index b5021469..0aec50e6 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.0.2 +3.1.4 diff --git a/lib/workos/organization.rb b/lib/workos/organization.rb index 75145ece..9bad7fc3 100644 --- a/lib/workos/organization.rb +++ b/lib/workos/organization.rb @@ -7,7 +7,15 @@ module WorkOS class Organization include HashProvider - attr_accessor :id, :domains, :name, :allow_profiles_outside_organization, :created_at, :updated_at + attr_accessor( + :id, + :domains, + :stripe_customer_id, + :name, + :allow_profiles_outside_organization, + :created_at, + :updated_at, + ) def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -16,6 +24,7 @@ def initialize(json) @name = hash[:name] @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 @@ -26,6 +35,7 @@ def to_json(*) name: name, allow_profiles_outside_organization: allow_profiles_outside_organization, domains: domains, + stripe_customer_id: stripe_customer_id, created_at: created_at, updated_at: updated_at, } diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index d8ecb5c5..b463dd15 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -71,7 +71,7 @@ def get_organization(id:) # Create an organization # - # @param [Array] domain_data List of domain hashes describing an orgnaization domain. + # @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 @@ -118,9 +118,10 @@ def create_organization( # Update an organization # # @param [String] organization Organization unique identifier - # @param [Array] domain_data List of domain hashes describing an orgnaization domain. + # @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 [Boolean, nil] allow_profiles_outside_organization Whether Connections # within the Organization allow profiles that are outside of the Organization's configured User Email Domains. @@ -129,6 +130,7 @@ def create_organization( # Deprecated: Use domain_data instead. def update_organization( organization:, + stripe_customer_id: nil, domain_data: nil, domains: nil, name: nil, @@ -136,6 +138,7 @@ def update_organization( ) body = { name: name } body[:domain_data] = domain_data if domain_data + body[:stripe_customer_id] = stripe_customer_id if stripe_customer_id if domains warn_deprecation '`domains` is deprecated. Use `domain_data` instead.' diff --git a/spec/lib/workos/organizations_spec.rb b/spec/lib/workos/organizations_spec.rb index 30be9337..8552084f 100644 --- a/spec/lib/workos/organizations_spec.rb +++ b/spec/lib/workos/organizations_spec.rb @@ -295,6 +295,21 @@ 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 end describe '.delete_organization' do diff --git a/spec/support/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml b/spec/support/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml new file mode 100644 index 00000000..29d6deeb --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml @@ -0,0 +1,78 @@ +--- +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 From 0a437d3919705b77b476a3af548d2df07fa5ec2a Mon Sep 17 00:00:00 2001 From: Dan Dorman Date: Thu, 23 Jan 2025 10:01:10 -0700 Subject: [PATCH 048/159] Bump minimum required Ruby version to 3.1 (#347) * Bump minimum required Ruby version to 3.1 Previous minimum was 2.7, which was end-of-life (EOL) 2023-03-31. 3.0 was EOL 2024-04-23 ([source][]). [source]: https://www.ruby-lang.org/en/downloads/branches/ * Bump Rubocop to get suppot for Ruby 3.1 * Jog CI --- .github/workflows/ci.yml | 2 - .rubocop.yml | 11 +++-- .rubocop_todo.yml | 94 ++++++++++++++++++++++++++++++++++++++++ Gemfile.lock | 33 ++++++++------ lib/workos/session.rb | 2 - workos.gemspec | 4 +- 6 files changed, 120 insertions(+), 26 deletions(-) create mode 100644 .rubocop_todo.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bae7d85a..badfcc4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,6 @@ jobs: strategy: matrix: ruby: - - '2.7' - - '3.0' - '3.1' - '3.2' steps: diff --git a/.rubocop.yml b/.rubocop.yml index 950d663f..a32030b0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,5 @@ -# Disabling due to conflict with Ruby 2.7/3.1 -Layout/BlockAlignment: - Enabled: false +inherit_from: .rubocop_todo.yml + Layout/DotPosition: EnforcedStyle: trailing Layout/EmptyLineAfterMagicComment: @@ -8,11 +7,11 @@ Layout/EmptyLineAfterMagicComment: Layout/EmptyLines: Enabled: false Layout/LineLength: - IgnoredPatterns: + AllowedPatterns: - 'VCR\.use_cassette' - '(\A|\s)/.*?/' Metrics/BlockLength: - ExcludedMethods: ['describe', 'context', 'before', 'it'] + AllowedMethods: ['describe', 'context', 'before', 'it'] Metrics/MethodLength: Max: 30 Metrics/ModuleLength: @@ -28,4 +27,4 @@ Style/TrailingCommaInArguments: Style/TrailingCommaInHashLiteral: EnforcedStyleForMultiline: 'consistent_comma' AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.1 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..54f5f130 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,94 @@ +# 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/Gemfile.lock b/Gemfile.lock index 125ad336..ad714ef5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,16 +19,18 @@ GEM diff-lcs (1.5.1) encryptor (3.0.0) hashdiff (1.1.0) + json (2.9.1) jwt (2.10.1) base64 - parallel (1.24.0) - parser (3.3.0.5) + language_server-protocol (3.17.0.3) + parallel (1.26.3) + parser (3.3.7.0) ast (~> 2.4.1) racc public_suffix (5.0.4) - racc (1.7.3) + racc (1.8.1) rainbow (3.1.1) - regexp_parser (2.9.0) + regexp_parser (2.10.0) rexml (3.2.6) rspec (3.9.0) rspec-core (~> 3.9.0) @@ -43,19 +45,22 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-support (3.9.4) - rubocop (0.93.1) + rubocop (1.71.0) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8) - rexml - rubocop-ast (>= 0.6.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.31.2) - parser (>= 3.3.0.4) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.37.0) + parser (>= 3.3.1.0) ruby-progressbar (1.13.0) - unicode-display_width (1.8.0) + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) vcr (5.0.0) webmock (3.23.0) addressable (>= 2.8.0) @@ -68,7 +73,7 @@ PLATFORMS DEPENDENCIES bundler (>= 2.0.1) rspec (~> 3.9.0) - rubocop (~> 0.77) + rubocop (~> 1.71) vcr (~> 5.0.0) webmock workos! diff --git a/lib/workos/session.rb b/lib/workos/session.rb index 348b09fa..9ce6f14f 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -11,7 +11,6 @@ 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. - # rubocop:disable Metrics/ClassLength class Session attr_accessor :jwks, :jwks_algorithms, :user_management, :cookie_password, :session_data, :client_id @@ -180,5 +179,4 @@ def is_valid_jwt(token) end # rubocop:enable Naming/PredicateName end - # rubocop:enable Metrics/ClassLength end diff --git a/workos.gemspec b/workos.gemspec index 98d092b9..20b5f427 100644 --- a/workos.gemspec +++ b/workos.gemspec @@ -26,9 +26,9 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler', '>= 2.0.1' spec.add_development_dependency 'rspec', '~> 3.9.0' - spec.add_development_dependency 'rubocop', '~> 0.77' + spec.add_development_dependency 'rubocop', '~> 1.71' spec.add_development_dependency 'vcr', '~> 5.0.0' spec.add_development_dependency 'webmock' - spec.required_ruby_version = '>= 2.7' + spec.required_ruby_version = '>= 3.1' end From 2a1b2a51be49e518aad4a3faeb2d3d6869670997 Mon Sep 17 00:00:00 2001 From: Dan Dorman Date: Thu, 23 Jan 2025 12:05:56 -0700 Subject: [PATCH 049/159] v5.12.0 (#348) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ad714ef5..0a44c753 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.11.1) + workos (5.12.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index a3dac792..5db5a852 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.11.1' + VERSION = '5.12.0' end From 7b9e66b26e0e0cf721b3d027860f22dae4321b2b Mon Sep 17 00:00:00 2001 From: Adam Heath Date: Tue, 28 Jan 2025 05:41:21 +0800 Subject: [PATCH 050/159] Add entitlements to session (#349) * Refactor session spec to mock less and split out the payload Allowing more complete testing of the token with only the verification being mocked. The separate payload enables creating more tests with differing payloads. * Include entitlements in the authenticated session If the users organisation has a stripe link the token includes any entitlements, this should be exposed to client code. Fixes #336 --- lib/workos/session.rb | 1 + spec/lib/workos/session_spec.rb | 64 +++++++++++++++++++++++---------- 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/lib/workos/session.rb b/lib/workos/session.rb index 9ce6f14f..c82b8799 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -50,6 +50,7 @@ def authenticate organization_id: decoded['org_id'], role: decoded['role'], permissions: decoded['permissions'], + entitlements: decoded['entitlements'], user: session[:user], impersonator: session[:impersonator], reason: nil, diff --git a/spec/lib/workos/session_spec.rb b/spec/lib/workos/session_spec.rb index 08d567e5..fa77a710 100644 --- a/spec/lib/workos/session_spec.rb +++ b/spec/lib/workos/session_spec.rb @@ -103,24 +103,23 @@ describe '.authenticate' do let(:user_management) { instance_double('UserManagement') } - let(:valid_access_token) do - payload = { + let(:payload) do + { sid: 'session_id', org_id: 'org_id', role: 'role', permissions: ['read'], exp: Time.now.to_i + 3600, } - headers = { kid: jwk[:kid] } - JWT.encode(payload, jwk.signing_key, jwk[:alg], headers) 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 + 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) @@ -167,14 +166,7 @@ session_data: session_data, cookie_password: cookie_password, ) - allow(session).to receive(:is_valid_jwt).and_return(true) - allow(JWT).to receive(:decode).and_return([{ - 'sid' => 'session_id', - 'org_id' => 'org_id', - 'role' => 'role', - 'permissions' => ['read'], - }]) - + allow_any_instance_of(JWT::Decode).to receive(:verify_signature).and_return(true) result = session.authenticate expect(result).to eq({ authenticated: true, @@ -182,11 +174,47 @@ organization_id: 'org_id', role: 'role', permissions: ['read'], + entitlements: nil, user: 'user', impersonator: 'impersonator', reason: nil, }) end + + describe 'with entitlements' do + let(:payload) do + { + sid: 'session_id', + org_id: 'org_id', + role: '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', + permissions: ['read'], + entitlements: ['billing'], + user: 'user', + impersonator: 'impersonator', + reason: nil, + }) + end + end end describe '.refresh' do From faba97f8aca179afa9e9f10f0efe9f3dad4487ec Mon Sep 17 00:00:00 2001 From: Dan Dorman Date: Tue, 28 Jan 2025 09:22:31 -0700 Subject: [PATCH 051/159] v5.13.0 (#350) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0a44c753..a37fc278 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.12.0) + workos (5.13.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 5db5a852..a8b944bb 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.12.0' + VERSION = '5.13.0' end From f947050a19b6a126b60d78437b388d238ed2925e Mon Sep 17 00:00:00 2001 From: Sahil Bansal Date: Tue, 11 Feb 2025 02:26:16 +0530 Subject: [PATCH 052/159] Add domain verification intent in admin portal link generation (#351) * Add domain verification intent in admin portal link generation * refactor: update order lexicographically * fix: syntax issue * fix: remove trailing whitespace --- lib/workos/types/intent.rb | 3 +- spec/lib/workos/portal_spec.rb | 15 ++++ .../generate_link_domain_verification.yml | 72 +++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 spec/support/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml diff --git a/lib/workos/types/intent.rb b/lib/workos/types/intent.rb index 501b484c..4a8e8728 100644 --- a/lib/workos/types/intent.rb +++ b/lib/workos/types/intent.rb @@ -7,11 +7,12 @@ module Types module Intent 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, DSYNC, LOG_STREAMS, SSO].freeze + ALL = [AUDIT_LOGS, CERTIFICATE_RENEWAL, DOMAIN_VERIFICATION, DSYNC, LOG_STREAMS, SSO].freeze end end end diff --git a/spec/lib/workos/portal_spec.rb b/spec/lib/workos/portal_spec.rb index 3bf20a71..c04210f6 100644 --- a/spec/lib/workos/portal_spec.rb +++ b/spec/lib/workos/portal_spec.rb @@ -68,6 +68,21 @@ 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 diff --git a/spec/support/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml b/spec/support/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml new file mode 100644 index 00000000..2da1824d --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml @@ -0,0 +1,72 @@ +--- +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 From 6f2e8fdc12ef7c02d7818c2cb74888dacdee28ed Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Thu, 13 Feb 2025 12:35:09 -0600 Subject: [PATCH 053/159] v5.14.0 (#353) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a37fc278..481f1d95 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.13.0) + workos (5.14.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index a8b944bb..dcfe4873 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.13.0' + VERSION = '5.14.0' end From ef77062c4b6c47cf4c4ed0a543eb892263b427dd Mon Sep 17 00:00:00 2001 From: Stacy Curry Date: Wed, 19 Feb 2025 19:38:55 -0600 Subject: [PATCH 054/159] add last_sign_in_at to user (#352) --- lib/workos/user.rb | 4 +++- spec/lib/workos/user_management_spec.rb | 6 ++++++ .../fixtures/vcr_cassettes/user_management/get_user.yml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/workos/user.rb b/lib/workos/user.rb index 28f11504..dd25753d 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, :created_at, :updated_at + :profile_picture_url, :last_sign_in_at, :created_at, :updated_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -19,6 +19,7 @@ def initialize(json) @last_name = hash[:last_name] @email_verified = hash[:email_verified] @profile_picture_url = hash[:profile_picture_url] + @last_sign_in_at = hash[:last_sign_in_at] @created_at = hash[:created_at] @updated_at = hash[:updated_at] end @@ -31,6 +32,7 @@ def to_json(*) last_name: last_name, email_verified: email_verified, profile_picture_url: profile_picture_url, + last_sign_in_at: last_sign_in_at, created_at: created_at, updated_at: updated_at, } diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 659b1a0c..863d456d 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -229,6 +229,12 @@ 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 diff --git a/spec/support/fixtures/vcr_cassettes/user_management/get_user.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_user.yml index 4455e22e..8946b20a 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/get_user.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/get_user.yml @@ -76,7 +76,7 @@ http_interactions: - 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,"created_at":"2024-02-06T23:13:18.137Z","updated_at":"2024-02-06T23:13:36.946Z"}' + 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 From 497f073092126703c0b62573c0891193d6541961 Mon Sep 17 00:00:00 2001 From: Stacy Curry Date: Thu, 20 Feb 2025 10:27:37 -0600 Subject: [PATCH 055/159] v5.15.0 (#354) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 481f1d95..e218c2a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.14.0) + workos (5.15.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index dcfe4873..ea50c5fb 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.14.0' + VERSION = '5.15.0' end From 678615a85e647ca5aeb6eda0bada34515b74abf0 Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Fri, 21 Mar 2025 13:42:33 -0400 Subject: [PATCH 056/159] Add email standard attribute to DirectoryUser and mark deprecated standard attributes. (#355) --- lib/workos/directory_user.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/workos/directory_user.rb b/lib/workos/directory_user.rb index 602666f6..e51025c7 100644 --- a/lib/workos/directory_user.rb +++ b/lib/workos/directory_user.rb @@ -7,7 +7,7 @@ module WorkOS class DirectoryUser < DeprecatedHashWrapper include HashProvider - attr_accessor :id, :idp_id, :emails, :first_name, :last_name, :job_title, :username, :state, + attr_accessor :id, :idp_id, :email, :emails, :first_name, :last_name, :job_title, :username, :state, :groups, :role, :custom_attributes, :raw_attributes, :directory_id, :organization_id, :created_at, :updated_at @@ -19,10 +19,20 @@ def initialize(json) @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] @@ -42,6 +52,7 @@ def to_json(*) directory_id: directory_id, organization_id: organization_id, idp_id: idp_id, + email: email, emails: emails, first_name: first_name, last_name: last_name, @@ -57,6 +68,7 @@ def to_json(*) } end + # @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 From e91296576d4da0f9360c92e4fa10a84303254308 Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Fri, 21 Mar 2025 14:01:11 -0400 Subject: [PATCH 057/159] Bump to version 5.16.0. (#356) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e218c2a2..b3cc5bd1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.15.0) + workos (5.16.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index ea50c5fb..888a219f 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.15.0' + VERSION = '5.16.0' end From 3289d7854d459c64e8463c834ba4b9cc193922c8 Mon Sep 17 00:00:00 2001 From: nickcollisson-workos Date: Mon, 7 Apr 2025 13:12:00 -0400 Subject: [PATCH 058/159] Pin third-party actions to currently used SHA (#357) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index badfcc4e..44d41dfa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - '3.2' steps: - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 + - uses: ruby/setup-ruby@1a615958ad9d422dd932dc1d5823942ee002799f # v1.227.0 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true From 0f803d2566f96cc933460f0ed9328b0d6a817d33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 11:22:17 -0400 Subject: [PATCH 059/159] Bump rexml from 3.2.6 to 3.3.3 (#318) Bumps [rexml](https://github.com/ruby/rexml) from 3.2.6 to 3.3.3. - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.2.6...v3.3.3) --- updated-dependencies: - dependency-name: rexml dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: nickcollisson-workos --- Gemfile.lock | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index b3cc5bd1..63f2ce17 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,7 +31,8 @@ GEM racc (1.8.1) rainbow (3.1.1) regexp_parser (2.10.0) - rexml (3.2.6) + rexml (3.3.3) + strscan rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) @@ -58,6 +59,7 @@ GEM rubocop-ast (1.37.0) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) + strscan (3.1.0) unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) From a418cc19e4d64dff9406aaa714900abf264f8405 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Wed, 23 Apr 2025 13:56:27 -0500 Subject: [PATCH 060/159] v5.16.1 (#362) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 63f2ce17..3123d85d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.16.0) + workos (5.16.1) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 888a219f..bec21ea7 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.16.0' + VERSION = '5.16.1' end From 0f540c860ce581b4e497f9f837ff5c11f07ffe68 Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Thu, 24 Apr 2025 14:37:07 -0400 Subject: [PATCH 061/159] Add custom_attributes field to SSO Profile. (#360) --- lib/workos/profile.rb | 6 +++++- spec/lib/workos/sso_spec.rb | 5 +++++ spec/support/fixtures/vcr_cassettes/sso/profile.yml | 2 +- spec/support/profile.txt | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/workos/profile.rb b/lib/workos/profile.rb index f3c075a0..3a02ac62 100644 --- a/lib/workos/profile.rb +++ b/lib/workos/profile.rb @@ -10,8 +10,9 @@ class Profile include HashProvider attr_accessor :id, :email, :first_name, :last_name, :role, :groups, :organization_id, - :connection_id, :connection_type, :idp_id, :raw_attributes + :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) @@ -25,8 +26,10 @@ def initialize(profile_json) @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(' ') @@ -44,6 +47,7 @@ def to_json(*) connection_id: connection_id, connection_type: connection_type, idp_id: idp_id, + custom_attributes: custom_attributes, raw_attributes: raw_attributes, } end diff --git a/spec/lib/workos/sso_spec.rb b/spec/lib/workos/sso_spec.rb index 2703e358..d3037e63 100644 --- a/spec/lib/workos/sso_spec.rb +++ b/spec/lib/workos/sso_spec.rb @@ -307,6 +307,7 @@ }, groups: nil, organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB', + custom_attributes: {}, raw_attributes: { email: 'bob.loblaw@workos.com', family_name: 'Loblaw', @@ -381,6 +382,9 @@ }, groups: %w[Admins Developers], organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB', + custom_attributes: { + license: 'professional', + }, raw_attributes: { email: 'demo@workos-okta.com', first_name: 'WorkOS', @@ -388,6 +392,7 @@ idp_id: '00u1klkowm8EGah2H357', last_name: 'Demo', groups: %w[Admins Developers], + license: 'professional', }, } diff --git a/spec/support/fixtures/vcr_cassettes/sso/profile.yml b/spec/support/fixtures/vcr_cassettes/sso/profile.yml index 70e29abf..65d6dec3 100644 --- a/spec/support/fixtures/vcr_cassettes/sso/profile.yml +++ b/spec/support/fixtures/vcr_cassettes/sso/profile.yml @@ -67,7 +67,7 @@ http_interactions: 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"},"raw_attributes":{"hd":"workos.com","id":"116485463307139932699","name":"Bob + '{"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"},"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 diff --git a/spec/support/profile.txt b/spec/support/profile.txt index 796a201e..7e19a262 100644 --- a/spec/support/profile.txt +++ b/spec/support/profile.txt @@ -1 +1 @@ -{"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"},"groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357","raw_attributes":{"id":"prof_01DRA1XNSJDZ19A31F183ECQW5","email":"demo@workos-okta.com","first_name":"WorkOS","last_name":"Demo","groups":["Admins","Developers"],"idp_id":"00u1klkowm8EGah2H357"}},"access_token":"01DVX6QBS3EG6FHY2ESAA5Q65X"} +{"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"},"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"} From fc13302d94ff590578a8bb82cf5b933229eaec58 Mon Sep 17 00:00:00 2001 From: Matt Dzwonczyk <9063128+mattgd@users.noreply.github.com> Date: Thu, 24 Apr 2025 15:28:53 -0400 Subject: [PATCH 062/159] Bump to version 5.17.0. (#363) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3123d85d..2d027465 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.16.1) + workos (5.17.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index bec21ea7..36a59525 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.16.1' + VERSION = '5.17.0' end From 01858fd17ff7f2cfe3b976004ac747e5afe4f6b2 Mon Sep 17 00:00:00 2001 From: Alex Leasenco Date: Fri, 25 Apr 2025 16:47:20 +0300 Subject: [PATCH 063/159] Bump rexml from 3.2.6 to 3.4.1 (#359) --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2d027465..276de115 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,7 +31,7 @@ GEM racc (1.8.1) rainbow (3.1.1) regexp_parser (2.10.0) - rexml (3.3.3) + rexml (3.4.1) strscan rspec (3.9.0) rspec-core (~> 3.9.0) From 948361c6f1ac748826a0304c0a6ee4f755ef1eda Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Fri, 25 Apr 2025 09:44:42 -0500 Subject: [PATCH 064/159] v5.17.1 (#364) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 276de115..d33ed71c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.17.0) + workos (5.17.1) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 36a59525..3d3725b1 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.17.0' + VERSION = '5.17.1' end From 3130877fca2998b46880fc8d327b807e66746625 Mon Sep 17 00:00:00 2001 From: Cameron Matheson Date: Tue, 20 May 2025 17:07:29 -0600 Subject: [PATCH 065/159] Support `email` param in `update_user` (#365) --- .rubocop.yml | 8 +- lib/workos/client.rb | 2 +- lib/workos/mfa.rb | 1 - lib/workos/session.rb | 1 - lib/workos/user_management.rb | 5 +- spec/lib/workos/user_management_spec.rb | 11 +++ .../user_management/update_user/email.yml | 82 +++++++++++++++++++ 7 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_user/email.yml diff --git a/.rubocop.yml b/.rubocop.yml index a32030b0..bd4c3333 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,10 +12,14 @@ Layout/LineLength: - '(\A|\s)/.*?/' Metrics/BlockLength: AllowedMethods: ['describe', 'context', 'before', 'it'] +Metrics/ClassLength: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false Metrics/MethodLength: - Max: 30 + Enabled: false Metrics/ModuleLength: - Max: 200 + Enabled: false Metrics/ParameterLists: Max: 6 Naming/ConstantName: diff --git a/lib/workos/client.rb b/lib/workos/client.rb index 40ac4ee6..1fa102ff 100644 --- a/lib/workos/client.rb +++ b/lib/workos/client.rb @@ -86,7 +86,7 @@ def user_agent ].join('; ') end - # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity: + # rubocop:disable Metrics/AbcSize: def handle_error_response(response:) http_status = response.code.to_i json = JSON.parse(response.body) diff --git a/lib/workos/mfa.rb b/lib/workos/mfa.rb index 3cf729c2..239edf96 100644 --- a/lib/workos/mfa.rb +++ b/lib/workos/mfa.rb @@ -32,7 +32,6 @@ def get_factor( WorkOS::Factor.new(response.body) end - # rubocop:disable Metrics/CyclomaticComplexity # rubocop:disable Metrics/PerceivedComplexity def validate_args( type:, diff --git a/lib/workos/session.rb b/lib/workos/session.rb index c82b8799..c5cc0e1e 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -64,7 +64,6 @@ def authenticate # @return [Hash] A hash containing a new sealed session, the authentication response, # and a reason if the refresh failed # rubocop:disable Metrics/AbcSize - # rubocop:disable Metrics/CyclomaticComplexity # rubocop:disable Metrics/PerceivedComplexity def refresh(options = nil) cookie_password = options.nil? || options[:cookie_password].nil? ? @cookie_password : options[:cookie_password] diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 62c2dbdd..6408c2ed 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -6,8 +6,6 @@ module WorkOS # The UserManagement module provides convenience methods for working with the # WorkOS User platform. You'll need a valid API key. - - # rubocop:disable Metrics/ModuleLength module UserManagement module Types # The ProviderEnum is a declaration of a @@ -217,6 +215,7 @@ def create_user( # 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. @@ -228,6 +227,7 @@ def create_user( # @return [WorkOS::User] def update_user( id:, + email: nil, first_name: nil, last_name: nil, email_verified: nil, @@ -238,6 +238,7 @@ def update_user( request = put_request( path: "/user_management/users/#{id}", body: { + email: email, first_name: first_name, last_name: last_name, email_verified: email_verified, diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 863d456d..18d3ca9a 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -343,6 +343,17 @@ 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 + context 'with an invalid payload' do it 'returns an error' do VCR.use_cassette 'user_management/update_user/invalid' do diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_user/email.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_user/email.yml new file mode 100644 index 00000000..593467f0 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/update_user/email.yml @@ -0,0 +1,82 @@ +--- +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 From 6a095582858b3373bc0cca81dc850f83123f18c7 Mon Sep 17 00:00:00 2001 From: Cameron Matheson Date: Thu, 22 May 2025 12:11:55 -0600 Subject: [PATCH 066/159] v5.18.0 (#374) includes #365 --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d33ed71c..b06ffe2f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.17.1) + workos (5.18.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 3d3725b1..5710f84d 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.17.1' + VERSION = '5.18.0' end From 94ecb7d59dad05f1b2133eeffcf63d6385bfbe37 Mon Sep 17 00:00:00 2001 From: James <44822937+jameslcarpino@users.noreply.github.com> Date: Thu, 29 May 2025 12:49:04 -0700 Subject: [PATCH 067/159] add missing session param to authenticate_with methods (#375) Co-authored-by: Nick Nisi --- lib/workos/user_management.rb | 69 +++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 6408c2ed..878f6fef 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -278,9 +278,20 @@ def delete_user(id:) # @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 [Hash] session An optional hash that determines whether the session should be sealed and + # the optional cookie password. # # @return WorkOS::AuthenticationResponse - def authenticate_with_password(email:, password:, client_id:, ip_address: nil, user_agent: nil) + def authenticate_with_password( + email:, + password:, + client_id:, + ip_address: nil, + user_agent: nil, + session: nil + ) + validate_session(session) + response = execute_request( request: post_request( path: '/user_management/authenticate', @@ -296,7 +307,7 @@ def authenticate_with_password(email:, password:, client_id:, ip_address: nil, u ), ) - WorkOS::AuthenticationResponse.new(response.body) + WorkOS::AuthenticationResponse.new(response.body, session) end # Authenticate a user using OAuth or an organization's SSO connection. @@ -317,9 +328,7 @@ def authenticate_with_code( user_agent: nil, session: nil ) - if session && (session[:seal_session] == true) && session[:cookie_password].nil? - raise ArgumentError, 'cookie_password is required when sealing session' - end + validate_session(session) response = execute_request( request: post_request( @@ -357,9 +366,7 @@ def authenticate_with_refresh_token( user_agent: nil, session: nil ) - if session && (session[:seal_session] == true) && session[:cookie_password].nil? - raise ArgumentError, 'cookie_password is required when sealing session' - end + validate_session(session) response = execute_request( request: post_request( @@ -388,16 +395,22 @@ def authenticate_with_refresh_token( # @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 [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 + link_authorization_code: nil, + session: nil ) + validate_session(session) + response = execute_request( request: post_request( path: '/user_management/authenticate', @@ -414,8 +427,9 @@ def authenticate_with_magic_auth( ), ) - WorkOS::AuthenticationResponse.new(response.body) + WorkOS::AuthenticationResponse.new(response.body, session) end + # rubocop:enable Metrics/ParameterLists # Authenticate a user into an organization they are a member of. # @@ -424,6 +438,8 @@ def authenticate_with_magic_auth( # @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( @@ -431,8 +447,11 @@ def authenticate_with_organization_selection( organization_id:, pending_authentication_token:, ip_address: nil, - user_agent: nil + user_agent: nil, + session: nil ) + validate_session(session) + response = execute_request( request: post_request( path: '/user_management/authenticate', @@ -448,7 +467,7 @@ def authenticate_with_organization_selection( ), ) - WorkOS::AuthenticationResponse.new(response.body) + WorkOS::AuthenticationResponse.new(response.body, session) end # Authenticate a user using TOTP. @@ -461,16 +480,22 @@ def authenticate_with_organization_selection( # 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 + user_agent: nil, + session: nil ) + validate_session(session) + response = execute_request( request: post_request( path: '/user_management/authenticate', @@ -487,8 +512,9 @@ def authenticate_with_totp( ), ) - WorkOS::AuthenticationResponse.new(response.body) + WorkOS::AuthenticationResponse.new(response.body, session) end + # rubocop:enable Metrics/ParameterLists # Authenticate a user using Email Verification Code. # @@ -498,6 +524,8 @@ def authenticate_with_totp( # 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( @@ -505,8 +533,11 @@ def authenticate_with_email_verification( client_id:, pending_authentication_token:, ip_address: nil, - user_agent: nil + user_agent: nil, + session: nil ) + validate_session(session) + response = execute_request( request: post_request( path: '/user_management/authenticate', @@ -522,7 +553,7 @@ def authenticate_with_email_verification( ), ) - WorkOS::AuthenticationResponse.new(response.body) + WorkOS::AuthenticationResponse.new(response.body, session) end # Get the logout URL for a session @@ -1082,6 +1113,12 @@ def revoke_invitation(id:) private + def validate_session(session) + return unless session && (session[:seal_session] == true) && session[:cookie_password].nil? + + raise ArgumentError, 'cookie_password is required when sealing session' + end + def validate_authorization_url_arguments( provider:, connection_id:, From 443e4d134982f1035dd8bd7e74b103a17b15496b Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Thu, 29 May 2025 15:32:42 -0500 Subject: [PATCH 068/159] v5.19.0 (#376) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b06ffe2f..a0a2a96d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.18.0) + workos (5.19.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 5710f84d..26f42810 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.18.0' + VERSION = '5.19.0' end From f94765f3a0dcd6b80fb4174b2cce5f0f794d05bf Mon Sep 17 00:00:00 2001 From: Stacy Curry Date: Tue, 17 Jun 2025 19:11:39 -0500 Subject: [PATCH 069/159] add support for custom oauth scopes (#379) * add support for oauth_tokens in auth response * add support for provider_scopes parameter --- lib/workos.rb | 1 + lib/workos/authentication_response.rb | 5 +- lib/workos/oauth_tokens.rb | 29 +++++++ lib/workos/user_management.rb | 5 +- spec/lib/workos/user_management_spec.rb | 60 ++++++++++++++ .../valid_with_oauth_tokens.yml | 82 +++++++++++++++++++ 6 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 lib/workos/oauth_tokens.rb create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml diff --git a/lib/workos.rb b/lib/workos.rb index f1c36fbc..b094f4fb 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -63,6 +63,7 @@ def self.key 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' diff --git a/lib/workos/authentication_response.rb b/lib/workos/authentication_response.rb index 84642790..9d675881 100644 --- a/lib/workos/authentication_response.rb +++ b/lib/workos/authentication_response.rb @@ -12,7 +12,8 @@ class AuthenticationResponse :access_token, :refresh_token, :authentication_method, - :sealed_session + :sealed_session, + :oauth_tokens # rubocop:disable Metrics/AbcSize def initialize(authentication_response_json, session = nil) @@ -27,6 +28,7 @@ def initialize(authentication_response_json, session = nil) 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({ @@ -49,6 +51,7 @@ def to_json(*) refresh_token: refresh_token, authentication_method: authentication_method, sealed_session: sealed_session, + oauth_tokens: oauth_tokens&.to_json, } end end diff --git a/lib/workos/oauth_tokens.rb b/lib/workos/oauth_tokens.rb new file mode 100644 index 00000000..f124085c --- /dev/null +++ b/lib/workos/oauth_tokens.rb @@ -0,0 +1,29 @@ +# 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/user_management.rb b/lib/workos/user_management.rb index 878f6fef..d0b2b2dc 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -71,6 +71,7 @@ def load_sealed_session(client_id:, session_data:, cookie_password:) # field of the IdP sign-in page for the user, if you know their username ahead of time. # @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', @@ -96,7 +97,8 @@ def authorization_url( provider: nil, connection_id: nil, organization_id: nil, - state: '' + state: '', + provider_scopes: nil ) validate_authorization_url_arguments( @@ -115,6 +117,7 @@ def authorization_url( provider: provider, connection_id: connection_id, organization_id: organization_id, + provider_scopes: provider_scopes, }.compact) "https://#{WorkOS.config.api_hostname}/user_management/authorize?#{query}" diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 18d3ca9a..2ed2939d 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -36,6 +36,32 @@ '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 @@ -453,6 +479,40 @@ 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 diff --git a/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml new file mode 100644 index 00000000..7f5e0f05 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml @@ -0,0 +1,82 @@ +--- +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 From b9d4400c651d4f6c9a4e3457fdbbe3f20abc937a Mon Sep 17 00:00:00 2001 From: Stacy Curry Date: Mon, 23 Jun 2025 17:13:54 -0500 Subject: [PATCH 070/159] bump to v5.20.0 (#380) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a0a2a96d..8c945ec9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.19.0) + workos (5.20.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 26f42810..66bcf70a 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.19.0' + VERSION = '5.20.0' end From 85d82496c9283fb01cf8c6f9b32c350a594a6da8 Mon Sep 17 00:00:00 2001 From: Max Lielje Date: Mon, 30 Jun 2025 17:22:31 +0200 Subject: [PATCH 071/159] user: allow updating `external_id`, add to `User` object (#378) * user: support `external_id` in `#update` * spec: add `external_id` to `update_user` * update cassette --------- Co-authored-by: Nick Nisi --- lib/workos/user.rb | 4 +++- lib/workos/user_management.rb | 3 +++ spec/lib/workos/user_management_spec.rb | 2 ++ .../vcr_cassettes/user_management/update_user/valid.yml | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/workos/user.rb b/lib/workos/user.rb index dd25753d..0840d459 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, :last_sign_in_at, :created_at, :updated_at + :profile_picture_url, :external_id, :last_sign_in_at, :created_at, :updated_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -19,6 +19,7 @@ def initialize(json) @last_name = hash[:last_name] @email_verified = hash[:email_verified] @profile_picture_url = hash[:profile_picture_url] + @external_id = hash[:external_id] @last_sign_in_at = hash[:last_sign_in_at] @created_at = hash[:created_at] @updated_at = hash[:updated_at] @@ -32,6 +33,7 @@ def to_json(*) last_name: last_name, email_verified: email_verified, profile_picture_url: profile_picture_url, + external_id: external_id, last_sign_in_at: last_sign_in_at, created_at: created_at, updated_at: updated_at, diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index d0b2b2dc..d3ae3cd1 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -222,6 +222,7 @@ def create_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] 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. @@ -234,6 +235,7 @@ def update_user( first_name: nil, last_name: nil, email_verified: nil, + external_id: nil, password: nil, password_hash: nil, password_hash_type: nil @@ -245,6 +247,7 @@ def update_user( first_name: first_name, last_name: last_name, email_verified: email_verified, + external_id: external_id, password: password, password_hash: password_hash, password_hash_type: password_hash_type, diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 2ed2939d..cb2324a2 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -362,10 +362,12 @@ 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 diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml index 34bff4b8..e3565592 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml @@ -5,7 +5,7 @@ http_interactions: uri: https://api.workos.com/user_management/users/user_01H7TVSKS45SDHN5V9XPSM6H44 body: encoding: UTF-8 - string: '{"first_name":"Jane","last_name":"Doe","email_verified":false}' + string: '{"first_name":"Jane","last_name":"Doe","email_verified":false,"external_id":"123"}' headers: Content-Type: - application/json @@ -76,7 +76,7 @@ http_interactions: - cloudflare body: encoding: ASCII-8BIT - string: '{"object":"user","id":"user_01H7TVSKS45SDHN5V9XPSM6H44","email":"willman@blips.app","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}' + 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 From 245a930c56843ce1e20de113e84f2bca86ee5f34 Mon Sep 17 00:00:00 2001 From: Andrew Hampton Date: Thu, 3 Jul 2025 18:07:59 -0400 Subject: [PATCH 072/159] Add `permissions` to `Role` (#382) The API response for Roles now includes the permissions associated with that role. However, this has not been exposed in the ruby API. This commit fixes that problem. --- lib/workos/organizations.rb | 9 +- lib/workos/role.rb | 4 +- spec/lib/workos/organizations_spec.rb | 42 ++++++ spec/lib/workos/role_spec.rb | 142 ++++++++++++++++++ .../organization/list_organization_roles.yml | 14 +- 5 files changed, 202 insertions(+), 9 deletions(-) create mode 100644 spec/lib/workos/role_spec.rb diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index b463dd15..af3dd472 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -185,7 +185,14 @@ def delete_organization(id:) # Retrieve a list of roles for the given organization. # - # @param [String] organizationId The ID of the organization to fetch roles for. + # @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( diff --git a/lib/workos/role.rb b/lib/workos/role.rb index 5838cb41..e54db2a9 100644 --- a/lib/workos/role.rb +++ b/lib/workos/role.rb @@ -7,7 +7,7 @@ module WorkOS class Role include HashProvider - attr_accessor :id, :name, :slug, :description, :type, :created_at, :updated_at + attr_accessor :id, :name, :slug, :description, :permissions, :type, :created_at, :updated_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -16,6 +16,7 @@ def initialize(json) @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] @@ -27,6 +28,7 @@ def to_json(*) name: name, slug: slug, description: description, + permissions: permissions, type: type, created_at: created_at, updated_at: updated_at, diff --git a/spec/lib/workos/organizations_spec.rb b/spec/lib/workos/organizations_spec.rb index 8552084f..2188c9f9 100644 --- a/spec/lib/workos/organizations_spec.rb +++ b/spec/lib/workos/organizations_spec.rb @@ -354,6 +354,48 @@ 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 end diff --git a/spec/lib/workos/role_spec.rb b/spec/lib/workos/role_spec.rb new file mode 100644 index 00000000..8d4d8f75 --- /dev/null +++ b/spec/lib/workos/role_spec.rb @@ -0,0 +1,142 @@ +# 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/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml b/spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml index c07d5690..be7064da 100644 --- a/spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml +++ b/spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml @@ -70,13 +70,13 @@ http_interactions: encoding: ASCII-8BIT string: '{"object":"list","data":[{"object":"role","id":"role_01HS1C7GRJE08PBR3M6Y0ZYGDZ","description":"Write - access to every resource available","name":"Admin","slug":"admin","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","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","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","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","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","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","type":"OrganizationRole","created_at":"2024-12-13T15:47:10.692Z","updated_at":"2024-12-13T15:47:10.692Z"}]}' + 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 From b9d89e2a1c9008ee585d8a2a3e6ed1bf9e0abc19 Mon Sep 17 00:00:00 2001 From: Nick Holden Date: Mon, 7 Jul 2025 06:10:32 -0700 Subject: [PATCH 073/159] v5.21.0 (#383) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8c945ec9..4b154900 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.20.0) + workos (5.21.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 66bcf70a..9c06919a 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.20.0' + VERSION = '5.21.0' end From 31a0e7901247652182dcaad95e131357b93d0d71 Mon Sep 17 00:00:00 2001 From: Alex Azevedo <1559784+vdyalex@users.noreply.github.com> Date: Mon, 21 Jul 2025 23:54:12 +0400 Subject: [PATCH 074/159] feat: Include Feature Flags decoded from the JWT in the payload of a Session (#386) --- lib/workos/session.rb | 1 + spec/lib/workos/session_spec.rb | 38 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/lib/workos/session.rb b/lib/workos/session.rb index c5cc0e1e..44ff587c 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -51,6 +51,7 @@ def authenticate role: decoded['role'], permissions: decoded['permissions'], entitlements: decoded['entitlements'], + feature_flags: decoded['feature_flags'], user: session[:user], impersonator: session[:impersonator], reason: nil, diff --git a/spec/lib/workos/session_spec.rb b/spec/lib/workos/session_spec.rb index fa77a710..6050bcea 100644 --- a/spec/lib/workos/session_spec.rb +++ b/spec/lib/workos/session_spec.rb @@ -174,6 +174,7 @@ organization_id: 'org_id', role: 'role', permissions: ['read'], + feature_flags: nil, entitlements: nil, user: 'user', impersonator: 'impersonator', @@ -209,6 +210,43 @@ role: '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', + 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', + permissions: ['read'], + entitlements: nil, + feature_flags: ['new_feature_enabled'], user: 'user', impersonator: 'impersonator', reason: nil, From ffb578e2d2a79bf1af6113cae2d4f57b151ac631 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Tue, 22 Jul 2025 10:00:25 -0500 Subject: [PATCH 075/159] Fix request body construction to only send non-nil values (#384) --- lib/workos/user_management.rb | 12 ++-- spec/lib/workos/user_management_spec.rb | 87 +++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index d3ae3cd1..09ab6c63 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -206,7 +206,7 @@ def create_user( email_verified: email_verified, password_hash: password_hash, password_hash_type: password_hash_type, - }, + }.compact, auth: true, ) @@ -251,7 +251,7 @@ def update_user( password: password, password_hash: password_hash, password_hash_type: password_hash_type, - }, + }.compact, auth: true, ) @@ -643,7 +643,7 @@ def create_magic_auth(email:, invitation_token: nil) body: { email: email, invitation_token: invitation_token, - }, + }.compact, auth: true, ), ) @@ -697,7 +697,7 @@ def enroll_auth_factor(user_id:, type:, totp_issuer: nil, totp_user: nil, totp_s totp_issuer: totp_issuer, totp_user: totp_user, totp_secret: totp_secret, - }, + }.compact, auth: true, ), ) @@ -928,7 +928,7 @@ def create_organization_membership(user_id:, organization_id:, role_slug: nil) user_id: user_id, organization_id: organization_id, role_slug: role_slug, - }, + }.compact, auth: true, ) @@ -1093,7 +1093,7 @@ def send_invitation(email:, organization_id: nil, expires_in_days: nil, inviter_ expires_in_days: expires_in_days, inviter_user_id: inviter_user_id, role_slug: role_slug, - }, + }.compact, auth: true, ), ) diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index cb2324a2..8ba0f023 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -338,6 +338,26 @@ 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 + context 'with an invalid payload' do it 'returns an error' do VCR.use_cassette 'user_management/create_user_invalid' do @@ -382,6 +402,30 @@ 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) + + # 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 + context 'with an invalid payload' do it 'returns an error' do VCR.use_cassette 'user_management/update_user/invalid' do @@ -778,6 +822,28 @@ 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 @@ -1444,6 +1510,27 @@ 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 From de4e23c5b3d374c3455abda07e3d237f68acd506 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Tue, 22 Jul 2025 10:00:49 -0500 Subject: [PATCH 076/159] Fix SSO error handling to surface detailed validation errors (#385) --- lib/workos/sso.rb | 27 ++--------- spec/lib/workos/sso_spec.rb | 91 +++++++++++++++++++++++++++++++++++-- 2 files changed, 90 insertions(+), 28 deletions(-) diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index bd7f52e9..87e90a33 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -120,8 +120,9 @@ def profile_and_token(code:, client_id: nil) code: code, } - response = client.request(post_request(path: '/sso/token', body: body)) - check_and_raise_profile_and_token_error(response: response) + response = execute_request( + request: post_request(path: '/sso/token', body: body), + ) WorkOS::ProfileAndToken.new(response.body) end @@ -229,28 +230,6 @@ def validate_authorization_url_arguments( raise ArgumentError, "#{provider} is not a valid value." \ " `provider` must be in #{PROVIDERS}" end - - def check_and_raise_profile_and_token_error(response:) - begin - body = JSON.parse(response.body) - return if body['access_token'] && body['profile'] - - message = body['message'] - error = body['error'] - error_description = body['error_description'] - request_id = response['x-request-id'] - rescue StandardError - message = 'Something went wrong' - end - - raise APIError.new( - message: message, - error: error, - error_description: error_description, - http_status: nil, - request_id: request_id, - ) - end end end end diff --git a/spec/lib/workos/sso_spec.rb b/spec/lib/workos/sso_spec.rb index d3037e63..6753e306 100644 --- a/spec/lib/workos/sso_spec.rb +++ b/spec/lib/workos/sso_spec.rb @@ -416,10 +416,73 @@ expect do described_class.profile_and_token(**args) end.to raise_error( - WorkOS::APIError, - 'error: some error, error_description: some error description - request ID: request-id', + 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 @@ -440,11 +503,31 @@ expect do described_class.profile_and_token(**args) end.to raise_error( - WorkOS::APIError, - "error: invalid_grant, error_description: The code '01DVX3C5Z367SFHR8QNDMK7V24'" \ + 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 From 579d4fdc10a09baee5c616714c1a68030385d269 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Tue, 22 Jul 2025 10:33:16 -0500 Subject: [PATCH 077/159] v5.22.0 (#387) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4b154900..13aec343 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.21.0) + workos (5.22.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 9c06919a..1abe3ed7 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.21.0' + VERSION = '5.22.0' end From 5bf1f012db355040d15d151bb60bfc16ce776b2c Mon Sep 17 00:00:00 2001 From: Eric Roberts Date: Wed, 23 Jul 2025 10:33:54 -0400 Subject: [PATCH 078/159] Add external_id to user and organization (#381) * Add external_id to user and organization On create and update (@mxlje already added to user update). * Allow passing of nil for external_id External IDs can actually be set to null. On create this isn't an issue, not sending it will result in it being null. But on update if a user passes nil we want to be sure a null value goes to the API. Since organizations and user update methods are different I opted for a slightly difference solution in each place. * Test that external_id can be set to null --- lib/workos/organization.rb | 3 + lib/workos/organizations.rb | 8 ++ lib/workos/user_management.rb | 21 +++-- spec/lib/workos/organizations_spec.rb | 52 ++++++++++++ spec/lib/workos/user_management_spec.rb | 35 ++++++++ .../organization/create_with_external_id.yml | 83 +++++++++++++++++++ .../organization/update_with_external_id.yml | 78 +++++++++++++++++ .../update_with_external_id_null.yml | 78 +++++++++++++++++ .../create_user_with_external_id.yml | 77 +++++++++++++++++ .../update_user_external_id_null.yml | 77 +++++++++++++++++ 10 files changed, 503 insertions(+), 9 deletions(-) create mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_with_external_id.yml create mode 100644 spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml create mode 100644 spec/support/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml diff --git a/lib/workos/organization.rb b/lib/workos/organization.rb index 9bad7fc3..19c98a20 100644 --- a/lib/workos/organization.rb +++ b/lib/workos/organization.rb @@ -12,6 +12,7 @@ class Organization :domains, :stripe_customer_id, :name, + :external_id, :allow_profiles_outside_organization, :created_at, :updated_at, @@ -22,6 +23,7 @@ def initialize(json) @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] @@ -33,6 +35,7 @@ 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, diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index af3dd472..ff83ca3d 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -75,6 +75,7 @@ def get_organization(id:) # @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. @@ -85,11 +86,13 @@ def create_organization( domain_data: nil, domains: nil, name:, + 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.' @@ -123,22 +126,26 @@ def create_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.' @@ -162,6 +169,7 @@ def update_organization( WorkOS::Organization.new(response.body) end + # rubocop:enable Metrics/ParameterLists # Delete an Organization # diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 09ab6c63..9b30e6d2 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -182,6 +182,7 @@ def list_users(options = {}) # @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. # @@ -193,6 +194,7 @@ def create_user( first_name: nil, last_name: nil, email_verified: nil, + external_id: nil, password_hash: nil, password_hash_type: nil ) @@ -204,6 +206,7 @@ def create_user( 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, @@ -231,14 +234,14 @@ def create_user( # @return [WorkOS::User] def update_user( id:, - email: nil, - first_name: nil, - last_name: nil, - email_verified: nil, - external_id: nil, - password: nil, - password_hash: nil, - password_hash_type: nil + email: :not_set, + first_name: :not_set, + last_name: :not_set, + email_verified: :not_set, + external_id: :not_set, + password: :not_set, + password_hash: :not_set, + password_hash_type: :not_set ) request = put_request( path: "/user_management/users/#{id}", @@ -251,7 +254,7 @@ def update_user( password: password, password_hash: password_hash, password_hash_type: password_hash_type, - }.compact, + }.reject { |_, v| v == :not_set }, auth: true, ) diff --git a/spec/lib/workos/organizations_spec.rb b/spec/lib/workos/organizations_spec.rb index 2188c9f9..91394493 100644 --- a/spec/lib/workos/organizations_spec.rb +++ b/spec/lib/workos/organizations_spec.rb @@ -33,6 +33,21 @@ 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 @@ -310,6 +325,43 @@ 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 diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 8ba0f023..5b595563 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -358,6 +358,22 @@ ) 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 @@ -426,6 +442,25 @@ ) 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 diff --git a/spec/support/fixtures/vcr_cassettes/organization/create_with_external_id.yml b/spec/support/fixtures/vcr_cassettes/organization/create_with_external_id.yml new file mode 100644 index 00000000..92470cc5 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/organization/create_with_external_id.yml @@ -0,0 +1,83 @@ +--- +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/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml b/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml new file mode 100644 index 00000000..8811e883 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml @@ -0,0 +1,78 @@ +--- +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/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml b/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml new file mode 100644 index 00000000..f01e5b11 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml @@ -0,0 +1,78 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml new file mode 100644 index 00000000..2447ebdc --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml @@ -0,0 +1,77 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml new file mode 100644 index 00000000..fa81b88f --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml @@ -0,0 +1,77 @@ +--- +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 From 9e5a3b0d4b702892af14820362cf20f8b0c0830e Mon Sep 17 00:00:00 2001 From: Eric Roberts Date: Wed, 23 Jul 2025 11:06:50 -0400 Subject: [PATCH 079/159] bump to v5.23.0 (#388) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 13aec343..ce1cfa39 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.22.0) + workos (5.23.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 1abe3ed7..8fbbf274 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.22.0' + VERSION = '5.23.0' end From c749079686e0d7f31926d2d774f9ac20200106a1 Mon Sep 17 00:00:00 2001 From: Teyler Date: Wed, 30 Jul 2025 13:56:53 -0600 Subject: [PATCH 080/159] Add screen_hint to Ruby Gem + vcr 6 (#389) * Add screen_hint to UserManagement As a solution to build "Sign-Up" paths in Rails applications, this adds the `screen_hint` to the UserManagement.authorization_url flow. This appears to be a valid api in NodeJS already (https://workos.com/docs/reference/authkit/authentication/get-authorization-url), this simply adds it to the Ruby Gem. Unit tests have been added as well. * Update VCR to resolve global_hook failure From research, this is a pretty well known issue in vcr 5 that has been resolved in vcr 6. Running bundle exec rspec still passes with this update. Resolves .rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/vcr-5.0.0/lib/vcr/library_hooks/webmock.rb:36:in `block in global_hook_disabled_requests': wrong number of arguments (given 1, expected 0) (ArgumentError). --- Gemfile.lock | 7 +++-- lib/workos/user_management.rb | 4 +++ spec/lib/workos/user_management_spec.rb | 35 +++++++++++++++++++++++++ workos.gemspec | 2 +- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ce1cfa39..b5c57b1d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,7 +32,6 @@ GEM rainbow (3.1.1) regexp_parser (2.10.0) rexml (3.4.1) - strscan rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) @@ -59,11 +58,11 @@ GEM rubocop-ast (1.37.0) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) - strscan (3.1.0) unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) - vcr (5.0.0) + vcr (6.3.1) + base64 webmock (3.23.0) addressable (>= 2.8.0) crack (>= 0.3.2) @@ -76,7 +75,7 @@ DEPENDENCIES bundler (>= 2.0.1) rspec (~> 3.9.0) rubocop (~> 1.71) - vcr (~> 5.0.0) + vcr (~> 6.0) webmock workos! diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 9b30e6d2..8084e0e1 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -69,6 +69,8 @@ def load_sealed_session(client_id:, session_data:, cookie_password:) # 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. @@ -94,6 +96,7 @@ def authorization_url( client_id: nil, domain_hint: nil, login_hint: nil, + screen_hint: nil, provider: nil, connection_id: nil, organization_id: nil, @@ -114,6 +117,7 @@ def authorization_url( state: state, domain_hint: domain_hint, login_hint: login_hint, + screen_hint: screen_hint, provider: provider, connection_id: connection_id, organization_id: organization_id, diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 5b595563..1192e936 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -202,6 +202,41 @@ 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 { diff --git a/workos.gemspec b/workos.gemspec index 20b5f427..b9f827a5 100644 --- a/workos.gemspec +++ b/workos.gemspec @@ -27,7 +27,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler', '>= 2.0.1' spec.add_development_dependency 'rspec', '~> 3.9.0' spec.add_development_dependency 'rubocop', '~> 1.71' - spec.add_development_dependency 'vcr', '~> 5.0.0' + spec.add_development_dependency 'vcr', '~> 6.0' spec.add_development_dependency 'webmock' spec.required_ruby_version = '>= 3.1' From 4d8a2ba818fac891485fc1ae0149c7fa676c124a Mon Sep 17 00:00:00 2001 From: Nick Holden Date: Wed, 30 Jul 2025 14:35:00 -0700 Subject: [PATCH 081/159] v5.24.0 (#390) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b5c57b1d..ff27d2b7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.23.0) + workos (5.24.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 8fbbf274..73f73f9e 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.23.0' + VERSION = '5.24.0' end From fc271a9b7bc87b919441495c5932f9af61efa10f Mon Sep 17 00:00:00 2001 From: Stanley Phu Date: Mon, 4 Aug 2025 18:10:44 -0700 Subject: [PATCH 082/159] Add GET /organizations/:orgId/feature-flags support (#391) --- lib/workos.rb | 1 + lib/workos/feature_flag.rb | 34 +++++ lib/workos/organizations.rb | 40 ++++++ spec/lib/workos/organizations_spec.rb | 116 ++++++++++++++++++ .../list_organization_feature_flags.yml | 78 ++++++++++++ 5 files changed, 269 insertions(+) create mode 100644 lib/workos/feature_flag.rb create mode 100644 spec/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml diff --git a/lib/workos.rb b/lib/workos.rb index b094f4fb..12a5617c 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -59,6 +59,7 @@ def self.key 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' diff --git a/lib/workos/feature_flag.rb b/lib/workos/feature_flag.rb new file mode 100644 index 00000000..85d958e2 --- /dev/null +++ b/lib/workos/feature_flag.rb @@ -0,0 +1,34 @@ +# 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/organizations.rb b/lib/workos/organizations.rb index ff83ca3d..d130fa03 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -224,6 +224,46 @@ def list_organization_roles(organization_id:) ) 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, + ), + ) + + parsed_response = JSON.parse(response.body) + + 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), + ) + end + private def check_and_raise_organization_error(response:) diff --git a/spec/lib/workos/organizations_spec.rb b/spec/lib/workos/organizations_spec.rb index 91394493..5ce146d1 100644 --- a/spec/lib/workos/organizations_spec.rb +++ b/spec/lib/workos/organizations_spec.rb @@ -450,4 +450,120 @@ 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/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml b/spec/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml new file mode 100644 index 00000000..3907287f --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml @@ -0,0 +1,78 @@ +--- +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 From 97d5be563dbae1c04729f215ac82acd306129d0e Mon Sep 17 00:00:00 2001 From: Stanley Phu Date: Tue, 5 Aug 2025 15:45:45 -0700 Subject: [PATCH 083/159] v5.25.0 (#393) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ff27d2b7..778887ea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.24.0) + workos (5.25.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 73f73f9e..7886021c 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.24.0' + VERSION = '5.25.0' end From 014332fe965faeb3b560a1b6ef69c46ba75cd4fc Mon Sep 17 00:00:00 2001 From: Adam Heath Date: Tue, 7 Oct 2025 16:11:13 +0100 Subject: [PATCH 084/159] Add SSO and Domain Verification widget scopes (#396) Allowing these widgets to be used via the `WorkOS::Widgets.get_token` API. --- lib/workos/types/widget_scope.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/workos/types/widget_scope.rb b/lib/workos/types/widget_scope.rb index d3ba05a5..d4097346 100644 --- a/lib/workos/types/widget_scope.rb +++ b/lib/workos/types/widget_scope.rb @@ -6,8 +6,10 @@ module Types # 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].freeze + ALL = [USERS_TABLE_MANAGE, SSO_MANAGE, DOMAIN_VERIFICATION_MANAGE].freeze end end end From 33da1976f67c5d49a50b2519a1924571de0ed0c0 Mon Sep 17 00:00:00 2001 From: Colin Barber Date: Fri, 10 Oct 2025 15:42:25 -0300 Subject: [PATCH 085/159] AuthKit multiple roles support (#397) * AuthKit multiple roles support --- .gitignore | 1 + lib/workos/organization_membership.rb | 4 +- lib/workos/session.rb | 3 +- lib/workos/user_management.rb | 38 ++++++---- spec/lib/workos/session_spec.rb | 6 ++ spec/lib/workos/user_management_spec.rb | 33 ++++++++ .../valid_multiple_roles.yml | 76 +++++++++++++++++++ .../valid_multiple_roles.yml | 76 +++++++++++++++++++ 8 files changed, 222 insertions(+), 15 deletions(-) create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml diff --git a/.gitignore b/.gitignore index 03fb3387..28a094d7 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ # .rubocop-https?--* .vscode +.idea/ diff --git a/lib/workos/organization_membership.rb b/lib/workos/organization_membership.rb index daf04f09..4943b5ad 100644 --- a/lib/workos/organization_membership.rb +++ b/lib/workos/organization_membership.rb @@ -7,7 +7,7 @@ module WorkOS class OrganizationMembership include HashProvider - attr_accessor :id, :user_id, :organization_id, :status, :role, :created_at, :updated_at + attr_accessor :id, :user_id, :organization_id, :status, :role, :roles, :created_at, :updated_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -17,6 +17,7 @@ def initialize(json) @organization_id = hash[:organization_id] @status = hash[:status] @role = hash[:role] + @roles = hash[:roles] @created_at = hash[:created_at] @updated_at = hash[:updated_at] end @@ -28,6 +29,7 @@ def to_json(*) organization_id: organization_id, status: status, role: role, + roles: roles, created_at: created_at, updated_at: updated_at, } diff --git a/lib/workos/session.rb b/lib/workos/session.rb index 44ff587c..a872487e 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -30,6 +30,7 @@ def initialize(user_management:, client_id:, session_data:, cookie_password:) # Authenticates the user based on the session data # @return [Hash] A hash containing the authentication response and a reason if the authentication failed + # rubocop:disable Metrics/AbcSize def authenticate return { authenticated: false, reason: 'NO_SESSION_COOKIE_PROVIDED' } if @session_data.nil? @@ -49,6 +50,7 @@ def authenticate 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'], @@ -64,7 +66,6 @@ def authenticate # @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 - # rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/PerceivedComplexity def refresh(options = nil) cookie_password = options.nil? || options[:cookie_password].nil? ? @cookie_password : options[:cookie_password] diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 8084e0e1..d0c8061a 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -926,16 +926,23 @@ def list_organization_memberships(options = {}) # @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) + 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: { - user_id: user_id, - organization_id: organization_id, - role_slug: role_slug, - }.compact, + body: body.compact, auth: true, ) @@ -946,17 +953,22 @@ def create_organization_membership(user_id:, organization_id:, role_slug: nil) # Update an Organization Membership # - # @param [String] organization_membership_id The ID of the Organization Membership. - # @param [String] role_slug The slug of the role to grant to this 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:) + 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 + + body = { id: id } + + body[:role_slugs] = role_slugs if role_slugs + body[:role_slug] = role_slug if role_slug + request = put_request( path: "/user_management/organization_memberships/#{id}", - body: { - id: id, - role_slug: role_slug, - }, + body: body.compact, auth: true, ) diff --git a/spec/lib/workos/session_spec.rb b/spec/lib/workos/session_spec.rb index 6050bcea..d0075650 100644 --- a/spec/lib/workos/session_spec.rb +++ b/spec/lib/workos/session_spec.rb @@ -108,6 +108,7 @@ sid: 'session_id', org_id: 'org_id', role: 'role', + roles: ['role'], permissions: ['read'], exp: Time.now.to_i + 3600, } @@ -173,6 +174,7 @@ session_id: 'session_id', organization_id: 'org_id', role: 'role', + roles: ['role'], permissions: ['read'], feature_flags: nil, entitlements: nil, @@ -188,6 +190,7 @@ sid: 'session_id', org_id: 'org_id', role: 'role', + roles: ['role'], permissions: ['read'], entitlements: ['billing'], exp: Time.now.to_i + 3600, @@ -208,6 +211,7 @@ session_id: 'session_id', organization_id: 'org_id', role: 'role', + roles: ['role'], permissions: ['read'], entitlements: ['billing'], feature_flags: nil, @@ -224,6 +228,7 @@ sid: 'session_id', org_id: 'org_id', role: 'role', + roles: ['role'], permissions: ['read'], feature_flags: ['new_feature_enabled'], exp: Time.now.to_i + 3600, @@ -244,6 +249,7 @@ session_id: 'session_id', organization_id: 'org_id', role: 'role', + roles: ['role'], permissions: ['read'], entitlements: nil, feature_flags: ['new_feature_enabled'], diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 1192e936..d137a795 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -1302,6 +1302,23 @@ 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 @@ -1329,6 +1346,22 @@ 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 diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml new file mode 100644 index 00000000..13afb89f --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml @@ -0,0 +1,76 @@ +--- +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"}], "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/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml new file mode 100644 index 00000000..7cb2dd46 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml @@ -0,0 +1,76 @@ +--- +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"}],"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 From 0bd554a55441df2f8dcaaac5bfcf1529a3d0b8ab Mon Sep 17 00:00:00 2001 From: Colin Barber Date: Fri, 10 Oct 2025 17:01:35 -0300 Subject: [PATCH 086/159] Bump to 5.26.0 (#399) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 778887ea..9fa290a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.25.0) + workos (5.26.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 7886021c..54c84c5c 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.25.0' + VERSION = '5.26.0' end From 5daa3ca30ba1e28449325be0009499e2b2209dea Mon Sep 17 00:00:00 2001 From: Stacy Curry Date: Fri, 10 Oct 2025 19:46:33 -0500 Subject: [PATCH 087/159] add locale to user (#400) ## Description adds locale to the User object, adds support for updating User locale ## Documentation Does this require changes to the WorkOS Docs? E.g. the [API Reference](https://workos.com/docs/reference) or code snippets need updates. ``` [X] Yes ``` If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required. --- lib/workos/user.rb | 4 +- lib/workos/user_management.rb | 3 + spec/lib/workos/user_management_spec.rb | 11 +++ .../user_management/update_user/locale.yml | 76 +++++++++++++++++++ 4 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_user/locale.yml diff --git a/lib/workos/user.rb b/lib/workos/user.rb index 0840d459..6e952815 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, :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) @@ -20,6 +20,7 @@ def initialize(json) @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] @@ -34,6 +35,7 @@ def to_json(*) 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, diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index d0c8061a..6a11dee2 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -230,6 +230,7 @@ def create_user( # @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. @@ -243,6 +244,7 @@ def update_user( 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 @@ -255,6 +257,7 @@ def update_user( 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, diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index d137a795..01378a5a 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -442,6 +442,16 @@ 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( @@ -462,6 +472,7 @@ 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') diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_user/locale.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_user/locale.yml new file mode 100644 index 00000000..6b3177c6 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/update_user/locale.yml @@ -0,0 +1,76 @@ +--- +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 From 8d75d32066381a4a593d9760c894e8d71d68f42a Mon Sep 17 00:00:00 2001 From: Stacy Curry Date: Mon, 27 Oct 2025 07:55:03 -0700 Subject: [PATCH 088/159] bump to v5.27.0 (#403) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9fa290a1..51a30f59 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.26.0) + workos (5.27.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 54c84c5c..35ff0d3d 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.26.0' + VERSION = '5.27.0' end From 1931e3f42f85f34e1b6bdb5a1e9545fa1f46d9d8 Mon Sep 17 00:00:00 2001 From: antn Date: Tue, 18 Nov 2025 16:51:20 -0800 Subject: [PATCH 089/159] Add ability to resend invitations (#404) --- lib/workos/user_management.rb | 16 ++++ spec/lib/workos/user_management_spec.rb | 75 +++++++++++++++++ .../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 +++++++++++++++++++ 7 files changed, 506 insertions(+) create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 6a11dee2..923ee713 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -1139,6 +1139,22 @@ def revoke_invitation(id:) 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 + private def validate_session(session) diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 01378a5a..f852db47 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -1693,6 +1693,81 @@ 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 diff --git a/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml new file mode 100644 index 00000000..a9965525 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml @@ -0,0 +1,83 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml new file mode 100644 index 00000000..75c2bde8 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml @@ -0,0 +1,83 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml new file mode 100644 index 00000000..91c16a03 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml @@ -0,0 +1,83 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml new file mode 100644 index 00000000..6466bc33 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml @@ -0,0 +1,83 @@ +--- +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/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml new file mode 100644 index 00000000..37d19423 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml @@ -0,0 +1,83 @@ +--- +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 + From 24837582bd2ee32af423df18ea2f3ecce4f651e0 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Wed, 19 Nov 2025 16:45:17 -0500 Subject: [PATCH 090/159] Fix reset_password to handle wrapped API response (#406) The WorkOS API returns password reset responses in wrapped format {"user": {...}} rather than a flat user object. This caused reset_password to return a User object with all nil fields despite successful API calls. Changes: - Updated reset_password to use UserResponse.new(response.body).user to correctly unwrap the API response (line 872) - Updated VCR cassette to match current API response format Verified: - Tested against real WorkOS API with local code changes - User object now correctly populated with all fields - All 119 user_management tests pass - Response format matches Go and Node.js SDK implementations - Resolves customer issue where password reset succeeded but returned User object with all null fields --- lib/workos/user_management.rb | 2 +- .../vcr_cassettes/user_management/reset_password/valid.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 923ee713..6d59f2be 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -869,7 +869,7 @@ def reset_password(token:, new_password:) ), ) - WorkOS::User.new(response.body) + WorkOS::UserResponse.new(response.body).user end # Get an Organization Membership diff --git a/spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml index 54d37b00..26bbecc0 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml @@ -76,7 +76,7 @@ http_interactions: - cloudflare body: encoding: UTF-8 - string: '{"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}' + 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 From f6d6780033df0d3f5c68b0a8b3d04763d7f20e45 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Thu, 20 Nov 2025 08:09:05 -0500 Subject: [PATCH 091/159] v5.28.0 (#407) * v5.27.1 * v5.28.0 --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 51a30f59..05a39110 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.27.0) + workos (5.28.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 35ff0d3d..31734d10 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.27.0' + VERSION = '5.28.0' end From 6fb6a962a0f422bfd4e1b3c100c36df4a5e628fc Mon Sep 17 00:00:00 2001 From: Oliver Morgan Date: Fri, 21 Nov 2025 20:16:01 +0000 Subject: [PATCH 092/159] expose authentication object even if expired (#398) * expose authentication object even if expired * remove unused variable * disable rubocop for long line * Fix tests * refactor to use keyword argument for backwards compatibility * fix rubocop errors --------- Co-authored-by: Nick Nisi --- lib/workos/session.rb | 70 ++++++++++++++++++--------------- spec/lib/workos/session_spec.rb | 38 ++++++++++++++++++ 2 files changed, 76 insertions(+), 32 deletions(-) diff --git a/lib/workos/session.rb b/lib/workos/session.rb index a872487e..2beb0d52 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -29,9 +29,10 @@ def initialize(user_management:, client_id:, session_data:, cookie_password:) end # Authenticates the user based on the session data + # @param include_expired [Boolean] If true, returns decoded token data even when expired (default: false) # @return [Hash] A hash containing the authentication response and a reason if the authentication failed - # rubocop:disable Metrics/AbcSize - def authenticate + # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity + def authenticate(include_expired: false) return { authenticated: false, reason: 'NO_SESSION_COOKIE_PROVIDED' } if @session_data.nil? begin @@ -41,23 +42,41 @@ def authenticate end return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } unless session[:access_token] - return { authenticated: false, reason: 'INVALID_JWT' } unless is_valid_jwt(session[:access_token]) - - decoded = JWT.decode(session[:access_token], nil, true, algorithms: @jwks_algorithms, jwks: @jwks).first - - { - authenticated: true, - 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: nil, - } + + 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 + + # Early return for expired tokens when not including expired data (backward compatible) + return { authenticated: false, reason: 'INVALID_JWT' } if expired && !include_expired + + # Return full data for valid tokens or when include_expired is true + { + 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, + } + rescue JWT::DecodeError + { authenticated: false, reason: 'INVALID_JWT' } + rescue StandardError => e + { authenticated: false, reason: e.message } + end end # Refreshes the session data using the refresh token stored in the session data @@ -66,7 +85,6 @@ def authenticate # @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 - # rubocop:disable Metrics/PerceivedComplexity def refresh(options = nil) cookie_password = options.nil? || options[:cookie_password].nil? ? @cookie_password : options[:cookie_password] @@ -168,17 +186,5 @@ def create_remote_jwk_set(uri) jwks end - - # Validates a JWT token using the JWKS set - # @param token [String] The JWT token to validate - # @return [Boolean] True if the token is valid, false otherwise - # rubocop:disable Naming/PredicateName - def is_valid_jwt(token) - JWT.decode(token, nil, true, algorithms: @jwks_algorithms, jwks: @jwks) - true - rescue StandardError - false - end - # rubocop:enable Naming/PredicateName end end diff --git a/spec/lib/workos/session_spec.rb b/spec/lib/workos/session_spec.rb index d0075650..d88037ec 100644 --- a/spec/lib/workos/session_spec.rb +++ b/spec/lib/workos/session_spec.rb @@ -160,6 +160,44 @@ 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, From 40e2a61405f702a10d50a735441582950c442f72 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Fri, 21 Nov 2025 15:46:10 -0500 Subject: [PATCH 093/159] v5.29.0 (#410) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 05a39110..3cb2fa0a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.28.0) + workos (5.29.0) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 31734d10..af6993a8 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.28.0' + VERSION = '5.29.0' end From 987ceb517278f8863d8b0ed1bae23a9890528ce9 Mon Sep 17 00:00:00 2001 From: Kendall Strautman Swarthout <36613477+kendallstrautman@users.noreply.github.com> Date: Tue, 2 Dec 2025 13:38:01 -0800 Subject: [PATCH 094/159] Add `roles` to SSO profile and directory user (#411) * Add roles to profile and directory user * Separate authz attributes * Move up primary email to public * Move primary email to the bottom * Adjust test --- lib/workos/directory_user.rb | 20 +++++++++++++++++-- lib/workos/profile.rb | 4 +++- spec/lib/workos/directory_user_spec.rb | 16 ++++++++++++--- spec/lib/workos/sso_spec.rb | 6 ++++++ .../vcr_cassettes/directory_sync/get_user.yml | 2 +- .../fixtures/vcr_cassettes/sso/profile.yml | 2 +- spec/support/profile.txt | 2 +- 7 files changed, 43 insertions(+), 9 deletions(-) diff --git a/lib/workos/directory_user.rb b/lib/workos/directory_user.rb index e51025c7..a168c1ee 100644 --- a/lib/workos/directory_user.rb +++ b/lib/workos/directory_user.rb @@ -8,7 +8,7 @@ class DirectoryUser < DeprecatedHashWrapper include HashProvider attr_accessor :id, :idp_id, :email, :emails, :first_name, :last_name, :job_title, :username, :state, - :groups, :role, :custom_attributes, :raw_attributes, :directory_id, :organization_id, + :groups, :role, :roles, :custom_attributes, :raw_attributes, :directory_id, :organization_id, :created_at, :updated_at # rubocop:disable Metrics/AbcSize @@ -37,6 +37,7 @@ def initialize(json) @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] @@ -47,6 +48,13 @@ def initialize(json) # rubocop:enable Metrics/AbcSize def to_json(*) + base_attributes. + merge(authorization_attributes) + end + + private + + def base_attributes { id: id, directory_id: directory_id, @@ -60,7 +68,6 @@ def to_json(*) username: username, state: state, groups: groups, - role: role, custom_attributes: custom_attributes, raw_attributes: raw_attributes, created_at: created_at, @@ -68,6 +75,15 @@ def to_json(*) } 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] } diff --git a/lib/workos/profile.rb b/lib/workos/profile.rb index 3a02ac62..56c101e7 100644 --- a/lib/workos/profile.rb +++ b/lib/workos/profile.rb @@ -9,7 +9,7 @@ module WorkOS class Profile include HashProvider - attr_accessor :id, :email, :first_name, :last_name, :role, :groups, :organization_id, + 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 @@ -21,6 +21,7 @@ def initialize(profile_json) @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] @@ -42,6 +43,7 @@ def to_json(*) first_name: first_name, last_name: last_name, role: role, + roles: roles, groups: groups, organization_id: organization_id, connection_id: connection_id, diff --git a/spec/lib/workos/directory_user_spec.rb b/spec/lib/workos/directory_user_spec.rb index 013c2613..e0c02150 100644 --- a/spec/lib/workos/directory_user_spec.rb +++ b/spec/lib/workos/directory_user_spec.rb @@ -37,13 +37,23 @@ 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 role' do - it 'returns the role slug' 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"},"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') + 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 diff --git a/spec/lib/workos/sso_spec.rb b/spec/lib/workos/sso_spec.rb index 6753e306..0af30aed 100644 --- a/spec/lib/workos/sso_spec.rb +++ b/spec/lib/workos/sso_spec.rb @@ -305,6 +305,9 @@ role: { slug: 'member', }, + roles: [{ + slug: 'member', + }], groups: nil, organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB', custom_attributes: {}, @@ -380,6 +383,9 @@ role: { slug: 'admin', }, + roles: [{ + slug: 'admin', + }], groups: %w[Admins Developers], organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB', custom_attributes: { diff --git a/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml index 9c8fe356..25717c4d 100644 --- a/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml +++ b/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml @@ -74,7 +74,7 @@ http_interactions: - 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","raw_attributes":{"id":"6092c280a3f1e19ef6d8cef8","name":"Bob + 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"}}]}' diff --git a/spec/support/fixtures/vcr_cassettes/sso/profile.yml b/spec/support/fixtures/vcr_cassettes/sso/profile.yml index 65d6dec3..5fa50a65 100644 --- a/spec/support/fixtures/vcr_cassettes/sso/profile.yml +++ b/spec/support/fixtures/vcr_cassettes/sso/profile.yml @@ -67,7 +67,7 @@ http_interactions: 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"},"custom_attributes":{},"raw_attributes":{"hd":"workos.com","id":"116485463307139932699","name":"Bob + '{"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 diff --git a/spec/support/profile.txt b/spec/support/profile.txt index 7e19a262..5e8df665 100644 --- a/spec/support/profile.txt +++ b/spec/support/profile.txt @@ -1 +1 @@ -{"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"},"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"} +{"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"} From d0e5551b43138800913f2dda9618c09992b212d8 Mon Sep 17 00:00:00 2001 From: Kendall Strautman Swarthout <36613477+kendallstrautman@users.noreply.github.com> Date: Tue, 2 Dec 2025 15:57:24 -0800 Subject: [PATCH 095/159] version bump (#412) --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3cb2fa0a..ce78f138 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.29.0) + workos (5.30.1) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index af6993a8..a1d193d7 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.29.0' + VERSION = '5.30.1' end From 75e5f896770c563e161119dac7af5538ec56c83a Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Wed, 17 Dec 2025 15:47:12 -0600 Subject: [PATCH 096/159] add context7.json (#413) --- context7.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 context7.json diff --git a/context7.json b/context7.json new file mode 100644 index 00000000..ed85fa0f --- /dev/null +++ b/context7.json @@ -0,0 +1,4 @@ +{ + "url": "https://context7.com/workos/workos-ruby", + "public_key": "pk_q7NnKuFFXMWA7WnmjMHQU" +} \ No newline at end of file From 6831ff2a7f5bffd36f2c35020793fa3cd7d5f7d6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 11:41:49 -0500 Subject: [PATCH 097/159] Update ruby/setup-ruby action to v1.281.0 (#358) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44d41dfa..458b0f74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - '3.2' steps: - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@1a615958ad9d422dd932dc1d5823942ee002799f # v1.227.0 + - uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true From 5740a9b99c6c8f1255824e1423999aa82ba5080a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 12:29:38 -0500 Subject: [PATCH 098/159] Update actions/checkout action to v6 (#409) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 458b0f74..acb62ea6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - '3.1' - '3.2' steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0 with: ruby-version: ${{ matrix.ruby }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 415ba82c..f38bfe56 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: name: Publish to RubyGems runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - uses: ruby/setup-ruby@v1 with: ruby-version: '3.2' From 1bd0a5c7f669284dd60ac3e254ddc35529f23f39 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Mon, 12 Jan 2026 12:38:17 -0500 Subject: [PATCH 099/159] Update CODEOWNERS for Rubyist Team (#416) --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 859e89b7..708559bf 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,4 +2,4 @@ # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners # Rubyist Team -* @workos-inc/ruby +* @workos/ruby From 27139bd347e719203ddb12fd4398b7ae8c666293 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 15:37:10 -0500 Subject: [PATCH 100/159] Bump rexml from 3.4.1 to 3.4.2 (#395) * Bump rexml from 3.4.1 to 3.4.2 Bumps [rexml](https://github.com/ruby/rexml) from 3.4.1 to 3.4.2. - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.4.1...v3.4.2) --- updated-dependencies: - dependency-name: rexml dependency-version: 3.4.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] * docs: Fix parameter name in DirectorySync#list_users documentation --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: masamichhhhi --- Gemfile.lock | 2 +- lib/workos/directory_sync.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ce78f138..18de8384 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,7 +31,7 @@ GEM racc (1.8.1) rainbow (3.1.1) regexp_parser (2.10.0) - rexml (3.4.1) + rexml (3.4.2) rspec (3.9.0) rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) diff --git a/lib/workos/directory_sync.rb b/lib/workos/directory_sync.rb index 0a652b8b..17345d7e 100644 --- a/lib/workos/directory_sync.rb +++ b/lib/workos/directory_sync.rb @@ -115,7 +115,7 @@ def list_groups(options = {}) # @param [Hash] options An options hash # @option options [String] directory The ID of the directory whose # directory users will be retrieved. - # @option options [String] user The ID of the directory group whose + # @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 From ce5fae720c7a89fbff5e51a5ca2d6af0ad4811ad Mon Sep 17 00:00:00 2001 From: Adam Heath Date: Thu, 15 Jan 2026 23:16:58 +0800 Subject: [PATCH 101/159] Add list sessions to user management (#415) Implementing the 'List sessions' API [1] providing a way to get the list of a users sessions data and a clean API to revoke them using the existing user management API. Note that due to how this gem already has a `Session` class at the root level, which provides the 'session helpers' [2] I nested this in the `UserManagement` namespace so as not to conflict or require a breaking change. 1: https://workos.com/docs/reference/authkit/session/list 2: https://workos.com/docs/reference/authkit/session-helpers --- lib/workos/user_management.rb | 36 ++++++++++++ lib/workos/user_management/session.rb | 57 +++++++++++++++++++ spec/lib/workos/user_management_spec.rb | 39 +++++++++++++ .../user_management/list_sessions/valid.yml | 38 +++++++++++++ 4 files changed, 170 insertions(+) create mode 100644 lib/workos/user_management/session.rb create mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 6d59f2be..238c3cd6 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -7,6 +7,8 @@ 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. @@ -740,6 +742,40 @@ def list_auth_factors(user_id:) ) 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, + ), + ) + + parsed_response = JSON.parse(response.body) + + 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'], + ) + end + # Gets an email verification object # # @param [String] id The unique ID of the EmailVerification object. diff --git a/lib/workos/user_management/session.rb b/lib/workos/user_management/session.rb new file mode 100644 index 00000000..7a9a5bef --- /dev/null +++ b/lib/workos/user_management/session.rb @@ -0,0 +1,57 @@ +# 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/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index f852db47..d8613dd8 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -1797,6 +1797,45 @@ 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( diff --git a/spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml new file mode 100644 index 00000000..34bc3cf9 --- /dev/null +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml @@ -0,0 +1,38 @@ +--- +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 From 629035e965880877a1d292d21e8444b0f80e8933 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 15 Jan 2026 14:01:27 -0500 Subject: [PATCH 102/159] =?UTF-8?q?=F0=9F=92=8E=205.31.0=20(#418)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 4 ++-- lib/workos/version.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 18de8384..86ca014b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.30.1) + workos (5.31.0) encryptor (~> 3.0) jwt (~> 2.8) @@ -20,7 +20,7 @@ GEM encryptor (3.0.0) hashdiff (1.1.0) json (2.9.1) - jwt (2.10.1) + jwt (2.10.2) base64 language_server-protocol (3.17.0.3) parallel (1.26.3) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index a1d193d7..9cb92759 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.30.1' + VERSION = '5.31.0' end From aff3593d760b5bdc3d8a5ceec667842393b0f796 Mon Sep 17 00:00:00 2001 From: Adam Jenkins Date: Mon, 2 Feb 2026 15:11:58 -0400 Subject: [PATCH 103/159] Add custom_attributes field to OrganizationMembership (#419) * Add idp_attributes field to OrganizationMembership - Add :idp_attributes to attr_accessor - Initialize @idp_attributes with default empty hash - Include idp_attributes in to_json output This change adds support for IDP custom attributes on organization memberships, which are sourced from the identity provider and stored as customAttributes in the API. Related to workos/workos PR #50470 Co-Authored-By: Claude Sonnet 4.5 * Remove default empty hash for idp_attributes to match codebase convention API guarantees idp_attributes is always present, so no default needed. * Rename idp_attributes to custom_attributes * Add release workflow automation --------- Co-authored-by: Claude Sonnet 4.5 Co-authored-by: Garen J. Torikian --- .github/workflows/release.yml | 77 +++++++++++++++++--------- .github/workflows/version-bump.yml | 80 +++++++++++++++++++++++++++ lib/workos/organization_membership.rb | 4 +- 3 files changed, 135 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/version-bump.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f38bfe56..582ca8f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,43 +1,70 @@ name: Release on: - # Support manually pushing a new release - workflow_dispatch: {} - # Trigger when a release is published - release: - types: [released] + pull_request: + types: [closed] + branches: [main] defaults: run: shell: bash jobs: - test: - name: Publish to RubyGems + create-release: + name: Create GitHub Release + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'version-bump') runs-on: ubuntu-latest + permissions: + contents: write steps: - - uses: actions/checkout@v6 - - uses: ruby/setup-ruby@v1 + - name: Generate token + id: generate-token + uses: actions/create-github-app-token@v1 with: - ruby-version: '3.2' - bundler-cache: true + app-id: ${{ vars.SDK_BOT_APP_ID }} + private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} - - name: Spec - run: | - bundle exec rspec + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ steps.generate-token.outputs.token }} - - name: Publish - env: - RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} + - name: Get version from version.rb + id: get-version run: | - mkdir -p ~/.gem + VERSION=$(grep "VERSION = " lib/workos/version.rb | sed "s/.*VERSION = '\(.*\)'/\1/") + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + tag_name: v${{ steps.get-version.outputs.version }} + name: v${{ steps.get-version.outputs.version }} + generate_release_notes: true + token: ${{ steps.generate-token.outputs.token }} + + publish: + name: Publish to RubyGems + needs: create-release + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" + bundler-cache: true - cat << EOF > ~/.gem/credentials - --- - :rubygems_api_key: ${RUBYGEMS_API_KEY} - EOF + - name: Run tests + run: bundle exec rspec - chmod 0600 ~/.gem/credentials + - name: Build gem + run: gem build workos.gemspec - bundle exec gem build workos --output=release.gem - bundle exec gem push release.gem + - name: Publish to RubyGems + uses: rubygems/release-gem@v1 diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml new file mode 100644 index 00000000..4793399f --- /dev/null +++ b/.github/workflows/version-bump.yml @@ -0,0 +1,80 @@ +name: Version Bump + +on: + workflow_dispatch: + inputs: + bump_type: + description: "Version bump type" + required: true + type: choice + options: + - patch + - minor + - major + +jobs: + bump-version: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Generate token + id: generate-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.SDK_BOT_APP_ID }} + private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} + + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ steps.generate-token.outputs.token }} + + - name: Configure Git + run: | + git config user.name "workos-bot[bot]" + git config user.email "workos-bot[bot]@users.noreply.github.com" + + - name: Read current version + id: current-version + run: | + CURRENT_VERSION=$(grep "VERSION = " lib/workos/version.rb | sed "s/.*VERSION = '\(.*\)'/\1/") + echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT + + - name: Bump version + id: bump-version + run: | + CURRENT_VERSION="${{ steps.current-version.outputs.version }}" + IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" + + case "${{ github.event.inputs.bump_type }}" in + major) + NEW_VERSION="$((MAJOR + 1)).0.0" + ;; + minor) + NEW_VERSION="$MAJOR.$((MINOR + 1)).0" + ;; + patch) + NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))" + ;; + esac + + echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT + + - name: Update version in version.rb + run: | + sed -i "s/VERSION = '.*'/VERSION = '${{ steps.bump-version.outputs.new_version }}'/" lib/workos/version.rb + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ steps.generate-token.outputs.token }} + commit-message: "v${{ steps.bump-version.outputs.new_version }}" + title: "v${{ steps.bump-version.outputs.new_version }}" + body: | + Bumps version from ${{ steps.current-version.outputs.version }} to ${{ steps.bump-version.outputs.new_version }}. + + This PR was automatically created by the version-bump workflow. + branch: version-bump-${{ steps.bump-version.outputs.new_version }} + labels: version-bump diff --git a/lib/workos/organization_membership.rb b/lib/workos/organization_membership.rb index 4943b5ad..8c8dcfb2 100644 --- a/lib/workos/organization_membership.rb +++ b/lib/workos/organization_membership.rb @@ -7,7 +7,7 @@ module WorkOS class OrganizationMembership include HashProvider - attr_accessor :id, :user_id, :organization_id, :status, :role, :roles, :created_at, :updated_at + attr_accessor :id, :user_id, :organization_id, :status, :role, :roles, :custom_attributes, :created_at, :updated_at def initialize(json) hash = JSON.parse(json, symbolize_names: true) @@ -18,6 +18,7 @@ def initialize(json) @status = hash[:status] @role = hash[:role] @roles = hash[:roles] + @custom_attributes = hash[:custom_attributes] @created_at = hash[:created_at] @updated_at = hash[:updated_at] end @@ -30,6 +31,7 @@ def to_json(*) status: status, role: role, roles: roles, + custom_attributes: custom_attributes, created_at: created_at, updated_at: updated_at, } From 238b0aeb66a31e88b3a00af8f4e87bcf2c3a059b Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Mon, 2 Feb 2026 14:16:13 -0500 Subject: [PATCH 104/159] v5.31.1 (#420) * v5.31.1 * update Gemfile.lock too --------- Co-authored-by: gjtorikian <64050+gjtorikian@users.noreply.github.com> Co-authored-by: Garen J. Torikian --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 86ca014b..9b4f75a7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.31.0) + workos (5.31.1) encryptor (~> 3.0) jwt (~> 2.8) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 9cb92759..e0ab11c9 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.31.0' + VERSION = '5.31.1' end From 408407b07e18dfba284838fdfb8291eebc53cae1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 2 Feb 2026 14:43:17 -0500 Subject: [PATCH 105/159] Update actions/checkout action to v6 (#421) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 4 ++-- .github/workflows/version-bump.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 582ca8f1..43576bee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: token: ${{ steps.generate-token.outputs.token }} @@ -52,7 +52,7 @@ jobs: contents: read steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup Ruby uses: ruby/setup-ruby@v1 diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 4793399f..149e63d4 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -27,7 +27,7 @@ jobs: private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: token: ${{ steps.generate-token.outputs.token }} From 678e1d5b7f106b90a2d4f13d8aafbb977b4a633f Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Mon, 2 Feb 2026 22:27:14 -0500 Subject: [PATCH 106/159] Add rake as a development dependency (#423) The rubygems/release-gem action requires rake to be in the bundle since it runs `bundle exec rake release`. This was missing, which caused the v5.31.1 publish to RubyGems to fail. Co-authored-by: Claude Opus 4.5 --- Gemfile.lock | 2 ++ workos.gemspec | 1 + 2 files changed, 3 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index 9b4f75a7..53fa4ad6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,6 +30,7 @@ GEM public_suffix (5.0.4) racc (1.8.1) rainbow (3.1.1) + rake (13.3.1) regexp_parser (2.10.0) rexml (3.4.2) rspec (3.9.0) @@ -73,6 +74,7 @@ PLATFORMS DEPENDENCIES bundler (>= 2.0.1) + rake rspec (~> 3.9.0) rubocop (~> 1.71) vcr (~> 6.0) diff --git a/workos.gemspec b/workos.gemspec index b9f827a5..7d8a42f5 100644 --- a/workos.gemspec +++ b/workos.gemspec @@ -25,6 +25,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'jwt', '~> 2.8' 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 'vcr', '~> 6.0' From 52c8a5c3288615ffdd8f7ec9452992b2160189f5 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 10:23:42 -0500 Subject: [PATCH 107/159] Add Rakefile to fix release workflow (#426) The `rubygems/release-gem@v1` action expects `rake release` to be available, which requires bundler gem tasks. This was causing the release workflow to fail with "No Rakefile found". Also removes the redundant `gem build` step since `rake release` handles both building and pushing the gem. Co-authored-by: Garen J. Torikian Co-authored-by: Claude Opus 4.5 --- .github/workflows/release.yml | 3 --- Rakefile | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 Rakefile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 43576bee..155bd36b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,8 +63,5 @@ jobs: - name: Run tests run: bundle exec rspec - - name: Build gem - run: gem build workos.gemspec - - name: Publish to RubyGems uses: rubygems/release-gem@v1 diff --git a/Rakefile b/Rakefile new file mode 100644 index 00000000..82bb534a --- /dev/null +++ b/Rakefile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require 'bundler/gem_tasks' +require 'rspec/core/rake_task' + +RSpec::Core::RakeTask.new(:spec) + +task default: :spec From c3b84182950f241064e2e313ec4cdf7b7e0b794a Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 10:44:23 -0500 Subject: [PATCH 108/159] Use gem-push-command to skip git push in release workflow (#427) The `rake release` task tries to push tags to GitHub, but the publish job only has `contents: read` permission (and the create-release job already handles creating tags). Use `rake build release:rubygem_push` to only build and push to RubyGems without git operations. Co-authored-by: Garen J. Torikian Co-authored-by: Claude Opus 4.5 --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 155bd36b..26e4e34c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,3 +65,5 @@ jobs: - name: Publish to RubyGems uses: rubygems/release-gem@v1 + with: + gem-push-command: bundle exec rake build release:rubygem_push From 5ab23f0b85d68716c0c512ab08da9f0414457ba7 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 12:01:14 -0500 Subject: [PATCH 109/159] Fix release workflow to use OIDC credentials directly (#429) Replace rubygems/release-gem with manual build and push to avoid the rake release task attempting git operations (which fails due to insufficient permissions in the publish job). - Use rubygems/configure-rubygems-credentials for OIDC auth - Run rake build to create the gem without git operations - Push directly with gem push Co-authored-by: Garen J. Torikian Co-authored-by: Claude Opus 4.5 --- .github/workflows/release.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 26e4e34c..fa922ca4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,8 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + outputs: + version: ${{ steps.get-version.outputs.version }} steps: - name: Generate token id: generate-token @@ -51,6 +53,11 @@ jobs: id-token: write contents: read steps: + - name: Configure RubyGems credentials + uses: rubygems/configure-rubygems-credentials@main + with: + role-to-assume: rg_oidc_akr_fn8dx45asckvmsnd2kka + - name: Checkout uses: actions/checkout@v6 @@ -64,6 +71,6 @@ jobs: run: bundle exec rspec - name: Publish to RubyGems - uses: rubygems/release-gem@v1 - with: - gem-push-command: bundle exec rake build release:rubygem_push + run: | + bundle exec rake build + gem push pkg/workos-${{ needs.create-release.outputs.version }}.gem --host https://rubygems.org From 20d3f823d9d5352f7edf09939afeeb0b160307c9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 13:21:17 -0500 Subject: [PATCH 110/159] Update actions/create-github-app-token action to v2 (#422) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- .github/workflows/version-bump.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa922ca4..1a1b4a97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Generate token id: generate-token - uses: actions/create-github-app-token@v1 + uses: actions/create-github-app-token@v2 with: app-id: ${{ vars.SDK_BOT_APP_ID }} private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 149e63d4..7fface38 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Generate token id: generate-token - uses: actions/create-github-app-token@v1 + uses: actions/create-github-app-token@v2 with: app-id: ${{ vars.SDK_BOT_APP_ID }} private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} From 0259a54ee06b37d1cbf3c20f7cdb0d64cbda831e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 17:49:38 -0500 Subject: [PATCH 111/159] Update peter-evans/create-pull-request action to v8 (#424) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/version-bump.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 7fface38..332800c6 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -67,7 +67,7 @@ jobs: sed -i "s/VERSION = '.*'/VERSION = '${{ steps.bump-version.outputs.new_version }}'/" lib/workos/version.rb - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 + uses: peter-evans/create-pull-request@v8 with: token: ${{ steps.generate-token.outputs.token }} commit-message: "v${{ steps.bump-version.outputs.new_version }}" From 90349a391490ab26e5081abc8fb4f55ebb438063 Mon Sep 17 00:00:00 2001 From: Adam Heath Date: Thu, 5 Feb 2026 02:54:48 +0800 Subject: [PATCH 112/159] Add ability to extract custom claims from the JWT during authentication (#431) Via an optional block param. E.g. ```rb result = session.authenticate do |jwt| { my_custom_claim: jwt['custom_claim'], my_other_claim: jwt['another_claim'] } end puts result[:my_custom_claim] ``` For use with JWT Templates [1] allowing additional properties to be included in the JWT. Alternatively we could include the whole raw decoded token if an argument is passed with something like: ```rb claims: include_raw_claims ? decoded : nil, `` While simpler, it felt cleaner to allow extracting just what's needed. 1: https://workos.com/docs/authkit/jwt-templates --- lib/workos/session.rb | 7 +++++-- spec/lib/workos/session_spec.rb | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/workos/session.rb b/lib/workos/session.rb index 2beb0d52..f59cdcef 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -30,9 +30,10 @@ def initialize(user_management:, client_id:, session_data:, cookie_password:) # 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) + def authenticate(include_expired: false, &claim_extractor) return { authenticated: false, reason: 'NO_SESSION_COOKIE_PROVIDED' } if @session_data.nil? begin @@ -59,7 +60,7 @@ def authenticate(include_expired: false) 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'], @@ -72,6 +73,8 @@ def authenticate(include_expired: false) 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 StandardError => e diff --git a/spec/lib/workos/session_spec.rb b/spec/lib/workos/session_spec.rb index d88037ec..9da7ec15 100644 --- a/spec/lib/workos/session_spec.rb +++ b/spec/lib/workos/session_spec.rb @@ -222,6 +222,29 @@ }) 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 { From 67e7c05f1c039950bb12df1746945c188d478d77 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 14:15:50 -0500 Subject: [PATCH 113/159] Upgrade jwt gem from ~> 2.8 to ~> 3.1 (#433) This commit upgrades the ruby-jwt dependency to version 3.1, bringing improved security and RFC compliance. - Upgraded jwt gem dependency from ~> 2.8 to ~> 3.1 in workos.gemspec - Updated session test fixture to generate valid base64-encoded JWK data The JWT 3.x series introduced stricter RFC 4648 compliance for base64 encoding/decoding, replacing the more lenient RFC 2045 standard used in 2.x. This provides better security and interoperability with other JWT implementations that follow the stricter standard. Key improvements in JWT 3.x: - Stricter base64 validation that rejects invalid padding and whitespace - Proper base64 encoding/decoding for HMAC JWK keys (the 'k' parameter) - Enhanced security through stricter validation The test fixture in session_spec.rb was updated to use dynamically generated JWK data instead of hardcoded placeholder values. Co-authored-by: workos-bot[bot] --- Gemfile.lock | 6 +++--- spec/lib/workos/session_spec.rb | 2 +- workos.gemspec | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 53fa4ad6..6f725e7e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: workos (5.31.1) encryptor (~> 3.0) - jwt (~> 2.8) + jwt (~> 3.1) GEM remote: https://rubygems.org/ @@ -11,7 +11,7 @@ GEM addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - base64 (0.2.0) + base64 (0.3.0) bigdecimal (3.1.7) crack (1.0.0) bigdecimal @@ -20,7 +20,7 @@ GEM encryptor (3.0.0) hashdiff (1.1.0) json (2.9.1) - jwt (2.10.2) + jwt (3.1.2) base64 language_server-protocol (3.17.0.3) parallel (1.26.3) diff --git a/spec/lib/workos/session_spec.rb b/spec/lib/workos/session_spec.rb index 9da7ec15..6977bf76 100644 --- a/spec/lib/workos/session_spec.rb +++ b/spec/lib/workos/session_spec.rb @@ -5,8 +5,8 @@ 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(:jwks_hash) { '{"keys":[{"alg":"RS256","kty":"RSA","use":"sig","n":"test_n","e":"AQAB","kid":"sso_oidc_key_pair_123","x5c":["test"],"x5t#S256":"test"}]}' } # rubocop:disable all 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) diff --git a/workos.gemspec b/workos.gemspec index 7d8a42f5..2e52b02c 100644 --- a/workos.gemspec +++ b/workos.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.add_dependency 'encryptor', '~> 3.0' - spec.add_dependency 'jwt', '~> 2.8' + spec.add_dependency 'jwt', '~> 3.1' spec.add_development_dependency 'bundler', '>= 2.0.1' spec.add_development_dependency 'rake' From bcaaff6e0471e4af665bf8ac0df171461a119e4c Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Wed, 4 Feb 2026 14:19:26 -0500 Subject: [PATCH 114/159] Allow pluggable encryptors for session seal/unseal (#432) --- lib/workos.rb | 1 + lib/workos/authentication_response.rb | 18 ++++-- lib/workos/encryptors.rb | 9 +++ lib/workos/encryptors/aes_gcm.rb | 49 ++++++++++++++ lib/workos/refresh_authentication_response.rb | 18 ++++-- lib/workos/session.rb | 54 +++++++--------- lib/workos/user_management.rb | 4 +- spec/lib/workos/encryptors/aes_gcm_spec.rb | 41 ++++++++++++ spec/lib/workos/session_spec.rb | 64 +++++++++++++++++++ 9 files changed, 213 insertions(+), 45 deletions(-) create mode 100644 lib/workos/encryptors.rb create mode 100644 lib/workos/encryptors/aes_gcm.rb create mode 100644 spec/lib/workos/encryptors/aes_gcm_spec.rb diff --git a/lib/workos.rb b/lib/workos.rb index 12a5617c..b098e3bf 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -56,6 +56,7 @@ def self.key 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' diff --git a/lib/workos/authentication_response.rb b/lib/workos/authentication_response.rb index 9d675881..52f733d1 100644 --- a/lib/workos/authentication_response.rb +++ b/lib/workos/authentication_response.rb @@ -31,13 +31,17 @@ def initialize(authentication_response_json, session = nil) @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],) + 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 diff --git a/lib/workos/encryptors.rb b/lib/workos/encryptors.rb new file mode 100644 index 00000000..f78591e0 --- /dev/null +++ b/lib/workos/encryptors.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +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 new file mode 100644 index 00000000..72a02248 --- /dev/null +++ b/lib/workos/encryptors/aes_gcm.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +require 'encryptor' +require 'securerandom' +require 'json' +require 'base64' + +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 + def seal(data, 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) + 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..] + + decrypted_data = Encryptor.decrypt( + value: encrypted_data, + key: key, + iv: iv, + algorithm: 'aes-256-gcm', + ) + + JSON.parse(decrypted_data, symbolize_names: true) + end + end + end +end diff --git a/lib/workos/refresh_authentication_response.rb b/lib/workos/refresh_authentication_response.rb index 76d7ce73..76d5c04a 100644 --- a/lib/workos/refresh_authentication_response.rb +++ b/lib/workos/refresh_authentication_response.rb @@ -22,13 +22,17 @@ def initialize(authentication_response_json, session = nil) 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],) + 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 diff --git a/lib/workos/session.rb b/lib/workos/session.rb index f59cdcef..d61ce9d3 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -12,11 +12,14 @@ 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 + attr_accessor :jwks, :jwks_algorithms, :user_management, :cookie_password, :session_data, :client_id, :encryptor - def initialize(user_management:, client_id:, session_data:, cookie_password:) + 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 @cookie_password = cookie_password @session_data = session_data @@ -37,7 +40,7 @@ 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) + session = Session.unseal_data(@session_data, @cookie_password, encryptor: @encryptor) rescue StandardError return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } end @@ -92,7 +95,7 @@ def refresh(options = nil) cookie_password = options.nil? || options[:cookie_password].nil? ? @cookie_password : options[:cookie_password] begin - session = Session.unseal_data(@session_data, cookie_password) + session = Session.unseal_data(@session_data, cookie_password, encryptor: @encryptor) rescue StandardError return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } end @@ -104,7 +107,7 @@ def refresh(options = nil) 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 }, + session: { seal_session: true, cookie_password: cookie_password, encryptor: @encryptor }, ) @session_data = auth_response.sealed_session @@ -137,43 +140,34 @@ def get_logout_url(return_to: nil) @user_management.get_logout_url(session_id: auth_response[:session_id], return_to: return_to) end - # Encrypts and seals data using AES-256-GCM + # 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) - 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) # Combine IV with encrypted data and encode as base64 + def self.seal_data(data, key, encryptor: nil) + enc = encryptor || WorkOS::Encryptors::AesGcm.new + enc.seal(data, key) end - # Decrypts and unseals data using AES-256-GCM + # 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) - decoded_data = Base64.decode64(sealed_data) - iv = decoded_data[0..11] # Extract the IV (first 12 bytes) - encrypted_data = decoded_data[12..-1] # Extract the encrypted data - - decrypted_data = Encryptor.decrypt( - value: encrypted_data, - key: key, - iv: iv, - algorithm: 'aes-256-gcm', - ) - - JSON.parse(decrypted_data, symbolize_names: true) # Parse the decrypted JSON string back to original data + def self.unseal_data(sealed_data, key, encryptor: nil) + enc = encryptor || WorkOS::Encryptors::AesGcm.new + enc.unseal(sealed_data, key) 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 diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 238c3cd6..eb1680bd 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -42,14 +42,16 @@ class << self # @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:) + 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 diff --git a/spec/lib/workos/encryptors/aes_gcm_spec.rb b/spec/lib/workos/encryptors/aes_gcm_spec.rb new file mode 100644 index 00000000..911cfdde --- /dev/null +++ b/spec/lib/workos/encryptors/aes_gcm_spec.rb @@ -0,0 +1,41 @@ +# 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/session_spec.rb b/spec/lib/workos/session_spec.rb index 6977bf76..f6e9c2e6 100644 --- a/spec/lib/workos/session_spec.rb +++ b/spec/lib/workos/session_spec.rb @@ -408,4 +408,68 @@ 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 From b8f7796c55b1a5ded2320d446d56e3d55a9ed940 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 14:23:55 -0500 Subject: [PATCH 115/159] v6.0.0 (#434) * v6.0.0 --------- Co-authored-by: gjtorikian <64050+gjtorikian@users.noreply.github.com> Co-authored-by: Garen J. Torikian --- Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6f725e7e..ffd27501 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (5.31.1) + workos (6.0.0) encryptor (~> 3.0) jwt (~> 3.1) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index e0ab11c9..cf8f5082 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '5.31.1' + VERSION = '6.0.0' end From b50a3863c782f8175d364321dd1676521cea22be Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 12:17:36 -0500 Subject: [PATCH 116/159] Add release-please for automated releases (#435) Replace the manual version-bump workflow and PR-triggered release flow with release-please for automated changelog generation and releases. The publish workflow now triggers on GitHub release events. Also adds a PR title linter to enforce conventional commits. Co-authored-by: Garen J. Torikian --- .github/workflows/lint-pr-title.yml | 20 +++++++ .github/workflows/release-please.yml | 25 +++++++++ .github/workflows/release.yml | 44 ++------------- .github/workflows/version-bump.yml | 80 ---------------------------- .release-please-manifest.json | 3 ++ release-please-config.json | 11 ++++ 6 files changed, 63 insertions(+), 120 deletions(-) create mode 100644 .github/workflows/lint-pr-title.yml create mode 100644 .github/workflows/release-please.yml delete mode 100644 .github/workflows/version-bump.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml new file mode 100644 index 00000000..83867c43 --- /dev/null +++ b/.github/workflows/lint-pr-title.yml @@ -0,0 +1,20 @@ +name: Lint PR Title + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + pull-requests: read + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..d8efdc7f --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,25 @@ +name: Release Please + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - name: Generate token + id: generate-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ vars.SDK_BOT_APP_ID }} + private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} + + - uses: googleapis/release-please-action@v4 + with: + token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a1b4a97..d054fb12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,53 +1,16 @@ name: Release on: - pull_request: - types: [closed] - branches: [main] + release: + types: [published] defaults: run: shell: bash jobs: - create-release: - name: Create GitHub Release - if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'version-bump') - runs-on: ubuntu-latest - permissions: - contents: write - outputs: - version: ${{ steps.get-version.outputs.version }} - steps: - - name: Generate token - id: generate-token - uses: actions/create-github-app-token@v2 - with: - app-id: ${{ vars.SDK_BOT_APP_ID }} - private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} - - - name: Checkout - uses: actions/checkout@v6 - with: - token: ${{ steps.generate-token.outputs.token }} - - - name: Get version from version.rb - id: get-version - run: | - VERSION=$(grep "VERSION = " lib/workos/version.rb | sed "s/.*VERSION = '\(.*\)'/\1/") - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Create Release - uses: softprops/action-gh-release@v2 - with: - tag_name: v${{ steps.get-version.outputs.version }} - name: v${{ steps.get-version.outputs.version }} - generate_release_notes: true - token: ${{ steps.generate-token.outputs.token }} - publish: name: Publish to RubyGems - needs: create-release runs-on: ubuntu-latest permissions: id-token: write @@ -72,5 +35,6 @@ jobs: - name: Publish to RubyGems run: | + VERSION="${GITHUB_REF_NAME#v}" bundle exec rake build - gem push pkg/workos-${{ needs.create-release.outputs.version }}.gem --host https://rubygems.org + gem push pkg/workos-${VERSION}.gem --host https://rubygems.org diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml deleted file mode 100644 index 332800c6..00000000 --- a/.github/workflows/version-bump.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Version Bump - -on: - workflow_dispatch: - inputs: - bump_type: - description: "Version bump type" - required: true - type: choice - options: - - patch - - minor - - major - -jobs: - bump-version: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - name: Generate token - id: generate-token - uses: actions/create-github-app-token@v2 - with: - app-id: ${{ vars.SDK_BOT_APP_ID }} - private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} - - - name: Checkout - uses: actions/checkout@v6 - with: - token: ${{ steps.generate-token.outputs.token }} - - - name: Configure Git - run: | - git config user.name "workos-bot[bot]" - git config user.email "workos-bot[bot]@users.noreply.github.com" - - - name: Read current version - id: current-version - run: | - CURRENT_VERSION=$(grep "VERSION = " lib/workos/version.rb | sed "s/.*VERSION = '\(.*\)'/\1/") - echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT - - - name: Bump version - id: bump-version - run: | - CURRENT_VERSION="${{ steps.current-version.outputs.version }}" - IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" - - case "${{ github.event.inputs.bump_type }}" in - major) - NEW_VERSION="$((MAJOR + 1)).0.0" - ;; - minor) - NEW_VERSION="$MAJOR.$((MINOR + 1)).0" - ;; - patch) - NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))" - ;; - esac - - echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT - - - name: Update version in version.rb - run: | - sed -i "s/VERSION = '.*'/VERSION = '${{ steps.bump-version.outputs.new_version }}'/" lib/workos/version.rb - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v8 - with: - token: ${{ steps.generate-token.outputs.token }} - commit-message: "v${{ steps.bump-version.outputs.new_version }}" - title: "v${{ steps.bump-version.outputs.new_version }}" - body: | - Bumps version from ${{ steps.current-version.outputs.version }} to ${{ steps.bump-version.outputs.new_version }}. - - This PR was automatically created by the version-bump workflow. - branch: version-bump-${{ steps.bump-version.outputs.new_version }} - labels: version-bump diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..a3a12f49 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "6.0.0" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..1a8d77de --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "ruby", + "package-name": "workos", + "version-file": "lib/workos/version.rb", + "changelog-path": "CHANGELOG.md" + } + } +} From d24e3dc2995de26970415e4570a7ed810d432715 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 10 Feb 2026 13:51:55 -0500 Subject: [PATCH 117/159] Add `invitation_token` parameter to authentication methods (#438) --- lib/workos/user_management.rb | 11 +++++ spec/lib/workos/user_management_spec.rb | 65 +++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index eb1680bd..cd362005 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -298,16 +298,19 @@ def delete_user(id:) # @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 ) validate_session(session) @@ -322,6 +325,7 @@ def authenticate_with_password( password: password, ip_address: ip_address, user_agent: user_agent, + invitation_token: invitation_token, grant_type: 'password', }, ), @@ -329,6 +333,7 @@ def authenticate_with_password( WorkOS::AuthenticationResponse.new(response.body, session) end + # rubocop:enable Metrics/ParameterLists # Authenticate a user using OAuth or an organization's SSO connection. # @@ -337,6 +342,7 @@ def authenticate_with_password( # @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. # @@ -346,6 +352,7 @@ def authenticate_with_code( client_id:, ip_address: nil, user_agent: nil, + invitation_token: nil, session: nil ) validate_session(session) @@ -359,6 +366,7 @@ def authenticate_with_code( client_secret: WorkOS.config.key!, ip_address: ip_address, user_agent: user_agent, + invitation_token: invitation_token, grant_type: 'authorization_code', }, ), @@ -415,6 +423,7 @@ def authenticate_with_refresh_token( # @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. # @@ -427,6 +436,7 @@ def authenticate_with_magic_auth( ip_address: nil, user_agent: nil, link_authorization_code: nil, + invitation_token: nil, session: nil ) validate_session(session) @@ -443,6 +453,7 @@ def authenticate_with_magic_auth( user_agent: user_agent, grant_type: 'urn:workos:oauth:grant-type:magic-auth:code', link_authorization_code: link_authorization_code, + invitation_token: invitation_token, }, ), ) diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index d8613dd8..2cdbc4e7 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -588,6 +588,28 @@ 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 @@ -671,6 +693,27 @@ 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 @@ -735,6 +778,28 @@ 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 From e596e3d6021bf927a3fd0b16aef532ff6f84cd64 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 13:52:45 -0500 Subject: [PATCH 118/159] Update amannn/action-semantic-pull-request action to v6 (#436) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/lint-pr-title.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index 83867c43..3900220a 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -15,6 +15,6 @@ jobs: name: Validate PR title runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@v5 + - uses: amannn/action-semantic-pull-request@v6 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b8358024c59d65790485a9c9afc1f85069503b28 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 14:15:34 -0500 Subject: [PATCH 119/159] chore(main): release workos 6.1.0 (#437) * chore(main): release workos 6.1.0 * chore: add missing changelog entry for invitation_token fix (#438) Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: workos-sdk-automation[bot] <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Co-authored-by: Garen J. Torikian Co-authored-by: Claude Opus 4.6 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a3a12f49..8ace9152 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "6.0.0" + ".": "6.1.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..87a64564 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +## [6.1.0](https://github.com/workos/workos-ruby/compare/workos-v6.0.0...workos/v6.1.0) (2026-02-10) + + +### Features + +* add support for totp_secret ([#300](https://github.com/workos/workos-ruby/issues/300)) ([c0a26bf](https://github.com/workos/workos-ruby/commit/c0a26bf745fb49ebaac7c5241e99d51188b886bb)) +* Include Feature Flags decoded from the JWT in the payload of a Session ([#386](https://github.com/workos/workos-ruby/issues/386)) ([31a0e79](https://github.com/workos/workos-ruby/commit/31a0e7901247652182dcaad95e131357b93d0d71)) +* **workos-ruby:** Add `connection` to `authorization_url` ([#78](https://github.com/workos/workos-ruby/issues/78)) ([c3a0e8e](https://github.com/workos/workos-ruby/commit/c3a0e8e4031a3ee888d925c11f1fd2fb152f0a16)) + + +### Bug Fixes + +* add `invitation_token` parameter to authentication methods ([#438](https://github.com/workos/workos-ruby/issues/438)) ([d24e3dc](https://github.com/workos/workos-ruby/commit/d24e3dc2995de26970415e4570a7ed810d432715)) diff --git a/Gemfile.lock b/Gemfile.lock index ffd27501..09aeeb8b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (6.0.0) + workos (6.1.0) encryptor (~> 3.0) jwt (~> 3.1) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index cf8f5082..2b3021f2 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '6.0.0' + VERSION = '6.1.0' end From 344021d755dc2f1ef55270b2a52c6e8ff17578fa Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 14:27:41 -0500 Subject: [PATCH 120/159] fix: use simple v-prefixed tags and fix gem publish path (#441) Release Please was creating tags like `workos/v6.1.0` instead of `v6.1.0` because `include-component-in-tag` defaults to true. This caused the publish workflow to look for `pkg/workos-workos/v6.1.0.gem` instead of `pkg/workos-6.1.0.gem`. - Set `include-component-in-tag: false` in release-please-config.json - Update VERSION extraction in release.yml to handle both tag formats Co-authored-by: Garen J. Torikian Co-authored-by: Claude Opus 4.6 --- .github/workflows/release.yml | 2 +- release-please-config.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d054fb12..56301d88 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,6 @@ jobs: - name: Publish to RubyGems run: | - VERSION="${GITHUB_REF_NAME#v}" + VERSION="${GITHUB_REF_NAME##*/v}" bundle exec rake build gem push pkg/workos-${VERSION}.gem --host https://rubygems.org diff --git a/release-please-config.json b/release-please-config.json index 1a8d77de..29926c7e 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,7 +5,8 @@ "release-type": "ruby", "package-name": "workos", "version-file": "lib/workos/version.rb", - "changelog-path": "CHANGELOG.md" + "changelog-path": "CHANGELOG.md", + "include-component-in-tag": false } } } From 56f1a48f99954b34f801a0824e2bab16829d80cb Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 14:34:54 -0500 Subject: [PATCH 121/159] fix: revert VERSION extraction to handle simple v-prefixed tags (#442) The `##*/v` pattern requires a `/` before `v` to match, so it doesn't strip the `v` from simple `v6.1.0` tags. Now that tags use `v6.1.0` format, the original `#v` pattern is correct. Co-authored-by: Garen J. Torikian Co-authored-by: Claude Opus 4.6 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 56301d88..d054fb12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,6 @@ jobs: - name: Publish to RubyGems run: | - VERSION="${GITHUB_REF_NAME##*/v}" + VERSION="${GITHUB_REF_NAME#v}" bundle exec rake build gem push pkg/workos-${VERSION}.gem --host https://rubygems.org From f156c799e88269493104628760f94b8abaebf542 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Mon, 23 Feb 2026 12:00:40 -0500 Subject: [PATCH 122/159] fix: update renovate rules (#443) * fix: update renovate rules * fix: remove old .github/renovate.json * fix: use config:recommended and valid schedule --------- Co-authored-by: Garen J. Torikian --- .github/renovate.json | 5 ----- renovate.json | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) delete mode 100644 .github/renovate.json create mode 100644 renovate.json diff --git a/.github/renovate.json b/.github/renovate.json deleted file mode 100644 index f45d8f11..00000000 --- a/.github/renovate.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": [ - "config:base" - ] -} diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..06b9f153 --- /dev/null +++ b/renovate.json @@ -0,0 +1,32 @@ +{ + "extends": [ + "config:recommended" + ], + "schedule": [ + "on the 15th day of the month before 12pm" + ], + "timezone": "UTC", + "rebaseWhen": "conflicted", + "packageRules": [ + { + "matchUpdateTypes": [ + "minor", + "patch" + ], + "automerge": true, + "groupName": "minor and patch updates" + }, + { + "matchUpdateTypes": [ + "major" + ], + "automerge": false + }, + { + "matchUpdateTypes": [ + "digest" + ], + "automerge": false + } + ] +} From 001d24d3173975c883139ec4f7bd3565d3b12092 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Mon, 2 Mar 2026 13:56:27 -0500 Subject: [PATCH 123/159] chore: Pin GitHub Actions (#445) --- .github/workflows/ci.yml | 2 +- .github/workflows/lint-pr-title.yml | 2 +- .github/workflows/release-please.yml | 4 ++-- .github/workflows/release.yml | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acb62ea6..e10f1270 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - '3.1' - '3.2' steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: ruby/setup-ruby@675dd7ba1b06c8786a1480d89c384f5620a42647 # v1.281.0 with: ruby-version: ${{ matrix.ruby }} diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml index 3900220a..0c9b2bc8 100644 --- a/.github/workflows/lint-pr-title.yml +++ b/.github/workflows/lint-pr-title.yml @@ -15,6 +15,6 @@ jobs: name: Validate PR title runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@v6 + - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index d8efdc7f..f727f274 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -15,11 +15,11 @@ jobs: steps: - name: Generate token id: generate-token - uses: actions/create-github-app-token@v2 + uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 with: app-id: ${{ vars.SDK_BOT_APP_ID }} private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} - - uses: googleapis/release-please-action@v4 + - uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0 with: token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d054fb12..2de482d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,15 +17,15 @@ jobs: contents: read steps: - name: Configure RubyGems credentials - uses: rubygems/configure-rubygems-credentials@main + uses: rubygems/configure-rubygems-credentials@88679b3ac821ffda0116bf098443db9ac7822e40 with: role-to-assume: rg_oidc_akr_fn8dx45asckvmsnd2kka - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup Ruby - uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@09a7688d3b55cf0e976497ff046b70949eeaccfd # v1.288.0 with: ruby-version: "3.2" bundler-cache: true From d1c93d6c9b84a447f1c778b8f26fd8e1b2749838 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Thu, 5 Mar 2026 15:41:15 -0500 Subject: [PATCH 124/159] chore: Add DX as Codeowners (#447) Co-authored-by: Garen J. Torikian Co-authored-by: Claude Opus 4.6 --- .github/CODEOWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 708559bf..45371dd5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,5 @@ # See GitHub's docs for more details: # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners -# Rubyist Team -* @workos/ruby +# Rubyist and DX Teams +* @workos/ruby @workos/dx From 914d824668b70950905d5db666978e9609c9f706 Mon Sep 17 00:00:00 2001 From: Wahhaj Zahedi Date: Thu, 5 Mar 2026 15:54:56 -0500 Subject: [PATCH 125/159] feat(user-management): add directory_managed to OrganizationMembership (#446) --- lib/workos/organization_membership.rb | 5 ++++- .../user_management/create_organization_membership/valid.yml | 2 +- .../create_organization_membership/valid_multiple_roles.yml | 2 +- .../user_management/deactivate_organization_membership.yml | 2 +- .../user_management/get_organization_membership.yml | 2 +- .../list_organization_memberships/no_options.yml | 2 +- .../list_organization_memberships/with_options.yml | 2 +- .../list_organization_memberships/with_statuses_option.yml | 2 +- .../user_management/reactivate_organization_membership.yml | 2 +- .../user_management/update_organization_membership/valid.yml | 2 +- .../update_organization_membership/valid_multiple_roles.yml | 2 +- 11 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/workos/organization_membership.rb b/lib/workos/organization_membership.rb index 8c8dcfb2..cde9a901 100644 --- a/lib/workos/organization_membership.rb +++ b/lib/workos/organization_membership.rb @@ -7,7 +7,8 @@ module WorkOS class OrganizationMembership include HashProvider - attr_accessor :id, :user_id, :organization_id, :status, :role, :roles, :custom_attributes, :created_at, :updated_at + 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) @@ -19,6 +20,7 @@ def initialize(json) @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 @@ -32,6 +34,7 @@ def to_json(*) role: role, roles: roles, custom_attributes: custom_attributes, + directory_managed: directory_managed, created_at: created_at, updated_at: updated_at, } diff --git a/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml index 12eace78..2ec456d1 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml @@ -76,7 +76,7 @@ http_interactions: - 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"},"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' + 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/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml index 13afb89f..c83a3f62 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml @@ -71,6 +71,6 @@ http_interactions: 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"}], "created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' + 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/spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml b/spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml index a83a8632..d2e59d15 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml @@ -58,7 +58,7 @@ http_interactions: - "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"},"created_at":"2024-05-15T19:00:05.359Z","updated_at":"2024-05-15T19:13:06.259Z"}' + 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/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml index 3579b0d4..8d79d6dc 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml @@ -76,7 +76,7 @@ http_interactions: - 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"}, "created_at": "2023-07-18T02:07:19.911Z", "updated_at": "2023-07-18T02:07:19.911Z"}' + 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/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml index 359efd62..0b1c1b8d 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml @@ -76,7 +76,7 @@ http_interactions: - 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"},"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"},"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":"before-id","after":null}}' + 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/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml index ec9eea14..c43f3a2b 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml @@ -76,7 +76,7 @@ http_interactions: - 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"},"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}' + 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/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml index 0fc4af43..47a16d40 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml @@ -58,7 +58,7 @@ http_interactions: - "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"},"created_at":"2024-05-15T19:00:05.359Z","updated_at":"2024-05-15T19:13:06.427Z"}],"list_metadata":{"before":null,"after":null}}' + 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/spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml b/spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml index ffa48a2a..9efa4677 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml @@ -58,7 +58,7 @@ http_interactions: - "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"},"created_at":"2024-05-15T19:00:05.359Z","updated_at":"2024-05-15T19:13:06.427Z"}' + 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/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml index fc9f705c..8e993fac 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml @@ -76,7 +76,7 @@ - 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"},"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' + 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 diff --git a/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml index 7cb2dd46..68c88fd1 100644 --- a/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml +++ b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml @@ -71,6 +71,6 @@ http_interactions: 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"}],"created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}' + 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 From b5b4da1c031bc5f688562fdc33506e03b769f650 Mon Sep 17 00:00:00 2001 From: Andrew Hampton Date: Fri, 6 Mar 2026 14:14:55 -0500 Subject: [PATCH 126/159] feat(user-management): add invitation accept endpoint (#448) --- lib/workos/user_management.rb | 16 ++++++ spec/lib/workos/user_management_spec.rb | 75 +++++++++++++++++++++++++ 2 files changed, 91 insertions(+) diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index cd362005..7cfbe96c 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -1172,6 +1172,22 @@ def send_invitation(email:, organization_id: nil, expires_in_days: nil, inviter_ 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. diff --git a/spec/lib/workos/user_management_spec.rb b/spec/lib/workos/user_management_spec.rb index 2cdbc4e7..b9485f9c 100644 --- a/spec/lib/workos/user_management_spec.rb +++ b/spec/lib/workos/user_management_spec.rb @@ -1728,6 +1728,81 @@ 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 From 896094487a559a2baa59b4698eb92b0197f5629e Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 14:19:09 -0500 Subject: [PATCH 127/159] chore(main): release 6.2.0 (#444) Co-authored-by: workos-sdk-automation[bot] <255426317+workos-sdk-automation[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ Gemfile.lock | 2 +- lib/workos/version.rb | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8ace9152..e1e352c1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "6.1.0" + ".": "6.2.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 87a64564..ced80f47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [6.2.0](https://github.com/workos/workos-ruby/compare/v6.1.0...v6.2.0) (2026-03-06) + + +### Features + +* **user-management:** add directory_managed to OrganizationMembership ([#446](https://github.com/workos/workos-ruby/issues/446)) ([914d824](https://github.com/workos/workos-ruby/commit/914d824668b70950905d5db666978e9609c9f706)) +* **user-management:** add invitation accept endpoint ([#448](https://github.com/workos/workos-ruby/issues/448)) ([b5b4da1](https://github.com/workos/workos-ruby/commit/b5b4da1c031bc5f688562fdc33506e03b769f650)) + + +### Bug Fixes + +* update renovate rules ([#443](https://github.com/workos/workos-ruby/issues/443)) ([f156c79](https://github.com/workos/workos-ruby/commit/f156c799e88269493104628760f94b8abaebf542)) + ## [6.1.0](https://github.com/workos/workos-ruby/compare/workos-v6.0.0...workos/v6.1.0) (2026-02-10) diff --git a/Gemfile.lock b/Gemfile.lock index 09aeeb8b..e4f6561f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (6.1.0) + workos (6.2.0) encryptor (~> 3.0) jwt (~> 3.1) diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 2b3021f2..149c146e 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module WorkOS - VERSION = '6.1.0' + VERSION = '6.2.0' end From dd5564c63589c24b399816adf7c422027e33df33 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 6 Mar 2026 15:23:23 -0500 Subject: [PATCH 128/159] Disable dependency dashboard in renovate config --- renovate.json | 1 + 1 file changed, 1 insertion(+) diff --git a/renovate.json b/renovate.json index 06b9f153..c30540d2 100644 --- a/renovate.json +++ b/renovate.json @@ -2,6 +2,7 @@ "extends": [ "config:recommended" ], + "dependencyDashboard": false, "schedule": [ "on the 15th day of the month before 12pm" ], From 4efa3e10cf0ac07d3cc8875c79351b1b1e8579da Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 10:51:46 -0400 Subject: [PATCH 129/159] chore(deps): update rubygems/configure-rubygems-credentials digest to a251ea8 (#449) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2de482d6..77c2a1c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: contents: read steps: - name: Configure RubyGems credentials - uses: rubygems/configure-rubygems-credentials@88679b3ac821ffda0116bf098443db9ac7822e40 + uses: rubygems/configure-rubygems-credentials@a251ea8ec8e94203b26acddd2010f89b187a44b7 with: role-to-assume: rg_oidc_akr_fn8dx45asckvmsnd2kka From b6d1ae6e2cb60b698b59970d7c5ab947f86bddb1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 10:52:33 -0400 Subject: [PATCH 130/159] chore(deps): update actions/create-github-app-token action to v3 (#451) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/release-please.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index f727f274..6d6916a3 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Generate token id: generate-token - uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 + uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 with: app-id: ${{ vars.SDK_BOT_APP_ID }} private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} From 83684f0639a9a100d0b4e5c48fcb1ba6321d8fda Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 14 Apr 2026 19:08:34 -0400 Subject: [PATCH 131/159] Update renovate.json to include GitHub Actions rules --- renovate.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/renovate.json b/renovate.json index c30540d2..383e0b68 100644 --- a/renovate.json +++ b/renovate.json @@ -9,6 +9,13 @@ "timezone": "UTC", "rebaseWhen": "conflicted", "packageRules": [ + { + "matchManagers": [ + "github-actions" + ], + "extractVersion": "^v(?\\d+\\.\\d+\\.\\d+)$", + "groupName": "github-actions" + }, { "matchUpdateTypes": [ "minor", From ff1dcf40ed38771ae8e06f3d0a68a2b8b708ecc1 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Wed, 15 Apr 2026 13:17:11 -0400 Subject: [PATCH 132/159] Refactor GitHub Actions package rules in renovate.json Added schema reference and updated package rules for GitHub Actions. --- renovate.json | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/renovate.json b/renovate.json index 383e0b68..bca5e5ce 100644 --- a/renovate.json +++ b/renovate.json @@ -1,4 +1,5 @@ { + "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ "config:recommended" ], @@ -9,13 +10,6 @@ "timezone": "UTC", "rebaseWhen": "conflicted", "packageRules": [ - { - "matchManagers": [ - "github-actions" - ], - "extractVersion": "^v(?\\d+\\.\\d+\\.\\d+)$", - "groupName": "github-actions" - }, { "matchUpdateTypes": [ "minor", @@ -35,6 +29,33 @@ "digest" ], "automerge": false + }, + { + "matchManagers": [ + "github-actions" + ], + "matchUpdateTypes": [ + "minor", + "patch", + "digest", + "pinDigest" + ], + "extractVersion": "^v(?\\d+\\.\\d+\\.\\d+)$", + "groupName": "github actions non-major", + "groupSlug": "github-actions-non-major", + "automerge": true + }, + { + "matchManagers": [ + "github-actions" + ], + "matchUpdateTypes": [ + "major" + ], + "extractVersion": "^v(?\\d+\\.\\d+\\.\\d+)$", + "groupName": "github actions major", + "groupSlug": "github-actions-major", + "automerge": false } ] } From 8132e48bfd25100df393be9fae21bc5c33ab6ae4 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 15 Apr 2026 14:21:48 -0400 Subject: [PATCH 133/159] fix: Remove extractVersion from matchUpdateTypes rules (#455) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: garen.torikian --- renovate.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/renovate.json b/renovate.json index bca5e5ce..b979c359 100644 --- a/renovate.json +++ b/renovate.json @@ -40,7 +40,6 @@ "digest", "pinDigest" ], - "extractVersion": "^v(?\\d+\\.\\d+\\.\\d+)$", "groupName": "github actions non-major", "groupSlug": "github-actions-non-major", "automerge": true @@ -52,7 +51,6 @@ "matchUpdateTypes": [ "major" ], - "extractVersion": "^v(?\\d+\\.\\d+\\.\\d+)$", "groupName": "github actions major", "groupSlug": "github-actions-major", "automerge": false From fd45b9d37bb9df9609fb293bf611b889fd485ff7 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Mon, 20 Apr 2026 10:01:47 -0400 Subject: [PATCH 134/159] feat!: Release OpenAPI spec generated Ruby SDK (#454) Co-authored-by: ci Co-authored-by: Claude Opus 4.6 (1M context) Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 15 +- .github/workflows/lint.yml | 25 + .github/workflows/release.yml | 2 +- .oagen-manifest.json | 1015 +++ .rspec | 1 - .rubocop.yml | 34 - .rubocop_todo.yml | 94 - .ruby-version | 2 +- .standard.yml | 1 + Gemfile | 2 +- Gemfile.lock | 138 +- README.md | 176 +- Rakefile | 12 +- docs/V7_MIGRATION_GUIDE.md | 780 ++ lib/workos.rb | 126 +- lib/workos/actions.rb | 93 + lib/workos/admin_portal.rb | 51 + lib/workos/admin_portal/generate_link.rb | 34 + lib/workos/admin_portal/intent_options.rb | 18 + .../admin_portal/portal_link_response.rb | 18 + lib/workos/admin_portal/sso_intent_options.rb | 22 + lib/workos/api_keys.rb | 128 + lib/workos/api_keys/api_key.rb | 43 + lib/workos/api_keys/api_key_created.rb | 34 + lib/workos/api_keys/api_key_created_data.rb | 43 + .../api_keys/api_key_created_data_owner.rb | 22 + lib/workos/api_keys/api_key_owner.rb | 7 + lib/workos/api_keys/api_key_revoked.rb | 34 + 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 | 18 + lib/workos/api_keys/api_key_with_value.rb | 46 + .../api_keys/api_key_with_value_owner.rb | 7 + .../api_keys/create_organization_api_key.rb | 22 + lib/workos/api_keys/validate_api_key.rb | 18 + lib/workos/audit_log_export.rb | 32 - lib/workos/audit_logs.rb | 324 +- lib/workos/audit_logs/audit_log_action.rb | 36 + .../audit_logs/audit_log_action_json.rb | 31 + lib/workos/audit_logs/audit_log_event.rb | 37 + .../audit_logs/audit_log_event_actor.rb | 28 + .../audit_logs/audit_log_event_context.rb | 22 + .../audit_log_event_create_response.rb | 18 + .../audit_logs/audit_log_event_ingestion.rb | 22 + .../audit_logs/audit_log_event_target.rb | 7 + lib/workos/audit_logs/audit_log_export.rb | 39 + .../audit_logs/audit_log_export_creation.rb | 49 + .../audit_logs/audit_log_export_json.rb | 34 + lib/workos/audit_logs/audit_log_schema.rb | 25 + .../audit_logs/audit_log_schema_actor.rb | 18 + .../audit_logs/audit_log_schema_json.rb | 34 + .../audit_logs/audit_log_schema_json_actor.rb | 7 + .../audit_log_schema_json_target.rb | 22 + .../audit_logs/audit_log_schema_target.rb | 7 + .../authentication_factor_and_challenge.rb | 28 - lib/workos/authentication_response.rb | 62 - lib/workos/authorization.rb | 1289 +++ .../authorization/add_role_permission.rb | 18 + lib/workos/authorization/assign_role.rb | 28 + .../authorization/authorization_check.rb | 18 + .../authorization/authorization_permission.rb | 43 + .../authorization/authorization_resource.rb | 46 + .../authorization/check_authorization.rb | 28 + .../create_authorization_permission.rb | 28 + .../create_authorization_resource.rb | 40 + .../authorization/create_organization_role.rb | 28 + lib/workos/authorization/create_role.rb | 7 + lib/workos/authorization/permission.rb | 7 + .../authorization/permission_created.rb | 34 + .../authorization/permission_created_data.rb | 40 + .../authorization/permission_deleted.rb | 34 + .../authorization/permission_deleted_data.rb | 7 + .../authorization/permission_updated.rb | 34 + .../authorization/permission_updated_data.rb | 7 + lib/workos/authorization/remove_role.rb | 7 + lib/workos/authorization/role.rb | 46 + lib/workos/authorization/role_assignment.rb | 34 + .../authorization/role_assignment_resource.rb | 25 + lib/workos/authorization/role_created.rb | 34 + lib/workos/authorization/role_created_data.rb | 34 + lib/workos/authorization/role_deleted.rb | 34 + lib/workos/authorization/role_deleted_data.rb | 7 + lib/workos/authorization/role_list.rb | 22 + lib/workos/authorization/role_updated.rb | 34 + lib/workos/authorization/role_updated_data.rb | 7 + .../authorization/set_role_permissions.rb | 18 + lib/workos/authorization/slim_role.rb | 7 + .../update_authorization_permission.rb | 22 + .../update_authorization_resource.rb | 31 + .../authorization/update_organization_role.rb | 7 + lib/workos/authorization/update_role.rb | 7 + ..._organization_membership_base_list_data.rb | 46 + lib/workos/base_client.rb | 350 + lib/workos/cache.rb | 94 - lib/workos/challenge.rb | 36 - lib/workos/client.rb | 253 +- lib/workos/configuration.rb | 61 +- lib/workos/connect.rb | 329 + .../application_credentials_list_item.rb | 34 + lib/workos/connect/connect_application.rb | 46 + .../connect/create_application_secret.rb | 13 + lib/workos/connect/create_m2m_application.rb | 31 + .../connect/create_oauth_application.rb | 40 + .../external_auth_complete_response.rb | 18 + .../connect/new_connect_application_secret.rb | 37 + lib/workos/connect/redirect_uri_input.rb | 22 + .../connect/update_oauth_application.rb | 28 + lib/workos/connect/user_consent_option.rb | 28 + .../connect/user_consent_option_choice.rb | 22 + .../connect/user_management_login_request.rb | 25 + lib/workos/connect/user_object.rb | 31 + 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 | 411 +- lib/workos/directory_sync/directory.rb | 49 + lib/workos/directory_sync/directory_group.rb | 43 + .../directory_sync/directory_metadata.rb | 22 + .../directory_sync/directory_metadata_user.rb | 22 + lib/workos/directory_sync/directory_user.rb | 103 + .../directory_sync/directory_user_email.rb | 25 + .../directory_user_with_groups.rb | 106 + .../directory_user_with_groups_email.rb | 7 + lib/workos/directory_sync/dsync_activated.rb | 34 + .../directory_sync/dsync_activated_data.rb | 46 + .../dsync_activated_data_domain.rb | 25 + .../directory_sync/dsync_deactivated.rb | 34 + .../directory_sync/dsync_deactivated_data.rb | 46 + .../dsync_deactivated_data_domain.rb | 7 + lib/workos/directory_sync/dsync_deleted.rb | 34 + .../directory_sync/dsync_deleted_data.rb | 40 + .../directory_sync/dsync_group_created.rb | 34 + .../directory_sync/dsync_group_deleted.rb | 34 + .../directory_sync/dsync_group_updated.rb | 34 + .../dsync_group_updated_data.rb | 46 + .../directory_sync/dsync_group_user_added.rb | 34 + .../dsync_group_user_added_data.rb | 25 + .../dsync_group_user_removed.rb | 34 + .../dsync_group_user_removed_data.rb | 7 + .../directory_sync/dsync_user_created.rb | 34 + .../directory_sync/dsync_user_deleted.rb | 34 + .../directory_sync/dsync_user_updated.rb | 34 + .../directory_sync/dsync_user_updated_data.rb | 106 + .../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 | 73 +- lib/workos/errors.rb | 92 +- lib/workos/event.rb | 30 - lib/workos/events.rb | 102 +- lib/workos/events/event_list_list_metadata.rb | 18 + lib/workos/events/event_schema.rb | 34 + lib/workos/factor.rb | 35 - lib/workos/feature_flag.rb | 34 - lib/workos/feature_flags.rb | 246 + lib/workos/feature_flags/feature_flag.rb | 49 + .../feature_flags/feature_flag_owner.rb | 25 + lib/workos/feature_flags/flag.rb | 7 + lib/workos/feature_flags/flag_created.rb | 34 + .../feature_flags/flag_created_context.rb | 22 + .../flag_created_context_actor.rb | 25 + lib/workos/feature_flags/flag_created_data.rb | 52 + .../feature_flags/flag_created_data_owner.rb | 7 + lib/workos/feature_flags/flag_deleted.rb | 34 + .../feature_flags/flag_deleted_context.rb | 22 + .../flag_deleted_context_actor.rb | 25 + 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 | 34 + .../flag_rule_updated_context.rb | 31 + .../flag_rule_updated_context_actor.rb | 25 + ..._rule_updated_context_configured_target.rb | 22 + ..._context_configured_target_organization.rb | 22 + ..._updated_context_configured_target_user.rb | 22 + ...rule_updated_context_previous_attribute.rb | 22 + ...ated_context_previous_attribute_context.rb | 22 + ...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 | 22 + .../feature_flags/flag_rule_updated_data.rb | 7 + .../flag_rule_updated_data_owner.rb | 7 + lib/workos/feature_flags/flag_updated.rb | 34 + .../feature_flags/flag_updated_context.rb | 25 + .../flag_updated_context_actor.rb | 25 + ...flag_updated_context_previous_attribute.rb | 18 + ...updated_context_previous_attribute_data.rb | 31 + 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/inflections.rb | 64 + lib/workos/invitation.rb | 49 - lib/workos/magic_auth.rb | 37 - lib/workos/mfa.rb | 136 - lib/workos/multi_factor_auth.rb | 215 + .../authentication_challenge.rb | 37 + ...uthentication_challenge_verify_response.rb | 22 + ...uthentication_challenges_verify_request.rb | 18 + .../authentication_factor.rb | 40 + .../authentication_factor_enrolled.rb | 40 + .../authentication_factor_enrolled_sms.rb | 18 + .../authentication_factor_enrolled_totp.rb | 31 + .../authentication_factor_sms.rb | 7 + .../authentication_factor_totp.rb | 22 + .../authentication_factors_create_request.rb | 31 + .../challenge_authentication_factor.rb | 18 + .../enroll_user_authentication_factor.rb | 28 + ...r_authentication_factor_enroll_response.rb | 22 + lib/workos/oauth_tokens.rb | 29 - lib/workos/organization.rb | 47 - lib/workos/organization_domains.rb | 94 + .../create_organization_domain.rb | 22 + .../organization_domain.rb | 46 + .../organization_domain_created.rb | 34 + .../organization_domain_created_data.rb | 46 + .../organization_domain_deleted.rb | 34 + .../organization_domain_deleted_data.rb | 46 + .../organization_domain_stand_alone.rb | 46 + .../organization_domain_updated.rb | 34 + .../organization_domain_updated_data.rb | 46 + ...organization_domain_verification_failed.rb | 34 + ...ization_domain_verification_failed_data.rb | 22 + ...ication_failed_data_organization_domain.rb | 46 + .../organization_domain_verified.rb | 34 + .../organization_domain_verified_data.rb | 46 + lib/workos/organization_membership.rb | 43 - lib/workos/organizations.rb | 474 +- .../organizations/audit_log_configuration.rb | 28 + .../audit_log_configuration_log_stream.rb | 31 + .../organizations/audit_logs_retention.rb | 23 + .../audit_logs_retention_json.rb | 18 + lib/workos/organizations/organization.rb | 55 + .../organizations/organization_created.rb | 34 + .../organization_created_data.rb | 43 + .../organization_created_data_domain.rb | 46 + .../organizations/organization_deleted.rb | 34 + .../organization_deleted_data.rb | 43 + .../organization_deleted_data_domain.rb | 46 + .../organizations/organization_domain_data.rb | 22 + .../organizations/organization_input.rb | 34 + .../organization_membership_created.rb | 34 + .../organization_membership_created_data.rb | 49 + .../organization_membership_deleted.rb | 34 + .../organization_membership_deleted_data.rb | 49 + .../organization_membership_updated.rb | 34 + .../organization_membership_updated_data.rb | 49 + .../organization_role_created.rb | 34 + .../organization_role_created_data.rb | 43 + .../organization_role_deleted.rb | 34 + .../organization_role_deleted_data.rb | 7 + .../organization_role_updated.rb | 34 + .../organization_role_updated_data.rb | 7 + .../organizations/organization_updated.rb | 34 + .../organization_updated_data.rb | 43 + .../organization_updated_data_domain.rb | 46 + .../update_audit_logs_retention.rb | 18 + .../organizations/update_organization.rb | 46 + lib/workos/password_reset.rb | 37 - lib/workos/passwordless.rb | 121 +- lib/workos/pipes.rb | 149 + lib/workos/pipes/connected_account.rb | 40 + .../data_integration_access_token_response.rb | 25 + ...tion_access_token_response_access_token.rb | 31 + ...data_integration_authorize_url_response.rb | 18 + ..._data_integration_authorize_url_request.rb | 25 + ...ata_integrations_get_user_token_request.rb | 22 + .../pipes/data_integrations_list_response.rb | 22 + .../data_integrations_list_response_data.rb | 52 + ...ns_list_response_data_connected_account.rb | 52 + 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 | 27 + lib/workos/radar.rb | 132 + ...dar_list_entry_already_present_response.rb | 18 + .../radar/radar_standalone_assess_request.rb | 37 + ...ndalone_delete_radar_list_entry_request.rb | 18 + lib/workos/radar/radar_standalone_response.rb | 31 + ...standalone_update_radar_attempt_request.rb | 22 + ...ar_standalone_update_radar_list_request.rb | 7 + lib/workos/refresh_authentication_response.rb | 51 - lib/workos/role.rb | 38 - lib/workos/session.rb | 268 +- lib/workos/session_manager.rb | 196 + lib/workos/shared/event_context.rb | 34 + lib/workos/shared/event_context_actor.rb | 25 + .../event_context_google_analytics_session.rb | 25 + lib/workos/shared/group.rb | 37 + lib/workos/shared/group_created.rb | 34 + lib/workos/shared/group_deleted.rb | 34 + lib/workos/shared/group_member_added.rb | 34 + lib/workos/shared/group_member_added_data.rb | 22 + lib/workos/shared/group_member_removed.rb | 34 + .../shared/group_member_removed_data.rb | 7 + lib/workos/shared/group_updated.rb | 34 + lib/workos/sso.rb | 443 +- lib/workos/sso/connection.rb | 58 + lib/workos/sso/connection_activated.rb | 34 + lib/workos/sso/connection_activated_data.rb | 49 + .../sso/connection_activated_data_domain.rb | 25 + lib/workos/sso/connection_deactivated.rb | 34 + lib/workos/sso/connection_deactivated_data.rb | 49 + .../sso/connection_deactivated_data_domain.rb | 7 + lib/workos/sso/connection_deleted.rb | 34 + lib/workos/sso/connection_deleted_data.rb | 40 + lib/workos/sso/connection_domain.rb | 7 + lib/workos/sso/connection_option.rb | 18 + ...ction_saml_certificate_renewal_required.rb | 34 + ..._saml_certificate_renewal_required_data.rb | 25 + ...icate_renewal_required_data_certificate.rb | 25 + ...ficate_renewal_required_data_connection.rb | 22 + .../connection_saml_certificate_renewed.rb | 34 + ...onnection_saml_certificate_renewed_data.rb | 25 + ...ml_certificate_renewed_data_certificate.rb | 22 + ...aml_certificate_renewed_data_connection.rb | 7 + lib/workos/sso/profile.rb | 58 + lib/workos/sso/sso_authorize_url_response.rb | 18 + .../sso/sso_logout_authorize_request.rb | 18 + .../sso/sso_logout_authorize_response.rb | 22 + lib/workos/sso/sso_token_response.rb | 31 + .../sso/sso_token_response_oauth_token.rb | 7 + lib/workos/sso/token_query.rb | 28 + lib/workos/types.rb | 12 - lib/workos/types/api_response.rb | 10 + lib/workos/types/applications_order.rb | 14 + ...udit_log_configuration_log_stream_state.rb | 15 + ...audit_log_configuration_log_stream_type.rb | 17 + .../types/audit_log_configuration_state.rb | 14 + .../types/audit_log_export_json_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 | 15 + .../types/authentication_factor_type.rb | 9 + ...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/base_model.rb | 35 + lib/workos/types/connected_account_state.rb | 14 + ...nnection_activated_data_connection_type.rb | 61 + .../types/connection_activated_data_state.rb | 16 + .../types/connection_activated_data_status.rb | 13 + ...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 | 9 + .../types/connection_deleted_data_state.rb | 9 + ...uired_data_certificate_certificate_type.rb | 14 + ...newed_data_certificate_certificate_type.rb | 9 + lib/workos/types/connection_state.rb | 17 + lib/workos/types/connection_status.rb | 9 + 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 | 16 + lib/workos/types/dsync_activated_data_type.rb | 34 + .../types/dsync_deactivated_data_state.rb | 9 + .../types/dsync_deactivated_data_type.rb | 9 + lib/workos/types/dsync_deleted_data_state.rb | 9 + lib/workos/types/dsync_deleted_data_type.rb | 9 + .../types/dsync_user_updated_data_state.rb | 9 + .../types/event_context_actor_source.rb | 14 + lib/workos/types/events_order.rb | 9 + 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 + lib/workos/types/generate_link_intent.rb | 18 + lib/workos/types/intent.rb | 18 - .../types/invitation_accepted_data_state.rb | 15 + .../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 | 9 + lib/workos/types/list_struct.rb | 128 +- .../organization_created_data_domain_state.rb | 16 + ...eated_data_domain_verification_strategy.rb | 13 + .../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 | 9 + .../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 | 9 + ...organization_domain_verified_data_state.rb | 9 + ...ain_verified_data_verification_strategy.rb | 9 + ...nization_membership_created_data_status.rb | 14 + ...nization_membership_deleted_data_status.rb | 9 + .../types/organization_membership_status.rb | 9 + ...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 | 18 + .../radar_standalone_response_control.rb | 21 + .../radar_standalone_response_verdict.rb | 14 + lib/workos/types/radar_type.rb | 9 + lib/workos/types/request_options.rb | 33 + .../resend_user_invite_options_locale.rb | 9 + lib/workos/types/role_type.rb | 13 + .../types/session_created_data_auth_method.rb | 21 + .../types/session_created_data_status.rb | 14 + .../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 | 13 + .../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 | 9 + lib/workos/types/user_sessions_status.rb | 9 + ...erification_completed_data_key_provider.rb | 14 + .../vault_data_created_data_actor_source.rb | 13 + .../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 | 9 + .../vault_kek_created_data_actor_source.rb | 9 + .../vault_metadata_read_data_actor_source.rb | 9 + .../vault_names_listed_data_actor_source.rb | 9 + .../types/webhook_endpoint_json_status.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 | 2692 ++++--- .../action_authentication_denied.rb | 34 + .../action_authentication_denied_data.rb | 43 + .../action_user_registration_denied.rb | 34 + .../action_user_registration_denied_data.rb | 40 + .../user_management/authenticate_response.rb | 40 + .../authenticate_response_impersonator.rb | 22 + .../authenticate_response_oauth_token.rb | 31 + ...uthentication_email_verification_failed.rb | 34 + ...tication_email_verification_failed_data.rb | 37 + ...on_email_verification_failed_data_error.rb | 22 + ...entication_email_verification_succeeded.rb | 34 + ...ation_email_verification_succeeded_data.rb | 34 + .../authentication_magic_auth_failed.rb | 34 + .../authentication_magic_auth_failed_data.rb | 37 + ...entication_magic_auth_failed_data_error.rb | 7 + .../authentication_magic_auth_succeeded.rb | 34 + ...uthentication_magic_auth_succeeded_data.rb | 34 + .../authentication_mfa_failed.rb | 34 + .../authentication_mfa_failed_data.rb | 37 + .../authentication_mfa_failed_data_error.rb | 7 + .../authentication_mfa_succeeded.rb | 34 + .../authentication_mfa_succeeded_data.rb | 34 + .../authentication_oauth_failed.rb | 34 + .../authentication_oauth_failed_data.rb | 37 + .../authentication_oauth_failed_data_error.rb | 7 + .../authentication_oauth_succeeded.rb | 34 + .../authentication_oauth_succeeded_data.rb | 34 + .../authentication_passkey_failed.rb | 34 + .../authentication_passkey_failed_data.rb | 37 + ...uthentication_passkey_failed_data_error.rb | 7 + .../authentication_passkey_succeeded.rb | 34 + .../authentication_passkey_succeeded_data.rb | 34 + .../authentication_password_failed.rb | 34 + .../authentication_password_failed_data.rb | 37 + ...thentication_password_failed_data_error.rb | 7 + .../authentication_password_succeeded.rb | 34 + .../authentication_password_succeeded_data.rb | 34 + .../authentication_radar_risk_detected.rb | 34 + ...authentication_radar_risk_detected_data.rb | 40 + .../authentication_sso_failed.rb | 34 + .../authentication_sso_failed_data.rb | 40 + .../authentication_sso_failed_data_error.rb | 7 + .../authentication_sso_failed_data_sso.rb | 25 + .../authentication_sso_started.rb | 34 + .../authentication_sso_started_data.rb | 37 + .../authentication_sso_started_data_sso.rb | 7 + .../authentication_sso_succeeded.rb | 34 + .../authentication_sso_succeeded_data.rb | 37 + .../authentication_sso_succeeded_data_sso.rb | 7 + .../authentication_sso_timed_out.rb | 34 + .../authentication_sso_timed_out_data.rb | 40 + ...authentication_sso_timed_out_data_error.rb | 7 + .../authentication_sso_timed_out_data_sso.rb | 7 + ...ation_code_session_authenticate_request.rb | 43 + ...uthorized_connect_application_list_data.rb | 31 + .../user_management/confirm_email_change.rb | 7 + .../user_management/cors_origin_response.rb | 31 + .../user_management/create_cors_origin.rb | 18 + .../create_magic_code_and_return.rb | 22 + .../user_management/create_password_reset.rb | 22 + .../create_password_reset_token.rb | 18 + .../user_management/create_redirect_uri.rb | 18 + lib/workos/user_management/create_user.rb | 43 + .../create_user_invite_options.rb | 34 + .../create_user_organization_membership.rb | 28 + .../device_authorization_response.rb | 34 + ...evice_code_session_authenticate_request.rb | 34 + lib/workos/user_management/email_change.rb | 31 + .../email_change_confirmation.rb | 22 + .../email_change_confirmation_user.rb | 55 + .../user_management/email_verification.rb | 40 + ...ation_code_session_authenticate_request.rb | 40 + .../email_verification_created.rb | 34 + .../email_verification_created_data.rb | 37 + lib/workos/user_management/invitation.rb | 58 + .../user_management/invitation_accepted.rb | 34 + .../invitation_accepted_data.rb | 52 + .../user_management/invitation_created.rb | 34 + .../invitation_created_data.rb | 52 + .../user_management/invitation_resent.rb | 34 + .../user_management/invitation_resent_data.rb | 52 + .../user_management/invitation_revoked.rb | 34 + .../invitation_revoked_data.rb | 52 + lib/workos/user_management/jwks_response.rb | 18 + .../user_management/jwks_response_keys.rb | 40 + .../user_management/jwt_template_response.rb | 28 + lib/workos/user_management/magic_auth.rb | 40 + ..._auth_code_session_authenticate_request.rb | 43 + .../user_management/magic_auth_created.rb | 34 + .../magic_auth_created_data.rb | 37 + .../mfa_totp_session_authenticate_request.rb | 43 + .../organization_membership.rb | 49 + ..._selection_session_authenticate_request.rb | 40 + lib/workos/user_management/password_reset.rb | 40 + .../user_management/password_reset_created.rb | 34 + .../password_reset_created_data.rb | 34 + .../password_reset_succeeded.rb | 34 + .../password_reset_succeeded_data.rb | 7 + .../password_session_authenticate_request.rb | 43 + lib/workos/user_management/redirect_uri.rb | 34 + ...resh_token_session_authenticate_request.rb | 40 + .../resend_user_invite_options.rb | 18 + .../reset_password_response.rb | 18 + lib/workos/user_management/revoke_session.rb | 22 + .../user_management/send_email_change.rb | 18 + .../send_verification_email_response.rb | 7 + lib/workos/user_management/session.rb | 57 - lib/workos/user_management/session_created.rb | 34 + .../user_management/session_created_data.rb | 55 + .../session_created_data_impersonator.rb | 7 + lib/workos/user_management/session_revoked.rb | 34 + .../user_management/session_revoked_data.rb | 55 + .../session_revoked_data_impersonator.rb | 7 + .../sso_device_authorization_request.rb | 18 + .../user_management/update_jwt_template.rb | 18 + lib/workos/user_management/update_user.rb | 46 + .../update_user_organization_membership.rb | 22 + ...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 | 34 + lib/workos/user_management/user_deleted.rb | 34 + .../user_identities_get_item.rb | 25 + lib/workos/user_management/user_invite.rb | 58 + .../user_organization_membership.rb | 49 + .../user_sessions_impersonator.rb | 7 + .../user_sessions_list_item.rb | 55 + lib/workos/user_management/user_updated.rb | 34 + .../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 | 241 + .../vault_byok_key_verification_completed.rb | 34 + ...lt_byok_key_verification_completed_data.rb | 25 + lib/workos/vault/vault_data_created.rb | 34 + lib/workos/vault/vault_data_created_data.rb | 34 + lib/workos/vault/vault_data_deleted.rb | 34 + lib/workos/vault/vault_data_deleted_data.rb | 28 + lib/workos/vault/vault_data_read.rb | 34 + lib/workos/vault/vault_data_read_data.rb | 31 + lib/workos/vault/vault_data_updated.rb | 34 + lib/workos/vault/vault_data_updated_data.rb | 34 + lib/workos/vault/vault_dek_decrypted.rb | 34 + lib/workos/vault/vault_dek_decrypted_data.rb | 28 + lib/workos/vault/vault_dek_read.rb | 34 + lib/workos/vault/vault_dek_read_data.rb | 31 + lib/workos/vault/vault_kek_created.rb | 34 + lib/workos/vault/vault_kek_created_data.rb | 31 + lib/workos/vault/vault_metadata_read.rb | 34 + lib/workos/vault/vault_metadata_read_data.rb | 28 + lib/workos/vault/vault_names_listed.rb | 34 + lib/workos/vault/vault_names_listed_data.rb | 25 + lib/workos/verify_challenge.rb | 25 - lib/workos/version.rb | 3 +- lib/workos/webhook.rb | 30 - lib/workos/webhook_event.rb | 120 + lib/workos/webhooks.rb | 372 +- .../webhooks/create_webhook_endpoint.rb | 22 + .../webhooks/update_webhook_endpoint.rb | 25 + lib/workos/webhooks/webhook_endpoint.rb | 45 + lib/workos/webhooks/webhook_endpoint_json.rb | 40 + lib/workos/widgets.rb | 72 +- lib/workos/widgets/widget_session_token.rb | 25 + .../widgets/widget_session_token_response.rb | 18 + rbi/workos/action_authentication_denied.rbi | 54 + .../action_authentication_denied_data.rbi | 72 + .../action_user_registration_denied.rbi | 54 + .../action_user_registration_denied_data.rbi | 66 + rbi/workos/actions.rbi | 48 + rbi/workos/add_role_permission.rbi | 24 + rbi/workos/admin_portal.rbi | 26 + rbi/workos/api_key.rbi | 72 + rbi/workos/api_key_created.rbi | 54 + rbi/workos/api_key_created_data.rbi | 72 + rbi/workos/api_key_created_data_owner.rbi | 30 + rbi/workos/api_key_owner.rbi | 30 + rbi/workos/api_key_revoked.rbi | 54 + rbi/workos/api_key_revoked_data.rbi | 72 + rbi/workos/api_key_revoked_data_owner.rbi | 30 + rbi/workos/api_key_validation_response.rbi | 24 + rbi/workos/api_key_with_value.rbi | 78 + rbi/workos/api_key_with_value_owner.rbi | 30 + rbi/workos/api_keys.rbi | 51 + .../application_credentials_list_item.rbi | 54 + rbi/workos/assign_role.rbi | 42 + rbi/workos/audit_log_action.rbi | 47 + rbi/workos/audit_log_action_json.rbi | 48 + rbi/workos/audit_log_configuration.rbi | 42 + .../audit_log_configuration_log_stream.rbi | 48 + rbi/workos/audit_log_event.rbi | 60 + rbi/workos/audit_log_event_actor.rbi | 42 + rbi/workos/audit_log_event_context.rbi | 30 + .../audit_log_event_create_response.rbi | 24 + rbi/workos/audit_log_event_ingestion.rbi | 30 + rbi/workos/audit_log_event_target.rbi | 42 + rbi/workos/audit_log_export.rbi | 53 + rbi/workos/audit_log_export_creation.rbi | 66 + rbi/workos/audit_log_export_json.rbi | 54 + rbi/workos/audit_log_schema.rbi | 36 + rbi/workos/audit_log_schema_actor.rbi | 24 + 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 | 30 + rbi/workos/audit_logs.rbi | 96 + rbi/workos/audit_logs_retention.rbi | 23 + rbi/workos/audit_logs_retention_json.rbi | 24 + rbi/workos/authenticate_response.rbi | 66 + .../authenticate_response_impersonator.rbi | 30 + .../authenticate_response_oauth_token.rbi | 48 + rbi/workos/authentication_challenge.rbi | 60 + ...thentication_challenge_verify_response.rbi | 30 + ...thentication_challenges_verify_request.rbi | 24 + ...thentication_email_verification_failed.rbi | 54 + ...ication_email_verification_failed_data.rbi | 60 + ...n_email_verification_failed_data_error.rbi | 30 + ...ntication_email_verification_succeeded.rbi | 54 + ...tion_email_verification_succeeded_data.rbi | 54 + rbi/workos/authentication_factor.rbi | 66 + rbi/workos/authentication_factor_enrolled.rbi | 66 + .../authentication_factor_enrolled_sms.rbi | 24 + .../authentication_factor_enrolled_totp.rbi | 48 + rbi/workos/authentication_factor_sms.rbi | 24 + rbi/workos/authentication_factor_totp.rbi | 30 + .../authentication_factors_create_request.rbi | 48 + .../authentication_magic_auth_failed.rbi | 54 + .../authentication_magic_auth_failed_data.rbi | 60 + ...ntication_magic_auth_failed_data_error.rbi | 30 + .../authentication_magic_auth_succeeded.rbi | 54 + ...thentication_magic_auth_succeeded_data.rbi | 54 + rbi/workos/authentication_mfa_failed.rbi | 54 + rbi/workos/authentication_mfa_failed_data.rbi | 60 + .../authentication_mfa_failed_data_error.rbi | 30 + rbi/workos/authentication_mfa_succeeded.rbi | 54 + .../authentication_mfa_succeeded_data.rbi | 54 + rbi/workos/authentication_oauth_failed.rbi | 54 + .../authentication_oauth_failed_data.rbi | 60 + ...authentication_oauth_failed_data_error.rbi | 30 + rbi/workos/authentication_oauth_succeeded.rbi | 54 + .../authentication_oauth_succeeded_data.rbi | 54 + rbi/workos/authentication_passkey_failed.rbi | 54 + .../authentication_passkey_failed_data.rbi | 60 + ...thentication_passkey_failed_data_error.rbi | 30 + .../authentication_passkey_succeeded.rbi | 54 + .../authentication_passkey_succeeded_data.rbi | 54 + rbi/workos/authentication_password_failed.rbi | 54 + .../authentication_password_failed_data.rbi | 60 + ...hentication_password_failed_data_error.rbi | 30 + .../authentication_password_succeeded.rbi | 54 + ...authentication_password_succeeded_data.rbi | 54 + .../authentication_radar_risk_detected.rbi | 54 + ...uthentication_radar_risk_detected_data.rbi | 66 + rbi/workos/authentication_sso_failed.rbi | 54 + rbi/workos/authentication_sso_failed_data.rbi | 66 + .../authentication_sso_failed_data_error.rbi | 30 + .../authentication_sso_failed_data_sso.rbi | 36 + rbi/workos/authentication_sso_started.rbi | 54 + .../authentication_sso_started_data.rbi | 60 + .../authentication_sso_started_data_sso.rbi | 36 + rbi/workos/authentication_sso_succeeded.rbi | 54 + .../authentication_sso_succeeded_data.rbi | 60 + .../authentication_sso_succeeded_data_sso.rbi | 36 + rbi/workos/authentication_sso_timed_out.rbi | 54 + .../authentication_sso_timed_out_data.rbi | 66 + ...uthentication_sso_timed_out_data_error.rbi | 30 + .../authentication_sso_timed_out_data_sso.rbi | 36 + rbi/workos/authorization.rbi | 414 + rbi/workos/authorization_check.rbi | 24 + ...tion_code_session_authenticate_request.rbi | 72 + rbi/workos/authorization_permission.rbi | 72 + rbi/workos/authorization_resource.rbi | 78 + ...thorized_connect_application_list_data.rbi | 48 + rbi/workos/base_client.rbi | 132 + .../challenge_authentication_factor.rbi | 24 + rbi/workos/check_authorization.rbi | 42 + rbi/workos/client.rbi | 61 + rbi/workos/configuration.rbi | 68 + rbi/workos/confirm_email_change.rbi | 24 + rbi/workos/connect.rbi | 102 + rbi/workos/connect_application.rbi | 78 + rbi/workos/connected_account.rbi | 66 + rbi/workos/connection.rbi | 84 + rbi/workos/connection_activated.rbi | 54 + rbi/workos/connection_activated_data.rbi | 84 + .../connection_activated_data_domain.rbi | 36 + rbi/workos/connection_deactivated.rbi | 54 + rbi/workos/connection_deactivated_data.rbi | 84 + .../connection_deactivated_data_domain.rbi | 36 + rbi/workos/connection_deleted.rbi | 54 + rbi/workos/connection_deleted_data.rbi | 66 + rbi/workos/connection_domain.rbi | 36 + rbi/workos/connection_option.rbi | 24 + ...tion_saml_certificate_renewal_required.rbi | 54 + ...saml_certificate_renewal_required_data.rbi | 36 + ...cate_renewal_required_data_certificate.rbi | 36 + ...icate_renewal_required_data_connection.rbi | 30 + .../connection_saml_certificate_renewed.rbi | 54 + ...nnection_saml_certificate_renewed_data.rbi | 36 + ...l_certificate_renewed_data_certificate.rbi | 30 + ...ml_certificate_renewed_data_connection.rbi | 30 + rbi/workos/cors_origin_response.rbi | 48 + rbi/workos/create_application_secret.rbi | 18 + .../create_authorization_permission.rbi | 42 + rbi/workos/create_authorization_resource.rbi | 66 + rbi/workos/create_cors_origin.rbi | 24 + rbi/workos/create_m2m_application.rbi | 48 + rbi/workos/create_magic_code_and_return.rbi | 30 + rbi/workos/create_oauth_application.rbi | 66 + rbi/workos/create_organization_api_key.rbi | 30 + rbi/workos/create_organization_domain.rbi | 30 + rbi/workos/create_organization_role.rbi | 42 + rbi/workos/create_password_reset.rbi | 30 + rbi/workos/create_password_reset_token.rbi | 24 + rbi/workos/create_redirect_uri.rbi | 24 + rbi/workos/create_role.rbi | 42 + rbi/workos/create_user.rbi | 72 + rbi/workos/create_user_invite_options.rbi | 54 + .../create_user_organization_membership.rbi | 42 + rbi/workos/create_webhook_endpoint.rbi | 30 + ...data_integration_access_token_response.rbi | 36 + ...ion_access_token_response_access_token.rbi | 48 + ...ata_integration_authorize_url_response.rbi | 24 + ...data_integration_authorize_url_request.rbi | 36 + ...ta_integrations_get_user_token_request.rbi | 30 + .../data_integrations_list_response.rbi | 30 + .../data_integrations_list_response_data.rbi | 90 + ...s_list_response_data_connected_account.rbi | 72 + rbi/workos/device_authorization_response.rbi | 54 + ...vice_code_session_authenticate_request.rbi | 54 + rbi/workos/directory.rbi | 84 + rbi/workos/directory_group.rbi | 72 + rbi/workos/directory_metadata.rbi | 30 + rbi/workos/directory_metadata_user.rbi | 30 + rbi/workos/directory_sync.rbi | 85 + rbi/workos/directory_user.rbi | 126 + rbi/workos/directory_user_email.rbi | 36 + rbi/workos/directory_user_with_groups.rbi | 132 + .../directory_user_with_groups_email.rbi | 36 + rbi/workos/dsync_activated.rbi | 54 + rbi/workos/dsync_activated_data.rbi | 78 + rbi/workos/dsync_activated_data_domain.rbi | 36 + rbi/workos/dsync_deactivated.rbi | 54 + rbi/workos/dsync_deactivated_data.rbi | 78 + rbi/workos/dsync_deactivated_data_domain.rbi | 36 + rbi/workos/dsync_deleted.rbi | 54 + rbi/workos/dsync_deleted_data.rbi | 66 + rbi/workos/dsync_group_created.rbi | 54 + rbi/workos/dsync_group_deleted.rbi | 54 + rbi/workos/dsync_group_updated.rbi | 54 + rbi/workos/dsync_group_updated_data.rbi | 78 + rbi/workos/dsync_group_user_added.rbi | 54 + rbi/workos/dsync_group_user_added_data.rbi | 36 + rbi/workos/dsync_group_user_removed.rbi | 54 + rbi/workos/dsync_group_user_removed_data.rbi | 36 + rbi/workos/dsync_user_created.rbi | 54 + rbi/workos/dsync_user_deleted.rbi | 54 + rbi/workos/dsync_user_updated.rbi | 54 + rbi/workos/dsync_user_updated_data.rbi | 132 + rbi/workos/dsync_user_updated_data_email.rbi | 36 + rbi/workos/email_change.rbi | 48 + rbi/workos/email_change_confirmation.rbi | 30 + rbi/workos/email_change_confirmation_user.rbi | 96 + rbi/workos/email_verification.rbi | 66 + ...tion_code_session_authenticate_request.rbi | 66 + rbi/workos/email_verification_created.rbi | 54 + .../email_verification_created_data.rbi | 60 + rbi/workos/encryptors/aes_gcm.rbi | 19 + .../enroll_user_authentication_factor.rbi | 42 + rbi/workos/errors.rbi | 43 + rbi/workos/event_context.rbi | 54 + rbi/workos/event_context_actor.rbi | 36 + ...event_context_google_analytics_session.rbi | 36 + rbi/workos/event_list_list_metadata.rbi | 24 + rbi/workos/event_schema.rbi | 54 + rbi/workos/events.rbi | 28 + .../external_auth_complete_response.rbi | 24 + rbi/workos/feature_flag.rbi | 84 + rbi/workos/feature_flag_owner.rbi | 36 + rbi/workos/feature_flags.rbi | 90 + rbi/workos/flag.rbi | 84 + rbi/workos/flag_created.rbi | 54 + rbi/workos/flag_created_context.rbi | 30 + rbi/workos/flag_created_context_actor.rbi | 36 + rbi/workos/flag_created_data.rbi | 90 + rbi/workos/flag_created_data_owner.rbi | 36 + rbi/workos/flag_deleted.rbi | 54 + rbi/workos/flag_deleted_context.rbi | 30 + rbi/workos/flag_deleted_context_actor.rbi | 36 + rbi/workos/flag_deleted_data.rbi | 90 + rbi/workos/flag_deleted_data_owner.rbi | 36 + rbi/workos/flag_owner.rbi | 36 + rbi/workos/flag_rule_updated.rbi | 54 + rbi/workos/flag_rule_updated_context.rbi | 48 + .../flag_rule_updated_context_actor.rbi | 36 + ...rule_updated_context_configured_target.rbi | 30 + ...context_configured_target_organization.rbi | 30 + ...updated_context_configured_target_user.rbi | 30 + ...ule_updated_context_previous_attribute.rbi | 30 + ...ted_context_previous_attribute_context.rbi | 30 + ...us_attribute_context_configured_target.rbi | 30 + ...context_configured_target_organization.rbi | 30 + ...tribute_context_configured_target_user.rbi | 30 + ...pdated_context_previous_attribute_data.rbi | 30 + rbi/workos/flag_rule_updated_data.rbi | 90 + rbi/workos/flag_rule_updated_data_owner.rbi | 36 + rbi/workos/flag_updated.rbi | 54 + rbi/workos/flag_updated_context.rbi | 36 + rbi/workos/flag_updated_context_actor.rbi | 36 + ...lag_updated_context_previous_attribute.rbi | 24 + ...pdated_context_previous_attribute_data.rbi | 48 + rbi/workos/flag_updated_data.rbi | 90 + rbi/workos/flag_updated_data_owner.rbi | 36 + rbi/workos/generate_link.rbi | 54 + rbi/workos/group.rbi | 60 + rbi/workos/group_created.rbi | 54 + rbi/workos/group_deleted.rbi | 54 + rbi/workos/group_member_added.rbi | 54 + rbi/workos/group_member_added_data.rbi | 30 + rbi/workos/group_member_removed.rbi | 54 + rbi/workos/group_member_removed_data.rbi | 30 + rbi/workos/group_updated.rbi | 54 + rbi/workos/hash_provider.rbi | 18 + rbi/workos/intent_options.rbi | 24 + rbi/workos/invitation.rbi | 102 + rbi/workos/invitation_accepted.rbi | 54 + rbi/workos/invitation_accepted_data.rbi | 90 + rbi/workos/invitation_created.rbi | 54 + rbi/workos/invitation_created_data.rbi | 90 + rbi/workos/invitation_resent.rbi | 54 + rbi/workos/invitation_resent_data.rbi | 90 + rbi/workos/invitation_revoked.rbi | 54 + rbi/workos/invitation_revoked_data.rbi | 90 + rbi/workos/jwks_response.rbi | 24 + rbi/workos/jwks_response_keys.rbi | 66 + rbi/workos/jwt_template_response.rbi | 42 + rbi/workos/magic_auth.rbi | 66 + ...auth_code_session_authenticate_request.rbi | 72 + rbi/workos/magic_auth_created.rbi | 54 + rbi/workos/magic_auth_created_data.rbi | 60 + .../mfa_totp_session_authenticate_request.rbi | 72 + rbi/workos/multi_factor_auth.rbi | 83 + rbi/workos/new_connect_application_secret.rbi | 60 + rbi/workos/organization.rbi | 78 + rbi/workos/organization_created.rbi | 54 + rbi/workos/organization_created_data.rbi | 72 + .../organization_created_data_domain.rbi | 78 + rbi/workos/organization_deleted.rbi | 54 + rbi/workos/organization_deleted_data.rbi | 72 + .../organization_deleted_data_domain.rbi | 78 + rbi/workos/organization_domain.rbi | 78 + rbi/workos/organization_domain_created.rbi | 54 + .../organization_domain_created_data.rbi | 78 + rbi/workos/organization_domain_data.rbi | 30 + rbi/workos/organization_domain_deleted.rbi | 54 + .../organization_domain_deleted_data.rbi | 78 + .../organization_domain_stand_alone.rbi | 78 + rbi/workos/organization_domain_updated.rbi | 54 + .../organization_domain_updated_data.rbi | 78 + ...rganization_domain_verification_failed.rbi | 54 + ...zation_domain_verification_failed_data.rbi | 30 + ...cation_failed_data_organization_domain.rbi | 78 + rbi/workos/organization_domain_verified.rbi | 54 + .../organization_domain_verified_data.rbi | 78 + rbi/workos/organization_domains.rbi | 46 + rbi/workos/organization_input.rbi | 54 + rbi/workos/organization_membership.rbi | 84 + .../organization_membership_created.rbi | 54 + .../organization_membership_created_data.rbi | 84 + .../organization_membership_deleted.rbi | 54 + .../organization_membership_deleted_data.rbi | 84 + .../organization_membership_updated.rbi | 54 + .../organization_membership_updated_data.rbi | 84 + rbi/workos/organization_role_created.rbi | 54 + rbi/workos/organization_role_created_data.rbi | 72 + rbi/workos/organization_role_deleted.rbi | 54 + rbi/workos/organization_role_deleted_data.rbi | 72 + rbi/workos/organization_role_updated.rbi | 54 + rbi/workos/organization_role_updated_data.rbi | 72 + ...selection_session_authenticate_request.rbi | 66 + rbi/workos/organization_updated.rbi | 54 + rbi/workos/organization_updated_data.rbi | 72 + .../organization_updated_data_domain.rbi | 78 + rbi/workos/organizations.rbi | 86 + rbi/workos/password_reset.rbi | 66 + rbi/workos/password_reset_created.rbi | 54 + rbi/workos/password_reset_created_data.rbi | 54 + rbi/workos/password_reset_succeeded.rbi | 54 + rbi/workos/password_reset_succeeded_data.rbi | 54 + .../password_session_authenticate_request.rbi | 72 + rbi/workos/passwordless.rbi | 47 + rbi/workos/permission.rbi | 72 + rbi/workos/permission_created.rbi | 54 + rbi/workos/permission_created_data.rbi | 66 + rbi/workos/permission_deleted.rbi | 54 + rbi/workos/permission_deleted_data.rbi | 66 + rbi/workos/permission_updated.rbi | 54 + rbi/workos/permission_updated_data.rbi | 66 + rbi/workos/pipes.rbi | 63 + rbi/workos/portal_link_response.rbi | 24 + rbi/workos/profile.rbi | 102 + rbi/workos/public_client.rbi | 12 + rbi/workos/radar.rbi | 57 + ...ar_list_entry_already_present_response.rbi | 24 + .../radar_standalone_assess_request.rbi | 60 + ...dalone_delete_radar_list_entry_request.rbi | 24 + rbi/workos/radar_standalone_response.rbi | 48 + ...tandalone_update_radar_attempt_request.rbi | 30 + ...r_standalone_update_radar_list_request.rbi | 24 + rbi/workos/redirect_uri.rbi | 54 + rbi/workos/redirect_uri_input.rbi | 30 + ...esh_token_session_authenticate_request.rbi | 66 + rbi/workos/remove_role.rbi | 42 + rbi/workos/resend_user_invite_options.rbi | 24 + rbi/workos/reset_password_response.rbi | 24 + rbi/workos/revoke_session.rbi | 30 + rbi/workos/role.rbi | 78 + rbi/workos/role_assignment.rbi | 54 + rbi/workos/role_assignment_resource.rbi | 36 + rbi/workos/role_created.rbi | 54 + rbi/workos/role_created_data.rbi | 54 + rbi/workos/role_deleted.rbi | 54 + rbi/workos/role_deleted_data.rbi | 54 + rbi/workos/role_list.rbi | 30 + rbi/workos/role_updated.rbi | 54 + rbi/workos/role_updated_data.rbi | 54 + rbi/workos/send_email_change.rbi | 24 + .../send_verification_email_response.rbi | 24 + rbi/workos/session.rbi | 43 + rbi/workos/session_created.rbi | 54 + rbi/workos/session_created_data.rbi | 96 + .../session_created_data_impersonator.rbi | 30 + rbi/workos/session_manager.rbi | 154 + rbi/workos/session_revoked.rbi | 54 + rbi/workos/session_revoked_data.rbi | 96 + .../session_revoked_data_impersonator.rbi | 30 + rbi/workos/set_role_permissions.rbi | 24 + rbi/workos/slim_role.rbi | 24 + rbi/workos/sso.rbi | 67 + rbi/workos/sso_authorize_url_response.rbi | 24 + .../sso_device_authorization_request.rbi | 24 + rbi/workos/sso_intent_options.rbi | 30 + rbi/workos/sso_logout_authorize_request.rbi | 24 + rbi/workos/sso_logout_authorize_response.rbi | 30 + rbi/workos/sso_token_response.rbi | 48 + rbi/workos/sso_token_response_oauth_token.rbi | 48 + rbi/workos/token_query.rbi | 42 + 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/update_audit_logs_retention.rbi | 24 + .../update_authorization_permission.rbi | 30 + rbi/workos/update_authorization_resource.rbi | 48 + rbi/workos/update_jwt_template.rbi | 24 + rbi/workos/update_oauth_application.rbi | 42 + rbi/workos/update_organization.rbi | 60 + rbi/workos/update_organization_role.rbi | 30 + rbi/workos/update_role.rbi | 30 + rbi/workos/update_user.rbi | 78 + .../update_user_organization_membership.rbi | 30 + rbi/workos/update_webhook_endpoint.rbi | 36 + rbi/workos/user.rbi | 96 + ..._authentication_factor_enroll_response.rbi | 30 + rbi/workos/user_consent_option.rbi | 42 + rbi/workos/user_consent_option_choice.rbi | 30 + rbi/workos/user_created.rbi | 54 + rbi/workos/user_deleted.rbi | 54 + rbi/workos/user_identities_get_item.rbi | 36 + rbi/workos/user_invite.rbi | 102 + rbi/workos/user_management.rbi | 410 + rbi/workos/user_management_login_request.rbi | 36 + rbi/workos/user_object.rbi | 48 + rbi/workos/user_organization_membership.rbi | 84 + ...organization_membership_base_list_data.rbi | 78 + rbi/workos/user_sessions_impersonator.rbi | 30 + rbi/workos/user_sessions_list_item.rbi | 96 + rbi/workos/user_updated.rbi | 54 + rbi/workos/util.rbi | 12 + rbi/workos/validate_api_key.rbi | 24 + rbi/workos/vault.rbi | 137 + .../vault_byok_key_verification_completed.rbi | 54 + ...t_byok_key_verification_completed_data.rbi | 36 + rbi/workos/vault_data_created.rbi | 54 + rbi/workos/vault_data_created_data.rbi | 54 + rbi/workos/vault_data_deleted.rbi | 54 + rbi/workos/vault_data_deleted_data.rbi | 42 + rbi/workos/vault_data_read.rbi | 54 + rbi/workos/vault_data_read_data.rbi | 48 + rbi/workos/vault_data_updated.rbi | 54 + rbi/workos/vault_data_updated_data.rbi | 54 + rbi/workos/vault_dek_decrypted.rbi | 54 + rbi/workos/vault_dek_decrypted_data.rbi | 42 + rbi/workos/vault_dek_read.rbi | 54 + rbi/workos/vault_dek_read_data.rbi | 48 + rbi/workos/vault_kek_created.rbi | 54 + rbi/workos/vault_kek_created_data.rbi | 48 + rbi/workos/vault_metadata_read.rbi | 54 + rbi/workos/vault_metadata_read_data.rbi | 42 + rbi/workos/vault_names_listed.rbi | 54 + rbi/workos/vault_names_listed_data.rbi | 36 + rbi/workos/verify_email_address.rbi | 24 + rbi/workos/verify_email_response.rbi | 24 + rbi/workos/webhook_endpoint.rbi | 65 + rbi/workos/webhook_endpoint_json.rbi | 66 + rbi/workos/webhooks.rbi | 52 + rbi/workos/widget_session_token.rbi | 36 + rbi/workos/widget_session_token_response.rbi | 24 + rbi/workos/widgets.rbi | 23 + renovate.json | 7 + script/ci | 16 + 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 - .../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 - .../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 - spec/support/profile.txt | 1 - spec/support/shared_examples/client.rb | 29 - spec/support/webhook_payload.txt | 1 - test/test_helper.rb | 20 + test/workos/test_actions.rb | 78 + test/workos/test_admin_portal.rb | 33 + test/workos/test_api_keys.rb | 57 + test/workos/test_audit_logs.rb | 89 + test/workos/test_authkit_helpers.rb | 109 + test/workos/test_authorization.rb | 321 + test/workos/test_base_client.rb | 173 + test/workos/test_connect.rb | 127 + test/workos/test_directory_sync.rb | 81 + test/workos/test_encryptors_aes_gcm.rb | 54 + test/workos/test_events.rb | 33 + test/workos/test_feature_flags.rb | 89 + test/workos/test_list_struct.rb | 39 + test/workos/test_model_round_trip.rb | 7013 +++++++++++++++++ test/workos/test_multi_factor_auth.rb | 81 + test/workos/test_organization_domains.rb | 57 + test/workos/test_organizations.rb | 81 + test/workos/test_passwordless.rb | 59 + test/workos/test_pipes.rb | 65 + test/workos/test_pkce.rb | 40 + test/workos/test_public_client.rb | 38 + test/workos/test_radar.rb | 57 + test/workos/test_session.rb | 261 + test/workos/test_sso.rb | 73 + test/workos/test_sso_helpers.rb | 80 + test/workos/test_sso_runtime.rb | 45 + test/workos/test_user_management.rb | 473 ++ test/workos/test_vault.rb | 151 + test/workos/test_webhook_verify.rb | 84 + test/workos/test_webhooks.rb | 57 + test/workos/test_widgets.rb | 33 + workos.gemspec | 43 +- 1345 files changed, 57003 insertions(+), 26471 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .oagen-manifest.json delete mode 100644 .rspec delete mode 100644 .rubocop.yml delete mode 100644 .rubocop_todo.yml create mode 100644 .standard.yml 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_action_json.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_export_json.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_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/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 create mode 100644 lib/workos/inflections.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/audit_logs_retention_json.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/api_response.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_json_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/base_model.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 create mode 100644 lib/workos/types/generate_link_intent.rb delete mode 100644 lib/workos/types/intent.rb 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/request_options.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_json_status.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/webhooks/webhook_endpoint_json.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/actions.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_action_json.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_export_json.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_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_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/audit_logs_retention_json.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/base_client.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/configuration.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/encryptors/aes_gcm.rbi create mode 100644 rbi/workos/enroll_user_authentication_factor.rbi create mode 100644 rbi/workos/errors.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/hash_provider.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/passwordless.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/public_client.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.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_manager.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/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/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/util.rbi create mode 100644 rbi/workos/validate_api_key.rbi create mode 100644 rbi/workos/vault.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/webhook_endpoint_json.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 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/fixtures/vcr_cassettes/audit_logs/create_event.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/audit_logs/create_export.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/audit_logs/get_export.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/audit_trail/create_event.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/audit_trail/get_events.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/delete_directory.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/get_group.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/events/list_events_with_event.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/delete_factor.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/get_factor_valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/create.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_with_domain_data.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_with_domains.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_with_external_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/create_without_domains.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/delete.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/delete_invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/get.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/list.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/update.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/passwordless/create_session.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/passwordless/send_session.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/portal/generate_link_dsync.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/portal/generate_link_invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/portal/generate_link_sso.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/list_connections/with_after.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/list_connections/with_before.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/sso/profile.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_user_invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_user_valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/delete_user/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/get_user.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_users/no_options.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/list_users/with_options.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_user/email.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_user/locale.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/user_management/verify_email/valid.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/widgets/get_token.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml delete mode 100644 spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml delete mode 100644 spec/support/profile.txt delete mode 100644 spec/support/shared_examples/client.rb delete mode 100644 spec/support/webhook_payload.txt create mode 100644 test/test_helper.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_audit_logs.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 create mode 100644 test/workos/test_connect.rb create mode 100644 test/workos/test_directory_sync.rb create mode 100644 test/workos/test_encryptors_aes_gcm.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 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_organizations.rb create mode 100644 test/workos/test_passwordless.rb create mode 100644 test/workos/test_pipes.rb create mode 100644 test/workos/test_pkce.rb create mode 100644 test/workos/test_public_client.rb create mode 100644 test/workos/test_radar.rb create mode 100644 test/workos/test_session.rb create mode 100644 test/workos/test_sso.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_user_management.rb create mode 100644 test/workos/test_vault.rb create mode 100644 test/workos/test_webhook_verify.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 e10f1270..403a12cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,19 +17,16 @@ 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 + - uses: ruby/setup-ruby@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1.302.0 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Rubocop + - name: Test run: | - bundle exec rubocop - - - name: Spec - run: | - bundle exec rspec + bundle exec rake test diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..2b312cc2 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint + +on: + push: + branches: + - 'main' + pull_request: {} + +defaults: + run: + shell: bash + +jobs: + standard: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: ruby/setup-ruby@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1.302.0 + with: + bundler-cache: true + + - name: Run Standardrb + run: | + bundle exec standardrb 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..a720fcab --- /dev/null +++ b/.oagen-manifest.json @@ -0,0 +1,1015 @@ +{ + "version": 1, + "language": "ruby", + "generatedAt": "2026-04-20T09:23:28.313Z", + "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_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_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", + "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/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", + "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_json.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_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", + "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_json_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_json.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_json.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_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_json.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_json.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/.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 index 0aec50e6..b9b3b0de 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.4 +3.3.11 diff --git a/.standard.yml b/.standard.yml new file mode 100644 index 00000000..49bff5f1 --- /dev/null +++ b/.standard.yml @@ -0,0 +1 @@ +ruby_version: 3.3 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..80fa2c62 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,84 +2,130 @@ PATH remote: . specs: workos (6.2.0) - encryptor (~> 3.0) jwt (~> 3.1) + logger (~> 1.7) + zeitwerk (~> 2.6) 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) - encryptor (3.0.0) - hashdiff (1.1.0) - json (2.9.1) + drb (2.2.3) + 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) + 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) 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) - 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.71.0) + rake (13.4.1) + regexp_parser (2.12.0) + rexml (3.4.4) + 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) + 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 ruby DEPENDENCIES bundler (>= 2.0.1) + minitest (~> 6.0) rake - rspec (~> 3.9.0) - rubocop (~> 1.71) - vcr (~> 6.0) - webmock + standard (~> 1.49) + webmock (~> 3.26) 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 + 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 + 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 + 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 + 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 + webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90 + workos (6.2.0) + zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd + BUNDLED WITH - 2.2.33 + 4.0.3 diff --git a/README.md b/README.md index 47758011..9749fa2e 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,191 @@ # 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 +``` + +## 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: + +```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 +208,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/Rakefile b/Rakefile index 82bb534a..b3021e54 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1,12 @@ # frozen_string_literal: true -require 'bundler/gem_tasks' -require 'rspec/core/rake_task' +require "bundler/gem_tasks" +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/docs/V7_MIGRATION_GUIDE.md b/docs/V7_MIGRATION_GUIDE.md new file mode 100644 index 00000000..ed9e1873 --- /dev/null +++ b/docs/V7_MIGRATION_GUIDE.md @@ -0,0 +1,780 @@ +# 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" + + 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: { + api_key: "sk_...", # per-request API key override (useful for multi-tenant) + 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" # default + config.client_id = ENV["WORKOS_CLIENT_ID"] + 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: + +```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` +- `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 + +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::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. In particular, any `rescue WorkOS::WorkOSError` must become `rescue WorkOS::Error`. + +#### 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. +- 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. + +### 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: + +- 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. + +### 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. + +`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. + +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: + +```ruby +session = WorkOS::UserManagement.load_sealed_session( + client_id: client_id, + session_data: session_data, + cookie_password: cookie_password, + encryptor: custom_encryptor # optional +) +``` + +After: + +```ruby +session = client.session_manager.load( + seal_data: session_data, + cookie_password: cookie_password +) +``` + +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) + ``` + + **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.** + +Before: + +```ruby +result = session.authenticate + +result[:authenticated] # => true / false +result[:reason] # => 'INVALID_SESSION_COOKIE' (uppercase string) +result[:session_id] +result[:feature_flags] +``` + +After: + +```ruby +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. 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` 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.rb b/lib/workos.rb index b098e3bf..5e7621fc 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -1,101 +1,35 @@ # 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 - - 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' +module WorkOS end + +loader = Zeitwerk::Loader.for_gem +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") +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 + +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..7feb7884 --- /dev/null +++ b/lib/workos/admin_portal.rb @@ -0,0 +1,51 @@ +# 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 new file mode 100644 index 00000000..dba22d01 --- /dev/null +++ b/lib/workos/admin_portal/generate_link.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class GenerateLink < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..cb85c9ca --- /dev/null +++ b/lib/workos/admin_portal/intent_options.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class IntentOptions < WorkOS::Types::BaseModel + HASH_ATTRS = { + sso: :sso + }.freeze + + attr_accessor :sso + + def initialize(json) + hash = self.class.normalize(json) + @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..0fa99d09 --- /dev/null +++ b/lib/workos/admin_portal/portal_link_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class PortalLinkResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + link: :link + }.freeze + + attr_accessor :link + + def initialize(json) + hash = self.class.normalize(json) + @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..13bfa8e4 --- /dev/null +++ b/lib/workos/admin_portal/sso_intent_options.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SSOIntentOptions < WorkOS::Types::BaseModel + HASH_ATTRS = { + bookmark_slug: :bookmark_slug, + provider_type: :provider_type + }.freeze + + attr_accessor \ + :bookmark_slug, + :provider_type + + def initialize(json) + hash = self.class.normalize(json) + @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..746f4899 --- /dev/null +++ b/lib/workos/api_keys.rb @@ -0,0 +1,128 @@ +# 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_organization_api_keys( + organization_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_organization_api_keys( + organization_id: organization_id, + before: before, + after: cursor, + limit: limit, + order: order, + 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: 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 new file mode 100644 index 00000000..94020562 --- /dev/null +++ b/lib/workos/api_keys/api_key.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ApiKey < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..f5e7179a --- /dev/null +++ b/lib/workos/api_keys/api_key_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ApiKeyCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..024af96c --- /dev/null +++ b/lib/workos/api_keys/api_key_created_data.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ApiKeyCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..d0163f32 --- /dev/null +++ b/lib/workos/api_keys/api_key_created_data_owner.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ApiKeyCreatedDataOwner < WorkOS::Types::BaseModel + HASH_ATTRS = { + type: :type, + id: :id + }.freeze + + attr_accessor \ + :type, + :id + + def initialize(json) + hash = self.class.normalize(json) + @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..9414c921 --- /dev/null +++ b/lib/workos/api_keys/api_key_revoked.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ApiKeyRevoked < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..7415d5c0 --- /dev/null +++ b/lib/workos/api_keys/api_key_validation_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ApiKeyValidationResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + api_key: :api_key + }.freeze + + attr_accessor :api_key + + def initialize(json) + hash = self.class.normalize(json) + @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..196bcce0 --- /dev/null +++ b/lib/workos/api_keys/api_key_with_value.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ApiKeyWithValue < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..51a01c95 --- /dev/null +++ b/lib/workos/api_keys/create_organization_api_key.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateOrganizationApiKey < WorkOS::Types::BaseModel + HASH_ATTRS = { + name: :name, + permissions: :permissions + }.freeze + + attr_accessor \ + :name, + :permissions + + def initialize(json) + hash = self.class.normalize(json) + @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..e7d92a4c --- /dev/null +++ b/lib/workos/api_keys/validate_api_key.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ValidateApiKey < WorkOS::Types::BaseModel + HASH_ATTRS = { + value: :value + }.freeze + + attr_accessor :value + + def initialize(json) + hash = self.class.normalize(json) + @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 a7176831..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 7865e2ca..7f21d0c7 100644 --- a/lib/workos/audit_logs.rb +++ b/lib/workos/audit_logs.rb @@ -1,88 +1,268 @@ # 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::AuditLogsRetentionJson] + 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 + ) + 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 - 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_actions( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_actions( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::AuditLogActionJson, + filters: {before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_action_schemas( + action_name:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_action_schemas( + action_name: action_name, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + 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 - 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::AuditLogSchemaJson] + 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 + ) + 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 - # 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::AuditLogExportJson] + 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 + ) + 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 - 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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.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_action_json.rb b/lib/workos/audit_logs/audit_log_action_json.rb new file mode 100644 index 00000000..adf5b40a --- /dev/null +++ b/lib/workos/audit_logs/audit_log_action_json.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogActionJson < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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_event.rb b/lib/workos/audit_logs/audit_log_event.rb new file mode 100644 index 00000000..cfd9f418 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_event.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogEvent < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..ae70d4f5 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_event_actor.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogEventActor < WorkOS::Types::BaseModel + HASH_ATTRS = { + id: :id, + type: :type, + name: :name, + metadata: :metadata + }.freeze + + attr_accessor \ + :id, + :type, + :name, + :metadata + + def initialize(json) + hash = self.class.normalize(json) + @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..c6ff6a78 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_event_context.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogEventContext < WorkOS::Types::BaseModel + HASH_ATTRS = { + location: :location, + user_agent: :user_agent + }.freeze + + attr_accessor \ + :location, + :user_agent + + def initialize(json) + hash = self.class.normalize(json) + @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..d79450a0 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_event_create_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogEventCreateResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + success: :success + }.freeze + + attr_accessor :success + + def initialize(json) + hash = self.class.normalize(json) + @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..b348450b --- /dev/null +++ b/lib/workos/audit_logs/audit_log_event_ingestion.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogEventIngestion < WorkOS::Types::BaseModel + HASH_ATTRS = { + organization_id: :organization_id, + event: :event + }.freeze + + attr_accessor \ + :organization_id, + :event + + def initialize(json) + hash = self.class.normalize(json) + @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..8034cf9d --- /dev/null +++ b/lib/workos/audit_logs/audit_log_export_creation.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogExportCreation < WorkOS::Types::BaseModel + 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 and will be removed in a future version.", uplevel: 1 + @actors + end + + attr_writer :actors + + def initialize(json) + hash = self.class.normalize(json) + @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_export_json.rb b/lib/workos/audit_logs/audit_log_export_json.rb new file mode 100644 index 00000000..c762c435 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_export_json.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogExportJson < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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 new file mode 100644 index 00000000..953374ef --- /dev/null +++ b/lib/workos/audit_logs/audit_log_schema.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogSchema < WorkOS::Types::BaseModel + HASH_ATTRS = { + actor: :actor, + targets: :targets, + metadata: :metadata + }.freeze + + attr_accessor \ + :actor, + :targets, + :metadata + + def initialize(json) + 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] || {} + 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..1e8a2e32 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_schema_actor.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogSchemaActor < WorkOS::Types::BaseModel + HASH_ATTRS = { + metadata: :metadata + }.freeze + + attr_accessor :metadata + + def initialize(json) + hash = self.class.normalize(json) + @metadata = hash[:metadata] || {} + 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..d96487cb --- /dev/null +++ b/lib/workos/audit_logs/audit_log_schema_json.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogSchemaJson < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..068382f0 --- /dev/null +++ b/lib/workos/audit_logs/audit_log_schema_json_target.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogSchemaJsonTarget < WorkOS::Types::BaseModel + HASH_ATTRS = { + type: :type, + metadata: :metadata + }.freeze + + attr_accessor \ + :type, + :metadata + + def initialize(json) + hash = self.class.normalize(json) + @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 new file mode 100644 index 00000000..80fabc5d --- /dev/null +++ b/lib/workos/audit_logs/audit_log_schema_target.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + AuditLogSchemaTarget = AuditLogSchemaJsonTarget +end diff --git a/lib/workos/authentication_factor_and_challenge.rb b/lib/workos/authentication_factor_and_challenge.rb deleted file mode 100644 index 83e8e904..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 52f733d1..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..d6a4fca8 --- /dev/null +++ b/lib/workos/authorization.rb @@ -0,0 +1,1289 @@ +# 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] (see WorkOS::Types::RequestOptions) + # @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 = {}.compact + 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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_organization_membership_resources( + organization_membership_id:, + permission_slug:, + parent_resource:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(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 + ) + } + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_resource_permissions( + organization_membership_id:, + resource_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(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 + ) + } + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @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: "desc", + 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 + ) + fetch_next = ->(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 + ) + } + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_organization_membership_role_assignments( + organization_membership_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_organization_membership_role_assignments( + organization_membership_id: organization_membership_id, + before: before, + after: cursor, + limit: limit, + order: order, + 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: fetch_next + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 = {}.compact + 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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @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 = {}.compact + 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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @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 = {}.compact + 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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @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: "desc", + 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 + ) + fetch_next = ->(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 + ) + } + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_resources( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(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 + ) + } + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @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 = {}.compact + 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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @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 = {}.compact + 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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_memberships_for_resource( + resource_id:, + permission_slug:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(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 + ) + } + 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::RoleList] + def list_environment_roles(request_options: {}) + response = @client.request( + method: :get, + path: "/authorization/roles", + auth: true, + request_options: request_options + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_permissions( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_permissions( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::AuthorizationPermission, + filters: {before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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..da22eb7b --- /dev/null +++ b/lib/workos/authorization/add_role_permission.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AddRolePermission < WorkOS::Types::BaseModel + HASH_ATTRS = { + slug: :slug + }.freeze + + attr_accessor :slug + + def initialize(json) + hash = self.class.normalize(json) + @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..3a550c03 --- /dev/null +++ b/lib/workos/authorization/assign_role.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AssignRole < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..0164ed1a --- /dev/null +++ b/lib/workos/authorization/authorization_check.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthorizationCheck < WorkOS::Types::BaseModel + HASH_ATTRS = { + authorized: :authorized + }.freeze + + attr_accessor :authorized + + def initialize(json) + hash = self.class.normalize(json) + @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..cf85df81 --- /dev/null +++ b/lib/workos/authorization/authorization_permission.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthorizationPermission < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..1d7928df --- /dev/null +++ b/lib/workos/authorization/authorization_resource.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthorizationResource < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..490d5260 --- /dev/null +++ b/lib/workos/authorization/check_authorization.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CheckAuthorization < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..d28bf57b --- /dev/null +++ b/lib/workos/authorization/create_authorization_permission.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateAuthorizationPermission < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..2aece3ad --- /dev/null +++ b/lib/workos/authorization/create_authorization_resource.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateAuthorizationResource < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..2b229d04 --- /dev/null +++ b/lib/workos/authorization/create_organization_role.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateOrganizationRole < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..57783b4c --- /dev/null +++ b/lib/workos/authorization/permission_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class PermissionCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..69a41462 --- /dev/null +++ b/lib/workos/authorization/permission_created_data.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class PermissionCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..bc86c1f1 --- /dev/null +++ b/lib/workos/authorization/permission_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class PermissionDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b5d36157 --- /dev/null +++ b/lib/workos/authorization/permission_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class PermissionUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..f5272bb7 --- /dev/null +++ b/lib/workos/authorization/role.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class Role < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b2281332 --- /dev/null +++ b/lib/workos/authorization/role_assignment.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RoleAssignment < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..bcdae5f2 --- /dev/null +++ b/lib/workos/authorization/role_assignment_resource.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RoleAssignmentResource < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..54e64472 --- /dev/null +++ b/lib/workos/authorization/role_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RoleCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..e15482df --- /dev/null +++ b/lib/workos/authorization/role_created_data.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RoleCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..1bb859a1 --- /dev/null +++ b/lib/workos/authorization/role_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RoleDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..4dfe809c --- /dev/null +++ b/lib/workos/authorization/role_list.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RoleList < WorkOS::Types::BaseModel + HASH_ATTRS = { + object: :object, + data: :data + }.freeze + + attr_accessor \ + :object, + :data + + def initialize(json) + hash = self.class.normalize(json) + @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..da154750 --- /dev/null +++ b/lib/workos/authorization/role_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RoleUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..3e66efee --- /dev/null +++ b/lib/workos/authorization/set_role_permissions.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SetRolePermissions < WorkOS::Types::BaseModel + HASH_ATTRS = { + permissions: :permissions + }.freeze + + attr_accessor :permissions + + def initialize(json) + hash = self.class.normalize(json) + @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..9d6ee344 --- /dev/null +++ b/lib/workos/authorization/update_authorization_permission.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UpdateAuthorizationPermission < WorkOS::Types::BaseModel + HASH_ATTRS = { + name: :name, + description: :description + }.freeze + + attr_accessor \ + :name, + :description + + def initialize(json) + hash = self.class.normalize(json) + @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..3ca4fa3b --- /dev/null +++ b/lib/workos/authorization/update_authorization_resource.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UpdateAuthorizationResource < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..c52c73d0 --- /dev/null +++ b/lib/workos/authorization/user_organization_membership_base_list_data.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserOrganizationMembershipBaseListData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..d5192d9e --- /dev/null +++ b/lib/workos/base_client.rb @@ -0,0 +1,350 @@ +# 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. + # + # @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 + 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 + + 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, random: Random.new) + @api_key = api_key + @base_url = base_url + @client_id = client_id + @timeout = timeout + @max_retries = max_retries + @logger = logger + @log_level = log_level + @random = random + 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: {}) + 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 + 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 || {}).transform_keys(&:to_sym) + 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 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 + 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 + cache = thread_connections + cache[key] = http + evict_lru_connections(cache) if cache.size > MAX_CACHED_CONNECTIONS + 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 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 + Fiber[:workos_connections] ||= {} + end + + def build_request(klass, path, auth:, request_options:) + opts = request_options.is_a?(Hash) ? request_options : {} + request = klass.new(path) + if auth + key = opts[:api_key] || opts["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) + 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 + 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 = @random.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 fece268d..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 1fa102ff..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 58be1f5c..a96f9e8f 100644 --- a/lib/workos/configuration.rb +++ b/lib/workos/configuration.rb @@ -1,16 +1,67 @@ # frozen_string_literal: true +# @oagen-ignore-file — hand-maintained runtime module WorkOS - # Configuration class sets config initializer + # 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_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 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 end end end diff --git a/lib/workos/connect.rb b/lib/workos/connect.rb new file mode 100644 index 00000000..3a46e737 --- /dev/null +++ b/lib/workos/connect.rb @@ -0,0 +1,329 @@ +# 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_applications( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_applications( + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + 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: fetch_next + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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. + # @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: {} + ) + 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.request( + method: :post, + path: "/connect/applications", + auth: true, + body: body, + request_options: request_options + ) + WorkOS::ConnectApplication.new(response.body) + 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: {} + ) + body = { + "application_type" => "m2m", + "name" => name, + "organization_id" => organization_id, + "description" => description, + "scopes" => scopes + }.compact + response = @client.request( + method: :post, + path: "/connect/applications", + auth: true, + body: body, + request_options: request_options + ) + WorkOS::ConnectApplication.new(response.body) + end + + # Get a Connect Application + # @param id [String] The application ID or client ID of the Connect Application. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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..c027d3c2 --- /dev/null +++ b/lib/workos/connect/application_credentials_list_item.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ApplicationCredentialsListItem < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..39230b72 --- /dev/null +++ b/lib/workos/connect/connect_application.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectApplication < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..6b3b1a03 --- /dev/null +++ b/lib/workos/connect/create_application_secret.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateApplicationSecret < WorkOS::Types::BaseModel + HASH_ATTRS = {}.freeze + + def initialize(json) + 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 new file mode 100644 index 00000000..d8ca27e6 --- /dev/null +++ b/lib/workos/connect/create_m2m_application.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateM2MApplication < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..ea780400 --- /dev/null +++ b/lib/workos/connect/create_oauth_application.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateOAuthApplication < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..71dfcc7b --- /dev/null +++ b/lib/workos/connect/external_auth_complete_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ExternalAuthCompleteResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + redirect_uri: :redirect_uri + }.freeze + + attr_accessor :redirect_uri + + def initialize(json) + hash = self.class.normalize(json) + @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..a6a05b68 --- /dev/null +++ b/lib/workos/connect/new_connect_application_secret.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class NewConnectApplicationSecret < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..36bf7b3b --- /dev/null +++ b/lib/workos/connect/redirect_uri_input.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RedirectUriInput < WorkOS::Types::BaseModel + HASH_ATTRS = { + uri: :uri, + default: :default + }.freeze + + attr_accessor \ + :uri, + :default + + def initialize(json) + hash = self.class.normalize(json) + @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..1845ae13 --- /dev/null +++ b/lib/workos/connect/update_oauth_application.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UpdateOAuthApplication < WorkOS::Types::BaseModel + HASH_ATTRS = { + name: :name, + description: :description, + scopes: :scopes, + redirect_uris: :redirect_uris + }.freeze + + attr_accessor \ + :name, + :description, + :scopes, + :redirect_uris + + def initialize(json) + hash = self.class.normalize(json) + @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..e1df94e8 --- /dev/null +++ b/lib/workos/connect/user_consent_option.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserConsentOption < WorkOS::Types::BaseModel + HASH_ATTRS = { + claim: :claim, + type: :type, + label: :label, + choices: :choices + }.freeze + + attr_accessor \ + :claim, + :type, + :label, + :choices + + def initialize(json) + hash = self.class.normalize(json) + @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..6128a9f9 --- /dev/null +++ b/lib/workos/connect/user_consent_option_choice.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserConsentOptionChoice < WorkOS::Types::BaseModel + HASH_ATTRS = { + value: :value, + label: :label + }.freeze + + attr_accessor \ + :value, + :label + + def initialize(json) + hash = self.class.normalize(json) + @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..245fab6c --- /dev/null +++ b/lib/workos/connect/user_management_login_request.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserManagementLoginRequest < WorkOS::Types::BaseModel + 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 = 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 } + 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..9d263482 --- /dev/null +++ b/lib/workos/connect/user_object.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserObject < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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 2608fc16..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 756da4a6..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)..-1] : 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 3c348349..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 7aeb4bce..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 7cdd5a2c..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 17345d7e..70e856d1 100644 --- a/lib/workos/directory_sync.rb +++ b/lib/workos/directory_sync.rb @@ -1,198 +1,247 @@ # frozen_string_literal: true -require 'net/http' +# This file is auto-generated by oagen. Do not edit. -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 - - # 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, - ), - ) - - parsed_response = JSON.parse(response.body) - 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'], - ) - end - - # Retrieve directory. - # - # @param [String] id Directory unique identifier - # - # @example - # WorkOS::SSO.get_directory(id: 'directory_01FK17DWRHH7APAFXT5B52PV0W') - # => #] + def list_directories( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + 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.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 - # 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, - ), - ) + # Get a Directory + # @param id [String] Unique identifier for the Directory. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Directory] + def get_directory( + id:, + request_options: {} + ) + response = @client.request( + method: :get, + path: "/directories/#{WorkOS::Util.encode_path(id)}", + auth: true, + request_options: request_options + ) + 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 - ::WorkOS::DirectoryGroup.new(response.body) - end + # Delete a Directory + # @param id [String] Unique identifier for the Directory. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [void] + def delete_directory( + id:, + request_options: {} + ) + @client.request( + method: :delete, + path: "/directories/#{WorkOS::Util.encode_path(id)}", + auth: true, + request_options: request_options + ) + nil + 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, - ), + # List Directory Groups + # @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::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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_groups( + before: nil, + after: nil, + limit: nil, + order: "desc", + directory: nil, + user: nil, + request_options: {} + ) + params = { + "before" => 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 + ) + fetch_next = ->(cursor) { + list_groups( + before: before, + after: cursor, + limit: limit, + order: order, + directory: directory, + user: user, + 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: fetch_next + ) + end - ::WorkOS::DirectoryUser.new(response.body) - end + # Get a Directory Group + # @param id [String] Unique identifier for the Directory Group. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - # 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}", + # 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_users( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_users( + before: before, + after: cursor, + limit: limit, + order: order, + directory: directory, + group: group, + 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: fetch_next + ) + end - response = execute_request(request: request) - - response.is_a? Net::HTTPSuccess - end + # Get a Directory User + # @param id [String] Unique identifier for the Directory User. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 new file mode 100644 index 00000000..b69fcc33 --- /dev/null +++ b/lib/workos/directory_sync/directory.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class Directory < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..8e115930 --- /dev/null +++ b/lib/workos/directory_sync/directory_group.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DirectoryGroup < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..386a0be0 --- /dev/null +++ b/lib/workos/directory_sync/directory_metadata.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DirectoryMetadata < WorkOS::Types::BaseModel + HASH_ATTRS = { + users: :users, + groups: :groups + }.freeze + + attr_accessor \ + :users, + :groups + + def initialize(json) + hash = self.class.normalize(json) + @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..1d43f750 --- /dev/null +++ b/lib/workos/directory_sync/directory_metadata_user.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DirectoryMetadataUser < WorkOS::Types::BaseModel + HASH_ATTRS = { + active: :active, + inactive: :inactive + }.freeze + + attr_accessor \ + :active, + :inactive + + def initialize(json) + hash = self.class.normalize(json) + @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..b3b06b43 --- /dev/null +++ b/lib/workos/directory_sync/directory_user.rb @@ -0,0 +1,103 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DirectoryUser < WorkOS::Types::BaseModel + 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 and will be removed in a future version.", uplevel: 1 + @emails + end + + attr_writer :emails + + def job_title + 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 and will be removed in a future version.", uplevel: 1 + @username + end + + attr_writer :username + + def raw_attributes + 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 = self.class.normalize(json) + @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..bb922a3b --- /dev/null +++ b/lib/workos/directory_sync/directory_user_email.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DirectoryUserEmail < WorkOS::Types::BaseModel + HASH_ATTRS = { + primary: :primary, + type: :type, + value: :value + }.freeze + + attr_accessor \ + :primary, + :type, + :value + + def initialize(json) + hash = self.class.normalize(json) + @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..32e14147 --- /dev/null +++ b/lib/workos/directory_sync/directory_user_with_groups.rb @@ -0,0 +1,106 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DirectoryUserWithGroups < WorkOS::Types::BaseModel + 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 and will be removed in a future version.", uplevel: 1 + @emails + end + + attr_writer :emails + + def job_title + 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 and will be removed in a future version.", uplevel: 1 + @username + end + + attr_writer :username + + def raw_attributes + 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 = self.class.normalize(json) + @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..8a8d4c32 --- /dev/null +++ b/lib/workos/directory_sync/dsync_activated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncActivated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b432c979 --- /dev/null +++ b/lib/workos/directory_sync/dsync_activated_data.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncActivatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..f444b8a2 --- /dev/null +++ b/lib/workos/directory_sync/dsync_activated_data_domain.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncActivatedDataDomain < WorkOS::Types::BaseModel + HASH_ATTRS = { + object: :object, + id: :id, + domain: :domain + }.freeze + + attr_accessor \ + :object, + :id, + :domain + + def initialize(json) + hash = self.class.normalize(json) + @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..7955aad0 --- /dev/null +++ b/lib/workos/directory_sync/dsync_deactivated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncDeactivated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..afe57f6c --- /dev/null +++ b/lib/workos/directory_sync/dsync_deactivated_data.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncDeactivatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..71048d2c --- /dev/null +++ b/lib/workos/directory_sync/dsync_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..24172251 --- /dev/null +++ b/lib/workos/directory_sync/dsync_deleted_data.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncDeletedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..796aa890 --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncGroupCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..71ad0b07 --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncGroupDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..f6e549f7 --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncGroupUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..485abbbc --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_updated_data.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncGroupUpdatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b43325eb --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_user_added.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncGroupUserAdded < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..aab4db3c --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_user_added_data.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncGroupUserAddedData < WorkOS::Types::BaseModel + HASH_ATTRS = { + directory_id: :directory_id, + user: :user, + group: :group + }.freeze + + attr_accessor \ + :directory_id, + :user, + :group + + def initialize(json) + 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 + 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..9b65fd90 --- /dev/null +++ b/lib/workos/directory_sync/dsync_group_user_removed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncGroupUserRemoved < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..6bde4dcb --- /dev/null +++ b/lib/workos/directory_sync/dsync_user_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncUserCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b25ee2f8 --- /dev/null +++ b/lib/workos/directory_sync/dsync_user_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncUserDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..a4d24305 --- /dev/null +++ b/lib/workos/directory_sync/dsync_user_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncUserUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..8298a54c --- /dev/null +++ b/lib/workos/directory_sync/dsync_user_updated_data.rb @@ -0,0 +1,106 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DsyncUserUpdatedData < WorkOS::Types::BaseModel + 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 and will be removed in a future version.", uplevel: 1 + @emails + end + + attr_writer :emails + + def job_title + 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 and will be removed in a future version.", uplevel: 1 + @username + end + + attr_writer :username + + def raw_attributes + 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 = self.class.normalize(json) + @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 a168c1ee..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] } - return 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 8d205c94..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 f78591e0..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 72a02248..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' -require 'base64' +# @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 c7c2acd7..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 5e38a951..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 3f39e1dc..fbe5f618 100644 --- a/lib/workos/events.rb +++ b/lib/workos/events.rb @@ -1,47 +1,73 @@ # 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 - - # 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? - - response = execute_request( - request: get_request( - path: '/events', - auth: true, - params: options, - ), - ) +require "json" - parsed_response = JSON.parse(response.body) - events = parsed_response['data'].map do |event| - ::WorkOS::Event.new(event.to_json) - end +module WorkOS + class Events + def initialize(client) + @client = client + end - WorkOS::Types::ListStruct.new( - data: events, - list_metadata: parsed_response['list_metadata'], + # 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_events( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(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 + } + 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 new file mode 100644 index 00000000..47625502 --- /dev/null +++ b/lib/workos/events/event_list_list_metadata.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EventListListMetadata < WorkOS::Types::BaseModel + HASH_ATTRS = { + after: :after + }.freeze + + attr_accessor :after + + def initialize(json) + hash = self.class.normalize(json) + @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..f965dea5 --- /dev/null +++ b/lib/workos/events/event_schema.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EventSchema < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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 bacfb58e..00000000 --- a/lib/workos/factor.rb +++ /dev/null @@ -1,35 +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 85d958e2..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..e1b1a195 --- /dev/null +++ b/lib/workos/feature_flags.rb @@ -0,0 +1,246 @@ +# 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_feature_flags( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_feature_flags( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_organization_feature_flags( + organization_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_organization_feature_flags( + organization_id: organization_id, + before: before, + after: cursor, + limit: limit, + order: order, + 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: fetch_next + ) + 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_user_feature_flags( + user_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_user_feature_flags( + user_id: user_id, + before: before, + after: cursor, + limit: limit, + order: order, + 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: fetch_next + ) + 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..126ebcb9 --- /dev/null +++ b/lib/workos/feature_flags/feature_flag.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FeatureFlag < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..5b995a3f --- /dev/null +++ b/lib/workos/feature_flags/feature_flag_owner.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FeatureFlagOwner < WorkOS::Types::BaseModel + HASH_ATTRS = { + email: :email, + first_name: :first_name, + last_name: :last_name + }.freeze + + attr_accessor \ + :email, + :first_name, + :last_name + + def initialize(json) + hash = self.class.normalize(json) + @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..c9bb4782 --- /dev/null +++ b/lib/workos/feature_flags/flag_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..c3d9efb8 --- /dev/null +++ b/lib/workos/feature_flags/flag_created_context.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagCreatedContext < WorkOS::Types::BaseModel + HASH_ATTRS = { + client_id: :client_id, + actor: :actor + }.freeze + + attr_accessor \ + :client_id, + :actor + + def initialize(json) + hash = self.class.normalize(json) + @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..115493a9 --- /dev/null +++ b/lib/workos/feature_flags/flag_created_context_actor.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagCreatedContextActor < WorkOS::Types::BaseModel + HASH_ATTRS = { + id: :id, + source: :source, + name: :name + }.freeze + + attr_accessor \ + :id, + :source, + :name + + def initialize(json) + hash = self.class.normalize(json) + @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..e2ada050 --- /dev/null +++ b/lib/workos/feature_flags/flag_created_data.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..8703a07b --- /dev/null +++ b/lib/workos/feature_flags/flag_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..104b9369 --- /dev/null +++ b/lib/workos/feature_flags/flag_deleted_context.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagDeletedContext < WorkOS::Types::BaseModel + HASH_ATTRS = { + client_id: :client_id, + actor: :actor + }.freeze + + attr_accessor \ + :client_id, + :actor + + def initialize(json) + hash = self.class.normalize(json) + @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..1c08635c --- /dev/null +++ b/lib/workos/feature_flags/flag_deleted_context_actor.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagDeletedContextActor < WorkOS::Types::BaseModel + HASH_ATTRS = { + id: :id, + source: :source, + name: :name + }.freeze + + attr_accessor \ + :id, + :source, + :name + + def initialize(json) + hash = self.class.normalize(json) + @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..f87d2363 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagRuleUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..01d49432 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagRuleUpdatedContext < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..d904b983 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_actor.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagRuleUpdatedContextActor < WorkOS::Types::BaseModel + HASH_ATTRS = { + id: :id, + source: :source, + name: :name + }.freeze + + attr_accessor \ + :id, + :source, + :name + + def initialize(json) + hash = self.class.normalize(json) + @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..2ab51a5f --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_configured_target.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagRuleUpdatedContextConfiguredTarget < WorkOS::Types::BaseModel + HASH_ATTRS = { + organizations: :organizations, + users: :users + }.freeze + + attr_accessor \ + :organizations, + :users + + def initialize(json) + 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 + 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..8f915fcf --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_configured_target_organization.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagRuleUpdatedContextConfiguredTargetOrganization < WorkOS::Types::BaseModel + HASH_ATTRS = { + id: :id, + name: :name + }.freeze + + attr_accessor \ + :id, + :name + + def initialize(json) + hash = self.class.normalize(json) + @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..d9b257a4 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_configured_target_user.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagRuleUpdatedContextConfiguredTargetUser < WorkOS::Types::BaseModel + HASH_ATTRS = { + id: :id, + email: :email + }.freeze + + attr_accessor \ + :id, + :email + + def initialize(json) + hash = self.class.normalize(json) + @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..1f09fbf5 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagRuleUpdatedContextPreviousAttribute < WorkOS::Types::BaseModel + HASH_ATTRS = { + data: :data, + context: :context + }.freeze + + attr_accessor \ + :data, + :context + + def initialize(json) + hash = self.class.normalize(json) + @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..76a4940a --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_context.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagRuleUpdatedContextPreviousAttributeContext < WorkOS::Types::BaseModel + HASH_ATTRS = { + access_type: :access_type, + configured_targets: :configured_targets + }.freeze + + attr_accessor \ + :access_type, + :configured_targets + + def initialize(json) + hash = self.class.normalize(json) + @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..7f666491 --- /dev/null +++ b/lib/workos/feature_flags/flag_rule_updated_context_previous_attribute_data.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagRuleUpdatedContextPreviousAttributeData < WorkOS::Types::BaseModel + HASH_ATTRS = { + enabled: :enabled, + default_value: :default_value + }.freeze + + attr_accessor \ + :enabled, + :default_value + + def initialize(json) + hash = self.class.normalize(json) + @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..488c9604 --- /dev/null +++ b/lib/workos/feature_flags/flag_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..fa1932cd --- /dev/null +++ b/lib/workos/feature_flags/flag_updated_context.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagUpdatedContext < WorkOS::Types::BaseModel + HASH_ATTRS = { + client_id: :client_id, + actor: :actor, + previous_attributes: :previous_attributes + }.freeze + + attr_accessor \ + :client_id, + :actor, + :previous_attributes + + def initialize(json) + 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 + 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..368a082e --- /dev/null +++ b/lib/workos/feature_flags/flag_updated_context_actor.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagUpdatedContextActor < WorkOS::Types::BaseModel + HASH_ATTRS = { + id: :id, + source: :source, + name: :name + }.freeze + + attr_accessor \ + :id, + :source, + :name + + def initialize(json) + hash = self.class.normalize(json) + @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..4bdb14ee --- /dev/null +++ b/lib/workos/feature_flags/flag_updated_context_previous_attribute.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagUpdatedContextPreviousAttribute < WorkOS::Types::BaseModel + HASH_ATTRS = { + data: :data + }.freeze + + attr_accessor :data + + def initialize(json) + hash = self.class.normalize(json) + @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..394cd75f --- /dev/null +++ b/lib/workos/feature_flags/flag_updated_context_previous_attribute_data.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class FlagUpdatedContextPreviousAttributeData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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 de3e7beb..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 08c64b8d..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/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/invitation.rb b/lib/workos/invitation.rb deleted file mode 100644 index 9e182a67..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 e05aad12..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 239edf96..00000000 --- a/lib/workos/mfa.rb +++ /dev/null @@ -1,136 +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..93f2f6ea --- /dev/null +++ b/lib/workos/multi_factor_auth.rb @@ -0,0 +1,215 @@ +# 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_user_auth_factors( + userland_user_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_user_auth_factors( + userland_user_id: userland_user_id, + before: before, + after: cursor, + limit: limit, + order: order, + 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: fetch_next + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 new file mode 100644 index 00000000..d04cec17 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_challenge.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationChallenge < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..65878b64 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_challenge_verify_response.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationChallengeVerifyResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + challenge: :challenge, + valid: :valid + }.freeze + + attr_accessor \ + :challenge, + :valid + + def initialize(json) + hash = self.class.normalize(json) + @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..43d397e8 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_challenges_verify_request.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationChallengesVerifyRequest < WorkOS::Types::BaseModel + HASH_ATTRS = { + code: :code + }.freeze + + attr_accessor :code + + def initialize(json) + hash = self.class.normalize(json) + @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..5a229119 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factor.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationFactor < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..f8ae8c86 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factor_enrolled.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationFactorEnrolled < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..f6265c4e --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factor_enrolled_sms.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationFactorEnrolledSms < WorkOS::Types::BaseModel + HASH_ATTRS = { + phone_number: :phone_number + }.freeze + + attr_accessor :phone_number + + def initialize(json) + hash = self.class.normalize(json) + @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..b291f215 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factor_enrolled_totp.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationFactorEnrolledTotp < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..56a3b06d --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factor_totp.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationFactorTotp < WorkOS::Types::BaseModel + HASH_ATTRS = { + issuer: :issuer, + user: :user + }.freeze + + attr_accessor \ + :issuer, + :user + + def initialize(json) + hash = self.class.normalize(json) + @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..3668f7b2 --- /dev/null +++ b/lib/workos/multi_factor_auth/authentication_factors_create_request.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationFactorsCreateRequest < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..4b327792 --- /dev/null +++ b/lib/workos/multi_factor_auth/challenge_authentication_factor.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ChallengeAuthenticationFactor < WorkOS::Types::BaseModel + HASH_ATTRS = { + sms_template: :sms_template + }.freeze + + attr_accessor :sms_template + + def initialize(json) + hash = self.class.normalize(json) + @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..fefc8fd5 --- /dev/null +++ b/lib/workos/multi_factor_auth/enroll_user_authentication_factor.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EnrollUserAuthenticationFactor < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..3be11320 --- /dev/null +++ b/lib/workos/multi_factor_auth/user_authentication_factor_enroll_response.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserAuthenticationFactorEnrollResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + authentication_factor: :authentication_factor, + authentication_challenge: :authentication_challenge + }.freeze + + attr_accessor \ + :authentication_factor, + :authentication_challenge + + def initialize(json) + 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 + end +end diff --git a/lib/workos/oauth_tokens.rb b/lib/workos/oauth_tokens.rb deleted file mode 100644 index f124085c..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 19c98a20..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..05f5861f --- /dev/null +++ b/lib/workos/organization_domains.rb @@ -0,0 +1,94 @@ +# 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 new file mode 100644 index 00000000..ba3c2b77 --- /dev/null +++ b/lib/workos/organization_domains/create_organization_domain.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateOrganizationDomain < WorkOS::Types::BaseModel + HASH_ATTRS = { + domain: :domain, + organization_id: :organization_id + }.freeze + + attr_accessor \ + :domain, + :organization_id + + def initialize(json) + hash = self.class.normalize(json) + @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..c4698d13 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomain < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..6fe193ea --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..8f1627fa --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_created_data.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b7944ed2 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..570802e6 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_deleted_data.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainDeletedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..48cc33e3 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_stand_alone.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainStandAlone < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..4ef6abeb --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..93753eca --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_updated_data.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainUpdatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..58caaca0 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_verification_failed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainVerificationFailed < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..a34a611e --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_verification_failed_data.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainVerificationFailedData < WorkOS::Types::BaseModel + HASH_ATTRS = { + reason: :reason, + organization_domain: :organization_domain + }.freeze + + attr_accessor \ + :reason, + :organization_domain + + def initialize(json) + hash = self.class.normalize(json) + @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..aed6cc0e --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_verification_failed_data_organization_domain.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainVerificationFailedDataOrganizationDomain < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..7172f83f --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_verified.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainVerified < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..564a9f37 --- /dev/null +++ b/lib/workos/organization_domains/organization_domain_verified_data.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainVerifiedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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 cde9a901..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 d130fa03..f886ded7 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -1,288 +1,220 @@ # 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 +require "json" - # 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 +module WorkOS + class Organizations + def initialize(client) + @client = client + 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( - domain_data: nil, - domains: nil, - name:, - external_id: nil, - allow_profiles_outside_organization: nil, - idempotency_key: nil + # 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_organizations( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 ) - 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, + fetch_next = ->(cursor) { + list_organizations( + before: before, + after: cursor, + limit: limit, + order: order, + domains: domains, + search: search, + request_options: request_options ) - - 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 + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::Organization, + filters: {before: before, limit: limit, order: order, domains: domains, search: search}, + fetch_next: fetch_next ) - 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) - - response.is_a? Net::HTTPSuccess - 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, - ), - ) - - 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: { - 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, - ), - ) - - parsed_response = JSON.parse(response.body) + end - feature_flags = parsed_response['data'].map do |feature_flag| - WorkOS::FeatureFlag.new(feature_flag.to_json) - 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - private + # Get an Organization + # @param id [String] Unique identifier of the Organization. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - message = body['message'] - request_id = response['x-request-id'] - rescue StandardError - message = 'Something went wrong' - end + # Delete an Organization + # @param id [String] Unique identifier of the Organization. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 new file mode 100644 index 00000000..e273e018 --- /dev/null +++ b/lib/workos/organizations/audit_log_configuration.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogConfiguration < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..6d05aaac --- /dev/null +++ b/lib/workos/organizations/audit_log_configuration_log_stream.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogConfigurationLogStream < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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/audit_logs_retention_json.rb b/lib/workos/organizations/audit_logs_retention_json.rb new file mode 100644 index 00000000..f3ed1b6e --- /dev/null +++ b/lib/workos/organizations/audit_logs_retention_json.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuditLogsRetentionJson < WorkOS::Types::BaseModel + HASH_ATTRS = { + retention_period_in_days: :retention_period_in_days + }.freeze + + attr_accessor :retention_period_in_days + + def initialize(json) + hash = self.class.normalize(json) + @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..03892166 --- /dev/null +++ b/lib/workos/organizations/organization.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class Organization < WorkOS::Types::BaseModel + 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 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 = self.class.normalize(json) + @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..b4cd5b82 --- /dev/null +++ b/lib/workos/organizations/organization_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..13d18eab --- /dev/null +++ b/lib/workos/organizations/organization_created_data.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..c6c18fd7 --- /dev/null +++ b/lib/workos/organizations/organization_created_data_domain.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationCreatedDataDomain < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..1a2381be --- /dev/null +++ b/lib/workos/organizations/organization_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..88259c39 --- /dev/null +++ b/lib/workos/organizations/organization_deleted_data.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDeletedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..bc40f61c --- /dev/null +++ b/lib/workos/organizations/organization_deleted_data_domain.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDeletedDataDomain < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..df58b2f5 --- /dev/null +++ b/lib/workos/organizations/organization_domain_data.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationDomainData < WorkOS::Types::BaseModel + HASH_ATTRS = { + domain: :domain, + state: :state + }.freeze + + attr_accessor \ + :domain, + :state + + def initialize(json) + hash = self.class.normalize(json) + @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..b4479b36 --- /dev/null +++ b/lib/workos/organizations/organization_input.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationInput < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..64864fbc --- /dev/null +++ b/lib/workos/organizations/organization_membership_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationMembershipCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..79f18f08 --- /dev/null +++ b/lib/workos/organizations/organization_membership_created_data.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationMembershipCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..ae5f3507 --- /dev/null +++ b/lib/workos/organizations/organization_membership_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationMembershipDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..227d309a --- /dev/null +++ b/lib/workos/organizations/organization_membership_deleted_data.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationMembershipDeletedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..3127cb78 --- /dev/null +++ b/lib/workos/organizations/organization_membership_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationMembershipUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..3c045383 --- /dev/null +++ b/lib/workos/organizations/organization_membership_updated_data.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationMembershipUpdatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..f55aa5f6 --- /dev/null +++ b/lib/workos/organizations/organization_role_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationRoleCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..36d295b1 --- /dev/null +++ b/lib/workos/organizations/organization_role_created_data.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationRoleCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..17ce8ce8 --- /dev/null +++ b/lib/workos/organizations/organization_role_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationRoleDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..51af21bd --- /dev/null +++ b/lib/workos/organizations/organization_role_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationRoleUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..c13a99bb --- /dev/null +++ b/lib/workos/organizations/organization_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..8acef2aa --- /dev/null +++ b/lib/workos/organizations/organization_updated_data.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationUpdatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..24a6d4bc --- /dev/null +++ b/lib/workos/organizations/organization_updated_data_domain.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationUpdatedDataDomain < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..14e0ccfa --- /dev/null +++ b/lib/workos/organizations/update_audit_logs_retention.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UpdateAuditLogsRetention < WorkOS::Types::BaseModel + HASH_ATTRS = { + retention_period_in_days: :retention_period_in_days + }.freeze + + attr_accessor :retention_period_in_days + + def initialize(json) + hash = self.class.normalize(json) + @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..30ada5a4 --- /dev/null +++ b/lib/workos/organizations/update_organization.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UpdateOrganization < WorkOS::Types::BaseModel + 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 and will be removed in a future version.", uplevel: 1 + @domains + end + + attr_writer :domains + + def initialize(json) + hash = self.class.normalize(json) + @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 be7db0cc..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 7ac0c5fd..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, - ), + # 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: hash["expires_at"], + link: hash["link"], + object: hash["object"] || "passwordless_session" ) + end - 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'], - ) + def to_h + super.compact end + 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, - ), - ) + def initialize(client) + @client = client + end - JSON.parse(response.body) - 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..c2eefb7e --- /dev/null +++ b/lib/workos/pipes.rb @@ -0,0 +1,149 @@ +# 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 new file mode 100644 index 00000000..2e496067 --- /dev/null +++ b/lib/workos/pipes/connected_account.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectedAccount < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..25d28046 --- /dev/null +++ b/lib/workos/pipes/data_integration_access_token_response.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegrationAccessTokenResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + active: :active, + access_token: :access_token, + error: :error + }.freeze + + attr_accessor \ + :active, + :access_token, + :error + + def initialize(json) + hash = self.class.normalize(json) + @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..e2db6ef0 --- /dev/null +++ b/lib/workos/pipes/data_integration_access_token_response_access_token.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegrationAccessTokenResponseAccessToken < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b9f610f1 --- /dev/null +++ b/lib/workos/pipes/data_integration_authorize_url_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegrationAuthorizeUrlResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + url: :url + }.freeze + + attr_accessor :url + + def initialize(json) + hash = self.class.normalize(json) + @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..495c04c5 --- /dev/null +++ b/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegrationsGetDataIntegrationAuthorizeUrlRequest < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..0aa4df76 --- /dev/null +++ b/lib/workos/pipes/data_integrations_get_user_token_request.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegrationsGetUserTokenRequest < WorkOS::Types::BaseModel + HASH_ATTRS = { + user_id: :user_id, + organization_id: :organization_id + }.freeze + + attr_accessor \ + :user_id, + :organization_id + + def initialize(json) + hash = self.class.normalize(json) + @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..35837685 --- /dev/null +++ b/lib/workos/pipes/data_integrations_list_response.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegrationsListResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + object: :object, + data: :data + }.freeze + + attr_accessor \ + :object, + :data + + def initialize(json) + hash = self.class.normalize(json) + @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..d84f0a8a --- /dev/null +++ b/lib/workos/pipes/data_integrations_list_response_data.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegrationsListResponseData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..e1957b5a --- /dev/null +++ b/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DataIntegrationsListResponseDataConnectedAccount < WorkOS::Types::BaseModel + 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 and will be removed in a future version.", uplevel: 1 + @userland_user_id + end + + attr_writer :userland_user_id + + def initialize(json) + hash = self.class.normalize(json) + @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 90fc37a9..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 56c101e7..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 8031d90f..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..aa6f4fdc --- /dev/null +++ b/lib/workos/public_client.rb @@ -0,0 +1,27 @@ +# 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 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:, **opts) + raise ArgumentError, "client_id is required" if client_id.nil? || client_id.empty? + WorkOS::Client.new(client_id: client_id, **opts) + end + end +end diff --git a/lib/workos/radar.rb b/lib/workos/radar.rb new file mode 100644 index 00000000..6d0da00a --- /dev/null +++ b/lib/workos/radar.rb @@ -0,0 +1,132 @@ +# 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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] (see WorkOS::Types::RequestOptions) + # @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..738ab835 --- /dev/null +++ b/lib/workos/radar/radar_list_entry_already_present_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RadarListEntryAlreadyPresentResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + message: :message + }.freeze + + attr_accessor :message + + def initialize(json) + hash = self.class.normalize(json) + @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..a66b56de --- /dev/null +++ b/lib/workos/radar/radar_standalone_assess_request.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RadarStandaloneAssessRequest < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..70d93caf --- /dev/null +++ b/lib/workos/radar/radar_standalone_delete_radar_list_entry_request.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RadarStandaloneDeleteRadarListEntryRequest < WorkOS::Types::BaseModel + HASH_ATTRS = { + entry: :entry + }.freeze + + attr_accessor :entry + + def initialize(json) + hash = self.class.normalize(json) + @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..dc6be73b --- /dev/null +++ b/lib/workos/radar/radar_standalone_response.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RadarStandaloneResponse < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..307a455d --- /dev/null +++ b/lib/workos/radar/radar_standalone_update_radar_attempt_request.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RadarStandaloneUpdateRadarAttemptRequest < WorkOS::Types::BaseModel + HASH_ATTRS = { + challenge_status: :challenge_status, + attempt_status: :attempt_status + }.freeze + + attr_accessor \ + :challenge_status, + :attempt_status + + def initialize(json) + hash = self.class.normalize(json) + @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 76d5c04a..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 e54db2a9..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 d61ce9d3..d2d49d9b 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -1,187 +1,135 @@ # frozen_string_literal: true -require 'jwt' -require 'uri' -require 'net/http' -require 'encryptor' -require 'securerandom' -require 'json' -require 'uri' +# @oagen-ignore-file +# 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 - # This class is not meant to be instantiated in a user space, and is instantiated internally but exposed. + # 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 - 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 + attr_reader :seal_data, :cookie_password + # 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? + return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::NO_SESSION_COOKIE_PROVIDED) if @seal_data.nil? || @seal_data.empty? - begin - session = Session.unseal_data(@session_data, @cookie_password, encryptor: @encryptor) - rescue StandardError - return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } + 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 - - 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 - - # Early return for expired tokens when not including expired data (backward compatible) - 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'], - user: session[:user], - impersonator: session[:impersonator], - reason: expired ? 'INVALID_JWT' : nil, - } - result.merge!(claim_extractor.call(decoded)) if block_given? - result + 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"], 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 - { authenticated: false, reason: 'INVALID_JWT' } - rescue StandardError => e - { authenticated: false, reason: e.message } - 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] - - begin - session = Session.unseal_data(@session_data, cookie_password, encryptor: @encryptor) - rescue StandardError - return { authenticated: false, reason: 'INVALID_SESSION_COOKIE' } + 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 StandardError => e - { authenticated: false, reason: e.message } - end + is_expired = decoded["exp"] && decoded["exp"] < Time.now.to_i + + SessionManager::AuthSuccess.new( + authenticated: !is_expired, + reason: is_expired ? SessionManager::EXPIRED_JWT : nil, + 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"] + + # 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, + "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: true, 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::AuthenticationError, WorkOS::InvalidRequestError => 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 + 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..7d787536 --- /dev/null +++ b/lib/workos/session_manager.rb @@ -0,0 +1,196 @@ +# 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 + # 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 + + # H04 success / failure shapes — kept minimal & frozen. + class AuthSuccess + RESERVED_KEYS = [ + :authenticated, :reason, :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:, reason: nil, + custom_claims: nil + ) + @authenticated = authenticated + @reason = reason + @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) + define_custom_claim_readers(@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 + + private + + def define_custom_claim_readers(claims) + claims.each_key do |key| + next if respond_to?(key) + + define_singleton_method(key) { @custom_claims[key] } + end + end + + 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" + INVALID_JWT_ALGORITHM = "invalid_jwt_algorithm" + INVALID_JWT_SIGNATURE = "invalid_jwt_signature" + EXPIRED_JWT = "expired_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:, 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. + 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, verify_expiration: true) + jwks = fetch_jwks + JWT.decode( + access_token, + nil, + true, + algorithms: JWK_ALGORITHMS, + jwks: jwks, + verify_aud: false, + verify_expiration: verify_expiration + ).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..eceeeaf8 --- /dev/null +++ b/lib/workos/shared/event_context.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EventContext < WorkOS::Types::BaseModel + 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 = 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] + @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..87bcc967 --- /dev/null +++ b/lib/workos/shared/event_context_actor.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EventContextActor < WorkOS::Types::BaseModel + HASH_ATTRS = { + id: :id, + source: :source, + name: :name + }.freeze + + attr_accessor \ + :id, + :source, + :name + + def initialize(json) + hash = self.class.normalize(json) + @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..db7eb102 --- /dev/null +++ b/lib/workos/shared/event_context_google_analytics_session.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EventContextGoogleAnalyticsSession < WorkOS::Types::BaseModel + HASH_ATTRS = { + containerId: :container_id, + sessionId: :session_id, + sessionNumber: :session_number + }.freeze + + attr_accessor \ + :container_id, + :session_id, + :session_number + + def initialize(json) + hash = self.class.normalize(json) + @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..eba34bbe --- /dev/null +++ b/lib/workos/shared/group.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class Group < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..0dfa881e --- /dev/null +++ b/lib/workos/shared/group_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class GroupCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..3278fa6b --- /dev/null +++ b/lib/workos/shared/group_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class GroupDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b5ba86a5 --- /dev/null +++ b/lib/workos/shared/group_member_added.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class GroupMemberAdded < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..1b925980 --- /dev/null +++ b/lib/workos/shared/group_member_added_data.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class GroupMemberAddedData < WorkOS::Types::BaseModel + HASH_ATTRS = { + group_id: :group_id, + organization_membership_id: :organization_membership_id + }.freeze + + attr_accessor \ + :group_id, + :organization_membership_id + + def initialize(json) + hash = self.class.normalize(json) + @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..1594967b --- /dev/null +++ b/lib/workos/shared/group_member_removed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class GroupMemberRemoved < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..d1f774d5 --- /dev/null +++ b/lib/workos/shared/group_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class GroupUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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 87e90a33..9585b943 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -1,235 +1,254 @@ # frozen_string_literal: true -require 'net/http' -require 'uri' +# This file is auto-generated by oagen. Do not edit. -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 +require "json" - validate_authorization_url_arguments( - provider: provider, - domain: domain, - connection: connection, - organization: organization, - ) +module WorkOS + class SSO + def initialize(client) + @client = client + end - query = URI.encode_www_form({ - client_id: client_id, - redirect_uri: redirect_uri, - response_type: 'code', - state: state, + # 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_connections( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_connections( + before: before, + after: cursor, + limit: limit, + order: order, + connection_type: connection_type, 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, - ), + organization_id: organization_id, + search: search, + 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: fetch_next + ) + end - WorkOS::Profile.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 - - # 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, - ), - ) + # Get a Connection + # @param id [String] Unique identifier for the Connection. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - parsed_response = JSON.parse(response.body) - connections = parsed_response['data'].map do |connection| - ::WorkOS::Connection.new(connection.to_json) - end + # Delete a Connection + # @param id [String] Unique identifier for the Connection. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 - WorkOS::Types::ListStruct.new( - data: connections, - list_metadata: parsed_response['listMetadata'], - ) - end + # Logout Authorize + # @param profile_id [String] The unique ID of the profile to log out. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 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}", - ) + # Get a User Profile + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Profile] + def get_profile(request_options: {}) + response = @client.request( + method: :get, + path: "/sso/profile", + auth: true, + request_options: request_options + ) + 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 - response = execute_request(request: request) + # Get a Profile and Token + # @param code [String] The authorization code received from the authorization callback. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::SSOTokenResponse] + def get_profile_and_token( + code:, + request_options: {} + ) + body = { + "grant_type" => "authorization_code", + "client_id" => request_options[:client_id] || @client.client_id, + "client_secret" => 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 + ) + 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 - 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) + # 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 - response.is_a? Net::HTTPSuccess - end + # 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 - private + # H17 — Build the SSO logout redirect URL (no HTTP call). + def build_logout_url(token:) + build_url("/sso/logout", {"token" => token}) + 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 + private - return unless provider && !PROVIDERS.include?(provider) + def build_url(path, params) + base = @client.base_url + uri = URI.join(base, path) + uri.query = URI.encode_www_form(params) + uri.to_s + end - raise ArgumentError, "#{provider} is not a valid value." \ - " `provider` must be in #{PROVIDERS}" - 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..77ac1b7a --- /dev/null +++ b/lib/workos/sso/connection.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class Connection < WorkOS::Types::BaseModel + 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 and will be removed in a future version.", uplevel: 1 + @status + end + + attr_writer :status + + def initialize(json) + hash = self.class.normalize(json) + @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..f33f6af7 --- /dev/null +++ b/lib/workos/sso/connection_activated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionActivated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..7fb4e19a --- /dev/null +++ b/lib/workos/sso/connection_activated_data.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionActivatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..1ad05087 --- /dev/null +++ b/lib/workos/sso/connection_activated_data_domain.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionActivatedDataDomain < WorkOS::Types::BaseModel + HASH_ATTRS = { + object: :object, + id: :id, + domain: :domain + }.freeze + + attr_accessor \ + :object, + :id, + :domain + + def initialize(json) + hash = self.class.normalize(json) + @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..00786d18 --- /dev/null +++ b/lib/workos/sso/connection_deactivated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionDeactivated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..6e01165a --- /dev/null +++ b/lib/workos/sso/connection_deactivated_data.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionDeactivatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..6b30064a --- /dev/null +++ b/lib/workos/sso/connection_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..62a59787 --- /dev/null +++ b/lib/workos/sso/connection_deleted_data.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionDeletedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..c724bcb5 --- /dev/null +++ b/lib/workos/sso/connection_option.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionOption < WorkOS::Types::BaseModel + HASH_ATTRS = { + signing_cert: :signing_cert + }.freeze + + attr_accessor :signing_cert + + def initialize(json) + hash = self.class.normalize(json) + @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..441b8cfd --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewal_required.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionSAMLCertificateRenewalRequired < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..92b64169 --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewal_required_data.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionSAMLCertificateRenewalRequiredData < WorkOS::Types::BaseModel + HASH_ATTRS = { + connection: :connection, + certificate: :certificate, + days_until_expiry: :days_until_expiry + }.freeze + + attr_accessor \ + :connection, + :certificate, + :days_until_expiry + + def initialize(json) + 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] + 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..f7b3903b --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewal_required_data_certificate.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionSAMLCertificateRenewalRequiredDataCertificate < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..371a6a83 --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewal_required_data_connection.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionSAMLCertificateRenewalRequiredDataConnection < WorkOS::Types::BaseModel + HASH_ATTRS = { + id: :id, + organization_id: :organization_id + }.freeze + + attr_accessor \ + :id, + :organization_id + + def initialize(json) + hash = self.class.normalize(json) + @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..42522d1a --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionSAMLCertificateRenewed < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b3a0723f --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewed_data.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionSAMLCertificateRenewedData < WorkOS::Types::BaseModel + HASH_ATTRS = { + connection: :connection, + certificate: :certificate, + renewed_at: :renewed_at + }.freeze + + attr_accessor \ + :connection, + :certificate, + :renewed_at + + def initialize(json) + 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] + 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..f67edf22 --- /dev/null +++ b/lib/workos/sso/connection_saml_certificate_renewed_data_certificate.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ConnectionSAMLCertificateRenewedDataCertificate < WorkOS::Types::BaseModel + HASH_ATTRS = { + certificate_type: :certificate_type, + expiry_date: :expiry_date + }.freeze + + attr_accessor \ + :certificate_type, + :expiry_date + + def initialize(json) + hash = self.class.normalize(json) + @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..39b3520c --- /dev/null +++ b/lib/workos/sso/profile.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class Profile < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..556d40e2 --- /dev/null +++ b/lib/workos/sso/sso_authorize_url_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SSOAuthorizeUrlResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + url: :url + }.freeze + + attr_accessor :url + + def initialize(json) + hash = self.class.normalize(json) + @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..ba75fea3 --- /dev/null +++ b/lib/workos/sso/sso_logout_authorize_request.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SSOLogoutAuthorizeRequest < WorkOS::Types::BaseModel + HASH_ATTRS = { + profile_id: :profile_id + }.freeze + + attr_accessor :profile_id + + def initialize(json) + hash = self.class.normalize(json) + @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..00ac8da5 --- /dev/null +++ b/lib/workos/sso/sso_logout_authorize_response.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SSOLogoutAuthorizeResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + logout_url: :logout_url, + logout_token: :logout_token + }.freeze + + attr_accessor \ + :logout_url, + :logout_token + + def initialize(json) + hash = self.class.normalize(json) + @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..5ddd9838 --- /dev/null +++ b/lib/workos/sso/sso_token_response.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SSOTokenResponse < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..4ee27dcc --- /dev/null +++ b/lib/workos/sso/token_query.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class TokenQuery < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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 6b8cef87..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/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/applications_order.rb b/lib/workos/types/applications_order.rb new file mode 100644 index 00000000..779a57ee --- /dev/null +++ b/lib/workos/types/applications_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 ApplicationsOrder + NORMAL = "normal" + DESC = "desc" + ASC = "asc" + ALL = [NORMAL, DESC, ASC].freeze + end + 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_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_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..598b6279 --- /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 = ApplicationsOrder + 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..788d3750 --- /dev/null +++ b/lib/workos/types/authentication_factor_enrolled_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 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 new file mode 100644 index 00000000..06d4d032 --- /dev/null +++ b/lib/workos/types/authentication_factor_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + AuthenticationFactorType = AuthenticationFactorEnrolledType + 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..76c3a7e4 --- /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 = ApplicationsOrder + end +end diff --git a/lib/workos/types/base_model.rb b/lib/workos/types/base_model.rb new file mode 100644 index 00000000..accc8126 --- /dev/null +++ b/lib/workos/types/base_model.rb @@ -0,0 +1,35 @@ +# 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. + 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/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..bc9da6ec --- /dev/null +++ b/lib/workos/types/connection_activated_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 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 new file mode 100644 index 00000000..e2f8859d --- /dev/null +++ b/lib/workos/types/connection_activated_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 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 new file mode 100644 index 00000000..0c76fca0 --- /dev/null +++ b/lib/workos/types/connection_activated_data_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 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 new file mode 100644 index 00000000..6c92eb99 --- /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 = ConnectionActivatedDataConnectionType + 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..4e5b6724 --- /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 = ConnectionActivatedDataState + 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..dfb61ac9 --- /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 = 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 new file mode 100644 index 00000000..20105452 --- /dev/null +++ b/lib/workos/types/connection_deleted_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 + ConnectionDeletedDataConnectionType = ConnectionActivatedDataConnectionType + 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..f2c44904 --- /dev/null +++ b/lib/workos/types/connection_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 + 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 new file mode 100644 index 00000000..9aed8144 --- /dev/null +++ b/lib/workos/types/connection_saml_certificate_renewal_required_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 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 new file mode 100644 index 00000000..4caf9619 --- /dev/null +++ b/lib/workos/types/connection_saml_certificate_renewed_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 + ConnectionSAMLCertificateRenewedDataCertificateCertificateType = ConnectionSAMLCertificateRenewalRequiredDataCertificateCertificateType + 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..f2168764 --- /dev/null +++ b/lib/workos/types/connection_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + ConnectionStatus = ConnectionActivatedDataStatus + 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..97175e72 --- /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 = ApplicationsOrder + 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..4fc0eff0 --- /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 = ApplicationsOrder + 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..1cc006ec --- /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 = ApplicationsOrder + 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..37052177 --- /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 = ApplicationsOrder + 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..2e7d4d87 --- /dev/null +++ b/lib/workos/types/dsync_activated_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 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 new file mode 100644 index 00000000..6e2949dd --- /dev/null +++ b/lib/workos/types/dsync_activated_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 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 new file mode 100644 index 00000000..33e4814e --- /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 = DsyncActivatedDataState + 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..3ca02e36 --- /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 = DsyncActivatedDataType + 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..7a836522 --- /dev/null +++ b/lib/workos/types/dsync_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 + DsyncDeletedDataState = DsyncActivatedDataState + 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..6c074cc1 --- /dev/null +++ b/lib/workos/types/dsync_deleted_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 + DsyncDeletedDataType = DsyncActivatedDataType + 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..4f73381f --- /dev/null +++ b/lib/workos/types/events_order.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + EventsOrder = ApplicationsOrder + 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..c66da69e --- /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 = ApplicationsOrder + 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/generate_link_intent.rb b/lib/workos/types/generate_link_intent.rb new file mode 100644 index 00000000..3f0613ab --- /dev/null +++ b/lib/workos/types/generate_link_intent.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + class GenerateLinkIntent + SSO = "sso" + DSYNC = "dsync" + AUDIT_LOGS = "audit_logs" + LOG_STREAMS = "log_streams" + 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/intent.rb b/lib/workos/types/intent.rb deleted file mode 100644 index 4a8e8728..00000000 --- a/lib/workos/types/intent.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -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' - DSYNC = 'dsync' - LOG_STREAMS = 'log_streams' - SSO = 'sso' - - ALL = [AUDIT_LOGS, CERTIFICATE_RENEWAL, DOMAIN_VERIFICATION, DSYNC, LOG_STREAMS, SSO].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..23a31066 --- /dev/null +++ b/lib/workos/types/invitation_accepted_data_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 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 new file mode 100644 index 00000000..51a03f2c --- /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 = InvitationAcceptedDataState + 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..b55a3484 --- /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 = InvitationAcceptedDataState + 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..df851c52 --- /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 = InvitationAcceptedDataState + end +end diff --git a/lib/workos/types/invitation_state.rb b/lib/workos/types/invitation_state.rb new file mode 100644 index 00000000..f3515097 --- /dev/null +++ b/lib/workos/types/invitation_state.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + InvitationState = InvitationAcceptedDataState + end +end diff --git a/lib/workos/types/list_struct.rb b/lib/workos/types/list_struct.rb index e03ece66..9f3c772d 100644 --- a/lib/workos/types/list_struct.rb +++ b/lib/workos/types/list_struct.rb @@ -1,15 +1,131 @@ # 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, :last_response + + 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. + # `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. + # @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 + 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. + # + # @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..3912e632 --- /dev/null +++ b/lib/workos/types/organization_created_data_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 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 new file mode 100644 index 00000000..f6f7f850 --- /dev/null +++ b/lib/workos/types/organization_created_data_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 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 new file mode 100644 index 00000000..67a51231 --- /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 = 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 new file mode 100644 index 00000000..3ce2fc4a --- /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 = 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 new file mode 100644 index 00000000..fad7dae6 --- /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 = 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 new file mode 100644 index 00000000..9d9ff25b --- /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 = OrganizationCreatedDataDomainVerificationStrategy + 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..cca3448b --- /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 = 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 new file mode 100644 index 00000000..8c20c5be --- /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 = 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 new file mode 100644 index 00000000..c3b8fb81 --- /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 = 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 new file mode 100644 index 00000000..bd05d21b --- /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 = OrganizationCreatedDataDomainVerificationStrategy + 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..62a30702 --- /dev/null +++ b/lib/workos/types/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 + 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 new file mode 100644 index 00000000..8957d295 --- /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 = 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 new file mode 100644 index 00000000..f19b6545 --- /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 = 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 new file mode 100644 index 00000000..b36fb81d --- /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 = 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 new file mode 100644 index 00000000..65b22801 --- /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 = OrganizationCreatedDataDomainVerificationStrategy + 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..d50b88f8 --- /dev/null +++ b/lib/workos/types/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 + 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 new file mode 100644 index 00000000..05d12ccc --- /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 = 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 new file mode 100644 index 00000000..79bf9ad5 --- /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 = 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 new file mode 100644 index 00000000..ba9baa58 --- /dev/null +++ b/lib/workos/types/organization_membership_created_data_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 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 new file mode 100644 index 00000000..1105bede --- /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 = OrganizationMembershipCreatedDataStatus + 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..4fd1d9b0 --- /dev/null +++ b/lib/workos/types/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 + 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 new file mode 100644 index 00000000..3062a6f2 --- /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 = 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 new file mode 100644 index 00000000..176ba64a --- /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 = 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 new file mode 100644 index 00000000..186792b2 --- /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 = OrganizationCreatedDataDomainVerificationStrategy + 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..01c79f57 --- /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 = ApplicationsOrder + 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..d7e5414e --- /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 = ApplicationsOrder + end +end diff --git a/lib/workos/types/organizations_order.rb b/lib/workos/types/organizations_order.rb new file mode 100644 index 00000000..38fad388 --- /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 = ApplicationsOrder + 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..a55d8a97 --- /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 = ApplicationsOrder + 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 c0bbd2c0..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..4301d9bf --- /dev/null +++ b/lib/workos/types/radar_standalone_response_blocklist_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 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_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..7e17d9c6 --- /dev/null +++ b/lib/workos/types/radar_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + RadarType = RadarStandaloneResponseBlocklistType + 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/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..1ab6204c --- /dev/null +++ b/lib/workos/types/session_created_data_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 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 new file mode 100644 index 00000000..61e58218 --- /dev/null +++ b/lib/workos/types/session_created_data_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 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 new file mode 100644 index 00000000..6834cd86 --- /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 = SessionCreatedDataAuthMethod + 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..b9e1d357 --- /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 = SessionCreatedDataStatus + 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..d56593e1 --- /dev/null +++ b/lib/workos/types/update_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 UpdateWebhookEndpointStatus + ENABLED = "enabled" + DISABLED = "disabled" + ALL = [ENABLED, DISABLED].freeze + end + 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..fce1c6c5 --- /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 = InvitationAcceptedDataState + 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..59339740 --- /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 = 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 new file mode 100644 index 00000000..32948f79 --- /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 = 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 new file mode 100644 index 00000000..54b5bc4c --- /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 = 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 new file mode 100644 index 00000000..810af00a --- /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 = 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 new file mode 100644 index 00000000..e3b383f3 --- /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 = 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 new file mode 100644 index 00000000..8ab6a151 --- /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 = ApplicationsOrder + 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..6caafaf0 --- /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 = 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 new file mode 100644 index 00000000..4204b56c --- /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 = OrganizationMembershipCreatedDataStatus + 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..4fa9faee --- /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 = OrganizationMembershipCreatedDataStatus + 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..80e749d7 --- /dev/null +++ b/lib/workos/types/user_sessions_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 + UserSessionsAuthMethod = SessionCreatedDataAuthMethod + 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..0d7e0642 --- /dev/null +++ b/lib/workos/types/user_sessions_status.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + module Types + UserSessionsStatus = SessionCreatedDataStatus + 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..000aebb9 --- /dev/null +++ b/lib/workos/types/vault_data_created_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 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 new file mode 100644 index 00000000..9c51bcbc --- /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 = 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 new file mode 100644 index 00000000..af5db407 --- /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 = 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 new file mode 100644 index 00000000..085a659f --- /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 = 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 new file mode 100644 index 00000000..be978084 --- /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 = 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 new file mode 100644 index 00000000..80c10a36 --- /dev/null +++ b/lib/workos/types/vault_dek_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 + 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 new file mode 100644 index 00000000..cd1f6981 --- /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 = 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 new file mode 100644 index 00000000..51568292 --- /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 = 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 new file mode 100644 index 00000000..9d4e6a27 --- /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 = 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/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..955368cd --- /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 = ApplicationsOrder + end +end diff --git a/lib/workos/types/widget_scope.rb b/lib/workos/types/widget_scope.rb deleted file mode 100644 index d4097346..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 6e952815..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 75a20aa9..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 7cfbe96c..dc561c06 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -1,1258 +1,1610 @@ # 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 - - # The AuthFactorType is a declaration of a - # fixed set of factor values to enroll - class AuthFactorType - Totp = 'totp' +require "json" - 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 + # 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] (see WorkOS::Types::RequestOptions) + # @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 ) + 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 - 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 + # 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] (see WorkOS::Types::RequestOptions) + # @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 ) - 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) - - WorkOS::User.new(response.body) - end + 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 - # 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: {} + ) + 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.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, + 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 + WorkOS::AuthenticateResponse.new(response.body) + 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: {} + ) + 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.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, + 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 + WorkOS::AuthenticateResponse.new(response.body) + 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: {} + ) + 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.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, + 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 + WorkOS::AuthenticateResponse.new(response.body) + 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: {} + ) + 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.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, + 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 + WorkOS::AuthenticateResponse.new(response.body) + 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: {} + ) + 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.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, + 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 + WorkOS::AuthenticateResponse.new(response.body) + 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: {} + ) + 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.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, + 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 + WorkOS::AuthenticateResponse.new(response.body) + 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: {} + ) + 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.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, + 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 + WorkOS::AuthenticateResponse.new(response.body) + 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: {} + ) + 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.request( + method: :post, + path: "/user_management/authenticate", + auth: true, + body: body, + 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, - ), - ) - - WorkOS::MagicAuth.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, - ), - ) + WorkOS::AuthenticateResponse.new(response.body) + 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - # 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.' + # 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] (see WorkOS::Types::RequestOptions) + # @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 - response = execute_request( - request: post_request( - path: '/user_management/magic_auth/send', - body: { - email: email, - }, - auth: true, - ), - ) + # Create a CORS origin + # @param origin [String] The origin URL to allow for CORS requests. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - response.is_a? Net::HTTPSuccess - end + # Get an email verification code + # @param id [String] The ID of the email verification code. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - # 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, - ) + # Create a password reset token + # @param email [String] The email address of the user requesting a password reset. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - 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, - ), - ) + # 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - WorkOS::AuthenticationFactorAndChallenge.new(response.body) - end + # Get a password reset token + # @param id [String] The ID of the password reset token. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - # 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, - ), + # 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_users( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_users( + before: before, + after: cursor, + limit: limit, + order: order, + organization: organization, + organization_id: organization_id, + email: email, + 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: fetch_next + ) + end - parsed_response = JSON.parse(response.body) - - auth_factors = parsed_response['data'].map do |auth_factor| - ::WorkOS::Factor.new(auth_factor.to_json) + # 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] (see WorkOS::Types::RequestOptions) + # @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 = {}.compact + 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: auth_factors, - 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, + "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 + ) + 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 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - parsed_response = JSON.parse(response.body) + # Get a user + # @param id [String] The unique ID of the user. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - 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] (see WorkOS::Types::RequestOptions) + # @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 = {}.compact + 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 + ) + 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 - # 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, - ), - ) - - WorkOS::EmailVerification.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, - ), - ) - - WorkOS::UserResponse.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, - ), - ) - - WorkOS::UserResponse.new(response.body) - 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, - ), - ) - - 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, - ), - ) - - 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.' - - request = post_request( - path: '/user_management/password_reset/send', - body: { - 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, - ), - ) - - WorkOS::UserResponse.new(response.body).user - end + # Delete a user + # @param id [String] The unique ID of the user. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 - # 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, - ), - ) + # 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - WorkOS::OrganizationMembership.new(response.body) - 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - # 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, - ), - ) + # Verify email + # @param id [String] The ID of the user. + # @param code [String] The one-time email verification code. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - parsed_response = JSON.parse(response.body) + # Send verification email + # @param id [String] The ID of the user. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - organization_memberships = parsed_response['data'].map do |organization_membership| - ::WorkOS::OrganizationMembership.new(organization_membership.to_json) - end + # Get user identities + # @param id [String] The unique ID of the user. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 - WorkOS::Types::ListStruct.new( - data: organization_memberships, - list_metadata: parsed_response['list_metadata'], + # 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_sessions( + id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_sessions( + id: id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options ) - 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 + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserSessionsListItem, + filters: {id: id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + end - body = { - user_id: user_id, + # 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_invitations( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_invitations( + before: before, + after: cursor, + limit: limit, + order: order, 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, - ) - - response = execute_request(request: request) - - WorkOS::OrganizationMembership.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 - - body = { id: id } - - body[:role_slugs] = role_slugs if role_slugs - body[:role_slug] = role_slug if role_slug - - request = put_request( - path: "/user_management/organization_memberships/#{id}", - body: body.compact, - auth: true, - ) - - response = execute_request(request: request) - - WorkOS::OrganizationMembership.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, - ), + email: email, + 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: fetch_next + ) + end - response.is_a? Net::HTTPSuccess - end + # 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - # 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, - ), - ) + # Find an invitation by token + # @param token [String] The token used to accept the invitation. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - WorkOS::OrganizationMembership.new(response.body) - end + # Get an invitation + # @param id [String] The unique ID of the invitation. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - # 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, - ), - ) + # Accept an invitation + # @param id [String] The unique ID of the invitation. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - WorkOS::OrganizationMembership.new(response.body) - 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - # 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, - ), - ) + # Revoke an invitation + # @param id [String] The unique ID of the invitation. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - WorkOS::Invitation.new(response.body) - end + # Update JWT template + # @param content [String] The JWT template content as a Liquid template string. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - # 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, - ), - ) + # 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - WorkOS::Invitation.new(response.body) - end + # Get Magic Auth code details + # @param id [String] The unique ID of the Magic Auth code. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - # 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 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_organization_memberships( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(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 ) + } + 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 - parsed_response = JSON.parse(response.body) - - invitations = parsed_response['data'].map do |invitation| - ::WorkOS::Invitation.new(invitation.to_json) + # 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::OrganizationMembership] + def create_organization_membership( + user_id:, + organization_id:, + role_slug: nil, + role_slugs: nil, + role: nil, + request_options: {} + ) + params = {}.compact + if role + case role[:type] + when "single" + params["role_slug"] = role[:role_slug] + when "multiple" + params["role_slugs"] = role[:role_slugs] end - - WorkOS::Types::ListStruct.new( - data: invitations, - list_metadata: parsed_response['list_metadata'], - ) 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 + ) + 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 - # 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, - ), - ) + # Get an organization membership + # @param id [String] The unique ID of the organization membership. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - WorkOS::Invitation.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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::UserOrganizationMembership] + def update_organization_membership( + id:, + role_slug: nil, + role_slugs: nil, + role: nil, + request_options: {} + ) + params = {}.compact + 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 + ) + 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 - # 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 + # Delete an organization membership + # @param id [String] The unique ID of the organization membership. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 - # 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, - ) + # Deactivate an organization membership + # @param id [String] The unique ID of the organization membership. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - response = execute_request(request: request) + # Reactivate an organization membership + # @param id [String] The unique ID of the organization membership. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - WorkOS::Invitation.new(response.body) - end + # Create a redirect URI + # @param uri [String] The redirect URI to create. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 - # 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, + # 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_user_authorized_applications( + user_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 + ) + fetch_next = ->(cursor) { + list_user_authorized_applications( + user_id: user_id, + before: before, + after: cursor, + limit: limit, + order: order, + 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: fetch_next + ) + end - response = execute_request(request: request) - - WorkOS::Invitation.new(response.body) - 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] (see WorkOS::Types::RequestOptions) + # @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 + 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 + 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..3a9dc236 --- /dev/null +++ b/lib/workos/user_management/action_authentication_denied.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ActionAuthenticationDenied < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b25a8e86 --- /dev/null +++ b/lib/workos/user_management/action_authentication_denied_data.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ActionAuthenticationDeniedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..0a9f39b0 --- /dev/null +++ b/lib/workos/user_management/action_user_registration_denied.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ActionUserRegistrationDenied < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..0b5192d5 --- /dev/null +++ b/lib/workos/user_management/action_user_registration_denied_data.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ActionUserRegistrationDeniedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..46a2d44b --- /dev/null +++ b/lib/workos/user_management/authenticate_response.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticateResponse < WorkOS::Types::BaseModel + 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 = 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] + @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..a5bcda83 --- /dev/null +++ b/lib/workos/user_management/authenticate_response_impersonator.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticateResponseImpersonator < WorkOS::Types::BaseModel + HASH_ATTRS = { + email: :email, + reason: :reason + }.freeze + + attr_accessor \ + :email, + :reason + + def initialize(json) + hash = self.class.normalize(json) + @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..80a3e093 --- /dev/null +++ b/lib/workos/user_management/authenticate_response_oauth_token.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticateResponseOAuthToken < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..20e6f964 --- /dev/null +++ b/lib/workos/user_management/authentication_email_verification_failed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationEmailVerificationFailed < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..5ecbea54 --- /dev/null +++ b/lib/workos/user_management/authentication_email_verification_failed_data.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationEmailVerificationFailedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..09151f5e --- /dev/null +++ b/lib/workos/user_management/authentication_email_verification_failed_data_error.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationEmailVerificationFailedDataError < WorkOS::Types::BaseModel + HASH_ATTRS = { + code: :code, + message: :message + }.freeze + + attr_accessor \ + :code, + :message + + def initialize(json) + hash = self.class.normalize(json) + @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..c8c57a98 --- /dev/null +++ b/lib/workos/user_management/authentication_email_verification_succeeded.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationEmailVerificationSucceeded < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..12a7bf7a --- /dev/null +++ b/lib/workos/user_management/authentication_email_verification_succeeded_data.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationEmailVerificationSucceededData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..38d2e6af --- /dev/null +++ b/lib/workos/user_management/authentication_magic_auth_failed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationMagicAuthFailed < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..5b96e069 --- /dev/null +++ b/lib/workos/user_management/authentication_magic_auth_failed_data.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationMagicAuthFailedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..9016c31b --- /dev/null +++ b/lib/workos/user_management/authentication_magic_auth_succeeded.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationMagicAuthSucceeded < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..32cb2e82 --- /dev/null +++ b/lib/workos/user_management/authentication_magic_auth_succeeded_data.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationMagicAuthSucceededData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..4e0a6f5a --- /dev/null +++ b/lib/workos/user_management/authentication_mfa_failed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationMFAFailed < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..11d997ca --- /dev/null +++ b/lib/workos/user_management/authentication_mfa_failed_data.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationMFAFailedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..34177373 --- /dev/null +++ b/lib/workos/user_management/authentication_mfa_succeeded.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationMFASucceeded < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..bd06277a --- /dev/null +++ b/lib/workos/user_management/authentication_mfa_succeeded_data.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationMFASucceededData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..d76b5284 --- /dev/null +++ b/lib/workos/user_management/authentication_oauth_failed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationOAuthFailed < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..a143a971 --- /dev/null +++ b/lib/workos/user_management/authentication_oauth_failed_data.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationOAuthFailedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..c224dcb2 --- /dev/null +++ b/lib/workos/user_management/authentication_oauth_succeeded.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationOAuthSucceeded < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..3291b4a7 --- /dev/null +++ b/lib/workos/user_management/authentication_oauth_succeeded_data.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationOAuthSucceededData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..35608fc2 --- /dev/null +++ b/lib/workos/user_management/authentication_passkey_failed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationPasskeyFailed < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..69e8e55f --- /dev/null +++ b/lib/workos/user_management/authentication_passkey_failed_data.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationPasskeyFailedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..043610c9 --- /dev/null +++ b/lib/workos/user_management/authentication_passkey_succeeded.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationPasskeySucceeded < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..63d253b6 --- /dev/null +++ b/lib/workos/user_management/authentication_passkey_succeeded_data.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationPasskeySucceededData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..de4efe20 --- /dev/null +++ b/lib/workos/user_management/authentication_password_failed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationPasswordFailed < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..66ac3776 --- /dev/null +++ b/lib/workos/user_management/authentication_password_failed_data.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationPasswordFailedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..49dc4a18 --- /dev/null +++ b/lib/workos/user_management/authentication_password_succeeded.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationPasswordSucceeded < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..a1aff8dd --- /dev/null +++ b/lib/workos/user_management/authentication_password_succeeded_data.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationPasswordSucceededData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..02a6c9c0 --- /dev/null +++ b/lib/workos/user_management/authentication_radar_risk_detected.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationRadarRiskDetected < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..c2fc6c53 --- /dev/null +++ b/lib/workos/user_management/authentication_radar_risk_detected_data.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationRadarRiskDetectedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..52584c18 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_failed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationSSOFailed < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..181894f9 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_failed_data.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationSSOFailedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..3cef0f7e --- /dev/null +++ b/lib/workos/user_management/authentication_sso_failed_data_sso.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationSSOFailedDataSSO < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..23dc9e54 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_started.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationSSOStarted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..8926caea --- /dev/null +++ b/lib/workos/user_management/authentication_sso_started_data.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationSSOStartedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..61e48f9b --- /dev/null +++ b/lib/workos/user_management/authentication_sso_succeeded.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationSSOSucceeded < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b2a37fd0 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_succeeded_data.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationSSOSucceededData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..cb52f547 --- /dev/null +++ b/lib/workos/user_management/authentication_sso_timed_out.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationSSOTimedOut < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..906486ec --- /dev/null +++ b/lib/workos/user_management/authentication_sso_timed_out_data.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthenticationSSOTimedOutData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..76f02f11 --- /dev/null +++ b/lib/workos/user_management/authorization_code_session_authenticate_request.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthorizationCodeSessionAuthenticateRequest < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..0b3e62d8 --- /dev/null +++ b/lib/workos/user_management/authorized_connect_application_list_data.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class AuthorizedConnectApplicationListData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..868bff79 --- /dev/null +++ b/lib/workos/user_management/cors_origin_response.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CORSOriginResponse < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..25136e48 --- /dev/null +++ b/lib/workos/user_management/create_cors_origin.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateCORSOrigin < WorkOS::Types::BaseModel + HASH_ATTRS = { + origin: :origin + }.freeze + + attr_accessor :origin + + def initialize(json) + hash = self.class.normalize(json) + @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..fcc683c9 --- /dev/null +++ b/lib/workos/user_management/create_magic_code_and_return.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateMagicCodeAndReturn < WorkOS::Types::BaseModel + HASH_ATTRS = { + email: :email, + invitation_token: :invitation_token + }.freeze + + attr_accessor \ + :email, + :invitation_token + + def initialize(json) + hash = self.class.normalize(json) + @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..64bf3905 --- /dev/null +++ b/lib/workos/user_management/create_password_reset.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreatePasswordReset < WorkOS::Types::BaseModel + HASH_ATTRS = { + token: :token, + new_password: :new_password + }.freeze + + attr_accessor \ + :token, + :new_password + + def initialize(json) + hash = self.class.normalize(json) + @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..df036baa --- /dev/null +++ b/lib/workos/user_management/create_password_reset_token.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreatePasswordResetToken < WorkOS::Types::BaseModel + HASH_ATTRS = { + email: :email + }.freeze + + attr_accessor :email + + def initialize(json) + hash = self.class.normalize(json) + @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..dcc41fe1 --- /dev/null +++ b/lib/workos/user_management/create_redirect_uri.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateRedirectUri < WorkOS::Types::BaseModel + HASH_ATTRS = { + uri: :uri + }.freeze + + attr_accessor :uri + + def initialize(json) + hash = self.class.normalize(json) + @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..b729884f --- /dev/null +++ b/lib/workos/user_management/create_user.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateUser < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..41e38f63 --- /dev/null +++ b/lib/workos/user_management/create_user_invite_options.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateUserInviteOptions < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..924a71dc --- /dev/null +++ b/lib/workos/user_management/create_user_organization_membership.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateUserOrganizationMembership < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b828c049 --- /dev/null +++ b/lib/workos/user_management/device_authorization_response.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DeviceAuthorizationResponse < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..de7c4b66 --- /dev/null +++ b/lib/workos/user_management/device_code_session_authenticate_request.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DeviceCodeSessionAuthenticateRequest < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..e2b6f5a7 --- /dev/null +++ b/lib/workos/user_management/email_change.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EmailChange < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..fc1609ce --- /dev/null +++ b/lib/workos/user_management/email_change_confirmation.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EmailChangeConfirmation < WorkOS::Types::BaseModel + HASH_ATTRS = { + object: :object, + user: :user + }.freeze + + attr_accessor \ + :object, + :user + + def initialize(json) + hash = self.class.normalize(json) + @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..b6c0ac2c --- /dev/null +++ b/lib/workos/user_management/email_change_confirmation_user.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EmailChangeConfirmationUser < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..7bf7312b --- /dev/null +++ b/lib/workos/user_management/email_verification.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EmailVerification < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..4774a0b5 --- /dev/null +++ b/lib/workos/user_management/email_verification_code_session_authenticate_request.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EmailVerificationCodeSessionAuthenticateRequest < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..c9472ad4 --- /dev/null +++ b/lib/workos/user_management/email_verification_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EmailVerificationCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..1bade3ee --- /dev/null +++ b/lib/workos/user_management/email_verification_created_data.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class EmailVerificationCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..12f77d58 --- /dev/null +++ b/lib/workos/user_management/invitation.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class Invitation < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..132f9bbe --- /dev/null +++ b/lib/workos/user_management/invitation_accepted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class InvitationAccepted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..e1745237 --- /dev/null +++ b/lib/workos/user_management/invitation_accepted_data.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class InvitationAcceptedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..989bc023 --- /dev/null +++ b/lib/workos/user_management/invitation_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class InvitationCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..7d0d7593 --- /dev/null +++ b/lib/workos/user_management/invitation_created_data.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class InvitationCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..b89d7768 --- /dev/null +++ b/lib/workos/user_management/invitation_resent.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class InvitationResent < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..e9aae396 --- /dev/null +++ b/lib/workos/user_management/invitation_resent_data.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class InvitationResentData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..d0f28b55 --- /dev/null +++ b/lib/workos/user_management/invitation_revoked.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class InvitationRevoked < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..4212f66c --- /dev/null +++ b/lib/workos/user_management/invitation_revoked_data.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class InvitationRevokedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..8b616313 --- /dev/null +++ b/lib/workos/user_management/jwks_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class JwksResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + keys: :keys + }.freeze + + attr_accessor :keys + + def initialize(json) + hash = self.class.normalize(json) + @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..e7486e9c --- /dev/null +++ b/lib/workos/user_management/jwks_response_keys.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class JwksResponseKeys < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..5dc65b0d --- /dev/null +++ b/lib/workos/user_management/jwt_template_response.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class JWTTemplateResponse < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..00ae887a --- /dev/null +++ b/lib/workos/user_management/magic_auth.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class MagicAuth < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..aad2df18 --- /dev/null +++ b/lib/workos/user_management/magic_auth_code_session_authenticate_request.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class MagicAuthCodeSessionAuthenticateRequest < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..e356dd07 --- /dev/null +++ b/lib/workos/user_management/magic_auth_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class MagicAuthCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..d9e0d970 --- /dev/null +++ b/lib/workos/user_management/magic_auth_created_data.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class MagicAuthCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..e05dc4a3 --- /dev/null +++ b/lib/workos/user_management/mfa_totp_session_authenticate_request.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class MFATotpSessionAuthenticateRequest < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..e2d9cf95 --- /dev/null +++ b/lib/workos/user_management/organization_membership.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationMembership < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..a2ed1857 --- /dev/null +++ b/lib/workos/user_management/organization_selection_session_authenticate_request.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationSelectionSessionAuthenticateRequest < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..f7398595 --- /dev/null +++ b/lib/workos/user_management/password_reset.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class PasswordReset < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..1ab44295 --- /dev/null +++ b/lib/workos/user_management/password_reset_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class PasswordResetCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..85f551b9 --- /dev/null +++ b/lib/workos/user_management/password_reset_created_data.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class PasswordResetCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..7865b21b --- /dev/null +++ b/lib/workos/user_management/password_reset_succeeded.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class PasswordResetSucceeded < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..f43f7970 --- /dev/null +++ b/lib/workos/user_management/password_session_authenticate_request.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class PasswordSessionAuthenticateRequest < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..a9e109f0 --- /dev/null +++ b/lib/workos/user_management/redirect_uri.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RedirectUri < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..d3d67524 --- /dev/null +++ b/lib/workos/user_management/refresh_token_session_authenticate_request.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RefreshTokenSessionAuthenticateRequest < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..55493e40 --- /dev/null +++ b/lib/workos/user_management/resend_user_invite_options.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ResendUserInviteOptions < WorkOS::Types::BaseModel + HASH_ATTRS = { + locale: :locale + }.freeze + + attr_accessor :locale + + def initialize(json) + hash = self.class.normalize(json) + @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..31f6b916 --- /dev/null +++ b/lib/workos/user_management/reset_password_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class ResetPasswordResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + user: :user + }.freeze + + attr_accessor :user + + def initialize(json) + hash = self.class.normalize(json) + @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..337432f5 --- /dev/null +++ b/lib/workos/user_management/revoke_session.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class RevokeSession < WorkOS::Types::BaseModel + HASH_ATTRS = { + session_id: :session_id, + return_to: :return_to + }.freeze + + attr_accessor \ + :session_id, + :return_to + + def initialize(json) + hash = self.class.normalize(json) + @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..afd95bfa --- /dev/null +++ b/lib/workos/user_management/send_email_change.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SendEmailChange < WorkOS::Types::BaseModel + HASH_ATTRS = { + new_email: :new_email + }.freeze + + attr_accessor :new_email + + def initialize(json) + hash = self.class.normalize(json) + @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 7a9a5bef..00000000 --- a/lib/workos/user_management/session.rb +++ /dev/null @@ -1,57 +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..452066ba --- /dev/null +++ b/lib/workos/user_management/session_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SessionCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..6a4c99d8 --- /dev/null +++ b/lib/workos/user_management/session_created_data.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SessionCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..4e7c0338 --- /dev/null +++ b/lib/workos/user_management/session_revoked.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SessionRevoked < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..88092132 --- /dev/null +++ b/lib/workos/user_management/session_revoked_data.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SessionRevokedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..a86cccbb --- /dev/null +++ b/lib/workos/user_management/sso_device_authorization_request.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class SSODeviceAuthorizationRequest < WorkOS::Types::BaseModel + HASH_ATTRS = { + client_id: :client_id + }.freeze + + attr_accessor :client_id + + def initialize(json) + hash = self.class.normalize(json) + @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..76dd4aa2 --- /dev/null +++ b/lib/workos/user_management/update_jwt_template.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UpdateJWTTemplate < WorkOS::Types::BaseModel + HASH_ATTRS = { + content: :content + }.freeze + + attr_accessor :content + + def initialize(json) + hash = self.class.normalize(json) + @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..6dfb19c7 --- /dev/null +++ b/lib/workos/user_management/update_user.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UpdateUser < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..e922b32c --- /dev/null +++ b/lib/workos/user_management/update_user_organization_membership.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UpdateUserOrganizationMembership < WorkOS::Types::BaseModel + HASH_ATTRS = { + role_slug: :role_slug, + role_slugs: :role_slugs + }.freeze + + attr_accessor \ + :role_slug, + :role_slugs + + def initialize(json) + hash = self.class.normalize(json) + @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..946d31ed --- /dev/null +++ b/lib/workos/user_management/user_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..1671fe12 --- /dev/null +++ b/lib/workos/user_management/user_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..09f8d76e --- /dev/null +++ b/lib/workos/user_management/user_identities_get_item.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserIdentitiesGetItem < WorkOS::Types::BaseModel + HASH_ATTRS = { + idp_id: :idp_id, + type: :type, + provider: :provider + }.freeze + + attr_accessor \ + :idp_id, + :type, + :provider + + def initialize(json) + hash = self.class.normalize(json) + @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..7cf0f45d --- /dev/null +++ b/lib/workos/user_management/user_invite.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserInvite < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..ff127f31 --- /dev/null +++ b/lib/workos/user_management/user_organization_membership.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserOrganizationMembership < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..11da49a7 --- /dev/null +++ b/lib/workos/user_management/user_sessions_list_item.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserSessionsListItem < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..50a1b426 --- /dev/null +++ b/lib/workos/user_management/user_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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 5776256d..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..75624c6b --- /dev/null +++ b/lib/workos/vault.rb @@ -0,0 +1,241 @@ +# 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. + # + # @example Store and retrieve a secret + # client.vault.create_object(name: "api-key", value: "sk_...", 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 + + DataKey = Data.define(:id, :key) do + def self.from_response(hash) + new(id: hash["id"], key: hash["data_key"]) + end + end + + DataKeyPair = Data.define(:context, :data_key, :encrypted_keys) 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 = 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 = Data.define(:context, :environment_id, :id, :key_id, :updated_at, :updated_by, :version_id) 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 = Data.define(:id, :name, :value, :metadata) 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 = 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 = 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 + 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..5638a96d --- /dev/null +++ b/lib/workos/vault/vault_byok_key_verification_completed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultByokKeyVerificationCompleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..45eeff8c --- /dev/null +++ b/lib/workos/vault/vault_byok_key_verification_completed_data.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultByokKeyVerificationCompletedData < WorkOS::Types::BaseModel + HASH_ATTRS = { + organization_id: :organization_id, + key_provider: :key_provider, + verified: :verified + }.freeze + + attr_accessor \ + :organization_id, + :key_provider, + :verified + + def initialize(json) + hash = self.class.normalize(json) + @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..6be3a932 --- /dev/null +++ b/lib/workos/vault/vault_data_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDataCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..ff632bc7 --- /dev/null +++ b/lib/workos/vault/vault_data_created_data.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDataCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..2cdff212 --- /dev/null +++ b/lib/workos/vault/vault_data_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDataDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..cd620c5a --- /dev/null +++ b/lib/workos/vault/vault_data_deleted_data.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDataDeletedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..9abdeaa8 --- /dev/null +++ b/lib/workos/vault/vault_data_read.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDataRead < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..5ab87246 --- /dev/null +++ b/lib/workos/vault/vault_data_read_data.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDataReadData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..dab9c3ed --- /dev/null +++ b/lib/workos/vault/vault_data_updated.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDataUpdated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..da2c0b37 --- /dev/null +++ b/lib/workos/vault/vault_data_updated_data.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDataUpdatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..02a0f0e4 --- /dev/null +++ b/lib/workos/vault/vault_dek_decrypted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDekDecrypted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..8ca57bbd --- /dev/null +++ b/lib/workos/vault/vault_dek_decrypted_data.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDekDecryptedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..7e283583 --- /dev/null +++ b/lib/workos/vault/vault_dek_read.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDekRead < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..c200c9f5 --- /dev/null +++ b/lib/workos/vault/vault_dek_read_data.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultDekReadData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..459455b1 --- /dev/null +++ b/lib/workos/vault/vault_kek_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultKekCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..e35a3ddc --- /dev/null +++ b/lib/workos/vault/vault_kek_created_data.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultKekCreatedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..10fb52ee --- /dev/null +++ b/lib/workos/vault/vault_metadata_read.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultMetadataRead < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..f2e0d487 --- /dev/null +++ b/lib/workos/vault/vault_metadata_read_data.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultMetadataReadData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..55bf8fc8 --- /dev/null +++ b/lib/workos/vault/vault_names_listed.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultNamesListed < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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..c1d4252f --- /dev/null +++ b/lib/workos/vault/vault_names_listed_data.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultNamesListedData < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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 10ca7221..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 149c146e..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' + VERSION = "6.2.0" end diff --git a/lib/workos/webhook.rb b/lib/workos/webhook.rb deleted file mode 100644 index 7a42d904..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 1f23044e..d2303d53 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -1,180 +1,234 @@ # 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 + class Webhooks + def initialize(client) + @client = client + end + + # 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_webhook_endpoints( + before: nil, + after: nil, + limit: nil, + order: "desc", + 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 ) - verify_header(payload: payload, sig_header: sig_header, secret: secret, tolerance: tolerance) - WorkOS::Webhook.new(payload) - end + fetch_next = ->(cursor) { + list_webhook_endpoints( + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::WebhookEndpointJson, + filters: {before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + 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 + # 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::WebhookEndpointJson] + 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 ) - begin - timestamp, signature_hash = get_timestamp_and_signature_hash(sig_header: sig_header) - rescue StandardError - raise WorkOS::SignatureVerificationError.new( - 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', - ) - 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 - - 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 - - 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: + 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 + # @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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::WebhookEndpointJson] + 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 ) - timestamp, signature_hash = sig_header.split(', ') + 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 - if timestamp.nil? || signature_hash.nil? - raise WorkOS::SignatureVerificationError.new( - message: 'Unable to extract timestamp and signature hash from header', - ) - end + # Delete a Webhook Endpoint + # @param id [String] Unique identifier of the Webhook Endpoint. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @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 - timestamp = timestamp.sub('t=', '') - signature_hash = signature_hash.sub('v1=', '') + # @oagen-ignore-start — non-spec helpers (hand-maintained) + require "openssl" + + DEFAULT_TOLERANCE_SECONDS = 180 + + # Verify a webhook signature and return a typed event struct. + # + # 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) + end - [timestamp, signature_hash] + # 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 + + # 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 + 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..8ce04034 --- /dev/null +++ b/lib/workos/webhooks/create_webhook_endpoint.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateWebhookEndpoint < WorkOS::Types::BaseModel + HASH_ATTRS = { + endpoint_url: :endpoint_url, + events: :events + }.freeze + + attr_accessor \ + :endpoint_url, + :events + + def initialize(json) + hash = self.class.normalize(json) + @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..9d6f7c09 --- /dev/null +++ b/lib/workos/webhooks/update_webhook_endpoint.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UpdateWebhookEndpoint < WorkOS::Types::BaseModel + HASH_ATTRS = { + endpoint_url: :endpoint_url, + status: :status, + events: :events + }.freeze + + attr_accessor \ + :endpoint_url, + :status, + :events + + def initialize(json) + hash = self.class.normalize(json) + @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/webhooks/webhook_endpoint_json.rb b/lib/workos/webhooks/webhook_endpoint_json.rb new file mode 100644 index 00000000..a033e364 --- /dev/null +++ b/lib/workos/webhooks/webhook_endpoint_json.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class WebhookEndpointJson < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @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 bd1e7bd5..a0534089 100644 --- a/lib/workos/widgets.rb +++ b/lib/workos/widgets.rb @@ -1,46 +1,42 @@ # 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] (see WorkOS::Types::RequestOptions) + # @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 + ) + 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 new file mode 100644 index 00000000..f702967b --- /dev/null +++ b/lib/workos/widgets/widget_session_token.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class WidgetSessionToken < WorkOS::Types::BaseModel + HASH_ATTRS = { + organization_id: :organization_id, + user_id: :user_id, + scopes: :scopes + }.freeze + + attr_accessor \ + :organization_id, + :user_id, + :scopes + + def initialize(json) + hash = self.class.normalize(json) + @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..05c3173a --- /dev/null +++ b/lib/workos/widgets/widget_session_token_response.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class WidgetSessionTokenResponse < WorkOS::Types::BaseModel + HASH_ATTRS = { + token: :token + }.freeze + + attr_accessor :token + + def initialize(json) + hash = self.class.normalize(json) + @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..b292df51 --- /dev/null +++ b/rbi/workos/action_authentication_denied.rbi @@ -0,0 +1,54 @@ +# 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..14cc5f25 --- /dev/null +++ b/rbi/workos/action_authentication_denied_data.rbi @@ -0,0 +1,72 @@ +# 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..b02e0b0a --- /dev/null +++ b/rbi/workos/action_user_registration_denied.rbi @@ -0,0 +1,54 @@ +# 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..d7b83312 --- /dev/null +++ b/rbi/workos/action_user_registration_denied_data.rbi @@ -0,0 +1,66 @@ +# 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/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/add_role_permission.rbi b/rbi/workos/add_role_permission.rbi new file mode 100644 index 00000000..049baa84 --- /dev/null +++ b/rbi/workos/add_role_permission.rbi @@ -0,0 +1,24 @@ +# 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..1a2f4961 --- /dev/null +++ b/rbi/workos/admin_portal.rbi @@ -0,0 +1,26 @@ +# 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..1a91ee61 --- /dev/null +++ b/rbi/workos/api_key.rbi @@ -0,0 +1,72 @@ +# 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..a59f3d55 --- /dev/null +++ b/rbi/workos/api_key_created.rbi @@ -0,0 +1,54 @@ +# 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..dfab3a6f --- /dev/null +++ b/rbi/workos/api_key_created_data.rbi @@ -0,0 +1,72 @@ +# 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..ca58254d --- /dev/null +++ b/rbi/workos/api_key_created_data_owner.rbi @@ -0,0 +1,30 @@ +# 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..32662250 --- /dev/null +++ b/rbi/workos/api_key_owner.rbi @@ -0,0 +1,30 @@ +# 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..022de35c --- /dev/null +++ b/rbi/workos/api_key_revoked.rbi @@ -0,0 +1,54 @@ +# 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..2fe10d3a --- /dev/null +++ b/rbi/workos/api_key_revoked_data.rbi @@ -0,0 +1,72 @@ +# 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..03aa89ee --- /dev/null +++ b/rbi/workos/api_key_revoked_data_owner.rbi @@ -0,0 +1,30 @@ +# 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..1b691a1f --- /dev/null +++ b/rbi/workos/api_key_validation_response.rbi @@ -0,0 +1,24 @@ +# 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..6519584f --- /dev/null +++ b/rbi/workos/api_key_with_value.rbi @@ -0,0 +1,78 @@ +# 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..4dcca49b --- /dev/null +++ b/rbi/workos/api_key_with_value_owner.rbi @@ -0,0 +1,30 @@ +# 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..059df93a --- /dev/null +++ b/rbi/workos/api_keys.rbi @@ -0,0 +1,51 @@ +# 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..2f9228e9 --- /dev/null +++ b/rbi/workos/application_credentials_list_item.rbi @@ -0,0 +1,54 @@ +# 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..d359992d --- /dev/null +++ b/rbi/workos/assign_role.rbi @@ -0,0 +1,42 @@ +# 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_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 new file mode 100644 index 00000000..b660bb20 --- /dev/null +++ b/rbi/workos/audit_log_configuration.rbi @@ -0,0 +1,42 @@ +# 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..e0129929 --- /dev/null +++ b/rbi/workos/audit_log_configuration_log_stream.rbi @@ -0,0 +1,48 @@ +# 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..885bba72 --- /dev/null +++ b/rbi/workos/audit_log_event.rbi @@ -0,0 +1,60 @@ +# 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..b2338729 --- /dev/null +++ b/rbi/workos/audit_log_event_actor.rbi @@ -0,0 +1,42 @@ +# 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..5585a178 --- /dev/null +++ b/rbi/workos/audit_log_event_context.rbi @@ -0,0 +1,30 @@ +# 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..c7021b8f --- /dev/null +++ b/rbi/workos/audit_log_event_create_response.rbi @@ -0,0 +1,24 @@ +# 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..52d94203 --- /dev/null +++ b/rbi/workos/audit_log_event_ingestion.rbi @@ -0,0 +1,30 @@ +# 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..b8e7237d --- /dev/null +++ b/rbi/workos/audit_log_event_target.rbi @@ -0,0 +1,42 @@ +# 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..7b6f2cee --- /dev/null +++ b/rbi/workos/audit_log_export_creation.rbi @@ -0,0 +1,66 @@ +# 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_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 new file mode 100644 index 00000000..580253b6 --- /dev/null +++ b/rbi/workos/audit_log_schema.rbi @@ -0,0 +1,36 @@ +# 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(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(T::Hash[Symbol, T.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..2ee5202c --- /dev/null +++ b/rbi/workos/audit_log_schema_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 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_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 new file mode 100644 index 00000000..8cc049e8 --- /dev/null +++ b/rbi/workos/audit_log_schema_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 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..b022e197 --- /dev/null +++ b/rbi/workos/audit_logs.rbi @@ -0,0 +1,96 @@ +# 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::AuditLogsRetentionJson) + 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::AuditLogsRetentionJson) + 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::AuditLogActionJson]) + 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::AuditLogSchemaJson]) + 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::AuditLogSchemaJson) + 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::AuditLogExportJson) + 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::AuditLogExportJson) + 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/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 new file mode 100644 index 00000000..9c64547e --- /dev/null +++ b/rbi/workos/authenticate_response.rbi @@ -0,0 +1,66 @@ +# 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..6ce8467b --- /dev/null +++ b/rbi/workos/authenticate_response_impersonator.rbi @@ -0,0 +1,30 @@ +# 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..856dc88e --- /dev/null +++ b/rbi/workos/authenticate_response_oauth_token.rbi @@ -0,0 +1,48 @@ +# 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..cebdd598 --- /dev/null +++ b/rbi/workos/authentication_challenge.rbi @@ -0,0 +1,60 @@ +# 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..6b9b39d6 --- /dev/null +++ b/rbi/workos/authentication_challenge_verify_response.rbi @@ -0,0 +1,30 @@ +# 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..03970967 --- /dev/null +++ b/rbi/workos/authentication_challenges_verify_request.rbi @@ -0,0 +1,24 @@ +# 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..5e0f6388 --- /dev/null +++ b/rbi/workos/authentication_email_verification_failed.rbi @@ -0,0 +1,54 @@ +# 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..ccf21d39 --- /dev/null +++ b/rbi/workos/authentication_email_verification_failed_data.rbi @@ -0,0 +1,60 @@ +# 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..9da0cfe1 --- /dev/null +++ b/rbi/workos/authentication_email_verification_failed_data_error.rbi @@ -0,0 +1,30 @@ +# 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..50831892 --- /dev/null +++ b/rbi/workos/authentication_email_verification_succeeded.rbi @@ -0,0 +1,54 @@ +# 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..1ede1392 --- /dev/null +++ b/rbi/workos/authentication_email_verification_succeeded_data.rbi @@ -0,0 +1,54 @@ +# 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..5f5ddd71 --- /dev/null +++ b/rbi/workos/authentication_factor.rbi @@ -0,0 +1,66 @@ +# 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..ebbcf833 --- /dev/null +++ b/rbi/workos/authentication_factor_enrolled.rbi @@ -0,0 +1,66 @@ +# 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..356a39c0 --- /dev/null +++ b/rbi/workos/authentication_factor_enrolled_sms.rbi @@ -0,0 +1,24 @@ +# 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..b8c30ccf --- /dev/null +++ b/rbi/workos/authentication_factor_enrolled_totp.rbi @@ -0,0 +1,48 @@ +# 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..03e79bbd --- /dev/null +++ b/rbi/workos/authentication_factor_sms.rbi @@ -0,0 +1,24 @@ +# 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..7553d31c --- /dev/null +++ b/rbi/workos/authentication_factor_totp.rbi @@ -0,0 +1,30 @@ +# 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..66d39735 --- /dev/null +++ b/rbi/workos/authentication_factors_create_request.rbi @@ -0,0 +1,48 @@ +# 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..56dc51ef --- /dev/null +++ b/rbi/workos/authentication_magic_auth_failed.rbi @@ -0,0 +1,54 @@ +# 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..6dabd36c --- /dev/null +++ b/rbi/workos/authentication_magic_auth_failed_data.rbi @@ -0,0 +1,60 @@ +# 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..322bcb88 --- /dev/null +++ b/rbi/workos/authentication_magic_auth_failed_data_error.rbi @@ -0,0 +1,30 @@ +# 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..51d53e57 --- /dev/null +++ b/rbi/workos/authentication_magic_auth_succeeded.rbi @@ -0,0 +1,54 @@ +# 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..ed155614 --- /dev/null +++ b/rbi/workos/authentication_magic_auth_succeeded_data.rbi @@ -0,0 +1,54 @@ +# 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..4352dd45 --- /dev/null +++ b/rbi/workos/authentication_mfa_failed.rbi @@ -0,0 +1,54 @@ +# 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..5f2997cd --- /dev/null +++ b/rbi/workos/authentication_mfa_failed_data.rbi @@ -0,0 +1,60 @@ +# 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..624541ab --- /dev/null +++ b/rbi/workos/authentication_mfa_failed_data_error.rbi @@ -0,0 +1,30 @@ +# 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..105895fe --- /dev/null +++ b/rbi/workos/authentication_mfa_succeeded.rbi @@ -0,0 +1,54 @@ +# 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..309ff5c5 --- /dev/null +++ b/rbi/workos/authentication_mfa_succeeded_data.rbi @@ -0,0 +1,54 @@ +# 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..f10b076c --- /dev/null +++ b/rbi/workos/authentication_oauth_failed.rbi @@ -0,0 +1,54 @@ +# 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..6b90714b --- /dev/null +++ b/rbi/workos/authentication_oauth_failed_data.rbi @@ -0,0 +1,60 @@ +# 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..c4d32d63 --- /dev/null +++ b/rbi/workos/authentication_oauth_failed_data_error.rbi @@ -0,0 +1,30 @@ +# 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..bb768038 --- /dev/null +++ b/rbi/workos/authentication_oauth_succeeded.rbi @@ -0,0 +1,54 @@ +# 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..94cb8314 --- /dev/null +++ b/rbi/workos/authentication_oauth_succeeded_data.rbi @@ -0,0 +1,54 @@ +# 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..b8986307 --- /dev/null +++ b/rbi/workos/authentication_passkey_failed.rbi @@ -0,0 +1,54 @@ +# 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..66db1035 --- /dev/null +++ b/rbi/workos/authentication_passkey_failed_data.rbi @@ -0,0 +1,60 @@ +# 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..ba6848e5 --- /dev/null +++ b/rbi/workos/authentication_passkey_failed_data_error.rbi @@ -0,0 +1,30 @@ +# 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..ccebdc2d --- /dev/null +++ b/rbi/workos/authentication_passkey_succeeded.rbi @@ -0,0 +1,54 @@ +# 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..fab857e8 --- /dev/null +++ b/rbi/workos/authentication_passkey_succeeded_data.rbi @@ -0,0 +1,54 @@ +# 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..bbc2c357 --- /dev/null +++ b/rbi/workos/authentication_password_failed.rbi @@ -0,0 +1,54 @@ +# 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..58ee2873 --- /dev/null +++ b/rbi/workos/authentication_password_failed_data.rbi @@ -0,0 +1,60 @@ +# 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..7c66c25b --- /dev/null +++ b/rbi/workos/authentication_password_failed_data_error.rbi @@ -0,0 +1,30 @@ +# 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..d12b4370 --- /dev/null +++ b/rbi/workos/authentication_password_succeeded.rbi @@ -0,0 +1,54 @@ +# 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..a25c726b --- /dev/null +++ b/rbi/workos/authentication_password_succeeded_data.rbi @@ -0,0 +1,54 @@ +# 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..3ec81b68 --- /dev/null +++ b/rbi/workos/authentication_radar_risk_detected.rbi @@ -0,0 +1,54 @@ +# 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..6bf908c2 --- /dev/null +++ b/rbi/workos/authentication_radar_risk_detected_data.rbi @@ -0,0 +1,66 @@ +# 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..1177cc10 --- /dev/null +++ b/rbi/workos/authentication_sso_failed.rbi @@ -0,0 +1,54 @@ +# 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..8d72f477 --- /dev/null +++ b/rbi/workos/authentication_sso_failed_data.rbi @@ -0,0 +1,66 @@ +# 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..3b44cd20 --- /dev/null +++ b/rbi/workos/authentication_sso_failed_data_error.rbi @@ -0,0 +1,30 @@ +# 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..44c4f139 --- /dev/null +++ b/rbi/workos/authentication_sso_failed_data_sso.rbi @@ -0,0 +1,36 @@ +# 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..6707b6b6 --- /dev/null +++ b/rbi/workos/authentication_sso_started.rbi @@ -0,0 +1,54 @@ +# 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..1eadea6a --- /dev/null +++ b/rbi/workos/authentication_sso_started_data.rbi @@ -0,0 +1,60 @@ +# 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..a60da2b2 --- /dev/null +++ b/rbi/workos/authentication_sso_started_data_sso.rbi @@ -0,0 +1,36 @@ +# 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..8e1a6d42 --- /dev/null +++ b/rbi/workos/authentication_sso_succeeded.rbi @@ -0,0 +1,54 @@ +# 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..af057ca5 --- /dev/null +++ b/rbi/workos/authentication_sso_succeeded_data.rbi @@ -0,0 +1,60 @@ +# 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..0f3672d0 --- /dev/null +++ b/rbi/workos/authentication_sso_succeeded_data_sso.rbi @@ -0,0 +1,36 @@ +# 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..d1fa6656 --- /dev/null +++ b/rbi/workos/authentication_sso_timed_out.rbi @@ -0,0 +1,54 @@ +# 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..3b434681 --- /dev/null +++ b/rbi/workos/authentication_sso_timed_out_data.rbi @@ -0,0 +1,66 @@ +# 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..65188269 --- /dev/null +++ b/rbi/workos/authentication_sso_timed_out_data_error.rbi @@ -0,0 +1,30 @@ +# 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..0e6ce663 --- /dev/null +++ b/rbi/workos/authentication_sso_timed_out_data_sso.rbi @@ -0,0 +1,36 @@ +# 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..6e2c1cda --- /dev/null +++ b/rbi/workos/authorization.rbi @@ -0,0 +1,414 @@ +# 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..61461282 --- /dev/null +++ b/rbi/workos/authorization_check.rbi @@ -0,0 +1,24 @@ +# 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..bbd4696e --- /dev/null +++ b/rbi/workos/authorization_code_session_authenticate_request.rbi @@ -0,0 +1,72 @@ +# 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..8dee7e9b --- /dev/null +++ b/rbi/workos/authorization_permission.rbi @@ -0,0 +1,72 @@ +# 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..608d99c6 --- /dev/null +++ b/rbi/workos/authorization_resource.rbi @@ -0,0 +1,78 @@ +# 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..3c60be86 --- /dev/null +++ b/rbi/workos/authorized_connect_application_list_data.rbi @@ -0,0 +1,48 @@ +# 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/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/challenge_authentication_factor.rbi b/rbi/workos/challenge_authentication_factor.rbi new file mode 100644 index 00000000..d0acd989 --- /dev/null +++ b/rbi/workos/challenge_authentication_factor.rbi @@ -0,0 +1,24 @@ +# 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..7efd4e8d --- /dev/null +++ b/rbi/workos/check_authorization.rbi @@ -0,0 +1,42 @@ +# 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..0282b224 --- /dev/null +++ b/rbi/workos/client.rbi @@ -0,0 +1,61 @@ +# 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/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/confirm_email_change.rbi b/rbi/workos/confirm_email_change.rbi new file mode 100644 index 00000000..249f59a2 --- /dev/null +++ b/rbi/workos/confirm_email_change.rbi @@ -0,0 +1,24 @@ +# 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..d7179206 --- /dev/null +++ b/rbi/workos/connect.rbi @@ -0,0 +1,102 @@ +# 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..dd7f4488 --- /dev/null +++ b/rbi/workos/connect_application.rbi @@ -0,0 +1,78 @@ +# 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..ccc12a54 --- /dev/null +++ b/rbi/workos/connected_account.rbi @@ -0,0 +1,66 @@ +# 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..2affbc25 --- /dev/null +++ b/rbi/workos/connection.rbi @@ -0,0 +1,84 @@ +# 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..7c0323ef --- /dev/null +++ b/rbi/workos/connection_activated.rbi @@ -0,0 +1,54 @@ +# 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..e7340347 --- /dev/null +++ b/rbi/workos/connection_activated_data.rbi @@ -0,0 +1,84 @@ +# 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..650f4b76 --- /dev/null +++ b/rbi/workos/connection_activated_data_domain.rbi @@ -0,0 +1,36 @@ +# 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..c0fd502c --- /dev/null +++ b/rbi/workos/connection_deactivated.rbi @@ -0,0 +1,54 @@ +# 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..c3ceb14b --- /dev/null +++ b/rbi/workos/connection_deactivated_data.rbi @@ -0,0 +1,84 @@ +# 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..f2450a5d --- /dev/null +++ b/rbi/workos/connection_deactivated_data_domain.rbi @@ -0,0 +1,36 @@ +# 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..628720ce --- /dev/null +++ b/rbi/workos/connection_deleted.rbi @@ -0,0 +1,54 @@ +# 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..5c860805 --- /dev/null +++ b/rbi/workos/connection_deleted_data.rbi @@ -0,0 +1,66 @@ +# 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..1ec9c344 --- /dev/null +++ b/rbi/workos/connection_domain.rbi @@ -0,0 +1,36 @@ +# 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..42fc29f3 --- /dev/null +++ b/rbi/workos/connection_option.rbi @@ -0,0 +1,24 @@ +# 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..66696e2f --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewal_required.rbi @@ -0,0 +1,54 @@ +# 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..f33fcf8c --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewal_required_data.rbi @@ -0,0 +1,36 @@ +# 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..ec3bdf4a --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewal_required_data_certificate.rbi @@ -0,0 +1,36 @@ +# 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..004e3b22 --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewal_required_data_connection.rbi @@ -0,0 +1,30 @@ +# 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..74a32493 --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewed.rbi @@ -0,0 +1,54 @@ +# 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..5a2806ed --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewed_data.rbi @@ -0,0 +1,36 @@ +# 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..829436c6 --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewed_data_certificate.rbi @@ -0,0 +1,30 @@ +# 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..4ed4df06 --- /dev/null +++ b/rbi/workos/connection_saml_certificate_renewed_data_connection.rbi @@ -0,0 +1,30 @@ +# 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..7699305c --- /dev/null +++ b/rbi/workos/cors_origin_response.rbi @@ -0,0 +1,48 @@ +# 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..14067768 --- /dev/null +++ b/rbi/workos/create_application_secret.rbi @@ -0,0 +1,18 @@ +# 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..872439a9 --- /dev/null +++ b/rbi/workos/create_authorization_permission.rbi @@ -0,0 +1,42 @@ +# 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..96810bc2 --- /dev/null +++ b/rbi/workos/create_authorization_resource.rbi @@ -0,0 +1,66 @@ +# 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..6679dee4 --- /dev/null +++ b/rbi/workos/create_cors_origin.rbi @@ -0,0 +1,24 @@ +# 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..53bf736a --- /dev/null +++ b/rbi/workos/create_m2m_application.rbi @@ -0,0 +1,48 @@ +# 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..55e625c4 --- /dev/null +++ b/rbi/workos/create_magic_code_and_return.rbi @@ -0,0 +1,30 @@ +# 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..8fff4ca8 --- /dev/null +++ b/rbi/workos/create_oauth_application.rbi @@ -0,0 +1,66 @@ +# 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..26502f63 --- /dev/null +++ b/rbi/workos/create_organization_api_key.rbi @@ -0,0 +1,30 @@ +# 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..c7db689a --- /dev/null +++ b/rbi/workos/create_organization_domain.rbi @@ -0,0 +1,30 @@ +# 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..6328349d --- /dev/null +++ b/rbi/workos/create_organization_role.rbi @@ -0,0 +1,42 @@ +# 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..0d9220c6 --- /dev/null +++ b/rbi/workos/create_password_reset.rbi @@ -0,0 +1,30 @@ +# 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..b6cedb02 --- /dev/null +++ b/rbi/workos/create_password_reset_token.rbi @@ -0,0 +1,24 @@ +# 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..5373598a --- /dev/null +++ b/rbi/workos/create_redirect_uri.rbi @@ -0,0 +1,24 @@ +# 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..92e9af9a --- /dev/null +++ b/rbi/workos/create_role.rbi @@ -0,0 +1,42 @@ +# 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..74d7b3b1 --- /dev/null +++ b/rbi/workos/create_user.rbi @@ -0,0 +1,72 @@ +# 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..fa6a6af2 --- /dev/null +++ b/rbi/workos/create_user_invite_options.rbi @@ -0,0 +1,54 @@ +# 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..8f70fa39 --- /dev/null +++ b/rbi/workos/create_user_organization_membership.rbi @@ -0,0 +1,42 @@ +# 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..3950b34b --- /dev/null +++ b/rbi/workos/create_webhook_endpoint.rbi @@ -0,0 +1,30 @@ +# 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..2320dd34 --- /dev/null +++ b/rbi/workos/data_integration_access_token_response.rbi @@ -0,0 +1,36 @@ +# 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..a7678930 --- /dev/null +++ b/rbi/workos/data_integration_access_token_response_access_token.rbi @@ -0,0 +1,48 @@ +# 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..5c3e7729 --- /dev/null +++ b/rbi/workos/data_integration_authorize_url_response.rbi @@ -0,0 +1,24 @@ +# 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..5b1ab5b9 --- /dev/null +++ b/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi @@ -0,0 +1,36 @@ +# 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..bad71270 --- /dev/null +++ b/rbi/workos/data_integrations_get_user_token_request.rbi @@ -0,0 +1,30 @@ +# 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..72ae7976 --- /dev/null +++ b/rbi/workos/data_integrations_list_response.rbi @@ -0,0 +1,30 @@ +# 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..a796f906 --- /dev/null +++ b/rbi/workos/data_integrations_list_response_data.rbi @@ -0,0 +1,90 @@ +# 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..9799b3b7 --- /dev/null +++ b/rbi/workos/data_integrations_list_response_data_connected_account.rbi @@ -0,0 +1,72 @@ +# 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..630bee1a --- /dev/null +++ b/rbi/workos/device_authorization_response.rbi @@ -0,0 +1,54 @@ +# 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..d9532902 --- /dev/null +++ b/rbi/workos/device_code_session_authenticate_request.rbi @@ -0,0 +1,54 @@ +# 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..e1572880 --- /dev/null +++ b/rbi/workos/directory.rbi @@ -0,0 +1,84 @@ +# 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..1391c5a1 --- /dev/null +++ b/rbi/workos/directory_group.rbi @@ -0,0 +1,72 @@ +# 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..e88d8de6 --- /dev/null +++ b/rbi/workos/directory_metadata.rbi @@ -0,0 +1,30 @@ +# 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..5d637da2 --- /dev/null +++ b/rbi/workos/directory_metadata_user.rbi @@ -0,0 +1,30 @@ +# 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..c4985c8e --- /dev/null +++ b/rbi/workos/directory_sync.rbi @@ -0,0 +1,85 @@ +# 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..baaaaa95 --- /dev/null +++ b/rbi/workos/directory_user.rbi @@ -0,0 +1,126 @@ +# 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..01ca0061 --- /dev/null +++ b/rbi/workos/directory_user_email.rbi @@ -0,0 +1,36 @@ +# 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..55fba4d7 --- /dev/null +++ b/rbi/workos/directory_user_with_groups.rbi @@ -0,0 +1,132 @@ +# 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..2864e702 --- /dev/null +++ b/rbi/workos/directory_user_with_groups_email.rbi @@ -0,0 +1,36 @@ +# 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..8c74eaea --- /dev/null +++ b/rbi/workos/dsync_activated.rbi @@ -0,0 +1,54 @@ +# 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..2e382cf4 --- /dev/null +++ b/rbi/workos/dsync_activated_data.rbi @@ -0,0 +1,78 @@ +# 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..d19530fd --- /dev/null +++ b/rbi/workos/dsync_activated_data_domain.rbi @@ -0,0 +1,36 @@ +# 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..51bf08cb --- /dev/null +++ b/rbi/workos/dsync_deactivated.rbi @@ -0,0 +1,54 @@ +# 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..056bc3f5 --- /dev/null +++ b/rbi/workos/dsync_deactivated_data.rbi @@ -0,0 +1,78 @@ +# 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..c8f60862 --- /dev/null +++ b/rbi/workos/dsync_deactivated_data_domain.rbi @@ -0,0 +1,36 @@ +# 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..705080e9 --- /dev/null +++ b/rbi/workos/dsync_deleted.rbi @@ -0,0 +1,54 @@ +# 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..97cdf3b0 --- /dev/null +++ b/rbi/workos/dsync_deleted_data.rbi @@ -0,0 +1,66 @@ +# 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..57ab9d28 --- /dev/null +++ b/rbi/workos/dsync_group_created.rbi @@ -0,0 +1,54 @@ +# 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..6d62a1c0 --- /dev/null +++ b/rbi/workos/dsync_group_deleted.rbi @@ -0,0 +1,54 @@ +# 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..e190600e --- /dev/null +++ b/rbi/workos/dsync_group_updated.rbi @@ -0,0 +1,54 @@ +# 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..0a1c6838 --- /dev/null +++ b/rbi/workos/dsync_group_updated_data.rbi @@ -0,0 +1,78 @@ +# 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..b1a55cf3 --- /dev/null +++ b/rbi/workos/dsync_group_user_added.rbi @@ -0,0 +1,54 @@ +# 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..fcb1a232 --- /dev/null +++ b/rbi/workos/dsync_group_user_added_data.rbi @@ -0,0 +1,36 @@ +# 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..1756b81b --- /dev/null +++ b/rbi/workos/dsync_group_user_removed.rbi @@ -0,0 +1,54 @@ +# 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..c21f46d0 --- /dev/null +++ b/rbi/workos/dsync_group_user_removed_data.rbi @@ -0,0 +1,36 @@ +# 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..8a0d78a4 --- /dev/null +++ b/rbi/workos/dsync_user_created.rbi @@ -0,0 +1,54 @@ +# 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..7d2151c9 --- /dev/null +++ b/rbi/workos/dsync_user_deleted.rbi @@ -0,0 +1,54 @@ +# 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..888d2261 --- /dev/null +++ b/rbi/workos/dsync_user_updated.rbi @@ -0,0 +1,54 @@ +# 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..a96b6925 --- /dev/null +++ b/rbi/workos/dsync_user_updated_data.rbi @@ -0,0 +1,132 @@ +# 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..642f4ac5 --- /dev/null +++ b/rbi/workos/dsync_user_updated_data_email.rbi @@ -0,0 +1,36 @@ +# 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..b0aa8bbf --- /dev/null +++ b/rbi/workos/email_change.rbi @@ -0,0 +1,48 @@ +# 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..bbfe547d --- /dev/null +++ b/rbi/workos/email_change_confirmation.rbi @@ -0,0 +1,30 @@ +# 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..67fbca88 --- /dev/null +++ b/rbi/workos/email_change_confirmation_user.rbi @@ -0,0 +1,96 @@ +# 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..93206900 --- /dev/null +++ b/rbi/workos/email_verification.rbi @@ -0,0 +1,66 @@ +# 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..7078be32 --- /dev/null +++ b/rbi/workos/email_verification_code_session_authenticate_request.rbi @@ -0,0 +1,66 @@ +# 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..43d1aadd --- /dev/null +++ b/rbi/workos/email_verification_created.rbi @@ -0,0 +1,54 @@ +# 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..663199e0 --- /dev/null +++ b/rbi/workos/email_verification_created_data.rbi @@ -0,0 +1,60 @@ +# 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/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/enroll_user_authentication_factor.rbi b/rbi/workos/enroll_user_authentication_factor.rbi new file mode 100644 index 00000000..76de94ae --- /dev/null +++ b/rbi/workos/enroll_user_authentication_factor.rbi @@ -0,0 +1,42 @@ +# 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/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/event_context.rbi b/rbi/workos/event_context.rbi new file mode 100644 index 00000000..9948c962 --- /dev/null +++ b/rbi/workos/event_context.rbi @@ -0,0 +1,54 @@ +# 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..8ec23b7e --- /dev/null +++ b/rbi/workos/event_context_actor.rbi @@ -0,0 +1,36 @@ +# 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..1821df41 --- /dev/null +++ b/rbi/workos/event_context_google_analytics_session.rbi @@ -0,0 +1,36 @@ +# 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..7e920ef6 --- /dev/null +++ b/rbi/workos/event_list_list_metadata.rbi @@ -0,0 +1,24 @@ +# 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..455ee748 --- /dev/null +++ b/rbi/workos/event_schema.rbi @@ -0,0 +1,54 @@ +# 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..d1b75791 --- /dev/null +++ b/rbi/workos/events.rbi @@ -0,0 +1,28 @@ +# 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..f0372b89 --- /dev/null +++ b/rbi/workos/external_auth_complete_response.rbi @@ -0,0 +1,24 @@ +# 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..4adb5bd9 --- /dev/null +++ b/rbi/workos/feature_flag.rbi @@ -0,0 +1,84 @@ +# 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..e0656831 --- /dev/null +++ b/rbi/workos/feature_flag_owner.rbi @@ -0,0 +1,36 @@ +# 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..7c31cbfc --- /dev/null +++ b/rbi/workos/feature_flags.rbi @@ -0,0 +1,90 @@ +# 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..ee3b1660 --- /dev/null +++ b/rbi/workos/flag.rbi @@ -0,0 +1,84 @@ +# 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..23af0ef9 --- /dev/null +++ b/rbi/workos/flag_created.rbi @@ -0,0 +1,54 @@ +# 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..420606da --- /dev/null +++ b/rbi/workos/flag_created_context.rbi @@ -0,0 +1,30 @@ +# 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..80c98994 --- /dev/null +++ b/rbi/workos/flag_created_context_actor.rbi @@ -0,0 +1,36 @@ +# 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..e93594e2 --- /dev/null +++ b/rbi/workos/flag_created_data.rbi @@ -0,0 +1,90 @@ +# 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..22ac1afd --- /dev/null +++ b/rbi/workos/flag_created_data_owner.rbi @@ -0,0 +1,36 @@ +# 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..59b473d4 --- /dev/null +++ b/rbi/workos/flag_deleted.rbi @@ -0,0 +1,54 @@ +# 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..e7ef6ee4 --- /dev/null +++ b/rbi/workos/flag_deleted_context.rbi @@ -0,0 +1,30 @@ +# 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..487b4572 --- /dev/null +++ b/rbi/workos/flag_deleted_context_actor.rbi @@ -0,0 +1,36 @@ +# 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..dffb387b --- /dev/null +++ b/rbi/workos/flag_deleted_data.rbi @@ -0,0 +1,90 @@ +# 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..3f596dd7 --- /dev/null +++ b/rbi/workos/flag_deleted_data_owner.rbi @@ -0,0 +1,36 @@ +# 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..c03cc037 --- /dev/null +++ b/rbi/workos/flag_owner.rbi @@ -0,0 +1,36 @@ +# 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..8f8f68d2 --- /dev/null +++ b/rbi/workos/flag_rule_updated.rbi @@ -0,0 +1,54 @@ +# 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..93d58644 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context.rbi @@ -0,0 +1,48 @@ +# 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..274ad954 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_actor.rbi @@ -0,0 +1,36 @@ +# 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..e98cf9ab --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_configured_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 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..b396d686 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_configured_target_organization.rbi @@ -0,0 +1,30 @@ +# 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..8b472f74 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_configured_target_user.rbi @@ -0,0 +1,30 @@ +# 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..8b781870 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute.rbi @@ -0,0 +1,30 @@ +# 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..3c3504cf --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context.rbi @@ -0,0 +1,30 @@ +# 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..2ded502d --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_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 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..8512965d --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_organization.rbi @@ -0,0 +1,30 @@ +# 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..b39c98b3 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_context_configured_target_user.rbi @@ -0,0 +1,30 @@ +# 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..3923ada8 --- /dev/null +++ b/rbi/workos/flag_rule_updated_context_previous_attribute_data.rbi @@ -0,0 +1,30 @@ +# 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..fccc290e --- /dev/null +++ b/rbi/workos/flag_rule_updated_data.rbi @@ -0,0 +1,90 @@ +# 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..188638c2 --- /dev/null +++ b/rbi/workos/flag_rule_updated_data_owner.rbi @@ -0,0 +1,36 @@ +# 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..82be340b --- /dev/null +++ b/rbi/workos/flag_updated.rbi @@ -0,0 +1,54 @@ +# 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..7a54833d --- /dev/null +++ b/rbi/workos/flag_updated_context.rbi @@ -0,0 +1,36 @@ +# 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..fa3ecefa --- /dev/null +++ b/rbi/workos/flag_updated_context_actor.rbi @@ -0,0 +1,36 @@ +# 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..6a9e1deb --- /dev/null +++ b/rbi/workos/flag_updated_context_previous_attribute.rbi @@ -0,0 +1,24 @@ +# 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..edab5b5f --- /dev/null +++ b/rbi/workos/flag_updated_context_previous_attribute_data.rbi @@ -0,0 +1,48 @@ +# 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..a7b477a3 --- /dev/null +++ b/rbi/workos/flag_updated_data.rbi @@ -0,0 +1,90 @@ +# 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..3489ad4d --- /dev/null +++ b/rbi/workos/flag_updated_data_owner.rbi @@ -0,0 +1,36 @@ +# 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..cb3d4bc7 --- /dev/null +++ b/rbi/workos/generate_link.rbi @@ -0,0 +1,54 @@ +# 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..ff7fda30 --- /dev/null +++ b/rbi/workos/group.rbi @@ -0,0 +1,60 @@ +# 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..5785c0fa --- /dev/null +++ b/rbi/workos/group_created.rbi @@ -0,0 +1,54 @@ +# 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..0f10e4f8 --- /dev/null +++ b/rbi/workos/group_deleted.rbi @@ -0,0 +1,54 @@ +# 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..30d370e5 --- /dev/null +++ b/rbi/workos/group_member_added.rbi @@ -0,0 +1,54 @@ +# 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..668dd0a1 --- /dev/null +++ b/rbi/workos/group_member_added_data.rbi @@ -0,0 +1,30 @@ +# 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..59a49f71 --- /dev/null +++ b/rbi/workos/group_member_removed.rbi @@ -0,0 +1,54 @@ +# 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..ea493d12 --- /dev/null +++ b/rbi/workos/group_member_removed_data.rbi @@ -0,0 +1,30 @@ +# 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..454691bb --- /dev/null +++ b/rbi/workos/group_updated.rbi @@ -0,0 +1,54 @@ +# 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/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/intent_options.rbi b/rbi/workos/intent_options.rbi new file mode 100644 index 00000000..e8c68c59 --- /dev/null +++ b/rbi/workos/intent_options.rbi @@ -0,0 +1,24 @@ +# 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..4ce15d01 --- /dev/null +++ b/rbi/workos/invitation.rbi @@ -0,0 +1,102 @@ +# 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..8138556f --- /dev/null +++ b/rbi/workos/invitation_accepted.rbi @@ -0,0 +1,54 @@ +# 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..56f976ed --- /dev/null +++ b/rbi/workos/invitation_accepted_data.rbi @@ -0,0 +1,90 @@ +# 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..c9c6eb69 --- /dev/null +++ b/rbi/workos/invitation_created.rbi @@ -0,0 +1,54 @@ +# 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..dfbdb553 --- /dev/null +++ b/rbi/workos/invitation_created_data.rbi @@ -0,0 +1,90 @@ +# 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..8edb243e --- /dev/null +++ b/rbi/workos/invitation_resent.rbi @@ -0,0 +1,54 @@ +# 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..07f8f4f8 --- /dev/null +++ b/rbi/workos/invitation_resent_data.rbi @@ -0,0 +1,90 @@ +# 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..220b34c8 --- /dev/null +++ b/rbi/workos/invitation_revoked.rbi @@ -0,0 +1,54 @@ +# 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..88e5f945 --- /dev/null +++ b/rbi/workos/invitation_revoked_data.rbi @@ -0,0 +1,90 @@ +# 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..64351f36 --- /dev/null +++ b/rbi/workos/jwks_response.rbi @@ -0,0 +1,24 @@ +# 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..af12afd0 --- /dev/null +++ b/rbi/workos/jwks_response_keys.rbi @@ -0,0 +1,66 @@ +# 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..11687fff --- /dev/null +++ b/rbi/workos/jwt_template_response.rbi @@ -0,0 +1,42 @@ +# 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..a2e26f75 --- /dev/null +++ b/rbi/workos/magic_auth.rbi @@ -0,0 +1,66 @@ +# 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..36442669 --- /dev/null +++ b/rbi/workos/magic_auth_code_session_authenticate_request.rbi @@ -0,0 +1,72 @@ +# 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..a89fecb1 --- /dev/null +++ b/rbi/workos/magic_auth_created.rbi @@ -0,0 +1,54 @@ +# 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..df9436fe --- /dev/null +++ b/rbi/workos/magic_auth_created_data.rbi @@ -0,0 +1,60 @@ +# 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..0d410bb9 --- /dev/null +++ b/rbi/workos/mfa_totp_session_authenticate_request.rbi @@ -0,0 +1,72 @@ +# 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..5ffb9677 --- /dev/null +++ b/rbi/workos/multi_factor_auth.rbi @@ -0,0 +1,83 @@ +# 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..1435ed6d --- /dev/null +++ b/rbi/workos/new_connect_application_secret.rbi @@ -0,0 +1,60 @@ +# 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..1443290b --- /dev/null +++ b/rbi/workos/organization.rbi @@ -0,0 +1,78 @@ +# 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..6bc18228 --- /dev/null +++ b/rbi/workos/organization_created.rbi @@ -0,0 +1,54 @@ +# 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..c24a180b --- /dev/null +++ b/rbi/workos/organization_created_data.rbi @@ -0,0 +1,72 @@ +# 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..c1e6f37a --- /dev/null +++ b/rbi/workos/organization_created_data_domain.rbi @@ -0,0 +1,78 @@ +# 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..5ac4a868 --- /dev/null +++ b/rbi/workos/organization_deleted.rbi @@ -0,0 +1,54 @@ +# 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..933b5656 --- /dev/null +++ b/rbi/workos/organization_deleted_data.rbi @@ -0,0 +1,72 @@ +# 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..40a235a1 --- /dev/null +++ b/rbi/workos/organization_deleted_data_domain.rbi @@ -0,0 +1,78 @@ +# 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..4776a2ce --- /dev/null +++ b/rbi/workos/organization_domain.rbi @@ -0,0 +1,78 @@ +# 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..6c718835 --- /dev/null +++ b/rbi/workos/organization_domain_created.rbi @@ -0,0 +1,54 @@ +# 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..e67f729a --- /dev/null +++ b/rbi/workos/organization_domain_created_data.rbi @@ -0,0 +1,78 @@ +# 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..66c0a19b --- /dev/null +++ b/rbi/workos/organization_domain_data.rbi @@ -0,0 +1,30 @@ +# 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..dc844e3a --- /dev/null +++ b/rbi/workos/organization_domain_deleted.rbi @@ -0,0 +1,54 @@ +# 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..cb6a7fe1 --- /dev/null +++ b/rbi/workos/organization_domain_deleted_data.rbi @@ -0,0 +1,78 @@ +# 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..950db190 --- /dev/null +++ b/rbi/workos/organization_domain_stand_alone.rbi @@ -0,0 +1,78 @@ +# 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..e9fd3033 --- /dev/null +++ b/rbi/workos/organization_domain_updated.rbi @@ -0,0 +1,54 @@ +# 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..03b90221 --- /dev/null +++ b/rbi/workos/organization_domain_updated_data.rbi @@ -0,0 +1,78 @@ +# 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..2967eb9d --- /dev/null +++ b/rbi/workos/organization_domain_verification_failed.rbi @@ -0,0 +1,54 @@ +# 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..ccade209 --- /dev/null +++ b/rbi/workos/organization_domain_verification_failed_data.rbi @@ -0,0 +1,30 @@ +# 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..18c2fe7a --- /dev/null +++ b/rbi/workos/organization_domain_verification_failed_data_organization_domain.rbi @@ -0,0 +1,78 @@ +# 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..a5c65205 --- /dev/null +++ b/rbi/workos/organization_domain_verified.rbi @@ -0,0 +1,54 @@ +# 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..ae28c143 --- /dev/null +++ b/rbi/workos/organization_domain_verified_data.rbi @@ -0,0 +1,78 @@ +# 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..36090166 --- /dev/null +++ b/rbi/workos/organization_domains.rbi @@ -0,0 +1,46 @@ +# 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..a86eb591 --- /dev/null +++ b/rbi/workos/organization_input.rbi @@ -0,0 +1,54 @@ +# 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..f51180a2 --- /dev/null +++ b/rbi/workos/organization_membership.rbi @@ -0,0 +1,84 @@ +# 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..6bf7b86d --- /dev/null +++ b/rbi/workos/organization_membership_created.rbi @@ -0,0 +1,54 @@ +# 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..f4151150 --- /dev/null +++ b/rbi/workos/organization_membership_created_data.rbi @@ -0,0 +1,84 @@ +# 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..22741fc1 --- /dev/null +++ b/rbi/workos/organization_membership_deleted.rbi @@ -0,0 +1,54 @@ +# 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..2e44b35e --- /dev/null +++ b/rbi/workos/organization_membership_deleted_data.rbi @@ -0,0 +1,84 @@ +# 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..8dffb228 --- /dev/null +++ b/rbi/workos/organization_membership_updated.rbi @@ -0,0 +1,54 @@ +# 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..4034ab1f --- /dev/null +++ b/rbi/workos/organization_membership_updated_data.rbi @@ -0,0 +1,84 @@ +# 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..fd5227f2 --- /dev/null +++ b/rbi/workos/organization_role_created.rbi @@ -0,0 +1,54 @@ +# 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..bd537837 --- /dev/null +++ b/rbi/workos/organization_role_created_data.rbi @@ -0,0 +1,72 @@ +# 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..b9e48d16 --- /dev/null +++ b/rbi/workos/organization_role_deleted.rbi @@ -0,0 +1,54 @@ +# 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..0b522ccb --- /dev/null +++ b/rbi/workos/organization_role_deleted_data.rbi @@ -0,0 +1,72 @@ +# 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..acbc1660 --- /dev/null +++ b/rbi/workos/organization_role_updated.rbi @@ -0,0 +1,54 @@ +# 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..1f815d66 --- /dev/null +++ b/rbi/workos/organization_role_updated_data.rbi @@ -0,0 +1,72 @@ +# 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..a848fa56 --- /dev/null +++ b/rbi/workos/organization_selection_session_authenticate_request.rbi @@ -0,0 +1,66 @@ +# 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..0cf67fd6 --- /dev/null +++ b/rbi/workos/organization_updated.rbi @@ -0,0 +1,54 @@ +# 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..92b25f60 --- /dev/null +++ b/rbi/workos/organization_updated_data.rbi @@ -0,0 +1,72 @@ +# 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..e237df78 --- /dev/null +++ b/rbi/workos/organization_updated_data_domain.rbi @@ -0,0 +1,78 @@ +# 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..7995e453 --- /dev/null +++ b/rbi/workos/organizations.rbi @@ -0,0 +1,86 @@ +# 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..649b4c24 --- /dev/null +++ b/rbi/workos/password_reset.rbi @@ -0,0 +1,66 @@ +# 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..3001796c --- /dev/null +++ b/rbi/workos/password_reset_created.rbi @@ -0,0 +1,54 @@ +# 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..9ebb64a7 --- /dev/null +++ b/rbi/workos/password_reset_created_data.rbi @@ -0,0 +1,54 @@ +# 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..167f283e --- /dev/null +++ b/rbi/workos/password_reset_succeeded.rbi @@ -0,0 +1,54 @@ +# 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..f4f39942 --- /dev/null +++ b/rbi/workos/password_reset_succeeded_data.rbi @@ -0,0 +1,54 @@ +# 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..bcb0f23e --- /dev/null +++ b/rbi/workos/password_session_authenticate_request.rbi @@ -0,0 +1,72 @@ +# 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/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/permission.rbi b/rbi/workos/permission.rbi new file mode 100644 index 00000000..a1469b13 --- /dev/null +++ b/rbi/workos/permission.rbi @@ -0,0 +1,72 @@ +# 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..94f3d015 --- /dev/null +++ b/rbi/workos/permission_created.rbi @@ -0,0 +1,54 @@ +# 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..878db3b0 --- /dev/null +++ b/rbi/workos/permission_created_data.rbi @@ -0,0 +1,66 @@ +# 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..fc04dc98 --- /dev/null +++ b/rbi/workos/permission_deleted.rbi @@ -0,0 +1,54 @@ +# 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..7949f42d --- /dev/null +++ b/rbi/workos/permission_deleted_data.rbi @@ -0,0 +1,66 @@ +# 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..26e6d11e --- /dev/null +++ b/rbi/workos/permission_updated.rbi @@ -0,0 +1,54 @@ +# 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..87ecff9f --- /dev/null +++ b/rbi/workos/permission_updated_data.rbi @@ -0,0 +1,66 @@ +# 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..3680c7f1 --- /dev/null +++ b/rbi/workos/pipes.rbi @@ -0,0 +1,63 @@ +# 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..4c678fe6 --- /dev/null +++ b/rbi/workos/portal_link_response.rbi @@ -0,0 +1,24 @@ +# 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..fc021e14 --- /dev/null +++ b/rbi/workos/profile.rbi @@ -0,0 +1,102 @@ +# 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/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/radar.rbi b/rbi/workos/radar.rbi new file mode 100644 index 00000000..0ae54330 --- /dev/null +++ b/rbi/workos/radar.rbi @@ -0,0 +1,57 @@ +# 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..d4a61cdb --- /dev/null +++ b/rbi/workos/radar_list_entry_already_present_response.rbi @@ -0,0 +1,24 @@ +# 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..ab905468 --- /dev/null +++ b/rbi/workos/radar_standalone_assess_request.rbi @@ -0,0 +1,60 @@ +# 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..524f530d --- /dev/null +++ b/rbi/workos/radar_standalone_delete_radar_list_entry_request.rbi @@ -0,0 +1,24 @@ +# 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..0affa270 --- /dev/null +++ b/rbi/workos/radar_standalone_response.rbi @@ -0,0 +1,48 @@ +# 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..2cc1ed8a --- /dev/null +++ b/rbi/workos/radar_standalone_update_radar_attempt_request.rbi @@ -0,0 +1,30 @@ +# 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..a1da0421 --- /dev/null +++ b/rbi/workos/radar_standalone_update_radar_list_request.rbi @@ -0,0 +1,24 @@ +# 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..831933c8 --- /dev/null +++ b/rbi/workos/redirect_uri.rbi @@ -0,0 +1,54 @@ +# 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..e836922b --- /dev/null +++ b/rbi/workos/redirect_uri_input.rbi @@ -0,0 +1,30 @@ +# 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..596f2a3a --- /dev/null +++ b/rbi/workos/refresh_token_session_authenticate_request.rbi @@ -0,0 +1,66 @@ +# 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..1c2b3bd0 --- /dev/null +++ b/rbi/workos/remove_role.rbi @@ -0,0 +1,42 @@ +# 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..d2e24c4a --- /dev/null +++ b/rbi/workos/resend_user_invite_options.rbi @@ -0,0 +1,24 @@ +# 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..d4c23b71 --- /dev/null +++ b/rbi/workos/reset_password_response.rbi @@ -0,0 +1,24 @@ +# 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..666aa43c --- /dev/null +++ b/rbi/workos/revoke_session.rbi @@ -0,0 +1,30 @@ +# 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..131dccd8 --- /dev/null +++ b/rbi/workos/role.rbi @@ -0,0 +1,78 @@ +# 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..a5f17a46 --- /dev/null +++ b/rbi/workos/role_assignment.rbi @@ -0,0 +1,54 @@ +# 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..cce0558b --- /dev/null +++ b/rbi/workos/role_assignment_resource.rbi @@ -0,0 +1,36 @@ +# 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..070899e7 --- /dev/null +++ b/rbi/workos/role_created.rbi @@ -0,0 +1,54 @@ +# 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..54beb7df --- /dev/null +++ b/rbi/workos/role_created_data.rbi @@ -0,0 +1,54 @@ +# 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..d75ccd0e --- /dev/null +++ b/rbi/workos/role_deleted.rbi @@ -0,0 +1,54 @@ +# 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..5f14ab2d --- /dev/null +++ b/rbi/workos/role_deleted_data.rbi @@ -0,0 +1,54 @@ +# 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..b2b8cce5 --- /dev/null +++ b/rbi/workos/role_list.rbi @@ -0,0 +1,30 @@ +# 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..4465c3ec --- /dev/null +++ b/rbi/workos/role_updated.rbi @@ -0,0 +1,54 @@ +# 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..e7aa1468 --- /dev/null +++ b/rbi/workos/role_updated_data.rbi @@ -0,0 +1,54 @@ +# 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..706163f2 --- /dev/null +++ b/rbi/workos/send_email_change.rbi @@ -0,0 +1,24 @@ +# 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..5cf4909f --- /dev/null +++ b/rbi/workos/send_verification_email_response.rbi @@ -0,0 +1,24 @@ +# 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.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_created.rbi b/rbi/workos/session_created.rbi new file mode 100644 index 00000000..930e0478 --- /dev/null +++ b/rbi/workos/session_created.rbi @@ -0,0 +1,54 @@ +# 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..72b03de0 --- /dev/null +++ b/rbi/workos/session_created_data.rbi @@ -0,0 +1,96 @@ +# 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..cfb44837 --- /dev/null +++ b/rbi/workos/session_created_data_impersonator.rbi @@ -0,0 +1,30 @@ +# 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_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/session_revoked.rbi b/rbi/workos/session_revoked.rbi new file mode 100644 index 00000000..605e90b1 --- /dev/null +++ b/rbi/workos/session_revoked.rbi @@ -0,0 +1,54 @@ +# 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..b0880cd9 --- /dev/null +++ b/rbi/workos/session_revoked_data.rbi @@ -0,0 +1,96 @@ +# 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..d7048563 --- /dev/null +++ b/rbi/workos/session_revoked_data_impersonator.rbi @@ -0,0 +1,30 @@ +# 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..b0ce0b18 --- /dev/null +++ b/rbi/workos/set_role_permissions.rbi @@ -0,0 +1,24 @@ +# 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..ae66ab9c --- /dev/null +++ b/rbi/workos/slim_role.rbi @@ -0,0 +1,24 @@ +# 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..9c134fac --- /dev/null +++ b/rbi/workos/sso.rbi @@ -0,0 +1,67 @@ +# 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..5fa59c7e --- /dev/null +++ b/rbi/workos/sso_authorize_url_response.rbi @@ -0,0 +1,24 @@ +# 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..82163afd --- /dev/null +++ b/rbi/workos/sso_device_authorization_request.rbi @@ -0,0 +1,24 @@ +# 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..6f9ac5ee --- /dev/null +++ b/rbi/workos/sso_intent_options.rbi @@ -0,0 +1,30 @@ +# 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..8ad9c49d --- /dev/null +++ b/rbi/workos/sso_logout_authorize_request.rbi @@ -0,0 +1,24 @@ +# 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..4cc3b97e --- /dev/null +++ b/rbi/workos/sso_logout_authorize_response.rbi @@ -0,0 +1,30 @@ +# 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..576bad40 --- /dev/null +++ b/rbi/workos/sso_token_response.rbi @@ -0,0 +1,48 @@ +# 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..618ccfa6 --- /dev/null +++ b/rbi/workos/sso_token_response_oauth_token.rbi @@ -0,0 +1,48 @@ +# 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..5ba0982d --- /dev/null +++ b/rbi/workos/token_query.rbi @@ -0,0 +1,42 @@ +# 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/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/update_audit_logs_retention.rbi b/rbi/workos/update_audit_logs_retention.rbi new file mode 100644 index 00000000..9784964c --- /dev/null +++ b/rbi/workos/update_audit_logs_retention.rbi @@ -0,0 +1,24 @@ +# 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..da1c25d0 --- /dev/null +++ b/rbi/workos/update_authorization_permission.rbi @@ -0,0 +1,30 @@ +# 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..fa5f9eb8 --- /dev/null +++ b/rbi/workos/update_authorization_resource.rbi @@ -0,0 +1,48 @@ +# 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..ed9b8b49 --- /dev/null +++ b/rbi/workos/update_jwt_template.rbi @@ -0,0 +1,24 @@ +# 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..8a83b8bb --- /dev/null +++ b/rbi/workos/update_oauth_application.rbi @@ -0,0 +1,42 @@ +# 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..cdc55825 --- /dev/null +++ b/rbi/workos/update_organization.rbi @@ -0,0 +1,60 @@ +# 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..a7c333c7 --- /dev/null +++ b/rbi/workos/update_organization_role.rbi @@ -0,0 +1,30 @@ +# 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..71a331e0 --- /dev/null +++ b/rbi/workos/update_role.rbi @@ -0,0 +1,30 @@ +# 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..e4311c0a --- /dev/null +++ b/rbi/workos/update_user.rbi @@ -0,0 +1,78 @@ +# 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..7f6377f3 --- /dev/null +++ b/rbi/workos/update_user_organization_membership.rbi @@ -0,0 +1,30 @@ +# 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..8ec96bb7 --- /dev/null +++ b/rbi/workos/update_webhook_endpoint.rbi @@ -0,0 +1,36 @@ +# 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..91856669 --- /dev/null +++ b/rbi/workos/user.rbi @@ -0,0 +1,96 @@ +# 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..3bd39137 --- /dev/null +++ b/rbi/workos/user_authentication_factor_enroll_response.rbi @@ -0,0 +1,30 @@ +# 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..e4f01db4 --- /dev/null +++ b/rbi/workos/user_consent_option.rbi @@ -0,0 +1,42 @@ +# 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..7437ea64 --- /dev/null +++ b/rbi/workos/user_consent_option_choice.rbi @@ -0,0 +1,30 @@ +# 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..1e36a910 --- /dev/null +++ b/rbi/workos/user_created.rbi @@ -0,0 +1,54 @@ +# 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..c2ba2e92 --- /dev/null +++ b/rbi/workos/user_deleted.rbi @@ -0,0 +1,54 @@ +# 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..8c494401 --- /dev/null +++ b/rbi/workos/user_identities_get_item.rbi @@ -0,0 +1,36 @@ +# 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..e2abbc4d --- /dev/null +++ b/rbi/workos/user_invite.rbi @@ -0,0 +1,102 @@ +# 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..53d746e7 --- /dev/null +++ b/rbi/workos/user_management.rbi @@ -0,0 +1,410 @@ +# 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..35ff184a --- /dev/null +++ b/rbi/workos/user_management_login_request.rbi @@ -0,0 +1,36 @@ +# 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..4e44fc89 --- /dev/null +++ b/rbi/workos/user_object.rbi @@ -0,0 +1,48 @@ +# 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..5ebf5d51 --- /dev/null +++ b/rbi/workos/user_organization_membership.rbi @@ -0,0 +1,84 @@ +# 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..33d6d634 --- /dev/null +++ b/rbi/workos/user_organization_membership_base_list_data.rbi @@ -0,0 +1,78 @@ +# 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..9aff166a --- /dev/null +++ b/rbi/workos/user_sessions_impersonator.rbi @@ -0,0 +1,30 @@ +# 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..646d576a --- /dev/null +++ b/rbi/workos/user_sessions_list_item.rbi @@ -0,0 +1,96 @@ +# 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..1e21a640 --- /dev/null +++ b/rbi/workos/user_updated.rbi @@ -0,0 +1,54 @@ +# 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/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/validate_api_key.rbi b/rbi/workos/validate_api_key.rbi new file mode 100644 index 00000000..b8e03051 --- /dev/null +++ b/rbi/workos/validate_api_key.rbi @@ -0,0 +1,24 @@ +# 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.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 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..d06710b9 --- /dev/null +++ b/rbi/workos/vault_byok_key_verification_completed.rbi @@ -0,0 +1,54 @@ +# 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..76d801ae --- /dev/null +++ b/rbi/workos/vault_byok_key_verification_completed_data.rbi @@ -0,0 +1,36 @@ +# 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..f2762093 --- /dev/null +++ b/rbi/workos/vault_data_created.rbi @@ -0,0 +1,54 @@ +# 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..2a5d3db2 --- /dev/null +++ b/rbi/workos/vault_data_created_data.rbi @@ -0,0 +1,54 @@ +# 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..9d424862 --- /dev/null +++ b/rbi/workos/vault_data_deleted.rbi @@ -0,0 +1,54 @@ +# 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..ee52ad04 --- /dev/null +++ b/rbi/workos/vault_data_deleted_data.rbi @@ -0,0 +1,42 @@ +# 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..e6aff1b8 --- /dev/null +++ b/rbi/workos/vault_data_read.rbi @@ -0,0 +1,54 @@ +# 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..8316ba0c --- /dev/null +++ b/rbi/workos/vault_data_read_data.rbi @@ -0,0 +1,48 @@ +# 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..05fdf3b6 --- /dev/null +++ b/rbi/workos/vault_data_updated.rbi @@ -0,0 +1,54 @@ +# 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..add8e355 --- /dev/null +++ b/rbi/workos/vault_data_updated_data.rbi @@ -0,0 +1,54 @@ +# 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..9a77263e --- /dev/null +++ b/rbi/workos/vault_dek_decrypted.rbi @@ -0,0 +1,54 @@ +# 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..1930cbcc --- /dev/null +++ b/rbi/workos/vault_dek_decrypted_data.rbi @@ -0,0 +1,42 @@ +# 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..04995705 --- /dev/null +++ b/rbi/workos/vault_dek_read.rbi @@ -0,0 +1,54 @@ +# 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..5c428736 --- /dev/null +++ b/rbi/workos/vault_dek_read_data.rbi @@ -0,0 +1,48 @@ +# 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..af66ec9b --- /dev/null +++ b/rbi/workos/vault_kek_created.rbi @@ -0,0 +1,54 @@ +# 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..baa25d1d --- /dev/null +++ b/rbi/workos/vault_kek_created_data.rbi @@ -0,0 +1,48 @@ +# 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..6073f667 --- /dev/null +++ b/rbi/workos/vault_metadata_read.rbi @@ -0,0 +1,54 @@ +# 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..9d2a6fd6 --- /dev/null +++ b/rbi/workos/vault_metadata_read_data.rbi @@ -0,0 +1,42 @@ +# 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..8a64f47f --- /dev/null +++ b/rbi/workos/vault_names_listed.rbi @@ -0,0 +1,54 @@ +# 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..6ad289d3 --- /dev/null +++ b/rbi/workos/vault_names_listed_data.rbi @@ -0,0 +1,36 @@ +# 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..bf28d4c8 --- /dev/null +++ b/rbi/workos/verify_email_address.rbi @@ -0,0 +1,24 @@ +# 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..dd52765c --- /dev/null +++ b/rbi/workos/verify_email_response.rbi @@ -0,0 +1,24 @@ +# 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/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 new file mode 100644 index 00000000..7a45a24f --- /dev/null +++ b/rbi/workos/webhooks.rbi @@ -0,0 +1,52 @@ +# 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::WebhookEndpointJson) + 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::WebhookEndpointJson) + 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..e0643d99 --- /dev/null +++ b/rbi/workos/widget_session_token.rbi @@ -0,0 +1,36 @@ +# 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..64a5a6b9 --- /dev/null +++ b/rbi/workos/widget_session_token_response.rbi @@ -0,0 +1,24 @@ +# 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..c2feab5a --- /dev/null +++ b/rbi/workos/widgets.rbi @@ -0,0 +1,23 @@ +# 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/renovate.json b/renovate.json index b979c359..c6226a9e 100644 --- a/renovate.json +++ b/renovate.json @@ -10,6 +10,13 @@ "timezone": "UTC", "rebaseWhen": "conflicted", "packageRules": [ + { + "matchManagers": [ + "github-actions" + ], + "pinDigests": true, + "extractVersion": "^v(?\\d+\\.\\d+\\.\\d+)$" + }, { "matchUpdateTypes": [ "minor", 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/spec/lib/workos/audit_logs_spec.rb b/spec/lib/workos/audit_logs_spec.rb deleted file mode 100644 index df93b6b2..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 0c301cb7..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 24d630a5..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 c5e8abbd..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 2a2ad704..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 e0c02150..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 911cfdde..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 213464dc..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 e13412ad..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 5ce146d1..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 d3d5fe19..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 c04210f6..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 8d4d8f75..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 f6e9c2e6..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 0af30aed..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 b9485f9c..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 6154bd57..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 80bb328d..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 ae48b876..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/fixtures/vcr_cassettes/audit_logs/create_event.yml b/spec/support/fixtures/vcr_cassettes/audit_logs/create_event.yml deleted file mode 100644 index 4f64036a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml b/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml deleted file mode 100644 index c590f60d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml b/spec/support/fixtures/vcr_cassettes/audit_logs/create_event_invalid.yml deleted file mode 100644 index fb5e3a63..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/audit_logs/create_export.yml b/spec/support/fixtures/vcr_cassettes/audit_logs/create_export.yml deleted file mode 100644 index 8bd71cbc..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml b/spec/support/fixtures/vcr_cassettes/audit_logs/create_export_with_filters.yml deleted file mode 100644 index 11e27b87..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/audit_logs/get_export.yml b/spec/support/fixtures/vcr_cassettes/audit_logs/get_export.yml deleted file mode 100644 index 589f7377..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/audit_trail/create_event.yml b/spec/support/fixtures/vcr_cassettes/audit_trail/create_event.yml deleted file mode 100644 index 79c77eea..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml b/spec/support/fixtures/vcr_cassettes/audit_trail/create_event_custom_idempotency_key.yml deleted file mode 100644 index db658401..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml b/spec/support/fixtures/vcr_cassettes/audit_trail/create_event_invalid.yml deleted file mode 100644 index 1fb1b91b..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml b/spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_and_payload.yml deleted file mode 100644 index 85957340..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml b/spec/support/fixtures/vcr_cassettes/audit_trail/create_events_duplicate_idempotency_key_different_payload.yml deleted file mode 100644 index 63a86e27..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/audit_trail/get_events.yml b/spec/support/fixtures/vcr_cassettes/audit_trail/get_events.yml deleted file mode 100644 index f888e16d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml b/spec/support/fixtures/vcr_cassettes/base/execute_request_unauthenticated.yml deleted file mode 100644 index 1e2acb5e..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/delete_directory.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/delete_directory.yml deleted file mode 100644 index 3749a318..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_invalid_id.yml deleted file mode 100644 index e75364f4..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/get_directory_with_valid_id.yml deleted file mode 100644 index ed47256e..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/get_group.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/get_group.yml deleted file mode 100644 index 31a7bd35..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/get_group_with_invalid_id.yml deleted file mode 100644 index 06d79deb..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/get_user.yml deleted file mode 100644 index 25717c4d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/get_user_with_invalid_id.yml deleted file mode 100644 index f973e481..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_after.yml deleted file mode 100644 index 88f043f4..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_before.yml deleted file mode 100644 index 5af2a63b..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_domain.yml deleted file mode 100644 index 5d1893fd..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_limit.yml deleted file mode 100644 index 91e88b7d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_no_options.yml deleted file mode 100644 index 9cc8fb33..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml deleted file mode 100644 index 99868832..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml deleted file mode 100644 index 4c12cd3e..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml deleted file mode 100644 index 4300c26a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml deleted file mode 100644 index c122604e..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml deleted file mode 100644 index 33f79b66..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_no_options.yml deleted file mode 100644 index 3f8bc762..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml deleted file mode 100644 index 845866d5..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml deleted file mode 100644 index b9b4f84b..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml deleted file mode 100644 index 8dc6c865..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml deleted file mode 100644 index c2de5b1c..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml deleted file mode 100644 index e445d34d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml deleted file mode 100644 index ea1edd89..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml b/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_no_options.yml deleted file mode 100644 index acef6cbf..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml b/spec/support/fixtures/vcr_cassettes/events/list_events_with_after.yml deleted file mode 100644 index dd4a45f8..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/events/list_events_with_event.yml b/spec/support/fixtures/vcr_cassettes/events/list_events_with_event.yml deleted file mode 100644 index 3d84e8a1..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml b/spec/support/fixtures/vcr_cassettes/events/list_events_with_no_options.yml deleted file mode 100644 index 9e1efab8..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml b/spec/support/fixtures/vcr_cassettes/events/list_events_with_organization_id.yml deleted file mode 100644 index 83339061..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml b/spec/support/fixtures/vcr_cassettes/events/list_events_with_range.yml deleted file mode 100644 index bec211c4..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml b/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_generic_valid.yml deleted file mode 100644 index ba4e04e5..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml b/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_sms_valid.yml deleted file mode 100644 index 51ead07f..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml b/spec/support/fixtures/vcr_cassettes/mfa/challenge_factor_totp_valid.yml deleted file mode 100644 index 3686f6d8..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/delete_factor.yml b/spec/support/fixtures/vcr_cassettes/mfa/delete_factor.yml deleted file mode 100644 index dd32c420..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml b/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_generic_valid.yml deleted file mode 100644 index 9268869c..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml b/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_sms_valid.yml deleted file mode 100644 index f76594a1..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml b/spec/support/fixtures/vcr_cassettes/mfa/enroll_factor_totp_valid.yml deleted file mode 100644 index 4be279b7..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml b/spec/support/fixtures/vcr_cassettes/mfa/get_factor_invalid.yml deleted file mode 100644 index f7e1a16f..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/get_factor_valid.yml b/spec/support/fixtures/vcr_cassettes/mfa/get_factor_valid.yml deleted file mode 100644 index 37ff9691..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml b/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_expired.yml deleted file mode 100644 index ceffcad8..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml b/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_invalid.yml deleted file mode 100644 index 25118022..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml b/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid.yml deleted file mode 100644 index abf1dc8a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml b/spec/support/fixtures/vcr_cassettes/mfa/verify_challenge_generic_valid_is_false.yml deleted file mode 100644 index c6d7dd3f..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/create.yml b/spec/support/fixtures/vcr_cassettes/organization/create.yml deleted file mode 100644 index c95e6284..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/create_invalid.yml b/spec/support/fixtures/vcr_cassettes/organization/create_invalid.yml deleted file mode 100644 index 610b6fe1..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/create_with_domain_data.yml b/spec/support/fixtures/vcr_cassettes/organization/create_with_domain_data.yml deleted file mode 100644 index 6d38c424..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/create_with_domains.yml b/spec/support/fixtures/vcr_cassettes/organization/create_with_domains.yml deleted file mode 100644 index a08052e9..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml b/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_different_payload.yml deleted file mode 100644 index 4e866144..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml b/spec/support/fixtures/vcr_cassettes/organization/create_with_duplicate_idempotency_key_and_payload.yml deleted file mode 100644 index c9537095..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/create_with_external_id.yml b/spec/support/fixtures/vcr_cassettes/organization/create_with_external_id.yml deleted file mode 100644 index 92470cc5..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml b/spec/support/fixtures/vcr_cassettes/organization/create_with_idempotency_key.yml deleted file mode 100644 index 82599a97..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/create_without_domains.yml b/spec/support/fixtures/vcr_cassettes/organization/create_without_domains.yml deleted file mode 100644 index 424ba948..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/delete.yml b/spec/support/fixtures/vcr_cassettes/organization/delete.yml deleted file mode 100644 index 05a05274..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/delete_invalid.yml b/spec/support/fixtures/vcr_cassettes/organization/delete_invalid.yml deleted file mode 100644 index 26db383b..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/get.yml b/spec/support/fixtures/vcr_cassettes/organization/get.yml deleted file mode 100644 index aefafc64..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml b/spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml deleted file mode 100644 index 7083c97f..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/list.yml b/spec/support/fixtures/vcr_cassettes/organization/list.yml deleted file mode 100644 index 95e432b2..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml b/spec/support/fixtures/vcr_cassettes/organization/list_organization_feature_flags.yml deleted file mode 100644 index 3907287f..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml b/spec/support/fixtures/vcr_cassettes/organization/list_organization_roles.yml deleted file mode 100644 index be7064da..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/update.yml b/spec/support/fixtures/vcr_cassettes/organization/update.yml deleted file mode 100644 index a6bb9460..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml b/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id.yml deleted file mode 100644 index 8811e883..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml b/spec/support/fixtures/vcr_cassettes/organization/update_with_external_id_null.yml deleted file mode 100644 index f01e5b11..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml b/spec/support/fixtures/vcr_cassettes/organization/update_with_stripe_customer_id.yml deleted file mode 100644 index 29d6deeb..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml b/spec/support/fixtures/vcr_cassettes/organization/update_without_name.yml deleted file mode 100644 index 8f8a49e5..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/passwordless/create_session.yml b/spec/support/fixtures/vcr_cassettes/passwordless/create_session.yml deleted file mode 100644 index 7d974763..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml b/spec/support/fixtures/vcr_cassettes/passwordless/create_session_invalid.yml deleted file mode 100644 index be934f89..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/passwordless/send_session.yml b/spec/support/fixtures/vcr_cassettes/passwordless/send_session.yml deleted file mode 100644 index a8ac69a1..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml b/spec/support/fixtures/vcr_cassettes/passwordless/send_session_invalid.yml deleted file mode 100644 index 396f6501..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml b/spec/support/fixtures/vcr_cassettes/portal/generate_link_audit_logs.yml deleted file mode 100644 index b1703296..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml b/spec/support/fixtures/vcr_cassettes/portal/generate_link_certificate_renewal.yml deleted file mode 100644 index 543078f0..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml b/spec/support/fixtures/vcr_cassettes/portal/generate_link_domain_verification.yml deleted file mode 100644 index 2da1824d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/portal/generate_link_dsync.yml b/spec/support/fixtures/vcr_cassettes/portal/generate_link_dsync.yml deleted file mode 100644 index 1d17d24a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/portal/generate_link_invalid.yml b/spec/support/fixtures/vcr_cassettes/portal/generate_link_invalid.yml deleted file mode 100644 index 817c1e6a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/portal/generate_link_sso.yml b/spec/support/fixtures/vcr_cassettes/portal/generate_link_sso.yml deleted file mode 100644 index befde7cc..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml b/spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_invalid_id.yml deleted file mode 100644 index fa237067..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml b/spec/support/fixtures/vcr_cassettes/sso/delete_connection_with_valid_id.yml deleted file mode 100644 index 2c739955..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml b/spec/support/fixtures/vcr_cassettes/sso/get_connection_with_invalid_id.yml deleted file mode 100644 index b8d9fd4c..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml b/spec/support/fixtures/vcr_cassettes/sso/get_connection_with_valid_id.yml deleted file mode 100644 index be3f1548..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_after.yml b/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_after.yml deleted file mode 100644 index 4a0d0066..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_before.yml b/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_before.yml deleted file mode 100644 index 574c80f6..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml b/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml deleted file mode 100644 index db89e1e7..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml b/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_domain.yml deleted file mode 100644 index 4fedc2c7..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml b/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml deleted file mode 100644 index c2941dad..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml b/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml deleted file mode 100644 index 1fb014a6..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml b/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_organization_id.yml deleted file mode 100644 index cc38865d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/sso/profile.yml b/spec/support/fixtures/vcr_cassettes/sso/profile.yml deleted file mode 100644 index 5fa50a65..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/invalid.yml deleted file mode 100644 index 5e98f9c5..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid.yml deleted file mode 100644 index 275ee799..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_impersonator.yml deleted file mode 100644 index 30d13c4f..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_code/valid_with_oauth_tokens.yml deleted file mode 100644 index 7f5e0f05..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/invalid.yml deleted file mode 100644 index 014c4487..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_email_verification/valid.yml deleted file mode 100644 index 25cdf812..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/invalid.yml deleted file mode 100644 index 85d2da91..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_magic_auth/valid.yml deleted file mode 100644 index 22b23850..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/invalid.yml deleted file mode 100644 index 3b7ef234..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_organization_selection/valid.yml deleted file mode 100644 index 61b18750..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/invalid.yml deleted file mode 100644 index 472422db..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/unverified.yml deleted file mode 100644 index aa2fc1f5..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_password/valid.yml deleted file mode 100644 index f7180823..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_code/invalid.yml deleted file mode 100644 index e29809e0..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_refresh_token/valid.yml deleted file mode 100644 index dd1b3328..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/invalid.yml deleted file mode 100644 index 0be3127f..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml deleted file mode 100644 index a7b36591..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml deleted file mode 100644 index e944c016..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml deleted file mode 100644 index ad91e49a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml deleted file mode 100644 index 7f095046..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml deleted file mode 100644 index c11c81c1..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml deleted file mode 100644 index 2ec456d1..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid_multiple_roles.yml deleted file mode 100644 index c83a3f62..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_password_reset/valid.yml deleted file mode 100644 index d6f523ed..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/create_user_invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_user_invalid.yml deleted file mode 100644 index 2a23e25b..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/create_user_valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_user_valid.yml deleted file mode 100644 index b137655a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml b/spec/support/fixtures/vcr_cassettes/user_management/create_user_with_external_id.yml deleted file mode 100644 index 2447ebdc..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml b/spec/support/fixtures/vcr_cassettes/user_management/deactivate_organization_membership.yml deleted file mode 100644 index d2e59d15..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/invalid.yml deleted file mode 100644 index 99e5e407..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/delete_organization_membership/valid.yml deleted file mode 100644 index 5077ad98..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/delete_user/invalid.yml deleted file mode 100644 index 69561c09..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/delete_user/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/delete_user/valid.yml deleted file mode 100644 index d7326bbb..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/invalid.yml deleted file mode 100644 index 74964278..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml deleted file mode 100644 index 96a6cd04..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/invalid.yml deleted file mode 100644 index ada1c41d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/find_invitation_by_token/valid.yml deleted file mode 100644 index 1fae0433..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/invalid.yml deleted file mode 100644 index 28003c8f..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_email_verification/valid.yml deleted file mode 100644 index 41ade083..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml deleted file mode 100644 index 492b60d6..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml deleted file mode 100644 index 8a287c2a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml deleted file mode 100644 index e7dd9544..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml deleted file mode 100644 index 5ea68f1b..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml deleted file mode 100644 index 8d79d6dc..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/invalid.yml deleted file mode 100644 index 27ca3be9..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_password_reset/valid.yml deleted file mode 100644 index 031fa605..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/get_user.yml b/spec/support/fixtures/vcr_cassettes/user_management/get_user.yml deleted file mode 100644 index 8946b20a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml deleted file mode 100644 index 0115eb5a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/valid.yml deleted file mode 100644 index 10aa1cf5..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_after.yml deleted file mode 100644 index e9dd5900..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_before.yml deleted file mode 100644 index 069d63a0..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_limit.yml deleted file mode 100644 index b1eff258..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_no_options.yml deleted file mode 100644 index 794b4fd0..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_invitations/with_organization_id.yml deleted file mode 100644 index f8c9e2b3..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/no_options.yml deleted file mode 100644 index 0b1c1b8d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_options.yml deleted file mode 100644 index c43f3a2b..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_organization_memberships/with_statuses_option.yml deleted file mode 100644 index 47a16d40..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_sessions/valid.yml deleted file mode 100644 index 34bc3cf9..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_users/no_options.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_users/no_options.yml deleted file mode 100644 index 74e6e730..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/list_users/with_options.yml b/spec/support/fixtures/vcr_cassettes/user_management/list_users/with_options.yml deleted file mode 100644 index 049d6a67..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml b/spec/support/fixtures/vcr_cassettes/user_management/reactivate_organization_membership.yml deleted file mode 100644 index 9efa4677..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/accepted.yml deleted file mode 100644 index a9965525..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/expired.yml deleted file mode 100644 index 75c2bde8..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/invalid.yml deleted file mode 100644 index 91c16a03..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/revoked.yml deleted file mode 100644 index 6466bc33..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/resend_invitation/valid.yml deleted file mode 100644 index 37d19423..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/reset_password/invalid.yml deleted file mode 100644 index df17b8ef..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/reset_password/valid.yml deleted file mode 100644 index 26bbecc0..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/invalid.yml deleted file mode 100644 index bad8352e..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/revoke_invitation/valid.yml deleted file mode 100644 index 5770353e..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml b/spec/support/fixtures/vcr_cassettes/user_management/revoke_session/not_found.yml deleted file mode 100644 index 9d80c301..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/revoke_session/valid.yml deleted file mode 100644 index 74377de9..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/invalid.yml deleted file mode 100644 index e97d2d21..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/send_invitation/valid.yml deleted file mode 100644 index 290ad88d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/send_magic_auth_code/valid.yml deleted file mode 100644 index 83d7fc2a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/invalid.yml deleted file mode 100644 index e3ebeb8d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml deleted file mode 100644 index 4217e677..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml deleted file mode 100644 index bee7673a..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml deleted file mode 100644 index 61657244..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml deleted file mode 100644 index 00574817..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml deleted file mode 100644 index 8e993fac..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid_multiple_roles.yml deleted file mode 100644 index 68c88fd1..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/update_user/email.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_user/email.yml deleted file mode 100644 index 593467f0..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml deleted file mode 100644 index 397a89c3..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/update_user/locale.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_user/locale.yml deleted file mode 100644 index 6b3177c6..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml deleted file mode 100644 index e3565592..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_user_external_id_null.yml deleted file mode 100644 index fa81b88f..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml deleted file mode 100644 index 15b34c62..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/update_user_password/valid.yml deleted file mode 100644 index a758fa9d..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml b/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml deleted file mode 100644 index 23a83d07..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml b/spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml deleted file mode 100644 index b288ca5f..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/user_management/verify_email/valid.yml b/spec/support/fixtures/vcr_cassettes/user_management/verify_email/valid.yml deleted file mode 100644 index 15bcd861..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/widgets/get_token.yml b/spec/support/fixtures/vcr_cassettes/widgets/get_token.yml deleted file mode 100644 index 1c9c42f6..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml b/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml deleted file mode 100644 index 83721e1b..00000000 --- a/spec/support/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/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml b/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml deleted file mode 100644 index 8ca40c91..00000000 --- a/spec/support/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/spec/support/profile.txt b/spec/support/profile.txt deleted file mode 100644 index 5e8df665..00000000 --- a/spec/support/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/spec/support/shared_examples/client.rb b/spec/support/shared_examples/client.rb deleted file mode 100644 index dc2a7dab..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/webhook_payload.txt b/spec/support/webhook_payload.txt deleted file mode 100644 index f1afd35a..00000000 --- a/spec/support/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 new file mode 100644 index 00000000..f67d0d33 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +# @oagen-ignore-file — hand-maintained runtime +$LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) + +require "minitest/autorun" +require "webmock/minitest" +require "json" +require "workos" + +module FixtureHelper + FIXTURES_DIR = File.expand_path("fixtures", __dir__) + + def load_fixture(name) + path = File.join(FIXTURES_DIR, name) + return {} unless File.exist?(path) + + JSON.parse(File.read(path)) + 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..77d1f561 --- /dev/null +++ b/test/workos/test_admin_portal.rb @@ -0,0 +1,33 @@ +# 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, %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 + + # 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 new file mode 100644 index 00000000..0e3737f2 --- /dev/null +++ b/test/workos/test_api_keys.rb @@ -0,0 +1,57 @@ +# 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, %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_delete_api_key_returns_expected_result + 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 + end + + def test_list_organization_api_keys_returns_expected_result + 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_create_organization_api_key_returns_expected_result + 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 + + # 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 new file mode 100644 index 00000000..c449bb40 --- /dev/null +++ b/test/workos/test_audit_logs.rb @@ -0,0 +1,89 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class AuditLogsTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_get_organization_audit_logs_retention_returns_expected_result + 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_update_organization_audit_logs_retention_returns_expected_result + 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_list_actions_returns_expected_result + 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_action_schemas_returns_expected_result + 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_create_schema_returns_expected_result + 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_event_returns_expected_result + 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_export_returns_expected_result + 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_get_export_returns_expected_result + 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 + + # 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_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..456808b2 --- /dev/null +++ b/test/workos/test_authorization.rb @@ -0,0 +1,321 @@ +# 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, %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_list_organization_membership_resources_returns_expected_result + 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_resource_permissions_returns_expected_result + 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_effective_permissions_by_external_id_returns_expected_result + 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_organization_membership_role_assignments_returns_expected_result + 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_assign_role_returns_expected_result + 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_remove_role_returns_expected_result + 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 + end + + def test_delete_organization_membership_role_assignment_returns_expected_result + 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 + end + + def test_list_organization_roles_returns_expected_result + 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_create_organization_role_returns_expected_result + 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_get_organization_role_returns_expected_result + 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_update_organization_role_returns_expected_result + 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_delete_organization_role_returns_expected_result + 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 + end + + def test_create_role_permission_returns_expected_result + 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_update_role_permissions_returns_expected_result + 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_delete_role_permission_returns_expected_result + 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") + refute_nil result + end + + def test_get_organization_resource_returns_expected_result + 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_update_organization_resource_returns_expected_result + 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_delete_organization_resource_returns_expected_result + 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 + end + + def test_list_resource_organization_memberships_returns_expected_result + 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_resources_returns_expected_result + 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_create_resource_returns_expected_result + 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_get_resource_returns_expected_result + 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_update_resource_returns_expected_result + 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_delete_resource_returns_expected_result + 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 + end + + def test_list_memberships_for_resource_returns_expected_result + 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_environment_roles_returns_expected_result + 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_create_environment_role_returns_expected_result + 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_get_environment_role_returns_expected_result + 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_update_environment_role_returns_expected_result + 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_add_environment_role_permission_returns_expected_result + 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_set_environment_role_permissions_returns_expected_result + 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_list_permissions_returns_expected_result + 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_create_permission_returns_expected_result + 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_get_permission_returns_expected_result + 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_update_permission_returns_expected_result + 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_delete_permission_returns_expected_result + 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 + 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 new file mode 100644 index 00000000..1d6f338e --- /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", {}], 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 + + 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_connect.rb b/test/workos/test_connect.rb new file mode 100644 index 00000000..5c1d2dbb --- /dev/null +++ b/test/workos/test_connect.rb @@ -0,0 +1,127 @@ +# 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, %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_list_applications_returns_expected_result + 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_create_application_returns_expected_result + 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_oauth_application_returns_expected_result + 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, %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) + end + end + + def test_create_m2m_application_returns_expected_result + 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, %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") + end + end + + def test_get_application_returns_expected_result + 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_update_application_returns_expected_result + 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_delete_application_returns_expected_result + 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 + end + + def test_list_application_client_secrets_returns_expected_result + 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_create_application_client_secret_returns_expected_result + 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_delete_client_secret_returns_expected_result + 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 + 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 new file mode 100644 index 00000000..574ec0ee --- /dev/null +++ b/test/workos/test_directory_sync.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class DirectorySyncTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_list_directories_returns_expected_result + 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_get_directory_returns_expected_result + 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_delete_directory_returns_expected_result + 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 + end + + def test_list_groups_returns_expected_result + 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_get_group_returns_expected_result + 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_list_users_returns_expected_result + 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_get_user_returns_expected_result + 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 + + # 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_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_events.rb b/test/workos/test_events.rb new file mode 100644 index 00000000..5e9b92ec --- /dev/null +++ b/test/workos/test_events.rb @@ -0,0 +1,33 @@ +# 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, %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 + + # 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 new file mode 100644 index 00000000..0a231e52 --- /dev/null +++ b/test/workos/test_feature_flags.rb @@ -0,0 +1,89 @@ +# 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, %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_get_feature_flag_returns_expected_result + 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_disable_feature_flag_returns_expected_result + 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_enable_feature_flag_returns_expected_result + 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_add_flag_target_returns_expected_result + 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 + end + + def test_remove_flag_target_returns_expected_result + 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 + end + + def test_list_organization_feature_flags_returns_expected_result + 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_user_feature_flags_returns_expected_result + 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 + + # 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_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_model_round_trip.rb b/test/workos/test_model_round_trip.rb new file mode 100644 index 00000000..79adf9e7 --- /dev/null +++ b/test/workos/test_model_round_trip.rb @@ -0,0 +1,7013 @@ +# 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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 + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "metadata" => {} + } + 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 + 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] + 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 + fixture = { + "actor" => {}, + "targets" => [], + "metadata" => {} + } + 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 + fixture = { + "sms_template" => "stub" + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "permissions" => [] + } + 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 + 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] + 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 + 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] + 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 + fixture = { + "name" => "stub", + "description" => nil + } + 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 + 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] + 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 + fixture = { + "name" => "stub", + "description" => nil + } + 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 + 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] + 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 + fixture = { + "name" => "stub", + "description" => nil + } + 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 + 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 + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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 + 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 + fixture = { + "bookmark_slug" => "stub", + "provider_type" => "GoogleSAML" + } + 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 + fixture = { + "sso" => {} + } + 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 + 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] + 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 + 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] + 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 + 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 + 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 + 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] + 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 + 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] + 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 + fixture = { + "locale" => "stub" + } + 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 + 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] + 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 + fixture = { + "role_slug" => "stub", + "role_slugs" => [] + } + 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 + 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] + 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 + 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 + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "endpoint_url" => "stub", + "status" => "stub", + "events" => [] + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "api_key" => nil + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "object" => "audit_log_export", + "id" => "stub", + "state" => "stub", + "url" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::AuditLogExportJson.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] + 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 + fixture = { + "retention_period_in_days" => nil + } + model = WorkOS::AuditLogsRetentionJson.new(fixture.to_json) + 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 + 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] + 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 + fixture = { + "object" => "audit_log_action", + "name" => "stub", + "schema" => {}, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::AuditLogActionJson.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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "object" => "list", + "data" => [] + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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 + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "primary" => true, + "type" => "stub", + "value" => nil + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "organizations" => [], + "users" => [] + } + 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 + 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] + 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 + 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] + 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 + fixture = { + "data" => {}, + "context" => {} + } + 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 + fixture = { + "enabled" => true, + "default_value" => true + } + 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 + fixture = { + "access_type" => "stub", + "configured_targets" => {} + } + 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 + fixture = { + "organizations" => [], + "users" => [] + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "data" => {} + } + 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 + 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 + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "reason" => "stub", + "organization_domain" => {} + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "active" => true, + "access_token" => {}, + "error" => "stub" + } + 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 + 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] + 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 + fixture = { + "object" => "list", + "data" => [] + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "authentication_factor" => {}, + "authentication_challenge" => {} + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "user" => {} + } + 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 + fixture = { + "user" => {} + } + 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 + 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] + 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 + fixture = { + "user" => {} + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "object" => "webhook_endpoint", + "id" => "stub", + "endpoint_url" => "stub", + "secret" => "stub", + "status" => "stub", + "events" => [], + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::WebhookEndpointJson.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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "keys" => [] + } + 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 + 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"] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "after" => nil + } + model = WorkOS::EventListListMetadata.new(fixture.to_json) + 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 + fixture = { + "primary" => true, + "type" => "stub", + "value" => nil + } + 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 + 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] + 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 + fixture = { + "primary" => true, + "type" => "stub", + "value" => nil + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "metadata" => {} + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "value" => "stub", + "label" => "stub" + } + 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 + 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] + 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 + 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 + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "challenge_status" => "success", + "attempt_status" => "success" + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + fixture = { + "object" => "email_change_confirmation", + "user" => {} + } + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 + 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] + 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 new file mode 100644 index 00000000..73cf661d --- /dev/null +++ b/test/workos/test_multi_factor_auth.rb @@ -0,0 +1,81 @@ +# 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, %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_enroll_factor_returns_expected_result + 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_get_factor_returns_expected_result + 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_delete_factor_returns_expected_result + 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 + end + + def test_challenge_factor_returns_expected_result + 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_list_user_auth_factors_returns_expected_result + 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_create_user_auth_factor_returns_expected_result + 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 + + # 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 new file mode 100644 index 00000000..aa20584c --- /dev/null +++ b/test/workos/test_organization_domains.rb @@ -0,0 +1,57 @@ +# 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, %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_get_organization_domain_returns_expected_result + 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_delete_organization_domain_returns_expected_result + 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 + end + + def test_verify_organization_domain_returns_expected_result + 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 + + # 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 new file mode 100644 index 00000000..4ee3c2b7 --- /dev/null +++ b/test/workos/test_organizations.rb @@ -0,0 +1,81 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class OrganizationsTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_list_organizations_returns_expected_result + 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_create_organization_returns_expected_result + 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_get_organization_by_external_id_returns_expected_result + 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_returns_expected_result + 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_update_organization_returns_expected_result + 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_delete_organization_returns_expected_result + 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 + end + + def test_get_audit_log_configuration_returns_expected_result + 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 + + # 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_passwordless.rb b/test/workos/test_passwordless.rb new file mode 100644 index 00000000..aa4fd5b2 --- /dev/null +++ b/test/workos/test_passwordless.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +require "test_helper" + +class PasswordlessTest < Minitest::Test + def setup + @client = WorkOS::Client.new(api_key: "sk_test_passwordless") + end + + def test_passwordless_accessor_exists + assert_kind_of WorkOS::Passwordless, @client.passwordless + end + + 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) + + 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_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..a085fc40 --- /dev/null +++ b/test/workos/test_pipes.rb @@ -0,0 +1,65 @@ +# 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, %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_create_data_integration_token_returns_expected_result + 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_get_user_connected_account_returns_expected_result + 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_delete_user_connected_account_returns_expected_result + 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 + end + + def test_list_user_data_providers_returns_expected_result + 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 + + # 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_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_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..017deea2 --- /dev/null +++ b/test/workos/test_radar.rb @@ -0,0 +1,57 @@ +# 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, %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_update_attempt_returns_expected_result + 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 + end + + def test_add_list_entry_returns_expected_result + 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_remove_list_entry_returns_expected_result + 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 + 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 new file mode 100644 index 00000000..ad9db804 --- /dev/null +++ b/test/workos/test_session.rb @@ -0,0 +1,261 @@ +# frozen_string_literal: true + +# @oagen-ignore-file +require "test_helper" +require "json" +require "openssl" +require "jwt" +require "base64" + +class SessionTest < Minitest::Test + PASSWORD = "very-long-cookie-password-secret" + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_session", client_id: "client_001") + @sm = @client.session_manager + end + + # --- 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 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 + + def test_unseal_rejects_short_payload + assert_raises(ArgumentError) do + @sm.unseal_data(Base64.strict_encode64("short"), PASSWORD) + end + end + + # --- H07 seal_session_from_auth_response ---------------------------------- + + 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 + + # --- H04 Session#authenticate with stubbed JWKS --------------------------- + + def signing_key_pair + rsa = OpenSSL::PKey::RSA.generate(2048) + [rsa, rsa.public_key] + end + + def make_jwt(claims, rsa, kid: "test-key") + JWT.encode(claims, rsa, "RS256", {kid: kid}) + 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_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) + + 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) + 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_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) + + 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) do |jwt| + { + my_custom_claim: jwt["custom_claim"], + my_other_claim: jwt["another_claim"] + } + 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_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) + + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) + + error = assert_raises(ArgumentError) do + @sm.authenticate(seal_data: sealed, cookie_password: PASSWORD) do + {authenticated: false} + end + end + + assert_match(/reserved key/, error.message) + 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 + + 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_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) + + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .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_SIGNATURE, 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 + 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) + + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) + + 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 + + # --- Session constructor validation --------------------------------------- + + 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 + + # --- 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 + + 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_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 new file mode 100644 index 00000000..f6e16efb --- /dev/null +++ b/test/workos/test_sso.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class SSOTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_list_connections_returns_expected_result + 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_get_connection_returns_expected_result + 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_delete_connection_returns_expected_result + 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 + end + + def test_authorize_logout_returns_expected_result + 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_get_profile_returns_expected_result + 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_and_token_returns_expected_result + 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 + + # 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_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 new file mode 100644 index 00000000..6456408a --- /dev/null +++ b/test/workos/test_user_management.rb @@ -0,0 +1,473 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class UserManagementTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_get_jwks_returns_expected_result + 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_create_authenticate_returns_expected_result + 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_authenticate_with_password_returns_expected_result + 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, %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") + end + end + + def test_authenticate_with_code_returns_expected_result + 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, %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") + end + end + + def test_authenticate_with_refresh_token_returns_expected_result + 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, %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") + end + end + + def test_authenticate_with_magic_auth_returns_expected_result + 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, %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") + end + end + + def test_authenticate_with_email_verification_returns_expected_result + 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, %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") + end + end + + def test_authenticate_with_totp_returns_expected_result + 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, %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") + end + end + + def test_authenticate_with_organization_selection_returns_expected_result + 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, %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") + end + end + + def test_authenticate_with_device_code_returns_expected_result + 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, %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") + end + end + + def test_create_device_returns_expected_result + 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_revoke_session_returns_expected_result + 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 + end + + def test_create_cors_origin_returns_expected_result + 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_get_email_verification_returns_expected_result + 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_reset_password_returns_expected_result + 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_confirm_password_reset_returns_expected_result + 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_get_password_reset_returns_expected_result + 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_list_users_returns_expected_result + 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_create_user_returns_expected_result + 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_get_user_by_external_id_returns_expected_result + 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_returns_expected_result + 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_update_user_returns_expected_result + 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_delete_user_returns_expected_result + 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 + end + + def test_confirm_email_change_returns_expected_result + 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_send_email_change_returns_expected_result + 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_verify_email_returns_expected_result + 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_send_verification_email_returns_expected_result + 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_get_user_identities_returns_expected_result + 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_list_sessions_returns_expected_result + 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_invitations_returns_expected_result + 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_send_invitation_returns_expected_result + 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_find_invitation_by_token_returns_expected_result + 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_get_invitation_returns_expected_result + 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_accept_invitation_returns_expected_result + 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_resend_invitation_returns_expected_result + 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_revoke_invitation_returns_expected_result + 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_update_jwt_template_returns_expected_result + 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_create_magic_auth_returns_expected_result + 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_get_magic_auth_returns_expected_result + 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_list_organization_memberships_returns_expected_result + 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_create_organization_membership_returns_expected_result + 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_get_organization_membership_returns_expected_result + 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_update_organization_membership_returns_expected_result + 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_delete_organization_membership_returns_expected_result + 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 + end + + def test_deactivate_organization_membership_returns_expected_result + 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_reactivate_organization_membership_returns_expected_result + 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_create_redirect_uri_returns_expected_result + 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_list_user_authorized_applications_returns_expected_result + 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_delete_user_authorized_application_returns_expected_result + 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 + 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_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 new file mode 100644 index 00000000..ddf268f0 --- /dev/null +++ b/test/workos/test_webhooks.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class WebhooksTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_list_webhook_endpoints_returns_expected_result + 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_create_webhook_endpoint_returns_expected_result + 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_update_webhook_endpoint_returns_expected_result + 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_delete_webhook_endpoint_returns_expected_result + 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 + 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 new file mode 100644 index 00000000..f8270c1e --- /dev/null +++ b/test/workos/test_widgets.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class WidgetsTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_create_token_returns_expected_result + 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 + + # 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 diff --git a/workos.gemspec b/workos.gemspec index 2e52b02c..88a611fd 100644 --- a/workos.gemspec +++ b/workos.gemspec @@ -1,35 +1,36 @@ # frozen_string_literal: true -lib = File.expand_path('lib', __dir__) +require "English" + +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/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.require_paths = ["lib"] - spec.add_dependency 'encryptor', '~> 3.0' - spec.add_dependency 'jwt', '~> 3.1' + 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 'rake' - spec.add_development_dependency 'rspec', '~> 3.9.0' - spec.add_development_dependency 'rubocop', '~> 1.71' - spec.add_development_dependency 'vcr', '~> 6.0' - spec.add_development_dependency 'webmock' + spec.add_development_dependency "bundler", ">= 2.0.1" + spec.add_development_dependency "minitest", "~> 6.0" + spec.add_development_dependency "rake" + spec.add_development_dependency "standard", "~> 1.49" + spec.add_development_dependency "webmock", "~> 3.26" - spec.required_ruby_version = '>= 3.1' + spec.required_ruby_version = ">= 3.3" end From e69ddbd811a67f7a63631b97659903854c08a3c6 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Mon, 20 Apr 2026 10:19:03 -0400 Subject: [PATCH 135/159] fix: outdated gemfile.lock --- Gemfile.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 80fa2c62..3fdc312e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,13 +13,13 @@ GEM public_suffix (>= 2.0.2, < 8.0) ast (2.4.3) base64 (0.3.0) - bigdecimal (4.1.1) + bigdecimal (4.1.2) crack (1.0.1) bigdecimal rexml drb (2.2.3) hashdiff (1.2.1) - json (2.19.3) + json (2.19.4) jwt (3.1.2) base64 language_server-protocol (3.17.0.5) @@ -36,7 +36,7 @@ GEM public_suffix (7.0.5) racc (1.8.1) rainbow (3.1.1) - rake (13.4.1) + rake (13.4.2) regexp_parser (2.12.0) rexml (3.4.4) rubocop (1.84.2) @@ -95,11 +95,11 @@ 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 + bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373 hashdiff (1.2.1) sha256=9c079dbc513dfc8833ab59c0c2d8f230fa28499cc5efb4b8dd276cf931457cd1 - json (2.19.3) sha256=289b0bb53052a1fa8c34ab33cc750b659ba14a5c45f3fcf4b18762dc67c78646 + json (2.19.4) sha256=670a7d333fb3b18ca5b29cb255eb7bef099e40d88c02c80bd42a3f30fe5239ac jwt (3.1.2) sha256=af6991f19a6bb4060d618d9add7a66f0eeb005ac0bc017cd01f63b42e122d535 language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87 @@ -111,7 +111,7 @@ CHECKSUMS 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 + rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701 regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f From 5aaca34072072ccd80548ec25f3c1ab7e3f1dc49 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2026 10:56:41 -0400 Subject: [PATCH 136/159] chore(main): release 7.0.0 (#456) Co-authored-by: workos-sdk-automation[bot] <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Co-authored-by: Garen Torikian --- .release-please-manifest.json | 2 +- CHANGELOG.md | 25 +++++++++++++++++++++++++ Gemfile.lock | 4 ++-- lib/workos/version.rb | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e1e352c1..aeda91d8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "6.2.0" + ".": "7.0.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index ced80f47..dc241aca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## [7.0.0](https://github.com/workos/workos-ruby/compare/v6.2.0...v7.0.0) (2026-04-20) + +This is a major release that introduces a fully redesigned SDK architecture. The SDK is now **generated from the WorkOS OpenAPI spec**, bringing type safety, consistent interfaces, and improved developer ergonomics. + +### High-Level Changes + +- **Client-centric architecture**: The SDK now revolves around an instantiated `WorkOS::Client` rather than module-level service calls. All product areas are accessed through client methods (e.g., `client.organizations`, `client.user_management`, `client.sso`). + +- **Generated request/response models**: Typed models replace raw hashes. Response models no longer inherit from `Hash` — use accessor methods instead of bracket notation. + +- **Per-request overrides**: The new runtime supports `request_options:` for per-request API key, timeout, base URL, and retry overrides — useful for multi-tenant setups. + +- **Minimum Ruby 3.3+**: The minimum Ruby version has been raised to 3.3. + +- **Renamed services and methods**: Several top-level services were renamed (e.g., `WorkOS::Portal` → `client.admin_portal`, `WorkOS::MFA` → `client.multi_factor_auth`). Method signatures now use explicit keyword arguments. + +- **Session management refactor**: AuthKit session sealing, refresh, and authentication flows were overhauled with a dedicated `SessionManager` on the client instance. + +- **New capabilities**: Device code flow, public/PKCE clients, `auto_paging_each` pagination, and `last_response` observability on all responses. + +### Migration Guide + +For detailed instructions on updating your application, see the **[v7 Migration Guide](https://github.com/workos/workos-ruby/blob/main/docs/V7_MIGRATION_GUIDE.md)**. + + ## [6.2.0](https://github.com/workos/workos-ruby/compare/v6.1.0...v6.2.0) (2026-03-06) diff --git a/Gemfile.lock b/Gemfile.lock index 3fdc312e..7163e5f4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (6.2.0) + workos (7.0.0) jwt (~> 3.1) logger (~> 1.7) zeitwerk (~> 2.6) @@ -124,7 +124,7 @@ CHECKSUMS unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42 unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90 - workos (6.2.0) + workos (7.0.0) zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd BUNDLED WITH diff --git a/lib/workos/version.rb b/lib/workos/version.rb index fff66459..8098fd55 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -2,5 +2,5 @@ # @oagen-ignore-file module WorkOS - VERSION = "6.2.0" + VERSION = "7.0.0" end From 75c016d6d4a049deb5a11ce7e3635d578617a7ec Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Mon, 20 Apr 2026 12:27:06 -0400 Subject: [PATCH 137/159] fix: use .ruby-version [skip ci] --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55676ba1..dccd5ef9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,6 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1.302.0 with: - ruby-version: "3.2" bundler-cache: true - name: Run tests From fc91a5a5539a509e8b9f6183bc71e27fb1afe8b7 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Mon, 20 Apr 2026 12:41:52 -0400 Subject: [PATCH 138/159] fix: outdated workflow [skip ci] --- .github/workflows/release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dccd5ef9..086cea25 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,9 +29,6 @@ jobs: with: bundler-cache: true - - name: Run tests - run: bundle exec rspec - - name: Publish to RubyGems run: | VERSION="${GITHUB_REF_NAME#v}" From 4fa1332f66c14e89c6df8d8d6af6ac8024824b15 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 24 Apr 2026 14:08:56 -0400 Subject: [PATCH 139/159] fix: update Zeitwerk autoload for inflections.rb (#460) --- lib/workos.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/workos.rb b/lib/workos.rb index 5e7621fc..2b9b84f9 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -30,6 +30,7 @@ module WorkOS loader.collapse("#{__dir__}/workos/webhooks") loader.collapse("#{__dir__}/workos/widgets") loader.ignore("#{__dir__}/workos/errors.rb") +loader.ignore("#{__dir__}/workos/inflections.rb") loader.setup require "workos/errors" From 6c145d2bfec9af8fcffdc5ffe678f452ea925f22 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Mon, 27 Apr 2026 16:47:52 -0400 Subject: [PATCH 140/159] feat(generated): update generated SDK from spec changes (#465) Co-authored-by: workos-sdk-automation[bot] <255426317+workos-sdk-automation[bot]@users.noreply.github.com> --- .last-synced-sha | 1 + .oagen-manifest.json | 743 +++++++++++++++++- lib/workos.rb | 1 + lib/workos/admin_portal.rb | 6 +- .../domain_verification_intent_options.rb | 18 + lib/workos/admin_portal/generate_link.rb | 6 +- lib/workos/admin_portal/intent_options.rb | 8 +- lib/workos/authorization.rb | 128 ++- lib/workos/client.rb | 8 + .../directory_user_with_groups.rb | 12 +- lib/workos/groups.rb | 256 ++++++ lib/workos/groups/create_group.rb | 22 + lib/workos/groups/create_group_membership.rb | 18 + lib/workos/{shared => groups}/group.rb | 0 lib/workos/groups/update_group.rb | 7 + lib/workos/shared/waitlist_user.rb | 37 + lib/workos/shared/waitlist_user_approved.rb | 34 + lib/workos/shared/waitlist_user_created.rb | 34 + lib/workos/shared/waitlist_user_denied.rb | 34 + .../types/create_webhook_endpoint_events.rb | 5 +- lib/workos/types/groups_order.rb | 9 + lib/workos/types/sso_provider.rb | 11 +- ...user_management_authentication_provider.rb | 11 +- ...nt_organization_membership_groups_order.rb | 9 + lib/workos/types/waitlist_user_state.rb | 14 + lib/workos/user_management.rb | 72 +- lib/workos/user_management/invitation.rb | 3 + .../invitation_accepted_data.rb | 3 + .../invitation_created_data.rb | 3 + .../user_management/invitation_resent_data.rb | 3 + .../invitation_revoked_data.rb | 3 + lib/workos/user_management/user_invite.rb | 3 + ...nagement_organization_membership_groups.rb | 60 ++ rbi/workos/admin_portal.rbi | 4 +- rbi/workos/authorization.rbi | 25 +- rbi/workos/client.rbi | 6 + rbi/workos/create_group.rbi | 30 + rbi/workos/create_group_membership.rbi | 24 + .../domain_verification_intent_options.rbi | 24 + rbi/workos/generate_link.rbi | 4 +- rbi/workos/groups.rbi | 97 +++ rbi/workos/intent_options.rbi | 10 +- rbi/workos/invitation.rbi | 6 + rbi/workos/invitation_accepted_data.rbi | 6 + rbi/workos/invitation_created_data.rbi | 6 + rbi/workos/invitation_resent_data.rbi | 6 + rbi/workos/invitation_revoked_data.rbi | 6 + rbi/workos/update_group.rbi | 30 + rbi/workos/user_invite.rbi | 6 + ...agement_organization_membership_groups.rbi | 25 + rbi/workos/waitlist_user.rbi | 60 ++ rbi/workos/waitlist_user_approved.rbi | 54 ++ rbi/workos/waitlist_user_created.rbi | 54 ++ rbi/workos/waitlist_user_denied.rbi | 54 ++ test/workos/test_authorization.rb | 66 +- test/workos/test_groups.rb | 89 +++ test/workos/test_model_round_trip.rb | 177 ++++- ...nagement_organization_membership_groups.rb | 33 + 58 files changed, 2285 insertions(+), 199 deletions(-) create mode 100644 .last-synced-sha create mode 100644 lib/workos/admin_portal/domain_verification_intent_options.rb create mode 100644 lib/workos/groups.rb create mode 100644 lib/workos/groups/create_group.rb create mode 100644 lib/workos/groups/create_group_membership.rb rename lib/workos/{shared => groups}/group.rb (100%) create mode 100644 lib/workos/groups/update_group.rb create mode 100644 lib/workos/shared/waitlist_user.rb create mode 100644 lib/workos/shared/waitlist_user_approved.rb create mode 100644 lib/workos/shared/waitlist_user_created.rb create mode 100644 lib/workos/shared/waitlist_user_denied.rb create mode 100644 lib/workos/types/groups_order.rb create mode 100644 lib/workos/types/user_management_organization_membership_groups_order.rb create mode 100644 lib/workos/types/waitlist_user_state.rb create mode 100644 lib/workos/user_management_organization_membership_groups.rb create mode 100644 rbi/workos/create_group.rbi create mode 100644 rbi/workos/create_group_membership.rbi create mode 100644 rbi/workos/domain_verification_intent_options.rbi create mode 100644 rbi/workos/groups.rbi create mode 100644 rbi/workos/update_group.rbi create mode 100644 rbi/workos/user_management_organization_membership_groups.rbi create mode 100644 rbi/workos/waitlist_user.rbi create mode 100644 rbi/workos/waitlist_user_approved.rbi create mode 100644 rbi/workos/waitlist_user_created.rbi create mode 100644 rbi/workos/waitlist_user_denied.rbi create mode 100644 test/workos/test_groups.rb create mode 100644 test/workos/test_user_management_organization_membership_groups.rb diff --git a/.last-synced-sha b/.last-synced-sha new file mode 100644 index 00000000..f72eb0e2 --- /dev/null +++ b/.last-synced-sha @@ -0,0 +1 @@ +92db0495807c86fbbc4d45bd266a6c1f5bcbb59c diff --git a/.oagen-manifest.json b/.oagen-manifest.json index a720fcab..b69affa1 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,10 +1,11 @@ { - "version": 1, + "version": 2, "language": "ruby", - "generatedAt": "2026-04-20T09:23:28.313Z", + "generatedAt": "2026-04-27T20:38:15.866Z", "files": [ "lib/workos.rb", "lib/workos/admin_portal.rb", + "lib/workos/admin_portal/domain_verification_intent_options.rb", "lib/workos/admin_portal/generate_link.rb", "lib/workos/admin_portal/intent_options.rb", "lib/workos/admin_portal/portal_link_response.rb", @@ -159,6 +160,11 @@ "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/groups.rb", + "lib/workos/groups/create_group.rb", + "lib/workos/groups/create_group_membership.rb", + "lib/workos/groups/group.rb", + "lib/workos/groups/update_group.rb", "lib/workos/inflections.rb", "lib/workos/multi_factor_auth.rb", "lib/workos/multi_factor_auth/authentication_challenge.rb", @@ -239,7 +245,6 @@ "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", @@ -247,6 +252,10 @@ "lib/workos/shared/group_member_removed.rb", "lib/workos/shared/group_member_removed_data.rb", "lib/workos/shared/group_updated.rb", + "lib/workos/shared/waitlist_user.rb", + "lib/workos/shared/waitlist_user_approved.rb", + "lib/workos/shared/waitlist_user_created.rb", + "lib/workos/shared/waitlist_user_denied.rb", "lib/workos/sso.rb", "lib/workos/sso/connection.rb", "lib/workos/sso/connection_activated.rb", @@ -333,6 +342,7 @@ "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/groups_order.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", @@ -392,6 +402,7 @@ "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_groups_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", @@ -411,6 +422,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/waitlist_user_state.rb", "lib/workos/types/webhook_endpoint_json_status.rb", "lib/workos/types/webhooks_order.rb", "lib/workos/types/widget_session_token_scopes.rb", @@ -542,6 +554,7 @@ "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/user_management_organization_membership_groups.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", @@ -704,6 +717,8 @@ "rbi/workos/create_authorization_permission.rbi", "rbi/workos/create_authorization_resource.rbi", "rbi/workos/create_cors_origin.rbi", + "rbi/workos/create_group.rbi", + "rbi/workos/create_group_membership.rbi", "rbi/workos/create_m2m_application.rbi", "rbi/workos/create_magic_code_and_return.rbi", "rbi/workos/create_oauth_application.rbi", @@ -737,6 +752,7 @@ "rbi/workos/directory_user_email.rbi", "rbi/workos/directory_user_with_groups.rbi", "rbi/workos/directory_user_with_groups_email.rbi", + "rbi/workos/domain_verification_intent_options.rbi", "rbi/workos/dsync_activated.rbi", "rbi/workos/dsync_activated_data.rbi", "rbi/workos/dsync_activated_data_domain.rbi", @@ -818,6 +834,7 @@ "rbi/workos/group_member_removed.rbi", "rbi/workos/group_member_removed_data.rbi", "rbi/workos/group_updated.rbi", + "rbi/workos/groups.rbi", "rbi/workos/intent_options.rbi", "rbi/workos/invitation.rbi", "rbi/workos/invitation_accepted.rbi", @@ -941,6 +958,7 @@ "rbi/workos/update_audit_logs_retention.rbi", "rbi/workos/update_authorization_permission.rbi", "rbi/workos/update_authorization_resource.rbi", + "rbi/workos/update_group.rbi", "rbi/workos/update_jwt_template.rbi", "rbi/workos/update_oauth_application.rbi", "rbi/workos/update_organization.rbi", @@ -959,6 +977,7 @@ "rbi/workos/user_invite.rbi", "rbi/workos/user_management.rbi", "rbi/workos/user_management_login_request.rbi", + "rbi/workos/user_management_organization_membership_groups.rbi", "rbi/workos/user_object.rbi", "rbi/workos/user_organization_membership.rbi", "rbi/workos/user_organization_membership_base_list_data.rbi", @@ -988,6 +1007,10 @@ "rbi/workos/vault_names_listed_data.rbi", "rbi/workos/verify_email_address.rbi", "rbi/workos/verify_email_response.rbi", + "rbi/workos/waitlist_user.rbi", + "rbi/workos/waitlist_user_approved.rbi", + "rbi/workos/waitlist_user_created.rbi", + "rbi/workos/waitlist_user_denied.rbi", "rbi/workos/webhook_endpoint_json.rbi", "rbi/workos/webhooks.rbi", "rbi/workos/widget_session_token.rbi", @@ -1001,6 +1024,7 @@ "test/workos/test_directory_sync.rb", "test/workos/test_events.rb", "test/workos/test_feature_flags.rb", + "test/workos/test_groups.rb", "test/workos/test_model_round_trip.rb", "test/workos/test_multi_factor_auth.rb", "test/workos/test_organization_domains.rb", @@ -1009,7 +1033,718 @@ "test/workos/test_radar.rb", "test/workos/test_sso.rb", "test/workos/test_user_management.rb", + "test/workos/test_user_management_organization_membership_groups.rb", "test/workos/test_webhooks.rb", "test/workos/test_widgets.rb" - ] + ], + "operations": { + "POST /api_keys/validations": { + "sdkMethod": "create_validation", + "service": "api_keys" + }, + "DELETE /api_keys/{id}": { + "sdkMethod": "delete_api_key", + "service": "api_keys" + }, + "POST /auth/challenges/{id}/verify": { + "sdkMethod": "verify_challenge", + "service": "multi_factor_auth" + }, + "POST /auth/factors/enroll": { + "sdkMethod": "enroll_factor", + "service": "multi_factor_auth" + }, + "GET /auth/factors/{id}": { + "sdkMethod": "get_factor", + "service": "multi_factor_auth" + }, + "DELETE /auth/factors/{id}": { + "sdkMethod": "delete_factor", + "service": "multi_factor_auth" + }, + "POST /auth/factors/{id}/challenge": { + "sdkMethod": "challenge_factor", + "service": "multi_factor_auth" + }, + "POST /authkit/oauth2/complete": { + "sdkMethod": "complete_oauth2", + "service": "connect" + }, + "POST /authorization/organization_memberships/{organization_membership_id}/check": { + "sdkMethod": "check", + "service": "authorization" + }, + "GET /authorization/organization_memberships/{organization_membership_id}/resources": { + "sdkMethod": "list_resources_for_membership", + "service": "authorization" + }, + "GET /authorization/organization_memberships/{organization_membership_id}/resources/{resource_id}/permissions": { + "sdkMethod": "list_effective_permissions", + "service": "authorization" + }, + "GET /authorization/organization_memberships/{organization_membership_id}/resources/{resource_type_slug}/{external_id}/permissions": { + "sdkMethod": "list_effective_permissions_by_external_id", + "service": "authorization" + }, + "GET /authorization/organization_memberships/{organization_membership_id}/role_assignments": { + "sdkMethod": "list_role_assignments", + "service": "authorization" + }, + "POST /authorization/organization_memberships/{organization_membership_id}/role_assignments": { + "sdkMethod": "assign_role", + "service": "authorization" + }, + "DELETE /authorization/organization_memberships/{organization_membership_id}/role_assignments": { + "sdkMethod": "remove_role", + "service": "authorization" + }, + "DELETE /authorization/organization_memberships/{organization_membership_id}/role_assignments/{role_assignment_id}": { + "sdkMethod": "remove_role_assignment", + "service": "authorization" + }, + "GET /authorization/organizations/{organizationId}/roles": { + "sdkMethod": "list_organization_roles", + "service": "authorization" + }, + "POST /authorization/organizations/{organizationId}/roles": { + "sdkMethod": "create_organization_role", + "service": "authorization" + }, + "GET /authorization/organizations/{organizationId}/roles/{slug}": { + "sdkMethod": "get_organization_role", + "service": "authorization" + }, + "PATCH /authorization/organizations/{organizationId}/roles/{slug}": { + "sdkMethod": "update_organization_role", + "service": "authorization" + }, + "DELETE /authorization/organizations/{organizationId}/roles/{slug}": { + "sdkMethod": "delete_organization_role", + "service": "authorization" + }, + "POST /authorization/organizations/{organizationId}/roles/{slug}/permissions": { + "sdkMethod": "add_organization_role_permission", + "service": "authorization" + }, + "PUT /authorization/organizations/{organizationId}/roles/{slug}/permissions": { + "sdkMethod": "set_organization_role_permissions", + "service": "authorization" + }, + "DELETE /authorization/organizations/{organizationId}/roles/{slug}/permissions/{permissionSlug}": { + "sdkMethod": "remove_organization_role_permission", + "service": "authorization" + }, + "GET /authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}": { + "sdkMethod": "get_resource_by_external_id", + "service": "authorization" + }, + "PATCH /authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}": { + "sdkMethod": "update_resource_by_external_id", + "service": "authorization" + }, + "DELETE /authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}": { + "sdkMethod": "delete_resource_by_external_id", + "service": "authorization" + }, + "GET /authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}/organization_memberships": { + "sdkMethod": "list_memberships_for_resource_by_external_id", + "service": "authorization" + }, + "GET /authorization/resources": { + "sdkMethod": "list_resources", + "service": "authorization" + }, + "POST /authorization/resources": { + "sdkMethod": "create_resource", + "service": "authorization" + }, + "GET /authorization/resources/{resource_id}": { + "sdkMethod": "get_resource", + "service": "authorization" + }, + "PATCH /authorization/resources/{resource_id}": { + "sdkMethod": "update_resource", + "service": "authorization" + }, + "DELETE /authorization/resources/{resource_id}": { + "sdkMethod": "delete_resource", + "service": "authorization" + }, + "GET /authorization/resources/{resource_id}/organization_memberships": { + "sdkMethod": "list_memberships_for_resource", + "service": "authorization" + }, + "GET /authorization/roles": { + "sdkMethod": "list_environment_roles", + "service": "authorization" + }, + "POST /authorization/roles": { + "sdkMethod": "create_environment_role", + "service": "authorization" + }, + "GET /authorization/roles/{slug}": { + "sdkMethod": "get_environment_role", + "service": "authorization" + }, + "PATCH /authorization/roles/{slug}": { + "sdkMethod": "update_environment_role", + "service": "authorization" + }, + "POST /authorization/roles/{slug}/permissions": { + "sdkMethod": "add_environment_role_permission", + "service": "authorization" + }, + "PUT /authorization/roles/{slug}/permissions": { + "sdkMethod": "set_environment_role_permissions", + "service": "authorization" + }, + "GET /authorization/permissions": { + "sdkMethod": "list_permissions", + "service": "authorization" + }, + "POST /authorization/permissions": { + "sdkMethod": "create_permission", + "service": "authorization" + }, + "GET /authorization/permissions/{slug}": { + "sdkMethod": "get_permission", + "service": "authorization" + }, + "PATCH /authorization/permissions/{slug}": { + "sdkMethod": "update_permission", + "service": "authorization" + }, + "DELETE /authorization/permissions/{slug}": { + "sdkMethod": "delete_permission", + "service": "authorization" + }, + "GET /connect/applications": { + "sdkMethod": "list_applications", + "service": "connect" + }, + "POST /connect/applications": { + "sdkMethod": "create_application", + "service": "connect" + }, + "POST /connect/applications#CreateOAuthApplication": { + "sdkMethod": "create_oauth_application", + "service": "connect" + }, + "POST /connect/applications#CreateM2MApplication": { + "sdkMethod": "create_m2m_application", + "service": "connect" + }, + "GET /connect/applications/{id}": { + "sdkMethod": "get_application", + "service": "connect" + }, + "PUT /connect/applications/{id}": { + "sdkMethod": "update_application", + "service": "connect" + }, + "DELETE /connect/applications/{id}": { + "sdkMethod": "delete_application", + "service": "connect" + }, + "GET /connect/applications/{id}/client_secrets": { + "sdkMethod": "list_application_client_secrets", + "service": "connect" + }, + "POST /connect/applications/{id}/client_secrets": { + "sdkMethod": "create_application_client_secret", + "service": "connect" + }, + "DELETE /connect/client_secrets/{id}": { + "sdkMethod": "delete_client_secret", + "service": "connect" + }, + "GET /connections": { + "sdkMethod": "list_connections", + "service": "sso" + }, + "GET /connections/{id}": { + "sdkMethod": "get_connection", + "service": "sso" + }, + "DELETE /connections/{id}": { + "sdkMethod": "delete_connection", + "service": "sso" + }, + "POST /data-integrations/{slug}/authorize": { + "sdkMethod": "authorize_data_integration", + "service": "pipes" + }, + "POST /data-integrations/{slug}/token": { + "sdkMethod": "create_data_integration_token", + "service": "pipes" + }, + "GET /directories": { + "sdkMethod": "list_directories", + "service": "directory_sync" + }, + "GET /directories/{id}": { + "sdkMethod": "get_directory", + "service": "directory_sync" + }, + "DELETE /directories/{id}": { + "sdkMethod": "delete_directory", + "service": "directory_sync" + }, + "GET /directory_groups": { + "sdkMethod": "list_groups", + "service": "directory_sync" + }, + "GET /directory_groups/{id}": { + "sdkMethod": "get_group", + "service": "directory_sync" + }, + "GET /directory_users": { + "sdkMethod": "list_users", + "service": "directory_sync" + }, + "GET /directory_users/{id}": { + "sdkMethod": "get_user", + "service": "directory_sync" + }, + "GET /events": { + "sdkMethod": "list_events", + "service": "events" + }, + "GET /feature-flags": { + "sdkMethod": "list_feature_flags", + "service": "feature_flags" + }, + "GET /feature-flags/{slug}": { + "sdkMethod": "get_feature_flag", + "service": "feature_flags" + }, + "PUT /feature-flags/{slug}/disable": { + "sdkMethod": "disable_feature_flag", + "service": "feature_flags" + }, + "PUT /feature-flags/{slug}/enable": { + "sdkMethod": "enable_feature_flag", + "service": "feature_flags" + }, + "POST /feature-flags/{slug}/targets/{resourceId}": { + "sdkMethod": "add_flag_target", + "service": "feature_flags" + }, + "DELETE /feature-flags/{slug}/targets/{resourceId}": { + "sdkMethod": "remove_flag_target", + "service": "feature_flags" + }, + "POST /organization_domains": { + "sdkMethod": "create_organization_domain", + "service": "organization_domains" + }, + "GET /organization_domains/{id}": { + "sdkMethod": "get_organization_domain", + "service": "organization_domains" + }, + "DELETE /organization_domains/{id}": { + "sdkMethod": "delete_organization_domain", + "service": "organization_domains" + }, + "POST /organization_domains/{id}/verify": { + "sdkMethod": "verify_organization_domain", + "service": "organization_domains" + }, + "GET /organizations": { + "sdkMethod": "list_organizations", + "service": "organizations" + }, + "POST /organizations": { + "sdkMethod": "create_organization", + "service": "organizations" + }, + "GET /organizations/external_id/{external_id}": { + "sdkMethod": "get_organization_by_external_id", + "service": "organizations" + }, + "GET /organizations/{id}": { + "sdkMethod": "get_organization", + "service": "organizations" + }, + "PUT /organizations/{id}": { + "sdkMethod": "update_organization", + "service": "organizations" + }, + "DELETE /organizations/{id}": { + "sdkMethod": "delete_organization", + "service": "organizations" + }, + "GET /organizations/{id}/audit_log_configuration": { + "sdkMethod": "get_audit_log_configuration", + "service": "organizations" + }, + "GET /organizations/{id}/audit_logs_retention": { + "sdkMethod": "get_organization_audit_logs_retention", + "service": "audit_logs" + }, + "PUT /organizations/{id}/audit_logs_retention": { + "sdkMethod": "update_organization_audit_logs_retention", + "service": "audit_logs" + }, + "GET /organizations/{organizationId}/api_keys": { + "sdkMethod": "list_organization_api_keys", + "service": "api_keys" + }, + "POST /organizations/{organizationId}/api_keys": { + "sdkMethod": "create_organization_api_key", + "service": "api_keys" + }, + "GET /organizations/{organizationId}/feature-flags": { + "sdkMethod": "list_organization_feature_flags", + "service": "feature_flags" + }, + "GET /organizations/{organizationId}/groups": { + "sdkMethod": "list_organization_groups", + "service": "groups" + }, + "POST /organizations/{organizationId}/groups": { + "sdkMethod": "create_organization_group", + "service": "groups" + }, + "GET /organizations/{organizationId}/groups/{groupId}": { + "sdkMethod": "get_organization_group", + "service": "groups" + }, + "PATCH /organizations/{organizationId}/groups/{groupId}": { + "sdkMethod": "update_organization_group", + "service": "groups" + }, + "DELETE /organizations/{organizationId}/groups/{groupId}": { + "sdkMethod": "delete_organization_group", + "service": "groups" + }, + "GET /organizations/{organizationId}/groups/{groupId}/organization-memberships": { + "sdkMethod": "list_group_organization_memberships", + "service": "groups" + }, + "POST /organizations/{organizationId}/groups/{groupId}/organization-memberships": { + "sdkMethod": "create_group_organization_membership", + "service": "groups" + }, + "DELETE /organizations/{organizationId}/groups/{groupId}/organization-memberships/{omId}": { + "sdkMethod": "delete_group_organization_membership", + "service": "groups" + }, + "POST /portal/generate_link": { + "sdkMethod": "generate_link", + "service": "admin_portal" + }, + "POST /radar/attempts": { + "sdkMethod": "create_attempt", + "service": "radar" + }, + "PUT /radar/attempts/{id}": { + "sdkMethod": "update_attempt", + "service": "radar" + }, + "POST /radar/lists/{type}/{action}": { + "sdkMethod": "add_list_entry", + "service": "radar" + }, + "DELETE /radar/lists/{type}/{action}": { + "sdkMethod": "remove_list_entry", + "service": "radar" + }, + "GET /sso/authorize": { + "sdkMethod": "get_authorization_url", + "service": "sso" + }, + "GET /sso/logout": { + "sdkMethod": "get_logout_url", + "service": "sso" + }, + "POST /sso/logout/authorize": { + "sdkMethod": "authorize_logout", + "service": "sso" + }, + "GET /sso/profile": { + "sdkMethod": "get_profile", + "service": "sso" + }, + "POST /sso/token": { + "sdkMethod": "get_profile_and_token", + "service": "sso" + }, + "GET /sso/jwks/{clientId}": { + "sdkMethod": "get_jwks", + "service": "user_management" + }, + "POST /user_management/authenticate": { + "sdkMethod": "create_authenticate", + "service": "user_management" + }, + "POST /user_management/authenticate#PasswordSessionAuthenticateRequest": { + "sdkMethod": "authenticate_with_password", + "service": "user_management" + }, + "POST /user_management/authenticate#AuthorizationCodeSessionAuthenticateRequest": { + "sdkMethod": "authenticate_with_code", + "service": "user_management" + }, + "POST /user_management/authenticate#RefreshTokenSessionAuthenticateRequest": { + "sdkMethod": "authenticate_with_refresh_token", + "service": "user_management" + }, + "POST /user_management/authenticate#MagicAuthCodeSessionAuthenticateRequest": { + "sdkMethod": "authenticate_with_magic_auth", + "service": "user_management" + }, + "POST /user_management/authenticate#EmailVerificationCodeSessionAuthenticateRequest": { + "sdkMethod": "authenticate_with_email_verification", + "service": "user_management" + }, + "POST /user_management/authenticate#MFATotpSessionAuthenticateRequest": { + "sdkMethod": "authenticate_with_totp", + "service": "user_management" + }, + "POST /user_management/authenticate#OrganizationSelectionSessionAuthenticateRequest": { + "sdkMethod": "authenticate_with_organization_selection", + "service": "user_management" + }, + "POST /user_management/authenticate#DeviceCodeSessionAuthenticateRequest": { + "sdkMethod": "authenticate_with_device_code", + "service": "user_management" + }, + "GET /user_management/authorize": { + "sdkMethod": "get_authorization_url", + "service": "user_management" + }, + "POST /user_management/authorize/device": { + "sdkMethod": "create_device", + "service": "user_management" + }, + "GET /user_management/sessions/logout": { + "sdkMethod": "get_logout_url", + "service": "user_management" + }, + "POST /user_management/sessions/revoke": { + "sdkMethod": "revoke_session", + "service": "user_management" + }, + "POST /user_management/cors_origins": { + "sdkMethod": "create_cors_origin", + "service": "user_management" + }, + "GET /user_management/email_verification/{id}": { + "sdkMethod": "get_email_verification", + "service": "user_management" + }, + "POST /user_management/password_reset": { + "sdkMethod": "reset_password", + "service": "user_management" + }, + "POST /user_management/password_reset/confirm": { + "sdkMethod": "confirm_password_reset", + "service": "user_management" + }, + "GET /user_management/password_reset/{id}": { + "sdkMethod": "get_password_reset", + "service": "user_management" + }, + "GET /user_management/users": { + "sdkMethod": "list_users", + "service": "user_management" + }, + "POST /user_management/users": { + "sdkMethod": "create_user", + "service": "user_management" + }, + "GET /user_management/users/external_id/{external_id}": { + "sdkMethod": "get_user_by_external_id", + "service": "user_management" + }, + "GET /user_management/users/{id}": { + "sdkMethod": "get_user", + "service": "user_management" + }, + "PUT /user_management/users/{id}": { + "sdkMethod": "update_user", + "service": "user_management" + }, + "DELETE /user_management/users/{id}": { + "sdkMethod": "delete_user", + "service": "user_management" + }, + "POST /user_management/users/{id}/email_change/confirm": { + "sdkMethod": "confirm_email_change", + "service": "user_management" + }, + "POST /user_management/users/{id}/email_change/send": { + "sdkMethod": "send_email_change", + "service": "user_management" + }, + "POST /user_management/users/{id}/email_verification/confirm": { + "sdkMethod": "verify_email", + "service": "user_management" + }, + "POST /user_management/users/{id}/email_verification/send": { + "sdkMethod": "send_verification_email", + "service": "user_management" + }, + "GET /user_management/users/{id}/identities": { + "sdkMethod": "get_user_identities", + "service": "user_management" + }, + "GET /user_management/users/{id}/sessions": { + "sdkMethod": "list_sessions", + "service": "user_management" + }, + "GET /user_management/invitations": { + "sdkMethod": "list_invitations", + "service": "user_management" + }, + "POST /user_management/invitations": { + "sdkMethod": "send_invitation", + "service": "user_management" + }, + "GET /user_management/invitations/by_token/{token}": { + "sdkMethod": "find_invitation_by_token", + "service": "user_management" + }, + "GET /user_management/invitations/{id}": { + "sdkMethod": "get_invitation", + "service": "user_management" + }, + "POST /user_management/invitations/{id}/accept": { + "sdkMethod": "accept_invitation", + "service": "user_management" + }, + "POST /user_management/invitations/{id}/resend": { + "sdkMethod": "resend_invitation", + "service": "user_management" + }, + "POST /user_management/invitations/{id}/revoke": { + "sdkMethod": "revoke_invitation", + "service": "user_management" + }, + "PUT /user_management/jwt_template": { + "sdkMethod": "update_jwt_template", + "service": "user_management" + }, + "POST /user_management/magic_auth": { + "sdkMethod": "create_magic_auth", + "service": "user_management" + }, + "GET /user_management/magic_auth/{id}": { + "sdkMethod": "get_magic_auth", + "service": "user_management" + }, + "GET /user_management/organization_memberships": { + "sdkMethod": "list_organization_memberships", + "service": "user_management" + }, + "POST /user_management/organization_memberships": { + "sdkMethod": "create_organization_membership", + "service": "user_management" + }, + "GET /user_management/organization_memberships/{id}": { + "sdkMethod": "get_organization_membership", + "service": "user_management" + }, + "PUT /user_management/organization_memberships/{id}": { + "sdkMethod": "update_organization_membership", + "service": "user_management" + }, + "DELETE /user_management/organization_memberships/{id}": { + "sdkMethod": "delete_organization_membership", + "service": "user_management" + }, + "PUT /user_management/organization_memberships/{id}/deactivate": { + "sdkMethod": "deactivate_organization_membership", + "service": "user_management" + }, + "PUT /user_management/organization_memberships/{id}/reactivate": { + "sdkMethod": "reactivate_organization_membership", + "service": "user_management" + }, + "GET /user_management/organization_memberships/{omId}/groups": { + "sdkMethod": "list_organization_membership_groups", + "service": "user_management_organization_membership_groups" + }, + "POST /user_management/redirect_uris": { + "sdkMethod": "create_redirect_uri", + "service": "user_management" + }, + "GET /user_management/users/{userId}/feature-flags": { + "sdkMethod": "list_user_feature_flags", + "service": "feature_flags" + }, + "GET /user_management/users/{user_id}/authorized_applications": { + "sdkMethod": "list_user_authorized_applications", + "service": "user_management" + }, + "DELETE /user_management/users/{user_id}/authorized_applications/{application_id}": { + "sdkMethod": "delete_user_authorized_application", + "service": "user_management" + }, + "GET /user_management/users/{user_id}/connected_accounts/{slug}": { + "sdkMethod": "get_user_connected_account", + "service": "pipes" + }, + "DELETE /user_management/users/{user_id}/connected_accounts/{slug}": { + "sdkMethod": "delete_user_connected_account", + "service": "pipes" + }, + "GET /user_management/users/{user_id}/data_providers": { + "sdkMethod": "list_user_data_providers", + "service": "pipes" + }, + "GET /user_management/users/{userlandUserId}/auth_factors": { + "sdkMethod": "list_user_auth_factors", + "service": "multi_factor_auth" + }, + "POST /user_management/users/{userlandUserId}/auth_factors": { + "sdkMethod": "create_user_auth_factor", + "service": "multi_factor_auth" + }, + "GET /webhook_endpoints": { + "sdkMethod": "list_webhook_endpoints", + "service": "webhooks" + }, + "POST /webhook_endpoints": { + "sdkMethod": "create_webhook_endpoint", + "service": "webhooks" + }, + "PATCH /webhook_endpoints/{id}": { + "sdkMethod": "update_webhook_endpoint", + "service": "webhooks" + }, + "DELETE /webhook_endpoints/{id}": { + "sdkMethod": "delete_webhook_endpoint", + "service": "webhooks" + }, + "POST /widgets/token": { + "sdkMethod": "create_token", + "service": "widgets" + }, + "GET /audit_logs/actions": { + "sdkMethod": "list_actions", + "service": "audit_logs" + }, + "GET /audit_logs/actions/{actionName}/schemas": { + "sdkMethod": "list_action_schemas", + "service": "audit_logs" + }, + "POST /audit_logs/actions/{actionName}/schemas": { + "sdkMethod": "create_schema", + "service": "audit_logs" + }, + "POST /audit_logs/events": { + "sdkMethod": "create_event", + "service": "audit_logs" + }, + "POST /audit_logs/exports": { + "sdkMethod": "create_export", + "service": "audit_logs" + }, + "GET /audit_logs/exports/{auditLogExportId}": { + "sdkMethod": "get_export", + "service": "audit_logs" + } + } } diff --git a/lib/workos.rb b/lib/workos.rb index 2b9b84f9..65b84295 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -18,6 +18,7 @@ module WorkOS loader.collapse("#{__dir__}/workos/directory_sync") loader.collapse("#{__dir__}/workos/events") loader.collapse("#{__dir__}/workos/feature_flags") +loader.collapse("#{__dir__}/workos/groups") loader.collapse("#{__dir__}/workos/multi_factor_auth") loader.collapse("#{__dir__}/workos/organization_domains") loader.collapse("#{__dir__}/workos/organizations") diff --git a/lib/workos/admin_portal.rb b/lib/workos/admin_portal.rb index 7feb7884..bd4ba292 100644 --- a/lib/workos/admin_portal.rb +++ b/lib/workos/admin_portal.rb @@ -16,7 +16,7 @@ def initialize(client) # @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 it_contact_emails [Array, nil] The email addresses of the IT contacts to grant access to the Admin Portal for the given organization. Accepts up to 20 emails. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::PortalLinkResponse] def generate_link( @@ -25,7 +25,7 @@ def generate_link( success_url: nil, intent: nil, intent_options: nil, - admin_emails: nil, + it_contact_emails: nil, request_options: {} ) body = { @@ -34,7 +34,7 @@ def generate_link( "organization" => organization, "intent" => intent, "intent_options" => intent_options, - "admin_emails" => admin_emails + "it_contact_emails" => it_contact_emails }.compact response = @client.request( method: :post, diff --git a/lib/workos/admin_portal/domain_verification_intent_options.rb b/lib/workos/admin_portal/domain_verification_intent_options.rb new file mode 100644 index 00000000..cfc703c5 --- /dev/null +++ b/lib/workos/admin_portal/domain_verification_intent_options.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class DomainVerificationIntentOptions < WorkOS::Types::BaseModel + HASH_ATTRS = { + domain_name: :domain_name + }.freeze + + attr_accessor :domain_name + + def initialize(json) + hash = self.class.normalize(json) + @domain_name = hash[:domain_name] + end + end +end diff --git a/lib/workos/admin_portal/generate_link.rb b/lib/workos/admin_portal/generate_link.rb index dba22d01..29868954 100644 --- a/lib/workos/admin_portal/generate_link.rb +++ b/lib/workos/admin_portal/generate_link.rb @@ -10,7 +10,7 @@ class GenerateLink < WorkOS::Types::BaseModel organization: :organization, intent: :intent, intent_options: :intent_options, - admin_emails: :admin_emails + it_contact_emails: :it_contact_emails }.freeze attr_accessor \ @@ -19,7 +19,7 @@ class GenerateLink < WorkOS::Types::BaseModel :organization, :intent, :intent_options, - :admin_emails + :it_contact_emails def initialize(json) hash = self.class.normalize(json) @@ -28,7 +28,7 @@ def initialize(json) @organization = hash[:organization] @intent = hash[:intent] @intent_options = hash[:intent_options] ? WorkOS::IntentOptions.new(hash[:intent_options]) : nil - @admin_emails = hash[:admin_emails] || [] + @it_contact_emails = hash[:it_contact_emails] || [] end end end diff --git a/lib/workos/admin_portal/intent_options.rb b/lib/workos/admin_portal/intent_options.rb index cb85c9ca..a19104fe 100644 --- a/lib/workos/admin_portal/intent_options.rb +++ b/lib/workos/admin_portal/intent_options.rb @@ -5,14 +5,18 @@ module WorkOS class IntentOptions < WorkOS::Types::BaseModel HASH_ATTRS = { - sso: :sso + sso: :sso, + domain_verification: :domain_verification }.freeze - attr_accessor :sso + attr_accessor \ + :sso, + :domain_verification def initialize(json) hash = self.class.normalize(json) @sso = hash[:sso] ? WorkOS::SSOIntentOptions.new(hash[:sso]) : nil + @domain_verification = hash[:domain_verification] ? WorkOS::DomainVerificationIntentOptions.new(hash[:domain_verification]) : nil end end end diff --git a/lib/workos/authorization.rb b/lib/workos/authorization.rb index d6a4fca8..c651908c 100644 --- a/lib/workos/authorization.rb +++ b/lib/workos/authorization.rb @@ -27,25 +27,23 @@ def check( resource_type_slug: nil, request_options: {} ) - params = {}.compact - 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 + case resource_target[:type] + when "by_id" + body["resource_id"] = resource_target[:resource_id] + when "by_external_id" + body["resource_external_id"] = resource_target[:resource_external_id] + body["resource_type_slug"] = resource_target[:resource_type_slug] + end 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 ) @@ -63,7 +61,7 @@ def check( # @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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] - def list_organization_membership_resources( + def list_resources_for_membership( organization_membership_id:, permission_slug:, parent_resource:, @@ -95,7 +93,7 @@ def list_organization_membership_resources( request_options: request_options ) fetch_next = ->(cursor) { - list_organization_membership_resources( + list_resources_for_membership( organization_membership_id: organization_membership_id, before: before, after: cursor, @@ -123,7 +121,7 @@ def list_organization_membership_resources( # @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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] - def list_resource_permissions( + def list_effective_permissions( organization_membership_id:, resource_id:, before: nil, @@ -146,7 +144,7 @@ def list_resource_permissions( request_options: request_options ) fetch_next = ->(cursor) { - list_resource_permissions( + list_effective_permissions( organization_membership_id: organization_membership_id, resource_id: resource_id, before: before, @@ -225,7 +223,7 @@ def list_effective_permissions_by_external_id( # @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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] - def list_organization_membership_role_assignments( + def list_role_assignments( organization_membership_id:, before: nil, after: nil, @@ -247,7 +245,7 @@ def list_organization_membership_role_assignments( request_options: request_options ) fetch_next = ->(cursor) { - list_organization_membership_role_assignments( + list_role_assignments( organization_membership_id: organization_membership_id, before: before, after: cursor, @@ -281,25 +279,23 @@ def assign_role( resource_type_slug: nil, request_options: {} ) - params = {}.compact - 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 + case resource_target[:type] + when "by_id" + body["resource_id"] = resource_target[:resource_id] + when "by_external_id" + body["resource_external_id"] = resource_target[:resource_external_id] + body["resource_type_slug"] = resource_target[:resource_type_slug] + end 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 ) @@ -355,7 +351,7 @@ def remove_role( # @param role_assignment_id [String] The ID of the role assignment to remove. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [void] - def delete_organization_membership_role_assignment( + def remove_role_assignment( organization_membership_id:, role_assignment_id:, request_options: {} @@ -498,7 +494,7 @@ def delete_organization_role( # @param body_slug [String] The slug of the permission to add to the role. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] - def create_role_permission( + def add_organization_role_permission( organization_id:, slug:, body_slug:, @@ -525,7 +521,7 @@ def create_role_permission( # @param permissions [Array] The permission slugs to assign to the role. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] - def update_role_permissions( + def set_organization_role_permissions( organization_id:, slug:, permissions:, @@ -552,7 +548,7 @@ def update_role_permissions( # @param permission_slug [String] The slug of the permission to remove. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Role] - def delete_role_permission( + def remove_organization_role_permission( organization_id:, slug:, permission_slug:, @@ -575,7 +571,7 @@ def delete_role_permission( # @param external_id [String] An identifier you provide to reference the resource in your system. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationResource] - def get_organization_resource( + def get_resource_by_external_id( organization_id:, resource_type_slug:, external_id:, @@ -603,7 +599,7 @@ def get_organization_resource( # @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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationResource] - def update_organization_resource( + def update_resource_by_external_id( organization_id:, resource_type_slug:, external_id:, @@ -615,16 +611,6 @@ def update_organization_resource( parent_resource: nil, request_options: {} ) - params = {}.compact - 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, @@ -632,11 +618,19 @@ def update_organization_resource( "parent_resource_external_id" => parent_resource_external_id, "parent_resource_type_slug" => parent_resource_type_slug }.compact + if parent_resource + case parent_resource[:type] + when "by_id" + body["parent_resource_id"] = parent_resource[:parent_resource_id] + when "by_external_id" + body["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] + body["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] + end + end 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 ) @@ -652,7 +646,7 @@ def update_organization_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] (see WorkOS::Types::RequestOptions) # @return [void] - def delete_organization_resource( + def delete_resource_by_external_id( organization_id:, resource_type_slug:, external_id:, @@ -684,7 +678,7 @@ def delete_organization_resource( # @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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] - def list_resource_organization_memberships( + def list_memberships_for_resource_by_external_id( organization_id:, resource_type_slug:, external_id:, @@ -712,7 +706,7 @@ def list_resource_organization_memberships( request_options: request_options ) fetch_next = ->(cursor) { - list_resource_organization_memberships( + list_memberships_for_resource_by_external_id( organization_id: organization_id, resource_type_slug: resource_type_slug, external_id: external_id, @@ -740,6 +734,7 @@ def list_resource_organization_memberships( # @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 resource_external_id [String, nil] Filter resources by external ID. # @param search [String, nil] Search resources by name. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] @@ -750,6 +745,7 @@ def list_resources( order: "desc", organization_id: nil, resource_type_slug: nil, + resource_external_id: nil, search: nil, parent: nil, request_options: {} @@ -761,6 +757,7 @@ def list_resources( "order" => order, "organization_id" => organization_id, "resource_type_slug" => resource_type_slug, + "resource_external_id" => resource_external_id, "search" => search }.compact if parent @@ -787,6 +784,7 @@ def list_resources( order: order, organization_id: organization_id, resource_type_slug: resource_type_slug, + resource_external_id: resource_external_id, search: search, parent: parent, request_options: request_options @@ -795,7 +793,7 @@ def list_resources( 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}, + filters: {before: before, limit: limit, order: order, organization_id: organization_id, resource_type_slug: resource_type_slug, resource_external_id: resource_external_id, search: search, parent: parent}, fetch_next: fetch_next ) end @@ -823,16 +821,6 @@ def create_resource( parent_resource: nil, request_options: {} ) - params = {}.compact - 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, @@ -843,11 +831,19 @@ def create_resource( "parent_resource_external_id" => parent_resource_external_id, "parent_resource_type_slug" => parent_resource_type_slug }.compact + if parent_resource + case parent_resource[:type] + when "by_id" + body["parent_resource_id"] = parent_resource[:parent_resource_id] + when "by_external_id" + body["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] + body["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] + end + end response = @client.request( method: :post, path: "/authorization/resources", auth: true, - params: params, body: body, request_options: request_options ) @@ -894,16 +890,6 @@ def update_resource( parent_resource: nil, request_options: {} ) - params = {}.compact - 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, @@ -911,11 +897,19 @@ def update_resource( "parent_resource_external_id" => parent_resource_external_id, "parent_resource_type_slug" => parent_resource_type_slug }.compact + if parent_resource + case parent_resource[:type] + when "by_id" + body["parent_resource_id"] = parent_resource[:parent_resource_id] + when "by_external_id" + body["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] + body["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] + end + end response = @client.request( method: :patch, path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}", auth: true, - params: params, body: body, request_options: request_options ) diff --git a/lib/workos/client.rb b/lib/workos/client.rb index c9af3643..36aa03a9 100644 --- a/lib/workos/client.rb +++ b/lib/workos/client.rb @@ -48,6 +48,10 @@ def organizations @organizations ||= WorkOS::Organizations.new(self) end + def groups + @groups ||= WorkOS::Groups.new(self) + end + def admin_portal @admin_portal ||= WorkOS::AdminPortal.new(self) end @@ -60,6 +64,10 @@ def user_management @user_management ||= WorkOS::UserManagement.new(self) end + def user_management_organization_membership_groups + @user_management_organization_membership_groups ||= WorkOS::UserManagementOrganizationMembershipGroups.new(self) + end + def webhooks @webhooks ||= WorkOS::Webhooks.new(self) end diff --git a/lib/workos/directory_sync/directory_user_with_groups.rb b/lib/workos/directory_sync/directory_user_with_groups.rb index 32e14147..b75d84fc 100644 --- a/lib/workos/directory_sync/directory_user_with_groups.rb +++ b/lib/workos/directory_sync/directory_user_with_groups.rb @@ -34,6 +34,8 @@ class DirectoryUserWithGroups < WorkOS::Types::BaseModel # @deprecated The username of the user. # @!attribute raw_attributes # @deprecated The raw attributes received from the directory provider. + # @!attribute groups + # @deprecated The directory groups the user belongs to. Use the List Directory Groups endpoint with a user filter instead. attr_accessor \ :object, @@ -49,8 +51,7 @@ class DirectoryUserWithGroups < WorkOS::Types::BaseModel :role, :roles, :created_at, - :updated_at, - :groups + :updated_at def emails warn "[DEPRECATION] `emails` is deprecated and will be removed in a future version.", uplevel: 1 @@ -80,6 +81,13 @@ def raw_attributes attr_writer :raw_attributes + def groups + warn "[DEPRECATION] `groups` is deprecated and will be removed in a future version.", uplevel: 1 + @groups + end + + attr_writer :groups + def initialize(json) hash = self.class.normalize(json) @object = hash[:object] diff --git a/lib/workos/groups.rb b/lib/workos/groups.rb new file mode 100644 index 00000000..75d7ddb2 --- /dev/null +++ b/lib/workos/groups.rb @@ -0,0 +1,256 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class Groups + def initialize(client) + @client = client + end + + # List groups + # @param organization_id [String] The ID 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. 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::GroupsOrder, 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_organization_groups( + organization_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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)}/groups", + auth: true, + params: params, + request_options: request_options + ) + fetch_next = ->(cursor) { + list_organization_groups( + organization_id: organization_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::Group, + filters: {organization_id: organization_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + end + + # Create a group + # @param organization_id [String] The ID of the organization. + # @param name [String] The name of the Group. + # @param description [String, nil] An optional description of the Group. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Group] + def create_organization_group( + organization_id:, + name:, + description: nil, + request_options: {} + ) + body = { + "name" => name, + "description" => description + }.compact + response = @client.request( + method: :post, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/groups", + auth: true, + body: body, + request_options: request_options + ) + result = WorkOS::Group.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 group + # @param organization_id [String] The ID of the organization. + # @param group_id [String] The ID of the group. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Group] + def get_organization_group( + organization_id:, + group_id:, + request_options: {} + ) + response = @client.request( + method: :get, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/groups/#{WorkOS::Util.encode_path(group_id)}", + auth: true, + request_options: request_options + ) + result = WorkOS::Group.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 group + # @param organization_id [String] The ID of the organization. + # @param group_id [String] The ID of the group. + # @param name [String, nil] The name of the Group. + # @param description [String, nil] An optional description of the Group. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Group] + def update_organization_group( + organization_id:, + group_id:, + name: nil, + description: nil, + request_options: {} + ) + body = { + "name" => name, + "description" => description + }.compact + response = @client.request( + method: :patch, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/groups/#{WorkOS::Util.encode_path(group_id)}", + auth: true, + body: body, + request_options: request_options + ) + result = WorkOS::Group.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 group + # @param organization_id [String] The ID of the organization. + # @param group_id [String] The ID of the group. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [void] + def delete_organization_group( + organization_id:, + group_id:, + request_options: {} + ) + @client.request( + method: :delete, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/groups/#{WorkOS::Util.encode_path(group_id)}", + auth: true, + request_options: request_options + ) + nil + end + + # List Group members + # @param organization_id [String] Unique identifier of the Organization. + # @param group_id [String] Unique identifier of the Group. + # @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::GroupsOrder, 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_group_organization_memberships( + organization_id:, + group_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + 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)}/groups/#{WorkOS::Util.encode_path(group_id)}/organization-memberships", + auth: true, + params: params, + request_options: request_options + ) + fetch_next = ->(cursor) { + list_group_organization_memberships( + organization_id: organization_id, + group_id: group_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserOrganizationMembershipBaseListData, + filters: {organization_id: organization_id, group_id: group_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + end + + # Add a member to a Group + # @param organization_id [String] Unique identifier of the Organization. + # @param group_id [String] Unique identifier of the Group. + # @param organization_membership_id [String] The ID of the Organization Membership to add to the group. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Group] + def create_group_organization_membership( + organization_id:, + group_id:, + organization_membership_id:, + request_options: {} + ) + body = { + "organization_membership_id" => organization_membership_id + }.compact + response = @client.request( + method: :post, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/groups/#{WorkOS::Util.encode_path(group_id)}/organization-memberships", + auth: true, + body: body, + request_options: request_options + ) + result = WorkOS::Group.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 member from a Group + # @param organization_id [String] Unique identifier of the Organization. + # @param group_id [String] Unique identifier of the Group. + # @param om_id [String] Unique identifier of the Organization Membership. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [void] + def delete_group_organization_membership( + organization_id:, + group_id:, + om_id:, + request_options: {} + ) + @client.request( + method: :delete, + path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/groups/#{WorkOS::Util.encode_path(group_id)}/organization-memberships/#{WorkOS::Util.encode_path(om_id)}", + auth: true, + request_options: request_options + ) + nil + end + end +end diff --git a/lib/workos/groups/create_group.rb b/lib/workos/groups/create_group.rb new file mode 100644 index 00000000..0b8627d2 --- /dev/null +++ b/lib/workos/groups/create_group.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateGroup < WorkOS::Types::BaseModel + HASH_ATTRS = { + name: :name, + description: :description + }.freeze + + attr_accessor \ + :name, + :description + + def initialize(json) + hash = self.class.normalize(json) + @name = hash[:name] + @description = hash[:description] + end + end +end diff --git a/lib/workos/groups/create_group_membership.rb b/lib/workos/groups/create_group_membership.rb new file mode 100644 index 00000000..4ba3c762 --- /dev/null +++ b/lib/workos/groups/create_group_membership.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateGroupMembership < WorkOS::Types::BaseModel + HASH_ATTRS = { + organization_membership_id: :organization_membership_id + }.freeze + + attr_accessor :organization_membership_id + + def initialize(json) + hash = self.class.normalize(json) + @organization_membership_id = hash[:organization_membership_id] + end + end +end diff --git a/lib/workos/shared/group.rb b/lib/workos/groups/group.rb similarity index 100% rename from lib/workos/shared/group.rb rename to lib/workos/groups/group.rb diff --git a/lib/workos/groups/update_group.rb b/lib/workos/groups/update_group.rb new file mode 100644 index 00000000..3b1b5710 --- /dev/null +++ b/lib/workos/groups/update_group.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + UpdateGroup = UpdateAuthorizationPermission +end diff --git a/lib/workos/shared/waitlist_user.rb b/lib/workos/shared/waitlist_user.rb new file mode 100644 index 00000000..0ca93111 --- /dev/null +++ b/lib/workos/shared/waitlist_user.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class WaitlistUser < WorkOS::Types::BaseModel + HASH_ATTRS = { + object: :object, + id: :id, + email: :email, + state: :state, + approved_at: :approved_at, + created_at: :created_at, + updated_at: :updated_at + }.freeze + + attr_accessor \ + :object, + :id, + :email, + :state, + :approved_at, + :created_at, + :updated_at + + def initialize(json) + hash = self.class.normalize(json) + @object = hash[:object] + @id = hash[:id] + @email = hash[:email] + @state = hash[:state] + @approved_at = hash[:approved_at] + @created_at = hash[:created_at] + @updated_at = hash[:updated_at] + end + end +end diff --git a/lib/workos/shared/waitlist_user_approved.rb b/lib/workos/shared/waitlist_user_approved.rb new file mode 100644 index 00000000..52fe72b7 --- /dev/null +++ b/lib/workos/shared/waitlist_user_approved.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class WaitlistUserApproved < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::WaitlistUser.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/waitlist_user_created.rb b/lib/workos/shared/waitlist_user_created.rb new file mode 100644 index 00000000..f20fc2a8 --- /dev/null +++ b/lib/workos/shared/waitlist_user_created.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class WaitlistUserCreated < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::WaitlistUser.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/waitlist_user_denied.rb b/lib/workos/shared/waitlist_user_denied.rb new file mode 100644 index 00000000..45678eaa --- /dev/null +++ b/lib/workos/shared/waitlist_user_denied.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class WaitlistUserDenied < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::WaitlistUser.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/types/create_webhook_endpoint_events.rb b/lib/workos/types/create_webhook_endpoint_events.rb index 035a6845..8b323a9f 100644 --- a/lib/workos/types/create_webhook_endpoint_events.rb +++ b/lib/workos/types/create_webhook_endpoint_events.rb @@ -79,7 +79,10 @@ class CreateWebhookEndpointEvents 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 + WAITLIST_USER_APPROVED = "waitlist_user.approved" + WAITLIST_USER_CREATED = "waitlist_user.created" + WAITLIST_USER_DENIED = "waitlist_user.denied" + 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, WAITLIST_USER_APPROVED, WAITLIST_USER_CREATED, WAITLIST_USER_DENIED].freeze end end end diff --git a/lib/workos/types/groups_order.rb b/lib/workos/types/groups_order.rb new file mode 100644 index 00000000..a000ce31 --- /dev/null +++ b/lib/workos/types/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 + GroupsOrder = ApplicationsOrder + end +end diff --git a/lib/workos/types/sso_provider.rb b/lib/workos/types/sso_provider.rb index 2159ec5a..46c71f8f 100644 --- a/lib/workos/types/sso_provider.rb +++ b/lib/workos/types/sso_provider.rb @@ -6,10 +6,19 @@ module WorkOS module Types class SSOProvider APPLE_OAUTH = "AppleOAuth" + BITBUCKET_OAUTH = "BitbucketOAuth" GIT_HUB_OAUTH = "GitHubOAuth" + GIT_LAB_OAUTH = "GitLabOAuth" GOOGLE_OAUTH = "GoogleOAuth" + INTUIT_OAUTH = "IntuitOAuth" + LINKED_IN_OAUTH = "LinkedInOAuth" MICROSOFT_OAUTH = "MicrosoftOAuth" - ALL = [APPLE_OAUTH, GIT_HUB_OAUTH, GOOGLE_OAUTH, MICROSOFT_OAUTH].freeze + SALESFORCE_OAUTH = "SalesforceOAuth" + SLACK_OAUTH = "SlackOAuth" + VERCEL_MARKETPLACE_OAUTH = "VercelMarketplaceOAuth" + VERCEL_OAUTH = "VercelOAuth" + XERO_OAUTH = "XeroOAuth" + ALL = [APPLE_OAUTH, BITBUCKET_OAUTH, 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].freeze end end end diff --git a/lib/workos/types/user_management_authentication_provider.rb b/lib/workos/types/user_management_authentication_provider.rb index bdbee8eb..f9d31423 100644 --- a/lib/workos/types/user_management_authentication_provider.rb +++ b/lib/workos/types/user_management_authentication_provider.rb @@ -7,10 +7,19 @@ module Types class UserManagementAuthenticationProvider AUTHKIT = "authkit" APPLE_OAUTH = "AppleOAuth" + BITBUCKET_OAUTH = "BitbucketOAuth" GIT_HUB_OAUTH = "GitHubOAuth" + GIT_LAB_OAUTH = "GitLabOAuth" GOOGLE_OAUTH = "GoogleOAuth" + INTUIT_OAUTH = "IntuitOAuth" + LINKED_IN_OAUTH = "LinkedInOAuth" MICROSOFT_OAUTH = "MicrosoftOAuth" - ALL = [AUTHKIT, APPLE_OAUTH, GIT_HUB_OAUTH, GOOGLE_OAUTH, MICROSOFT_OAUTH].freeze + SALESFORCE_OAUTH = "SalesforceOAuth" + SLACK_OAUTH = "SlackOAuth" + VERCEL_MARKETPLACE_OAUTH = "VercelMarketplaceOAuth" + VERCEL_OAUTH = "VercelOAuth" + XERO_OAUTH = "XeroOAuth" + ALL = [AUTHKIT, APPLE_OAUTH, BITBUCKET_OAUTH, 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].freeze end end end diff --git a/lib/workos/types/user_management_organization_membership_groups_order.rb b/lib/workos/types/user_management_organization_membership_groups_order.rb new file mode 100644 index 00000000..5b8749cf --- /dev/null +++ b/lib/workos/types/user_management_organization_membership_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 + UserManagementOrganizationMembershipGroupsOrder = ApplicationsOrder + end +end diff --git a/lib/workos/types/waitlist_user_state.rb b/lib/workos/types/waitlist_user_state.rb new file mode 100644 index 00000000..ac6e2501 --- /dev/null +++ b/lib/workos/types/waitlist_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 WaitlistUserState + PENDING = "pending" + APPROVED = "approved" + DENIED = "denied" + ALL = [PENDING, APPROVED, DENIED].freeze + end + end +end diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index dc561c06..d1dd282e 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -630,16 +630,6 @@ def create_user( password_hash_type: nil, request_options: {} ) - params = {}.compact - 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, @@ -651,11 +641,19 @@ def create_user( "password_hash" => password_hash, "password_hash_type" => password_hash_type }.compact + if password + case password[:type] + when "plaintext" + body["password"] = password[:password] + when "hashed" + body["password_hash"] = password[:password_hash] + body["password_hash_type"] = password[:password_hash_type] + end + end response = @client.request( method: :post, path: "/user_management/users", auth: true, - params: params, body: body, request_options: request_options ) @@ -730,16 +728,6 @@ def update_user( password_hash_type: nil, request_options: {} ) - params = {}.compact - 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, @@ -752,11 +740,19 @@ def update_user( "password_hash" => password_hash, "password_hash_type" => password_hash_type }.compact + if password + case password[:type] + when "plaintext" + body["password"] = password[:password] + when "hashed" + body["password_hash"] = password[:password_hash] + body["password_hash_type"] = password[:password_hash_type] + end + end response = @client.request( method: :put, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}", auth: true, - params: params, body: body, request_options: request_options ) @@ -1271,26 +1267,24 @@ def create_organization_membership( role: nil, request_options: {} ) - params = {}.compact - 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 + if role + case role[:type] + when "single" + body["role_slug"] = role[:role_slug] + when "multiple" + body["role_slugs"] = role[:role_slugs] + end + end response = @client.request( method: :post, path: "/user_management/organization_memberships", auth: true, - params: params, body: body, request_options: request_options ) @@ -1331,24 +1325,22 @@ def update_organization_membership( role: nil, request_options: {} ) - params = {}.compact + body = { + "role_slug" => role_slug, + "role_slugs" => role_slugs + }.compact if role case role[:type] when "single" - params["role_slug"] = role[:role_slug] + body["role_slug"] = role[:role_slug] when "multiple" - params["role_slugs"] = role[:role_slugs] + body["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 ) diff --git a/lib/workos/user_management/invitation.rb b/lib/workos/user_management/invitation.rb index 12f77d58..c1ecd312 100644 --- a/lib/workos/user_management/invitation.rb +++ b/lib/workos/user_management/invitation.rb @@ -15,6 +15,7 @@ class Invitation < WorkOS::Types::BaseModel organization_id: :organization_id, inviter_user_id: :inviter_user_id, accepted_user_id: :accepted_user_id, + role_slug: :role_slug, created_at: :created_at, updated_at: :updated_at, token: :token, @@ -32,6 +33,7 @@ class Invitation < WorkOS::Types::BaseModel :organization_id, :inviter_user_id, :accepted_user_id, + :role_slug, :created_at, :updated_at, :token, @@ -49,6 +51,7 @@ def initialize(json) @organization_id = hash[:organization_id] @inviter_user_id = hash[:inviter_user_id] @accepted_user_id = hash[:accepted_user_id] + @role_slug = hash[:role_slug] @created_at = hash[:created_at] @updated_at = hash[:updated_at] @token = hash[:token] diff --git a/lib/workos/user_management/invitation_accepted_data.rb b/lib/workos/user_management/invitation_accepted_data.rb index e1745237..456726a4 100644 --- a/lib/workos/user_management/invitation_accepted_data.rb +++ b/lib/workos/user_management/invitation_accepted_data.rb @@ -15,6 +15,7 @@ class InvitationAcceptedData < WorkOS::Types::BaseModel organization_id: :organization_id, inviter_user_id: :inviter_user_id, accepted_user_id: :accepted_user_id, + role_slug: :role_slug, created_at: :created_at, updated_at: :updated_at }.freeze @@ -30,6 +31,7 @@ class InvitationAcceptedData < WorkOS::Types::BaseModel :organization_id, :inviter_user_id, :accepted_user_id, + :role_slug, :created_at, :updated_at @@ -45,6 +47,7 @@ def initialize(json) @organization_id = hash[:organization_id] @inviter_user_id = hash[:inviter_user_id] @accepted_user_id = hash[:accepted_user_id] + @role_slug = hash[:role_slug] @created_at = hash[:created_at] @updated_at = hash[:updated_at] end diff --git a/lib/workos/user_management/invitation_created_data.rb b/lib/workos/user_management/invitation_created_data.rb index 7d0d7593..7720c1ce 100644 --- a/lib/workos/user_management/invitation_created_data.rb +++ b/lib/workos/user_management/invitation_created_data.rb @@ -15,6 +15,7 @@ class InvitationCreatedData < WorkOS::Types::BaseModel organization_id: :organization_id, inviter_user_id: :inviter_user_id, accepted_user_id: :accepted_user_id, + role_slug: :role_slug, created_at: :created_at, updated_at: :updated_at }.freeze @@ -30,6 +31,7 @@ class InvitationCreatedData < WorkOS::Types::BaseModel :organization_id, :inviter_user_id, :accepted_user_id, + :role_slug, :created_at, :updated_at @@ -45,6 +47,7 @@ def initialize(json) @organization_id = hash[:organization_id] @inviter_user_id = hash[:inviter_user_id] @accepted_user_id = hash[:accepted_user_id] + @role_slug = hash[:role_slug] @created_at = hash[:created_at] @updated_at = hash[:updated_at] end diff --git a/lib/workos/user_management/invitation_resent_data.rb b/lib/workos/user_management/invitation_resent_data.rb index e9aae396..7fa50c54 100644 --- a/lib/workos/user_management/invitation_resent_data.rb +++ b/lib/workos/user_management/invitation_resent_data.rb @@ -15,6 +15,7 @@ class InvitationResentData < WorkOS::Types::BaseModel organization_id: :organization_id, inviter_user_id: :inviter_user_id, accepted_user_id: :accepted_user_id, + role_slug: :role_slug, created_at: :created_at, updated_at: :updated_at }.freeze @@ -30,6 +31,7 @@ class InvitationResentData < WorkOS::Types::BaseModel :organization_id, :inviter_user_id, :accepted_user_id, + :role_slug, :created_at, :updated_at @@ -45,6 +47,7 @@ def initialize(json) @organization_id = hash[:organization_id] @inviter_user_id = hash[:inviter_user_id] @accepted_user_id = hash[:accepted_user_id] + @role_slug = hash[:role_slug] @created_at = hash[:created_at] @updated_at = hash[:updated_at] end diff --git a/lib/workos/user_management/invitation_revoked_data.rb b/lib/workos/user_management/invitation_revoked_data.rb index 4212f66c..b7cd0c07 100644 --- a/lib/workos/user_management/invitation_revoked_data.rb +++ b/lib/workos/user_management/invitation_revoked_data.rb @@ -15,6 +15,7 @@ class InvitationRevokedData < WorkOS::Types::BaseModel organization_id: :organization_id, inviter_user_id: :inviter_user_id, accepted_user_id: :accepted_user_id, + role_slug: :role_slug, created_at: :created_at, updated_at: :updated_at }.freeze @@ -30,6 +31,7 @@ class InvitationRevokedData < WorkOS::Types::BaseModel :organization_id, :inviter_user_id, :accepted_user_id, + :role_slug, :created_at, :updated_at @@ -45,6 +47,7 @@ def initialize(json) @organization_id = hash[:organization_id] @inviter_user_id = hash[:inviter_user_id] @accepted_user_id = hash[:accepted_user_id] + @role_slug = hash[:role_slug] @created_at = hash[:created_at] @updated_at = hash[:updated_at] end diff --git a/lib/workos/user_management/user_invite.rb b/lib/workos/user_management/user_invite.rb index 7cf0f45d..87ca1a14 100644 --- a/lib/workos/user_management/user_invite.rb +++ b/lib/workos/user_management/user_invite.rb @@ -15,6 +15,7 @@ class UserInvite < WorkOS::Types::BaseModel organization_id: :organization_id, inviter_user_id: :inviter_user_id, accepted_user_id: :accepted_user_id, + role_slug: :role_slug, created_at: :created_at, updated_at: :updated_at, token: :token, @@ -32,6 +33,7 @@ class UserInvite < WorkOS::Types::BaseModel :organization_id, :inviter_user_id, :accepted_user_id, + :role_slug, :created_at, :updated_at, :token, @@ -49,6 +51,7 @@ def initialize(json) @organization_id = hash[:organization_id] @inviter_user_id = hash[:inviter_user_id] @accepted_user_id = hash[:accepted_user_id] + @role_slug = hash[:role_slug] @created_at = hash[:created_at] @updated_at = hash[:updated_at] @token = hash[:token] diff --git a/lib/workos/user_management_organization_membership_groups.rb b/lib/workos/user_management_organization_membership_groups.rb new file mode 100644 index 00000000..ddecd12c --- /dev/null +++ b/lib/workos/user_management_organization_membership_groups.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "json" + +module WorkOS + class UserManagementOrganizationMembershipGroups + def initialize(client) + @client = client + end + + # List groups + # @param om_id [String] Unique identifier 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::UserManagementOrganizationMembershipGroupsOrder, 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_organization_membership_groups( + om_id:, + before: nil, + after: nil, + limit: nil, + order: "desc", + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request( + method: :get, + path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(om_id)}/groups", + auth: true, + params: params, + request_options: request_options + ) + fetch_next = ->(cursor) { + list_organization_membership_groups( + om_id: om_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::Group, + filters: {om_id: om_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + end + end +end diff --git a/rbi/workos/admin_portal.rbi b/rbi/workos/admin_portal.rbi index 1a2f4961..d800a993 100644 --- a/rbi/workos/admin_portal.rbi +++ b/rbi/workos/admin_portal.rbi @@ -16,11 +16,11 @@ module WorkOS success_url: T.nilable(String), intent: T.nilable(String), intent_options: T.nilable(WorkOS::IntentOptions), - admin_emails: T.nilable(T::Array[String]), + it_contact_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 + def generate_link(organization:, return_url:, success_url:, intent:, intent_options:, it_contact_emails:, request_options:); end end end diff --git a/rbi/workos/authorization.rbi b/rbi/workos/authorization.rbi index 6e2c1cda..3089a0ef 100644 --- a/rbi/workos/authorization.rbi +++ b/rbi/workos/authorization.rbi @@ -32,7 +32,7 @@ module WorkOS 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 + def list_resources_for_membership(organization_membership_id:, permission_slug:, before:, after:, limit:, order:, request_options:); end sig do params( @@ -45,7 +45,7 @@ module WorkOS 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 + def list_effective_permissions(organization_membership_id:, resource_id:, before:, after:, limit:, order:, request_options:); end sig do params( @@ -71,7 +71,7 @@ module WorkOS 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 + def list_role_assignments(organization_membership_id:, before:, after:, limit:, order:, request_options:); end sig do params( @@ -104,7 +104,7 @@ module WorkOS 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 + def remove_role_assignment(organization_membership_id:, role_assignment_id:, request_options:); end sig do params( @@ -162,7 +162,7 @@ module WorkOS request_options: T::Hash[Symbol, T.untyped] ).returns(WorkOS::Role) end - def create_role_permission(organization_id:, slug:, request_options:); end + def add_organization_role_permission(organization_id:, slug:, request_options:); end sig do params( @@ -172,7 +172,7 @@ module WorkOS request_options: T::Hash[Symbol, T.untyped] ).returns(WorkOS::Role) end - def update_role_permissions(organization_id:, slug:, permissions:, request_options:); end + def set_organization_role_permissions(organization_id:, slug:, permissions:, request_options:); end sig do params( @@ -182,7 +182,7 @@ module WorkOS request_options: T::Hash[Symbol, T.untyped] ).returns(WorkOS::Role) end - def delete_role_permission(organization_id:, slug:, permission_slug:, request_options:); end + def remove_organization_role_permission(organization_id:, slug:, permission_slug:, request_options:); end sig do params( @@ -192,7 +192,7 @@ module WorkOS 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 + def get_resource_by_external_id(organization_id:, resource_type_slug:, external_id:, request_options:); end sig do params( @@ -207,7 +207,7 @@ module WorkOS 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 + def update_resource_by_external_id(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( @@ -218,7 +218,7 @@ module WorkOS 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 + def delete_resource_by_external_id(organization_id:, resource_type_slug:, external_id:, cascade_delete:, request_options:); end sig do params( @@ -234,7 +234,7 @@ module WorkOS 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 + def list_memberships_for_resource_by_external_id(organization_id:, resource_type_slug:, external_id:, permission_slug:, before:, after:, limit:, order:, assignment:, request_options:); end sig do params( @@ -244,11 +244,12 @@ module WorkOS order: T.nilable(String), organization_id: T.nilable(String), resource_type_slug: T.nilable(String), + resource_external_id: 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 + def list_resources(before:, after:, limit:, order:, organization_id:, resource_type_slug:, resource_external_id:, search:, request_options:); end sig do params( diff --git a/rbi/workos/client.rbi b/rbi/workos/client.rbi index 0282b224..ca3c8bc1 100644 --- a/rbi/workos/client.rbi +++ b/rbi/workos/client.rbi @@ -42,6 +42,9 @@ module WorkOS sig { returns(WorkOS::AuditLogs) } def audit_logs; end + sig { returns(WorkOS::Groups) } + def groups; end + sig { returns(WorkOS::AdminPortal) } def admin_portal; end @@ -51,6 +54,9 @@ module WorkOS sig { returns(WorkOS::UserManagement) } def user_management; end + sig { returns(WorkOS::UserManagementOrganizationMembershipGroups) } + def user_management_organization_membership_groups; end + sig { returns(WorkOS::Webhooks) } def webhooks; end diff --git a/rbi/workos/create_group.rbi b/rbi/workos/create_group.rbi new file mode 100644 index 00000000..58ffa42a --- /dev/null +++ b/rbi/workos/create_group.rbi @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateGroup + 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(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/create_group_membership.rbi b/rbi/workos/create_group_membership.rbi new file mode 100644 index 00000000..56aa7923 --- /dev/null +++ b/rbi/workos/create_group_membership.rbi @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateGroupMembership + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); 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/domain_verification_intent_options.rbi b/rbi/workos/domain_verification_intent_options.rbi new file mode 100644 index 00000000..8f53607a --- /dev/null +++ b/rbi/workos/domain_verification_intent_options.rbi @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class DomainVerificationIntentOptions + sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } + def initialize(json); end + + sig { returns(T.nilable(String)) } + def domain_name; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def domain_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 index cb3d4bc7..4dee0aaf 100644 --- a/rbi/workos/generate_link.rbi +++ b/rbi/workos/generate_link.rbi @@ -40,10 +40,10 @@ module WorkOS def intent_options=(value); end sig { returns(T.nilable(T::Array[String])) } - def admin_emails; end + def it_contact_emails; end sig { params(value: T.nilable(T::Array[String])).returns(T.nilable(T::Array[String])) } - def admin_emails=(value); end + def it_contact_emails=(value); end sig { returns(T::Hash[Symbol, T.untyped]) } def to_h; end diff --git a/rbi/workos/groups.rbi b/rbi/workos/groups.rbi new file mode 100644 index 00000000..3f52d4b2 --- /dev/null +++ b/rbi/workos/groups.rbi @@ -0,0 +1,97 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class Groups + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); 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_groups(organization_id:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + organization_id: String, + name: String, + description: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Group) + end + def create_organization_group(organization_id:, name:, description:, request_options:); end + + sig do + params( + organization_id: String, + group_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Group) + end + def get_organization_group(organization_id:, group_id:, request_options:); end + + sig do + params( + organization_id: String, + group_id: String, + name: T.nilable(String), + description: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Group) + end + def update_organization_group(organization_id:, group_id:, name:, description:, request_options:); end + + sig do + params( + organization_id: String, + group_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_organization_group(organization_id:, group_id:, request_options:); end + + sig do + params( + organization_id: String, + group_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_group_organization_memberships(organization_id:, group_id:, before:, after:, limit:, order:, request_options:); end + + sig do + params( + organization_id: String, + group_id: String, + organization_membership_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Group) + end + def create_group_organization_membership(organization_id:, group_id:, organization_membership_id:, request_options:); end + + sig do + params( + organization_id: String, + group_id: String, + om_id: String, + request_options: T::Hash[Symbol, T.untyped] + ).returns(NilClass) + end + def delete_group_organization_membership(organization_id:, group_id:, om_id:, request_options:); end + + end +end diff --git a/rbi/workos/intent_options.rbi b/rbi/workos/intent_options.rbi index e8c68c59..38eea586 100644 --- a/rbi/workos/intent_options.rbi +++ b/rbi/workos/intent_options.rbi @@ -9,12 +9,18 @@ module WorkOS sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } def initialize(json); end - sig { returns(WorkOS::SSOIntentOptions) } + sig { returns(T.nilable(WorkOS::SSOIntentOptions)) } def sso; end - sig { params(value: WorkOS::SSOIntentOptions).returns(WorkOS::SSOIntentOptions) } + sig { params(value: T.nilable(WorkOS::SSOIntentOptions)).returns(T.nilable(WorkOS::SSOIntentOptions)) } def sso=(value); end + sig { returns(T.nilable(WorkOS::DomainVerificationIntentOptions)) } + def domain_verification; end + + sig { params(value: T.nilable(WorkOS::DomainVerificationIntentOptions)).returns(T.nilable(WorkOS::DomainVerificationIntentOptions)) } + def domain_verification=(value); end + sig { returns(T::Hash[Symbol, T.untyped]) } def to_h; end diff --git a/rbi/workos/invitation.rbi b/rbi/workos/invitation.rbi index 4ce15d01..03ad00cb 100644 --- a/rbi/workos/invitation.rbi +++ b/rbi/workos/invitation.rbi @@ -69,6 +69,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def accepted_user_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(String) } def created_at; end diff --git a/rbi/workos/invitation_accepted_data.rbi b/rbi/workos/invitation_accepted_data.rbi index 56f976ed..e1485516 100644 --- a/rbi/workos/invitation_accepted_data.rbi +++ b/rbi/workos/invitation_accepted_data.rbi @@ -69,6 +69,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def accepted_user_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(String) } def created_at; end diff --git a/rbi/workos/invitation_created_data.rbi b/rbi/workos/invitation_created_data.rbi index dfbdb553..5acdac5c 100644 --- a/rbi/workos/invitation_created_data.rbi +++ b/rbi/workos/invitation_created_data.rbi @@ -69,6 +69,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def accepted_user_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(String) } def created_at; end diff --git a/rbi/workos/invitation_resent_data.rbi b/rbi/workos/invitation_resent_data.rbi index 07f8f4f8..94cdb880 100644 --- a/rbi/workos/invitation_resent_data.rbi +++ b/rbi/workos/invitation_resent_data.rbi @@ -69,6 +69,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def accepted_user_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(String) } def created_at; end diff --git a/rbi/workos/invitation_revoked_data.rbi b/rbi/workos/invitation_revoked_data.rbi index 88e5f945..fa37587b 100644 --- a/rbi/workos/invitation_revoked_data.rbi +++ b/rbi/workos/invitation_revoked_data.rbi @@ -69,6 +69,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def accepted_user_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(String) } def created_at; end diff --git a/rbi/workos/update_group.rbi b/rbi/workos/update_group.rbi new file mode 100644 index 00000000..44a36ebc --- /dev/null +++ b/rbi/workos/update_group.rbi @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UpdateGroup + 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/user_invite.rbi b/rbi/workos/user_invite.rbi index e2abbc4d..b96f062a 100644 --- a/rbi/workos/user_invite.rbi +++ b/rbi/workos/user_invite.rbi @@ -69,6 +69,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def accepted_user_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(String) } def created_at; end diff --git a/rbi/workos/user_management_organization_membership_groups.rbi b/rbi/workos/user_management_organization_membership_groups.rbi new file mode 100644 index 00000000..a4b8f5d5 --- /dev/null +++ b/rbi/workos/user_management_organization_membership_groups.rbi @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserManagementOrganizationMembershipGroups + sig { params(client: WorkOS::BaseClient).void } + def initialize(client); end + + sig do + params( + om_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_groups(om_id:, before:, after:, limit:, order:, request_options:); end + + end +end diff --git a/rbi/workos/waitlist_user.rbi b/rbi/workos/waitlist_user.rbi new file mode 100644 index 00000000..e694809f --- /dev/null +++ b/rbi/workos/waitlist_user.rbi @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class WaitlistUser + 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 approved_at; end + + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def approved_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/waitlist_user_approved.rbi b/rbi/workos/waitlist_user_approved.rbi new file mode 100644 index 00000000..947c2aa5 --- /dev/null +++ b/rbi/workos/waitlist_user_approved.rbi @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class WaitlistUserApproved + 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::WaitlistUser) } + def data; end + + sig { params(value: WorkOS::WaitlistUser).returns(WorkOS::WaitlistUser) } + 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/waitlist_user_created.rbi b/rbi/workos/waitlist_user_created.rbi new file mode 100644 index 00000000..b1be8351 --- /dev/null +++ b/rbi/workos/waitlist_user_created.rbi @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class WaitlistUserCreated + 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::WaitlistUser) } + def data; end + + sig { params(value: WorkOS::WaitlistUser).returns(WorkOS::WaitlistUser) } + 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/waitlist_user_denied.rbi b/rbi/workos/waitlist_user_denied.rbi new file mode 100644 index 00000000..ab811f93 --- /dev/null +++ b/rbi/workos/waitlist_user_denied.rbi @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class WaitlistUserDenied + 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::WaitlistUser) } + def data; end + + sig { params(value: WorkOS::WaitlistUser).returns(WorkOS::WaitlistUser) } + 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/test/workos/test_authorization.rb b/test/workos/test_authorization.rb index 456808b2..56c1dfcc 100644 --- a/test/workos/test_authorization.rb +++ b/test/workos/test_authorization.rb @@ -18,17 +18,17 @@ def test_check_returns_expected_result refute_nil result end - def test_list_organization_membership_resources_returns_expected_result + def test_list_resources_for_membership_returns_expected_result 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"}) + result = @client.authorization.list_resources_for_membership(organization_membership_id: "stub", permission_slug: "stub", parent_resource: {type: "by_id"}) assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_resource_permissions_returns_expected_result + def test_list_effective_permissions_returns_expected_result 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") + result = @client.authorization.list_effective_permissions(organization_membership_id: "stub", resource_id: "stub") assert_kind_of WorkOS::Types::ListStruct, result end @@ -39,10 +39,10 @@ def test_list_effective_permissions_by_external_id_returns_expected_result assert_kind_of WorkOS::Types::ListStruct, result end - def test_list_organization_membership_role_assignments_returns_expected_result + def test_list_role_assignments_returns_expected_result 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") + result = @client.authorization.list_role_assignments(organization_membership_id: "stub") assert_kind_of WorkOS::Types::ListStruct, result end @@ -60,10 +60,10 @@ def test_remove_role_returns_expected_result assert_nil result end - def test_delete_organization_membership_role_assignment_returns_expected_result + def test_remove_role_assignment_returns_expected_result 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") + result = @client.authorization.remove_role_assignment(organization_membership_id: "stub", role_assignment_id: "stub") assert_nil result end @@ -102,52 +102,52 @@ def test_delete_organization_role_returns_expected_result assert_nil result end - def test_create_role_permission_returns_expected_result + def test_add_organization_role_permission_returns_expected_result 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") + result = @client.authorization.add_organization_role_permission(organization_id: "stub", slug: "stub", body_slug: "stub") refute_nil result end - def test_update_role_permissions_returns_expected_result + def test_set_organization_role_permissions_returns_expected_result 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: []) + result = @client.authorization.set_organization_role_permissions(organization_id: "stub", slug: "stub", permissions: []) refute_nil result end - def test_delete_role_permission_returns_expected_result + def test_remove_organization_role_permission_returns_expected_result 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") + result = @client.authorization.remove_organization_role_permission(organization_id: "stub", slug: "stub", permission_slug: "stub") refute_nil result end - def test_get_organization_resource_returns_expected_result + def test_get_resource_by_external_id_returns_expected_result 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") + result = @client.authorization.get_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") refute_nil result end - def test_update_organization_resource_returns_expected_result + def test_update_resource_by_external_id_returns_expected_result 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") + result = @client.authorization.update_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") refute_nil result end - def test_delete_organization_resource_returns_expected_result + def test_delete_resource_by_external_id_returns_expected_result 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") + result = @client.authorization.delete_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") assert_nil result end - def test_list_resource_organization_memberships_returns_expected_result + def test_list_memberships_for_resource_by_external_id_returns_expected_result 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") + result = @client.authorization.list_memberships_for_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub", permission_slug: "stub") assert_kind_of WorkOS::Types::ListStruct, result end @@ -273,25 +273,25 @@ def test_delete_permission_returns_expected_result # 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_resources_for_membership, 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_effective_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: :list_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: :remove_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: :add_organization_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: :set_organization_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: :remove_organization_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_resource_by_external_id, 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_resource_by_external_id, 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_resource_by_external_id, 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_memberships_for_resource_by_external_id, 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"}}, diff --git a/test/workos/test_groups.rb b/test/workos/test_groups.rb new file mode 100644 index 00000000..cc61912f --- /dev/null +++ b/test/workos/test_groups.rb @@ -0,0 +1,89 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class GroupsTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_list_organization_groups_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/groups(\?|\z)}) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.groups.list_organization_groups(organization_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_create_organization_group_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/groups(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.groups.create_organization_group(organization_id: "stub", name: "stub") + refute_nil result + end + + def test_get_organization_group_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.groups.get_organization_group(organization_id: "stub", group_id: "stub") + refute_nil result + end + + def test_update_organization_group_returns_expected_result + stub_request(:patch, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.groups.update_organization_group(organization_id: "stub", group_id: "stub") + refute_nil result + end + + def test_delete_organization_group_returns_expected_result + stub_request(:delete, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.groups.delete_organization_group(organization_id: "stub", group_id: "stub") + assert_nil result + end + + def test_list_group_organization_memberships_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub/organization-memberships(\?|\z)}) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.groups.list_group_organization_memberships(organization_id: "stub", group_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_create_group_organization_membership_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub/organization-memberships(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.groups.create_group_organization_membership(organization_id: "stub", group_id: "stub", organization_membership_id: "stub") + refute_nil result + end + + def test_delete_group_organization_membership_returns_expected_result + stub_request(:delete, %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub/organization-memberships/stub(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.groups.delete_group_organization_membership(organization_id: "stub", group_id: "stub", om_id: "stub") + assert_nil result + end + + # Parameterized authentication error tests (one per endpoint). + [ + {name: :list_organization_groups, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups(\?|\z)}, args: {organization_id: "stub"}}, + {name: :create_organization_group, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups(\?|\z)}, args: {organization_id: "stub", name: "stub"}}, + {name: :get_organization_group, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)}, args: {organization_id: "stub", group_id: "stub"}}, + {name: :update_organization_group, verb: :patch, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)}, args: {organization_id: "stub", group_id: "stub"}}, + {name: :delete_organization_group, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub(\?|\z)}, args: {organization_id: "stub", group_id: "stub"}}, + {name: :list_group_organization_memberships, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub/organization-memberships(\?|\z)}, args: {organization_id: "stub", group_id: "stub"}}, + {name: :create_group_organization_membership, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub/organization-memberships(\?|\z)}, args: {organization_id: "stub", group_id: "stub", organization_membership_id: "stub"}}, + {name: :delete_group_organization_membership, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organizations/stub/groups/stub/organization-memberships/stub(\?|\z)}, args: {organization_id: "stub", group_id: "stub", om_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.groups.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 79adf9e7..b5b481c7 100644 --- a/test/workos/test_model_round_trip.rb +++ b/test/workos/test_model_round_trip.rb @@ -459,6 +459,40 @@ def test_create_cors_origin_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_create_group_membership_round_trip + fixture = { + "organization_membership_id" => "stub" + } + model = WorkOS::CreateGroupMembership.new(fixture.to_json) + json = model.to_h + assert_kind_of Hash, json + 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_create_group_round_trip + fixture = { + "name" => "stub", + "description" => nil + } + model = WorkOS::CreateGroup.new(fixture.to_json) + 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_group_round_trip + fixture = { + "name" => "stub", + "description" => nil + } + model = WorkOS::UpdateGroup.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_jwt_template_round_trip fixture = { "content" => "stub" @@ -550,9 +584,20 @@ def test_sso_intent_options_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_domain_verification_intent_options_round_trip + fixture = { + "domain_name" => "stub" + } + model = WorkOS::DomainVerificationIntentOptions.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 fixture = { - "sso" => {} + "sso" => {}, + "domain_verification" => {} } model = WorkOS::IntentOptions.new(fixture.to_json) json = model.to_h @@ -567,7 +612,7 @@ def test_generate_link_round_trip "organization" => "stub", "intent" => "stub", "intent_options" => {}, - "admin_emails" => [] + "it_contact_emails" => [] } model = WorkOS::GenerateLink.new(fixture.to_json) json = model.to_h @@ -1321,6 +1366,28 @@ def test_directory_user_with_groups_round_trip 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 + 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] + 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 fixture = { "id" => "stub", @@ -1384,28 +1451,6 @@ def test_directory_user_round_trip 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 - 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] - 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 fixture = { "object" => "user", @@ -1438,6 +1483,27 @@ def test_user_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_waitlist_user_round_trip + fixture = { + "object" => "waitlist_user", + "id" => "stub", + "email" => "stub", + "state" => "stub", + "approved_at" => nil, + "created_at" => "stub", + "updated_at" => "stub" + } + model = WorkOS::WaitlistUser.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[:approved_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 fixture = { "object" => "event", @@ -3746,6 +3812,7 @@ def test_invitation_accepted_data_round_trip "organization_id" => nil, "inviter_user_id" => nil, "accepted_user_id" => nil, + "role_slug" => nil, "created_at" => "stub", "updated_at" => "stub" } @@ -3760,6 +3827,7 @@ def test_invitation_accepted_data_round_trip assert_nil json[:organization_id] assert_nil json[:inviter_user_id] assert_nil json[:accepted_user_id] + assert_nil json[:role_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}" } @@ -3794,6 +3862,7 @@ def test_invitation_created_data_round_trip "organization_id" => nil, "inviter_user_id" => nil, "accepted_user_id" => nil, + "role_slug" => nil, "created_at" => "stub", "updated_at" => "stub" } @@ -3808,6 +3877,7 @@ def test_invitation_created_data_round_trip assert_nil json[:organization_id] assert_nil json[:inviter_user_id] assert_nil json[:accepted_user_id] + assert_nil json[:role_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}" } @@ -3842,6 +3912,7 @@ def test_invitation_resent_data_round_trip "organization_id" => nil, "inviter_user_id" => nil, "accepted_user_id" => nil, + "role_slug" => nil, "created_at" => "stub", "updated_at" => "stub" } @@ -3856,6 +3927,7 @@ def test_invitation_resent_data_round_trip assert_nil json[:organization_id] assert_nil json[:inviter_user_id] assert_nil json[:accepted_user_id] + assert_nil json[:role_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}" } @@ -3890,6 +3962,7 @@ def test_invitation_revoked_data_round_trip "organization_id" => nil, "inviter_user_id" => nil, "accepted_user_id" => nil, + "role_slug" => nil, "created_at" => "stub", "updated_at" => "stub" } @@ -3904,6 +3977,7 @@ def test_invitation_revoked_data_round_trip assert_nil json[:organization_id] assert_nil json[:inviter_user_id] assert_nil json[:accepted_user_id] + assert_nil json[:role_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}" } @@ -5423,6 +5497,57 @@ def test_vault_names_listed_data_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_waitlist_user_approved_round_trip + fixture = { + "id" => "stub", + "event" => "waitlist_user.approved", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::WaitlistUserApproved.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] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_waitlist_user_created_round_trip + fixture = { + "id" => "stub", + "event" => "waitlist_user.created", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::WaitlistUserCreated.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] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_waitlist_user_denied_round_trip + fixture = { + "id" => "stub", + "event" => "waitlist_user.denied", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::WaitlistUserDenied.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] + 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 fixture = { "object" => "jwt_template", @@ -5717,6 +5842,7 @@ def test_user_invite_round_trip "organization_id" => nil, "inviter_user_id" => nil, "accepted_user_id" => nil, + "role_slug" => nil, "created_at" => "stub", "updated_at" => "stub", "token" => "stub", @@ -5733,6 +5859,7 @@ def test_user_invite_round_trip assert_nil json[:organization_id] assert_nil json[:inviter_user_id] assert_nil json[:accepted_user_id] + assert_nil json[:role_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["token"], json[:token] @@ -6826,6 +6953,7 @@ def test_invitation_round_trip "organization_id" => nil, "inviter_user_id" => nil, "accepted_user_id" => nil, + "role_slug" => nil, "created_at" => "stub", "updated_at" => "stub", "token" => "stub", @@ -6842,6 +6970,7 @@ def test_invitation_round_trip assert_nil json[:organization_id] assert_nil json[:inviter_user_id] assert_nil json[:accepted_user_id] + assert_nil json[:role_slug] assert_equal fixture["created_at"], json[:created_at] assert_equal fixture["updated_at"], json[:updated_at] assert_equal fixture["token"], json[:token] diff --git a/test/workos/test_user_management_organization_membership_groups.rb b/test/workos/test_user_management_organization_membership_groups.rb new file mode 100644 index 00000000..b0f07081 --- /dev/null +++ b/test/workos/test_user_management_organization_membership_groups.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +require "test_helper" + +class UserManagementOrganizationMembershipGroupsTest < Minitest::Test + include FixtureHelper + + def setup + @client = WorkOS::Client.new(api_key: "sk_test_123") + end + + def test_list_organization_membership_groups_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub/groups(\?|\z)}) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.user_management_organization_membership_groups.list_organization_membership_groups(om_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + # Parameterized authentication error tests (one per endpoint). + [ + {name: :list_organization_membership_groups, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub/groups(\?|\z)}, args: {om_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_organization_membership_groups.send(spec[:name], **(spec[:args] || {})) + end + end + end +end From 92b2aa5166e370bc8f9aaaee22626058d93521a5 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Mon, 27 Apr 2026 16:59:30 -0400 Subject: [PATCH 141/159] fix: remove stale URN-prefixed alias files breaking Zeitwerk (#466) Co-authored-by: Claude Opus 4.6 (1M context) --- ...grant_type_device_code_session_authenticate_request.rb | 8 -------- ...mail_verification_code_session_authenticate_request.rb | 8 -------- ...t_type_magic_auth_code_session_authenticate_request.rb | 8 -------- ...th_grant_type_mfa_totp_session_authenticate_request.rb | 8 -------- ...organization_selection_session_authenticate_request.rb | 8 -------- 5 files changed, 40 deletions(-) delete mode 100644 lib/workos/user_management/urn_ietf_params_oauth_grant_type_device_code_session_authenticate_request.rb delete mode 100644 lib/workos/user_management/urn_workos_oauth_grant_type_email_verification_code_session_authenticate_request.rb delete mode 100644 lib/workos/user_management/urn_workos_oauth_grant_type_magic_auth_code_session_authenticate_request.rb delete mode 100644 lib/workos/user_management/urn_workos_oauth_grant_type_mfa_totp_session_authenticate_request.rb delete mode 100644 lib/workos/user_management/urn_workos_oauth_grant_type_organization_selection_session_authenticate_request.rb 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 deleted file mode 100644 index e6acd7a4..00000000 --- a/lib/workos/user_management/urn_ietf_params_oauth_grant_type_device_code_session_authenticate_request.rb +++ /dev/null @@ -1,8 +0,0 @@ -# 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 deleted file mode 100644 index edce56f1..00000000 --- a/lib/workos/user_management/urn_workos_oauth_grant_type_email_verification_code_session_authenticate_request.rb +++ /dev/null @@ -1,8 +0,0 @@ -# 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 deleted file mode 100644 index ea199f7c..00000000 --- a/lib/workos/user_management/urn_workos_oauth_grant_type_magic_auth_code_session_authenticate_request.rb +++ /dev/null @@ -1,8 +0,0 @@ -# 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 deleted file mode 100644 index 8a5d4ef4..00000000 --- a/lib/workos/user_management/urn_workos_oauth_grant_type_mfa_totp_session_authenticate_request.rb +++ /dev/null @@ -1,8 +0,0 @@ -# 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 deleted file mode 100644 index 10651e79..00000000 --- a/lib/workos/user_management/urn_workos_oauth_grant_type_organization_selection_session_authenticate_request.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - # @deprecated Use WorkOS::OrganizationSelectionSessionAuthenticateRequest instead. - UrnWorkosOAuthGrantTypeOrganizationSelectionSessionAuthenticateRequest = OrganizationSelectionSessionAuthenticateRequest -end From eea391cd88015373fb89f3b8fbe1dda9c5cfedbe Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Mon, 27 Apr 2026 17:00:35 -0400 Subject: [PATCH 142/159] fix: eagerly load configuration.rb to fix WorkOS.configure (#467) Co-authored-by: Claude Opus 4.6 (1M context) --- .oagen-manifest.json | 2 +- README.md | 1 - lib/workos.rb | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.oagen-manifest.json b/.oagen-manifest.json index b69affa1..4da8af4f 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,7 +1,7 @@ { "version": 2, "language": "ruby", - "generatedAt": "2026-04-27T20:38:15.866Z", + "generatedAt": "2026-04-27T20:55:49.741Z", "files": [ "lib/workos.rb", "lib/workos/admin_portal.rb", diff --git a/README.md b/README.md index 9749fa2e..66b81300 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,6 @@ Or configure the SDK in an initializer: # /config/initializers/workos.rb require "workos" -require "workos/configuration" WorkOS.configure do |config| config.api_key = ENV.fetch("WORKOS_API_KEY") diff --git a/lib/workos.rb b/lib/workos.rb index 65b84295..0b92065f 100644 --- a/lib/workos.rb +++ b/lib/workos.rb @@ -32,6 +32,8 @@ module WorkOS loader.collapse("#{__dir__}/workos/widgets") loader.ignore("#{__dir__}/workos/errors.rb") loader.ignore("#{__dir__}/workos/inflections.rb") +loader.ignore("#{__dir__}/workos/configuration.rb") loader.setup require "workos/errors" +require "workos/configuration" From 2aa0574f3084e79af488c2125adbfc337604a3be Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Mon, 27 Apr 2026 17:03:35 -0400 Subject: [PATCH 143/159] fix: update Gemfile.lock in release-please PR and bump action pins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After release-please creates a PR, run bundle install and commit the updated Gemfile.lock so CI doesn't fail due to a missing checksum. Also bumps ruby/setup-ruby v1.302.0 → v1.306.0 and action pins. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/release-please.yml | 26 ++++++++++++++++++++++++-- .github/workflows/release.yml | 2 +- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 403a12cc..1347431d 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@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1.302.0 + - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2b312cc2..e4edcf8f 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@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1.302.0 + - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: true diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 6d6916a3..8941380d 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -15,11 +15,33 @@ jobs: steps: - name: Generate token id: generate-token - uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 with: app-id: ${{ vars.SDK_BOT_APP_ID }} private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} - - uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0 + - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 + id: release with: token: ${{ steps.generate-token.outputs.token }} + + - name: Update Gemfile.lock on release PR + if: steps.release.outputs.pr + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ fromJSON(steps.release.outputs.pr).headBranchName }} + token: ${{ steps.generate-token.outputs.token }} + + - name: Bundle install and commit + if: steps.release.outputs.pr + run: | + bundle install + if git diff --quiet Gemfile.lock; then + echo "Gemfile.lock is up to date" + else + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add Gemfile.lock + git commit -m "chore: update Gemfile.lock" + git push + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 086cea25..4262d2dc 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@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1.302.0 + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 with: bundler-cache: true From aa5ebd0e26edc291f54d92b2f4681a224b0d3889 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Mon, 27 Apr 2026 17:08:32 -0400 Subject: [PATCH 144/159] fix: add ruby/setup-ruby to release-please workflow bundle install requires Ruby to be available on the runner. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/release-please.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 8941380d..0f09d3cf 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -32,6 +32,12 @@ jobs: ref: ${{ fromJSON(steps.release.outputs.pr).headBranchName }} token: ${{ steps.generate-token.outputs.token }} + - name: Set up Ruby + if: steps.release.outputs.pr + uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + with: + ruby-version: ruby + - name: Bundle install and commit if: steps.release.outputs.pr run: | From a4febaf859117336f4fa1bc07cfe837f498c3113 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Mon, 27 Apr 2026 17:16:23 -0400 Subject: [PATCH 145/159] chore(main): release 7.1.0 (#461) Co-authored-by: workos-sdk-automation[bot] <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] --- .release-please-manifest.json | 2 +- CHANGELOG.md | 16 ++++++++++++++++ Gemfile.lock | 4 ++-- lib/workos/version.rb | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index aeda91d8..58ef57e0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "7.0.0" + ".": "7.1.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index dc241aca..2feb2aaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [7.1.0](https://github.com/workos/workos-ruby/compare/v7.0.0...v7.1.0) (2026-04-27) + + +### Features + +* **generated:** update generated SDK from spec changes ([#465](https://github.com/workos/workos-ruby/issues/465)) ([6c145d2](https://github.com/workos/workos-ruby/commit/6c145d2bfec9af8fcffdc5ffe678f452ea925f22)) + + +### Bug Fixes + +* add ruby/setup-ruby to release-please workflow ([aa5ebd0](https://github.com/workos/workos-ruby/commit/aa5ebd0e26edc291f54d92b2f4681a224b0d3889)) +* eagerly load configuration.rb to fix WorkOS.configure ([#467](https://github.com/workos/workos-ruby/issues/467)) ([eea391c](https://github.com/workos/workos-ruby/commit/eea391cd88015373fb89f3b8fbe1dda9c5cfedbe)) +* remove stale URN-prefixed alias files breaking Zeitwerk ([#466](https://github.com/workos/workos-ruby/issues/466)) ([92b2aa5](https://github.com/workos/workos-ruby/commit/92b2aa5166e370bc8f9aaaee22626058d93521a5)) +* update Gemfile.lock in release-please PR and bump action pins ([2aa0574](https://github.com/workos/workos-ruby/commit/2aa0574f3084e79af488c2125adbfc337604a3be)) +* update Zeitwerk autoload for inflections.rb ([#460](https://github.com/workos/workos-ruby/issues/460)) ([4fa1332](https://github.com/workos/workos-ruby/commit/4fa1332f66c14e89c6df8d8d6af6ac8024824b15)) + ## [7.0.0](https://github.com/workos/workos-ruby/compare/v6.2.0...v7.0.0) (2026-04-20) This is a major release that introduces a fully redesigned SDK architecture. The SDK is now **generated from the WorkOS OpenAPI spec**, bringing type safety, consistent interfaces, and improved developer ergonomics. diff --git a/Gemfile.lock b/Gemfile.lock index 7163e5f4..41c50281 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (7.0.0) + workos (7.1.0) jwt (~> 3.1) logger (~> 1.7) zeitwerk (~> 2.6) @@ -124,7 +124,7 @@ CHECKSUMS unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42 unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90 - workos (7.0.0) + workos (7.1.0) zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd BUNDLED WITH diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 8098fd55..3472267a 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -2,5 +2,5 @@ # @oagen-ignore-file module WorkOS - VERSION = "7.0.0" + VERSION = "7.1.0" end From 32662ab3d67ffdcc895141aa8fd5efb22ba79fdb Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Wed, 29 Apr 2026 11:00:21 -0400 Subject: [PATCH 146/159] fix: seal session client-side in Session#refresh (#470) Co-authored-by: Claude Opus 4.6 (1M context) --- lib/workos/session.rb | 21 ++++-- test/workos/test_session.rb | 125 ++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 5 deletions(-) diff --git a/lib/workos/session.rb b/lib/workos/session.rb index d2d49d9b..5165fb32 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -90,18 +90,27 @@ def refresh(organization_id: nil, cookie_password: nil) body = { "grant_type" => "refresh_token", "client_id" => @client.client_id, - "refresh_token" => session["refresh_token"], - "session" => {"seal_session" => true, "cookie_password" => effective_password} + "refresh_token" => session["refresh_token"] } body["organization_id"] = organization_id if organization_id 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 - @cookie_password = effective_password + sealed = @manager.seal_session_from_auth_response( + access_token: auth_response["access_token"], + refresh_token: auth_response["refresh_token"], + cookie_password: effective_password, + user: auth_response["user"], + impersonator: auth_response["impersonator"] + ) + + # Decode before mutating session state so a malformed access_token + # doesn't leave the Session half-updated. decoded = @manager.decode_jwt(auth_response["access_token"]) + + @seal_data = sealed + @cookie_password = effective_password SessionManager::RefreshSuccess.new( authenticated: true, sealed_session: sealed, @@ -117,6 +126,8 @@ def refresh(organization_id: nil, cookie_password: nil) ) rescue WorkOS::AuthenticationError, WorkOS::InvalidRequestError => e SessionManager::RefreshError.new(authenticated: false, reason: e.message) + rescue JWT::DecodeError => e + SessionManager::RefreshError.new(authenticated: false, reason: e.message) end # Build the WorkOS session-logout URL for the currently authenticated session. diff --git a/test/workos/test_session.rb b/test/workos/test_session.rb index ad9db804..1fc6d116 100644 --- a/test/workos/test_session.rb +++ b/test/workos/test_session.rb @@ -206,6 +206,131 @@ def test_get_logout_url_includes_session_id_from_authenticate assert_equal "https://app/cb", params["return_to"] end + # --- Session#refresh ------------------------------------------------------- + + def test_refresh_seals_session_client_side_and_returns_refresh_success + rsa, pub = signing_key_pair + old_access = make_jwt({"sid" => "session_old", "exp" => Time.now.to_i - 60}, rsa) + sealed = @sm.seal_data({"access_token" => old_access, "refresh_token" => "rt_old", "user" => {"id" => "u_1"}}, PASSWORD) + + new_access = make_jwt({"sid" => "session_new", "org_id" => "org_1", "role" => "admin", "exp" => Time.now.to_i + 300}, rsa) + api_response = { + "access_token" => new_access, + "refresh_token" => "rt_new", + "user" => {"id" => "u_1", "email" => "a@b.com"}, + "impersonator" => nil + } + + stub_request(:post, "https://api.workos.com/user_management/authenticate") + .with(body: hash_including("grant_type" => "refresh_token", "refresh_token" => "rt_old")) + .to_return(status: 200, body: api_response.to_json) + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) + + session = @sm.load(seal_data: sealed, cookie_password: PASSWORD) + result = session.refresh + + assert_kind_of WorkOS::SessionManager::RefreshSuccess, result + assert result.authenticated + assert_equal "session_new", result.session_id + assert_equal "org_1", result.organization_id + assert_equal "admin", result.role + assert_equal "u_1", result.user["id"] + + # sealed_session should be a non-empty string that round-trips + refute_empty result.sealed_session + unsealed = @sm.unseal_data(result.sealed_session, PASSWORD) + assert_equal new_access, unsealed["access_token"] + assert_equal "rt_new", unsealed["refresh_token"] + end + + def test_refresh_updates_internal_seal_data_for_subsequent_authenticate + rsa, pub = signing_key_pair + old_access = make_jwt({"sid" => "session_old", "exp" => Time.now.to_i - 60}, rsa) + sealed = @sm.seal_data({"access_token" => old_access, "refresh_token" => "rt_old", "user" => {"id" => "u_1"}}, PASSWORD) + + new_access = make_jwt({"sid" => "session_refreshed", "org_id" => "org_2", "exp" => Time.now.to_i + 300}, rsa) + api_response = { + "access_token" => new_access, + "refresh_token" => "rt_new", + "user" => {"id" => "u_1"} + } + + stub_request(:post, "https://api.workos.com/user_management/authenticate") + .to_return(status: 200, body: api_response.to_json) + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) + + session = @sm.load(seal_data: sealed, cookie_password: PASSWORD) + session.refresh + + # A subsequent authenticate should use the refreshed token + auth = session.authenticate + assert_kind_of WorkOS::SessionManager::AuthSuccess, auth + assert auth.authenticated + assert_equal "session_refreshed", auth.session_id + end + + def test_refresh_returns_error_on_invalid_cookie + result = @sm.refresh(seal_data: "garbage", cookie_password: PASSWORD) + assert_kind_of WorkOS::SessionManager::RefreshError, result + refute result.authenticated + assert_equal WorkOS::SessionManager::INVALID_SESSION_COOKIE, result.reason + end + + def test_refresh_returns_error_when_no_refresh_token + sealed = @sm.seal_data({"access_token" => "at_only"}, PASSWORD) + result = @sm.refresh(seal_data: sealed, cookie_password: PASSWORD) + assert_kind_of WorkOS::SessionManager::RefreshError, result + assert_equal WorkOS::SessionManager::INVALID_SESSION_COOKIE, result.reason + end + + def test_refresh_does_not_send_session_param_to_api + rsa, pub = signing_key_pair + old_access = make_jwt({"sid" => "s", "exp" => Time.now.to_i - 60}, rsa) + sealed = @sm.seal_data({"access_token" => old_access, "refresh_token" => "rt_x", "user" => {"id" => "u"}}, PASSWORD) + + new_access = make_jwt({"sid" => "s2", "exp" => Time.now.to_i + 300}, rsa) + api_response = {"access_token" => new_access, "refresh_token" => "rt_y", "user" => {"id" => "u"}} + + stub = stub_request(:post, "https://api.workos.com/user_management/authenticate") + .with { |req| !req.body.include?("seal_session") } + .to_return(status: 200, body: api_response.to_json) + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) + + session = @sm.load(seal_data: sealed, cookie_password: PASSWORD) + session.refresh + + assert_requested(stub) + end + + def test_refresh_returns_error_on_malformed_access_token_without_mutating_state + rsa, pub = signing_key_pair + old_access = make_jwt({"sid" => "session_old", "exp" => Time.now.to_i - 60}, rsa) + sealed = @sm.seal_data({"access_token" => old_access, "refresh_token" => "rt_old", "user" => {"id" => "u_1"}}, PASSWORD) + + api_response = { + "access_token" => "not-a-valid-jwt", + "refresh_token" => "rt_new", + "user" => {"id" => "u_1"} + } + + stub_request(:post, "https://api.workos.com/user_management/authenticate") + .to_return(status: 200, body: api_response.to_json) + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) + + session = @sm.load(seal_data: sealed, cookie_password: PASSWORD) + result = session.refresh + + assert_kind_of WorkOS::SessionManager::RefreshError, result + refute result.authenticated + + # Session state should not have been mutated + assert_equal sealed, session.seal_data + end + # --- Session constructor validation --------------------------------------- def test_session_load_requires_cookie_password From 260974f431d24ed3ddd691b75be6e568a92b2053 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Wed, 29 Apr 2026 11:28:14 -0400 Subject: [PATCH 147/159] chore(main): release 7.1.1 (#472) Co-authored-by: workos-sdk-automation[bot] <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ Gemfile.lock | 4 ++-- lib/workos/version.rb | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 58ef57e0..4e9d6c7e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "7.1.0" + ".": "7.1.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 2feb2aaa..9c5b6fc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [7.1.1](https://github.com/workos/workos-ruby/compare/v7.1.0...v7.1.1) (2026-04-29) + + +### Bug Fixes + +* seal session client-side in Session#refresh ([#470](https://github.com/workos/workos-ruby/issues/470)) ([32662ab](https://github.com/workos/workos-ruby/commit/32662ab3d67ffdcc895141aa8fd5efb22ba79fdb)) + ## [7.1.0](https://github.com/workos/workos-ruby/compare/v7.0.0...v7.1.0) (2026-04-27) diff --git a/Gemfile.lock b/Gemfile.lock index 41c50281..f3997384 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (7.1.0) + workos (7.1.1) jwt (~> 3.1) logger (~> 1.7) zeitwerk (~> 2.6) @@ -124,7 +124,7 @@ CHECKSUMS unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42 unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90 - workos (7.1.0) + workos (7.1.1) zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd BUNDLED WITH diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 3472267a..824922b5 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -2,5 +2,5 @@ # @oagen-ignore-file module WorkOS - VERSION = "7.1.0" + VERSION = "7.1.1" end From a66c15b6070ad8c26f0ca0b9ad7414f7b2ce8d8a Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Thu, 30 Apr 2026 14:05:16 -0400 Subject: [PATCH 148/159] fix: replace parameter-group hashes with typed variant classes (#473) Co-authored-by: Claude Opus 4.7 (1M context) --- .oagen-manifest.json | 2 +- lib/workos/api_keys.rb | 2 +- lib/workos/audit_logs.rb | 4 +- lib/workos/authorization.rb | 244 +++++++++++++++------------- lib/workos/groups.rb | 2 +- lib/workos/multi_factor_auth.rb | 2 +- lib/workos/organization_domains.rb | 2 +- lib/workos/radar.rb | 4 +- lib/workos/sso.rb | 4 +- lib/workos/user_management.rb | 139 ++++++++-------- lib/workos/webhooks.rb | 2 +- rbi/workos/authorization.rbi | 126 +++++++++++--- rbi/workos/user_management.rbi | 74 +++++++-- test/workos/test_audit_logs.rb | 4 +- test/workos/test_authorization.rb | 106 +++++++++--- test/workos/test_user_management.rb | 52 +++++- test/workos/test_webhooks.rb | 4 +- 17 files changed, 508 insertions(+), 265 deletions(-) diff --git a/.oagen-manifest.json b/.oagen-manifest.json index 4da8af4f..3dd2b3da 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,7 +1,7 @@ { "version": 2, "language": "ruby", - "generatedAt": "2026-04-27T20:55:49.741Z", + "generatedAt": "2026-04-30T17:41:02.756Z", "files": [ "lib/workos.rb", "lib/workos/admin_portal.rb", diff --git a/lib/workos/api_keys.rb b/lib/workos/api_keys.rb index 746f4899..5fb3a995 100644 --- a/lib/workos/api_keys.rb +++ b/lib/workos/api_keys.rb @@ -20,7 +20,7 @@ def create_validation( ) body = { "value" => value - }.compact + } response = @client.request( method: :post, path: "/api_keys/validations", diff --git a/lib/workos/audit_logs.rb b/lib/workos/audit_logs.rb index 7f21d0c7..45226db3 100644 --- a/lib/workos/audit_logs.rb +++ b/lib/workos/audit_logs.rb @@ -41,7 +41,7 @@ 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", @@ -189,7 +189,7 @@ def create_event( body = { "organization_id" => organization_id, "event" => event - }.compact + } response = @client.request( method: :post, path: "/audit_logs/events", diff --git a/lib/workos/authorization.rb b/lib/workos/authorization.rb index c651908c..fcdc09aa 100644 --- a/lib/workos/authorization.rb +++ b/lib/workos/authorization.rb @@ -6,6 +6,48 @@ module WorkOS class Authorization + # Identifies the resource target (by id variant). + # + # @!attribute [r] resource_id + # @return [String] + ResourceTargetById = Data.define(:resource_id) + + # Identifies the resource target (by external id variant). + # + # @!attribute [r] resource_external_id + # @return [String] + # @!attribute [r] resource_type_slug + # @return [String] + ResourceTargetByExternalId = Data.define(:resource_external_id, :resource_type_slug) + + # Identifies the parent resource (by id variant). + # + # @!attribute [r] parent_resource_id + # @return [String] + ParentResourceById = Data.define(:parent_resource_id) + + # Identifies the parent resource (by external id variant). + # + # @!attribute [r] parent_resource_type_slug + # @return [String] + # @!attribute [r] parent_resource_external_id + # @return [String] + ParentResourceByExternalId = Data.define(:parent_resource_type_slug, :parent_resource_external_id) + + # Identifies the parent (by id variant). + # + # @!attribute [r] parent_resource_id + # @return [String] + ParentById = Data.define(:parent_resource_id) + + # Identifies the parent (by external id variant). + # + # @!attribute [r] parent_resource_type_slug + # @return [String] + # @!attribute [r] parent_external_id + # @return [String] + ParentByExternalId = Data.define(:parent_resource_type_slug, :parent_external_id) + def initialize(client) @client = client end @@ -13,32 +55,26 @@ def initialize(client) # 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 resource_target [WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId] Identifies the resource target. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @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: {} ) body = { - "permission_slug" => permission_slug, - "resource_id" => resource_id, - "resource_external_id" => resource_external_id, - "resource_type_slug" => resource_type_slug - }.compact - case resource_target[:type] - when "by_id" - body["resource_id"] = resource_target[:resource_id] - when "by_external_id" - body["resource_external_id"] = resource_target[:resource_external_id] - body["resource_type_slug"] = resource_target[:resource_type_slug] + "permission_slug" => permission_slug + } + case resource_target + when WorkOS::Authorization::ResourceTargetById + body["resource_id"] = resource_target.resource_id + when WorkOS::Authorization::ResourceTargetByExternalId + body["resource_external_id"] = resource_target.resource_external_id + body["resource_type_slug"] = resource_target.resource_type_slug + else + raise ArgumentError, "expected resource_target to be one of: WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId, got #{resource_target.class}" end response = @client.request( method: :post, @@ -59,6 +95,7 @@ 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 parent_resource [WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId] Identifies the parent resource. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_resources_for_membership( @@ -78,12 +115,14 @@ def list_resources_for_membership( "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] + case parent_resource + when WorkOS::Authorization::ParentResourceById + params["parent_resource_id"] = parent_resource.parent_resource_id + when WorkOS::Authorization::ParentResourceByExternalId + params["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug + params["parent_resource_external_id"] = parent_resource.parent_resource_external_id + else + raise ArgumentError, "expected parent_resource to be one of: WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId, got #{parent_resource.class}" end response = @client.request( method: :get, @@ -265,32 +304,26 @@ def list_role_assignments( # 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 resource_target [WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId] Identifies the resource target. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @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: {} ) body = { - "role_slug" => role_slug, - "resource_id" => resource_id, - "resource_external_id" => resource_external_id, - "resource_type_slug" => resource_type_slug - }.compact - case resource_target[:type] - when "by_id" - body["resource_id"] = resource_target[:resource_id] - when "by_external_id" - body["resource_external_id"] = resource_target[:resource_external_id] - body["resource_type_slug"] = resource_target[:resource_type_slug] + "role_slug" => role_slug + } + case resource_target + when WorkOS::Authorization::ResourceTargetById + body["resource_id"] = resource_target.resource_id + when WorkOS::Authorization::ResourceTargetByExternalId + body["resource_external_id"] = resource_target.resource_external_id + body["resource_type_slug"] = resource_target.resource_type_slug + else + raise ArgumentError, "expected resource_target to be one of: WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId, got #{resource_target.class}" end response = @client.request( method: :post, @@ -307,34 +340,28 @@ def assign_role( # 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 resource_target [WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId] Identifies the resource target. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @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 = {}.compact - 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] + params = {} + case resource_target + when WorkOS::Authorization::ResourceTargetById + params["resource_id"] = resource_target.resource_id + when WorkOS::Authorization::ResourceTargetByExternalId + params["resource_external_id"] = resource_target.resource_external_id + params["resource_type_slug"] = resource_target.resource_type_slug + else + raise ArgumentError, "expected resource_target to be one of: WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId, got #{resource_target.class}" end body = { - "role_slug" => role_slug, - "resource_id" => resource_id, - "resource_external_id" => resource_external_id, - "resource_type_slug" => resource_type_slug - }.compact + "role_slug" => role_slug + } @client.request( method: :delete, path: "/authorization/organization_memberships/#{WorkOS::Util.encode_path(organization_membership_id)}/role_assignments", @@ -502,7 +529,7 @@ def add_organization_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", @@ -529,7 +556,7 @@ def set_organization_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", @@ -594,9 +621,7 @@ def get_resource_by_external_id( # @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 parent_resource [WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId, nil] Identifies the parent resource. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationResource] def update_resource_by_external_id( @@ -605,26 +630,22 @@ def update_resource_by_external_id( 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: {} ) 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 + "description" => description }.compact if parent_resource - case parent_resource[:type] - when "by_id" - body["parent_resource_id"] = parent_resource[:parent_resource_id] - when "by_external_id" - body["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] - body["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] + case parent_resource + when WorkOS::Authorization::ParentResourceById + body["parent_resource_id"] = parent_resource.parent_resource_id + when WorkOS::Authorization::ParentResourceByExternalId + body["parent_resource_external_id"] = parent_resource.parent_resource_external_id + body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug + else + raise ArgumentError, "expected parent_resource to be one of: WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId, got #{parent_resource.class}" end end response = @client.request( @@ -736,6 +757,7 @@ def list_memberships_for_resource_by_external_id( # @param resource_type_slug [String, nil] Filter resources by resource type slug. # @param resource_external_id [String, nil] Filter resources by external ID. # @param search [String, nil] Search resources by name. + # @param parent [WorkOS::Authorization::ParentById, WorkOS::Authorization::ParentByExternalId, nil] Identifies the parent. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_resources( @@ -761,12 +783,14 @@ def list_resources( "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] + case parent + when WorkOS::Authorization::ParentById + params["parent_resource_id"] = parent.parent_resource_id + when WorkOS::Authorization::ParentByExternalId + params["parent_resource_type_slug"] = parent.parent_resource_type_slug + params["parent_external_id"] = parent.parent_external_id + else + raise ArgumentError, "expected parent to be one of: WorkOS::Authorization::ParentById, WorkOS::Authorization::ParentByExternalId, got #{parent.class}" end end response = @client.request( @@ -804,9 +828,7 @@ def list_resources( # @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 parent_resource [WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId, nil] Identifies the parent resource. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::AuthorizationResource] def create_resource( @@ -815,9 +837,6 @@ def create_resource( 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: {} ) @@ -826,18 +845,17 @@ def create_resource( "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 + "organization_id" => organization_id }.compact if parent_resource - case parent_resource[:type] - when "by_id" - body["parent_resource_id"] = parent_resource[:parent_resource_id] - when "by_external_id" - body["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] - body["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] + case parent_resource + when WorkOS::Authorization::ParentResourceById + body["parent_resource_id"] = parent_resource.parent_resource_id + when WorkOS::Authorization::ParentResourceByExternalId + body["parent_resource_external_id"] = parent_resource.parent_resource_external_id + body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug + else + raise ArgumentError, "expected parent_resource to be one of: WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId, got #{parent_resource.class}" end end response = @client.request( @@ -875,35 +893,29 @@ def get_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 parent_resource [WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId, nil] Identifies the parent resource. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @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: {} ) 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 + "description" => description }.compact if parent_resource - case parent_resource[:type] - when "by_id" - body["parent_resource_id"] = parent_resource[:parent_resource_id] - when "by_external_id" - body["parent_resource_external_id"] = parent_resource[:parent_resource_external_id] - body["parent_resource_type_slug"] = parent_resource[:parent_resource_type_slug] + case parent_resource + when WorkOS::Authorization::ParentResourceById + body["parent_resource_id"] = parent_resource.parent_resource_id + when WorkOS::Authorization::ParentResourceByExternalId + body["parent_resource_external_id"] = parent_resource.parent_resource_external_id + body["parent_resource_type_slug"] = parent_resource.parent_resource_type_slug + else + raise ArgumentError, "expected parent_resource to be one of: WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId, got #{parent_resource.class}" end end response = @client.request( @@ -1102,7 +1114,7 @@ def add_environment_role_permission( ) body = { "slug" => body_slug - }.compact + } response = @client.request( method: :post, path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}/permissions", @@ -1127,7 +1139,7 @@ def set_environment_role_permissions( ) body = { "permissions" => permissions - }.compact + } response = @client.request( method: :put, path: "/authorization/roles/#{WorkOS::Util.encode_path(slug)}/permissions", diff --git a/lib/workos/groups.rb b/lib/workos/groups.rb index 75d7ddb2..d506e1f9 100644 --- a/lib/workos/groups.rb +++ b/lib/workos/groups.rb @@ -219,7 +219,7 @@ def create_group_organization_membership( ) body = { "organization_membership_id" => organization_membership_id - }.compact + } response = @client.request( method: :post, path: "/organizations/#{WorkOS::Util.encode_path(organization_id)}/groups/#{WorkOS::Util.encode_path(group_id)}/organization-memberships", diff --git a/lib/workos/multi_factor_auth.rb b/lib/workos/multi_factor_auth.rb index 93f2f6ea..59b66850 100644 --- a/lib/workos/multi_factor_auth.rb +++ b/lib/workos/multi_factor_auth.rb @@ -22,7 +22,7 @@ def verify_challenge( ) body = { "code" => code - }.compact + } response = @client.request( method: :post, path: "/auth/challenges/#{WorkOS::Util.encode_path(id)}/verify", diff --git a/lib/workos/organization_domains.rb b/lib/workos/organization_domains.rb index 05f5861f..c0b9970d 100644 --- a/lib/workos/organization_domains.rb +++ b/lib/workos/organization_domains.rb @@ -23,7 +23,7 @@ def create_organization_domain( body = { "domain" => domain, "organization_id" => organization_id - }.compact + } response = @client.request( method: :post, path: "/organization_domains", diff --git a/lib/workos/radar.rb b/lib/workos/radar.rb index 6d0da00a..451f817f 100644 --- a/lib/workos/radar.rb +++ b/lib/workos/radar.rb @@ -91,7 +91,7 @@ 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)}", @@ -118,7 +118,7 @@ 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)}", diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index 9585b943..6f71c5ed 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -116,7 +116,7 @@ def authorize_logout( ) body = { "profile_id" => profile_id - }.compact + } response = @client.request( method: :post, path: "/sso/logout/authorize", @@ -157,7 +157,7 @@ def get_profile_and_token( "client_id" => request_options[:client_id] || @client.client_id, "client_secret" => request_options[:api_key] || @client.api_key, "code" => code - }.compact + } response = @client.request( method: :post, path: "/sso/token", diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index d1dd282e..b76145fa 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -6,6 +6,32 @@ module WorkOS class UserManagement + # Identifies the password (plaintext variant). + # + # @!attribute [r] password + # @return [String] + PasswordPlaintext = Data.define(:password) + + # Identifies the password (hashed variant). + # + # @!attribute [r] password_hash + # @return [String] + # @!attribute [r] password_hash_type + # @return [WorkOS::Types::CreateUserPasswordHashType] + PasswordHashed = Data.define(:password_hash, :password_hash_type) + + # Identifies the role (single variant). + # + # @!attribute [r] role_slug + # @return [String] + RoleSingle = Data.define(:role_slug) + + # Identifies the role (multiple variant). + # + # @!attribute [r] role_slugs + # @return [Array] + RoleMultiple = Data.define(:role_slugs) + def initialize(client) @client = client end @@ -403,7 +429,7 @@ def create_device( ) body = { "client_id" => client_id - }.compact + } response = @client.request( method: :post, path: "/user_management/authorize/device", @@ -450,7 +476,7 @@ def create_cors_origin( ) body = { "origin" => origin - }.compact + } response = @client.request( method: :post, path: "/user_management/cors_origins", @@ -492,7 +518,7 @@ def reset_password( ) body = { "email" => email - }.compact + } response = @client.request( method: :post, path: "/user_management/password_reset", @@ -518,7 +544,7 @@ def confirm_password_reset( body = { "token" => token, "new_password" => new_password - }.compact + } response = @client.request( method: :post, path: "/user_management/password_reset/confirm", @@ -613,9 +639,7 @@ def list_users( # @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 password [WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, nil] Identifies the password. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::User] def create_user( @@ -626,8 +650,6 @@ def create_user( metadata: nil, external_id: nil, password: nil, - password_hash: nil, - password_hash_type: nil, request_options: {} ) body = { @@ -636,18 +658,17 @@ def create_user( "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 + "external_id" => external_id }.compact if password - case password[:type] - when "plaintext" - body["password"] = password[:password] - when "hashed" - body["password_hash"] = password[:password_hash] - body["password_hash_type"] = password[:password_hash_type] + case password + when WorkOS::UserManagement::PasswordPlaintext + body["password"] = password.password + when WorkOS::UserManagement::PasswordHashed + body["password_hash"] = password.password_hash + body["password_hash_type"] = password.password_hash_type + else + raise ArgumentError, "expected password to be one of: WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, got #{password.class}" end end response = @client.request( @@ -709,9 +730,7 @@ def get_user( # @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 password [WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, nil] Identifies the password. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::User] def update_user( @@ -724,8 +743,6 @@ def update_user( external_id: nil, locale: nil, password: nil, - password_hash: nil, - password_hash_type: nil, request_options: {} ) body = { @@ -735,18 +752,17 @@ def update_user( "email_verified" => email_verified, "metadata" => metadata, "external_id" => external_id, - "locale" => locale, - "password" => password, - "password_hash" => password_hash, - "password_hash_type" => password_hash_type + "locale" => locale }.compact if password - case password[:type] - when "plaintext" - body["password"] = password[:password] - when "hashed" - body["password_hash"] = password[:password_hash] - body["password_hash_type"] = password[:password_hash_type] + case password + when WorkOS::UserManagement::PasswordPlaintext + body["password"] = password.password + when WorkOS::UserManagement::PasswordHashed + body["password_hash"] = password.password_hash + body["password_hash_type"] = password.password_hash_type + else + raise ArgumentError, "expected password to be one of: WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed, got #{password.class}" end end response = @client.request( @@ -790,7 +806,7 @@ 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", @@ -815,7 +831,7 @@ 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", @@ -840,7 +856,7 @@ def verify_email( ) body = { "code" => code - }.compact + } response = @client.request( method: :post, path: "/user_management/users/#{WorkOS::Util.encode_path(id)}/email_verification/confirm", @@ -1138,7 +1154,7 @@ def update_jwt_template( ) body = { "content" => content - }.compact + } response = @client.request( method: :put, path: "/user_management/jwt_template", @@ -1255,30 +1271,27 @@ def list_organization_memberships( # 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 role [WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, nil] Identifies the role. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::OrganizationMembership] def create_organization_membership( user_id:, organization_id:, - role_slug: nil, - role_slugs: nil, role: nil, request_options: {} ) body = { "user_id" => user_id, - "organization_id" => organization_id, - "role_slug" => role_slug, - "role_slugs" => role_slugs - }.compact + "organization_id" => organization_id + } if role - case role[:type] - when "single" - body["role_slug"] = role[:role_slug] - when "multiple" - body["role_slugs"] = role[:role_slugs] + case role + when WorkOS::UserManagement::RoleSingle + body["role_slug"] = role.role_slug + when WorkOS::UserManagement::RoleMultiple + body["role_slugs"] = role.role_slugs + else + raise ArgumentError, "expected role to be one of: WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, got #{role.class}" end end response = @client.request( @@ -1314,27 +1327,23 @@ def get_organization_membership( # 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 role [WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, nil] Identifies the role. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::UserOrganizationMembership] def update_organization_membership( id:, - role_slug: nil, - role_slugs: nil, role: nil, request_options: {} ) - body = { - "role_slug" => role_slug, - "role_slugs" => role_slugs - }.compact + body = {} if role - case role[:type] - when "single" - body["role_slug"] = role[:role_slug] - when "multiple" - body["role_slugs"] = role[:role_slugs] + case role + when WorkOS::UserManagement::RoleSingle + body["role_slug"] = role.role_slug + when WorkOS::UserManagement::RoleMultiple + body["role_slugs"] = role.role_slugs + else + raise ArgumentError, "expected role to be one of: WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple, got #{role.class}" end end response = @client.request( @@ -1414,7 +1423,7 @@ def create_redirect_uri( ) body = { "uri" => uri - }.compact + } response = @client.request( method: :post, path: "/user_management/redirect_uris", diff --git a/lib/workos/webhooks.rb b/lib/workos/webhooks.rb index d2303d53..8b86d12c 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -67,7 +67,7 @@ def create_webhook_endpoint( body = { "endpoint_url" => endpoint_url, "events" => events - }.compact + } response = @client.request( method: :post, path: "/webhook_endpoints", diff --git a/rbi/workos/authorization.rbi b/rbi/workos/authorization.rbi index 3089a0ef..5e4eea64 100644 --- a/rbi/workos/authorization.rbi +++ b/rbi/workos/authorization.rbi @@ -6,6 +6,90 @@ module WorkOS class Authorization + class ResourceTargetById + sig { returns(String) } + def resource_id; end + + sig do + params( + resource_id: String + ).returns(WorkOS::Authorization::ResourceTargetById) + end + def self.new(resource_id:); end + end + + class ResourceTargetByExternalId + sig { returns(String) } + def resource_external_id; end + + sig { returns(String) } + def resource_type_slug; end + + sig do + params( + resource_external_id: String, + resource_type_slug: String + ).returns(WorkOS::Authorization::ResourceTargetByExternalId) + end + def self.new(resource_external_id:, resource_type_slug:); end + end + + class ParentResourceById + sig { returns(String) } + def parent_resource_id; end + + sig do + params( + parent_resource_id: String + ).returns(WorkOS::Authorization::ParentResourceById) + end + def self.new(parent_resource_id:); end + end + + class ParentResourceByExternalId + sig { returns(String) } + def parent_resource_type_slug; end + + sig { returns(String) } + def parent_resource_external_id; end + + sig do + params( + parent_resource_type_slug: String, + parent_resource_external_id: String + ).returns(WorkOS::Authorization::ParentResourceByExternalId) + end + def self.new(parent_resource_type_slug:, parent_resource_external_id:); end + end + + class ParentById + sig { returns(String) } + def parent_resource_id; end + + sig do + params( + parent_resource_id: String + ).returns(WorkOS::Authorization::ParentById) + end + def self.new(parent_resource_id:); end + end + + class ParentByExternalId + sig { returns(String) } + def parent_resource_type_slug; end + + sig { returns(String) } + def parent_external_id; end + + sig do + params( + parent_resource_type_slug: String, + parent_external_id: String + ).returns(WorkOS::Authorization::ParentByExternalId) + end + def self.new(parent_resource_type_slug:, parent_external_id:); end + end + sig { params(client: WorkOS::BaseClient).void } def initialize(client); end @@ -13,18 +97,17 @@ module WorkOS 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), + resource_target: T.any(WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId), 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 + def check(organization_membership_id:, permission_slug:, resource_target:, request_options:); end sig do params( organization_membership_id: String, permission_slug: String, + parent_resource: T.any(WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId), before: T.nilable(String), after: T.nilable(String), limit: T.nilable(Integer), @@ -32,7 +115,7 @@ module WorkOS request_options: T::Hash[Symbol, T.untyped] ).returns(WorkOS::Types::ListStruct) end - def list_resources_for_membership(organization_membership_id:, permission_slug:, before:, after:, limit:, order:, request_options:); end + def list_resources_for_membership(organization_membership_id:, permission_slug:, parent_resource:, before:, after:, limit:, order:, request_options:); end sig do params( @@ -77,25 +160,21 @@ module WorkOS 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), + resource_target: T.any(WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId), 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 + def assign_role(organization_membership_id:, role_slug:, resource_target:, 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), + resource_target: T.any(WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId), 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 + def remove_role(organization_membership_id:, role_slug:, resource_target:, request_options:); end sig do params( @@ -201,13 +280,11 @@ module WorkOS 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), + parent_resource: T.nilable(T.any(WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId)), request_options: T::Hash[Symbol, T.untyped] ).returns(WorkOS::AuthorizationResource) end - def update_resource_by_external_id(organization_id:, resource_type_slug:, external_id:, name:, description:, parent_resource_id:, parent_resource_external_id:, parent_resource_type_slug:, request_options:); end + def update_resource_by_external_id(organization_id:, resource_type_slug:, external_id:, name:, description:, parent_resource:, request_options:); end sig do params( @@ -246,10 +323,11 @@ module WorkOS resource_type_slug: T.nilable(String), resource_external_id: T.nilable(String), search: T.nilable(String), + parent: T.nilable(T.any(WorkOS::Authorization::ParentById, WorkOS::Authorization::ParentByExternalId)), request_options: T::Hash[Symbol, T.untyped] ).returns(WorkOS::Types::ListStruct) end - def list_resources(before:, after:, limit:, order:, organization_id:, resource_type_slug:, resource_external_id:, search:, request_options:); end + def list_resources(before:, after:, limit:, order:, organization_id:, resource_type_slug:, resource_external_id:, search:, parent:, request_options:); end sig do params( @@ -258,13 +336,11 @@ module WorkOS 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), + parent_resource: T.nilable(T.any(WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId)), 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 + def create_resource(external_id:, name:, resource_type_slug:, organization_id:, description:, parent_resource:, request_options:); end sig do params( @@ -279,13 +355,11 @@ module WorkOS 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), + parent_resource: T.nilable(T.any(WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId)), 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 + def update_resource(resource_id:, name:, description:, parent_resource:, request_options:); end sig do params( diff --git a/rbi/workos/user_management.rbi b/rbi/workos/user_management.rbi index 53d746e7..2d2c0bca 100644 --- a/rbi/workos/user_management.rbi +++ b/rbi/workos/user_management.rbi @@ -6,6 +6,58 @@ module WorkOS class UserManagement + class PasswordPlaintext + sig { returns(String) } + def password; end + + sig do + params( + password: String + ).returns(WorkOS::UserManagement::PasswordPlaintext) + end + def self.new(password:); end + end + + class PasswordHashed + sig { returns(String) } + def password_hash; end + + sig { returns(String) } + def password_hash_type; end + + sig do + params( + password_hash: String, + password_hash_type: String + ).returns(WorkOS::UserManagement::PasswordHashed) + end + def self.new(password_hash:, password_hash_type:); end + end + + class RoleSingle + sig { returns(String) } + def role_slug; end + + sig do + params( + role_slug: String + ).returns(WorkOS::UserManagement::RoleSingle) + end + def self.new(role_slug:); end + end + + class RoleMultiple + sig { returns(T::Array[String]) } + def role_slugs; end + + sig do + params( + role_slugs: T::Array[String] + ).returns(WorkOS::UserManagement::RoleMultiple) + end + def self.new(role_slugs:); end + end + sig { params(client: WorkOS::BaseClient).void } def initialize(client); end @@ -113,13 +165,11 @@ module WorkOS 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), + password: T.nilable(T.any(WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed)), 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 + def create_user(email:, first_name:, last_name:, email_verified:, metadata:, external_id:, password:, request_options:); end sig do params( @@ -147,13 +197,11 @@ module WorkOS 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), + password: T.nilable(T.any(WorkOS::UserManagement::PasswordPlaintext, WorkOS::UserManagement::PasswordHashed)), 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 + def update_user(id:, email:, first_name:, last_name:, email_verified:, metadata:, external_id:, locale:, password:, request_options:); end sig do params( @@ -328,12 +376,11 @@ module WorkOS params( user_id: String, organization_id: String, - role_slug: T.nilable(String), - role_slugs: T.nilable(T::Array[String]), + role: T.nilable(T.any(WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple)), 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 + def create_organization_membership(user_id:, organization_id:, role:, request_options:); end sig do params( @@ -346,12 +393,11 @@ module WorkOS sig do params( id: String, - role_slug: T.nilable(String), - role_slugs: T.nilable(T::Array[String]), + role: T.nilable(T.any(WorkOS::UserManagement::RoleSingle, WorkOS::UserManagement::RoleMultiple)), request_options: T::Hash[Symbol, T.untyped] ).returns(WorkOS::UserOrganizationMembership) end - def update_organization_membership(id:, role_slug:, role_slugs:, request_options:); end + def update_organization_membership(id:, role:, request_options:); end sig do params( diff --git a/test/workos/test_audit_logs.rb b/test/workos/test_audit_logs.rb index c449bb40..764e2674 100644 --- a/test/workos/test_audit_logs.rb +++ b/test/workos/test_audit_logs.rb @@ -42,7 +42,7 @@ def test_list_action_schemas_returns_expected_result def test_create_schema_returns_expected_result 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: []) + result = @client.audit_logs.create_schema(action_name: "stub", targets: [{}]) refute_nil result end @@ -73,7 +73,7 @@ def test_get_export_returns_expected_result {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_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"}} diff --git a/test/workos/test_authorization.rb b/test/workos/test_authorization.rb index 56c1dfcc..56de8137 100644 --- a/test/workos/test_authorization.rb +++ b/test/workos/test_authorization.rb @@ -13,15 +13,31 @@ def setup def test_check_returns_expected_result stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/check(\?|\z)}) + .with(body: hash_including("permission_slug" => "stub", "resource_id" => "stub")) .to_return(body: "{}", status: 200) - result = @client.authorization.check(organization_membership_id: "stub", permission_slug: "stub", resource_target: {type: "by_id"}) + result = @client.authorization.check(organization_membership_id: "stub", permission_slug: "stub", resource_target: WorkOS::Authorization::ResourceTargetById.new(resource_id: "stub")) + refute_nil result + end + + def test_check_with_resource_target_by_external_id_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/check(\?|\z)}) + .with(body: hash_including("permission_slug" => "stub", "resource_external_id" => "stub", "resource_type_slug" => "stub")) + .to_return(body: "{}", status: 200) + result = @client.authorization.check(organization_membership_id: "stub", permission_slug: "stub", resource_target: WorkOS::Authorization::ResourceTargetByExternalId.new(resource_external_id: "stub", resource_type_slug: "stub")) refute_nil result end def test_list_resources_for_membership_returns_expected_result 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_resources_for_membership(organization_membership_id: "stub", permission_slug: "stub", parent_resource: {type: "by_id"}) + result = @client.authorization.list_resources_for_membership(organization_membership_id: "stub", permission_slug: "stub", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_id: "stub")) + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_resources_for_membership_with_parent_resource_by_external_id_returns_expected_result + 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_resources_for_membership(organization_membership_id: "stub", permission_slug: "stub", parent_resource: WorkOS::Authorization::ParentResourceByExternalId.new(parent_resource_type_slug: "stub", parent_resource_external_id: "stub")) assert_kind_of WorkOS::Types::ListStruct, result end @@ -48,15 +64,31 @@ def test_list_role_assignments_returns_expected_result def test_assign_role_returns_expected_result stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments(\?|\z)}) + .with(body: hash_including("role_slug" => "stub", "resource_id" => "stub")) .to_return(body: "{}", status: 200) - result = @client.authorization.assign_role(organization_membership_id: "stub", role_slug: "stub", resource_target: {type: "by_id"}) + result = @client.authorization.assign_role(organization_membership_id: "stub", role_slug: "stub", resource_target: WorkOS::Authorization::ResourceTargetById.new(resource_id: "stub")) + refute_nil result + end + + def test_assign_role_with_resource_target_by_external_id_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/role_assignments(\?|\z)}) + .with(body: hash_including("role_slug" => "stub", "resource_external_id" => "stub", "resource_type_slug" => "stub")) + .to_return(body: "{}", status: 200) + result = @client.authorization.assign_role(organization_membership_id: "stub", role_slug: "stub", resource_target: WorkOS::Authorization::ResourceTargetByExternalId.new(resource_external_id: "stub", resource_type_slug: "stub")) refute_nil result end def test_remove_role_returns_expected_result 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"}) + result = @client.authorization.remove_role(organization_membership_id: "stub", role_slug: "stub", resource_target: WorkOS::Authorization::ResourceTargetById.new(resource_id: "stub")) + assert_nil result + end + + def test_remove_role_with_resource_target_by_external_id_returns_expected_result + 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: WorkOS::Authorization::ResourceTargetByExternalId.new(resource_external_id: "stub", resource_type_slug: "stub")) assert_nil result end @@ -112,7 +144,7 @@ def test_add_organization_role_permission_returns_expected_result def test_set_organization_role_permissions_returns_expected_result stub_request(:put, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub/permissions(\?|\z)}) .to_return(body: "{}", status: 200) - result = @client.authorization.set_organization_role_permissions(organization_id: "stub", slug: "stub", permissions: []) + result = @client.authorization.set_organization_role_permissions(organization_id: "stub", slug: "stub", permissions: ["stub"]) refute_nil result end @@ -132,8 +164,17 @@ def test_get_resource_by_external_id_returns_expected_result def test_update_resource_by_external_id_returns_expected_result stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)}) + .with(body: hash_including("parent_resource_id" => "stub")) .to_return(body: "{}", status: 200) - result = @client.authorization.update_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") + result = @client.authorization.update_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_id: "stub")) + refute_nil result + end + + def test_update_resource_by_external_id_with_parent_resource_by_external_id_returns_expected_result + stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub(\?|\z)}) + .with(body: hash_including("parent_resource_external_id" => "stub", "parent_resource_type_slug" => "stub")) + .to_return(body: "{}", status: 200) + result = @client.authorization.update_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceByExternalId.new(parent_resource_external_id: "stub", parent_resource_type_slug: "stub")) refute_nil result end @@ -154,14 +195,30 @@ def test_list_memberships_for_resource_by_external_id_returns_expected_result def test_list_resources_returns_expected_result stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) - result = @client.authorization.list_resources + result = @client.authorization.list_resources(parent: WorkOS::Authorization::ParentById.new(parent_resource_id: "stub")) + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_list_resources_with_parent_by_external_id_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_resources(parent: WorkOS::Authorization::ParentByExternalId.new(parent_resource_type_slug: "stub", parent_external_id: "stub")) assert_kind_of WorkOS::Types::ListStruct, result end def test_create_resource_returns_expected_result stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}) + .with(body: hash_including("external_id" => "stub", "name" => "stub", "resource_type_slug" => "stub", "organization_id" => "stub", "parent_resource_id" => "stub")) .to_return(body: "{}", status: 200) - result = @client.authorization.create_resource(external_id: "stub", name: "stub", resource_type_slug: "stub", organization_id: "stub") + result = @client.authorization.create_resource(external_id: "stub", name: "stub", resource_type_slug: "stub", organization_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_id: "stub")) + refute_nil result + end + + def test_create_resource_with_parent_resource_by_external_id_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}) + .with(body: hash_including("external_id" => "stub", "name" => "stub", "resource_type_slug" => "stub", "organization_id" => "stub", "parent_resource_external_id" => "stub", "parent_resource_type_slug" => "stub")) + .to_return(body: "{}", status: 200) + result = @client.authorization.create_resource(external_id: "stub", name: "stub", resource_type_slug: "stub", organization_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceByExternalId.new(parent_resource_external_id: "stub", parent_resource_type_slug: "stub")) refute_nil result end @@ -174,8 +231,17 @@ def test_get_resource_returns_expected_result def test_update_resource_returns_expected_result stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}) + .with(body: hash_including("parent_resource_id" => "stub")) + .to_return(body: "{}", status: 200) + result = @client.authorization.update_resource(resource_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_id: "stub")) + refute_nil result + end + + def test_update_resource_with_parent_resource_by_external_id_returns_expected_result + stub_request(:patch, %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}) + .with(body: hash_including("parent_resource_external_id" => "stub", "parent_resource_type_slug" => "stub")) .to_return(body: "{}", status: 200) - result = @client.authorization.update_resource(resource_id: "stub") + result = @client.authorization.update_resource(resource_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceByExternalId.new(parent_resource_external_id: "stub", parent_resource_type_slug: "stub")) refute_nil result end @@ -231,7 +297,7 @@ def test_add_environment_role_permission_returns_expected_result def test_set_environment_role_permissions_returns_expected_result 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: []) + result = @client.authorization.set_environment_role_permissions(slug: "stub", permissions: ["stub"]) refute_nil result end @@ -272,13 +338,13 @@ def test_delete_permission_returns_expected_result # 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_resources_for_membership, 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: :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: WorkOS::Authorization::ResourceTargetById.new(resource_id: "stub")}}, + {name: :list_resources_for_membership, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organization_memberships/stub/resources(\?|\z)}, args: {organization_membership_id: "stub", permission_slug: "stub", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_id: "stub")}}, {name: :list_effective_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_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: :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: WorkOS::Authorization::ResourceTargetById.new(resource_id: "stub")}}, + {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: WorkOS::Authorization::ResourceTargetById.new(resource_id: "stub")}}, {name: :remove_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"}}, @@ -286,16 +352,16 @@ def test_delete_permission_returns_expected_result {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: :add_organization_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: :set_organization_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: :set_organization_role_permissions, verb: :put, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/roles/stub/permissions(\?|\z)}, args: {organization_id: "stub", slug: "stub", permissions: ["stub"]}}, {name: :remove_organization_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_resource_by_external_id, 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_resource_by_external_id, 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: :update_resource_by_external_id, 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", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_id: "stub")}}, {name: :delete_resource_by_external_id, 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_memberships_for_resource_by_external_id, 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: :list_resources, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}, args: {parent: WorkOS::Authorization::ParentById.new(parent_resource_id: "stub")}}, + {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", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_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: :update_resource, verb: :patch, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub(\?|\z)}, args: {resource_id: "stub", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_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)}}, @@ -303,7 +369,7 @@ def test_delete_permission_returns_expected_result {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: :set_environment_role_permissions, verb: :put, url: %r{\Ahttps://api\.workos\.com/authorization/roles/stub/permissions(\?|\z)}, args: {slug: "stub", permissions: ["stub"]}}, {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"}}, diff --git a/test/workos/test_user_management.rb b/test/workos/test_user_management.rb index 6456408a..f2520e0b 100644 --- a/test/workos/test_user_management.rb +++ b/test/workos/test_user_management.rb @@ -203,8 +203,17 @@ def test_list_users_returns_expected_result def test_create_user_returns_expected_result stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users(\?|\z)}) + .with(body: hash_including("email" => "stub", "password" => "stub")) .to_return(body: "{}", status: 200) - result = @client.user_management.create_user(email: "stub") + result = @client.user_management.create_user(email: "stub", password: WorkOS::UserManagement::PasswordPlaintext.new(password: "stub")) + refute_nil result + end + + def test_create_user_with_password_hashed_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users(\?|\z)}) + .with(body: hash_including("email" => "stub", "password_hash" => "stub", "password_hash_type" => "stub")) + .to_return(body: "{}", status: 200) + result = @client.user_management.create_user(email: "stub", password: WorkOS::UserManagement::PasswordHashed.new(password_hash: "stub", password_hash_type: "stub")) refute_nil result end @@ -224,8 +233,17 @@ def test_get_user_returns_expected_result def test_update_user_returns_expected_result stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/users/stub(\?|\z)}) + .with(body: hash_including("password" => "stub")) + .to_return(body: "{}", status: 200) + result = @client.user_management.update_user(id: "stub", password: WorkOS::UserManagement::PasswordPlaintext.new(password: "stub")) + refute_nil result + end + + def test_update_user_with_password_hashed_returns_expected_result + stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/users/stub(\?|\z)}) + .with(body: hash_including("password_hash" => "stub", "password_hash_type" => "stub")) .to_return(body: "{}", status: 200) - result = @client.user_management.update_user(id: "stub") + result = @client.user_management.update_user(id: "stub", password: WorkOS::UserManagement::PasswordHashed.new(password_hash: "stub", password_hash_type: "stub")) refute_nil result end @@ -357,8 +375,17 @@ def test_list_organization_memberships_returns_expected_result def test_create_organization_membership_returns_expected_result stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships(\?|\z)}) + .with(body: hash_including("user_id" => "stub", "organization_id" => "stub", "role_slug" => "stub")) .to_return(body: "{}", status: 200) - result = @client.user_management.create_organization_membership(user_id: "stub", organization_id: "stub") + result = @client.user_management.create_organization_membership(user_id: "stub", organization_id: "stub", role: WorkOS::UserManagement::RoleSingle.new(role_slug: "stub")) + refute_nil result + end + + def test_create_organization_membership_with_role_multiple_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships(\?|\z)}) + .with(body: hash_including("user_id" => "stub", "organization_id" => "stub", "role_slugs" => ["stub"])) + .to_return(body: "{}", status: 200) + result = @client.user_management.create_organization_membership(user_id: "stub", organization_id: "stub", role: WorkOS::UserManagement::RoleMultiple.new(role_slugs: ["stub"])) refute_nil result end @@ -371,8 +398,17 @@ def test_get_organization_membership_returns_expected_result def test_update_organization_membership_returns_expected_result stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub(\?|\z)}) + .with(body: hash_including("role_slug" => "stub")) + .to_return(body: "{}", status: 200) + result = @client.user_management.update_organization_membership(id: "stub", role: WorkOS::UserManagement::RoleSingle.new(role_slug: "stub")) + refute_nil result + end + + def test_update_organization_membership_with_role_multiple_returns_expected_result + stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub(\?|\z)}) + .with(body: hash_including("role_slugs" => ["stub"])) .to_return(body: "{}", status: 200) - result = @client.user_management.update_organization_membership(id: "stub") + result = @client.user_management.update_organization_membership(id: "stub", role: WorkOS::UserManagement::RoleMultiple.new(role_slugs: ["stub"])) refute_nil result end @@ -430,10 +466,10 @@ def test_delete_user_authorized_application_returns_expected_result {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: :create_user, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users(\?|\z)}, args: {email: "stub", password: WorkOS::UserManagement::PasswordPlaintext.new(password: "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: :update_user, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub(\?|\z)}, args: {id: "stub", password: WorkOS::UserManagement::PasswordPlaintext.new(password: "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"}}, @@ -452,9 +488,9 @@ def test_delete_user_authorized_application_returns_expected_result {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: :create_organization_membership, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/organization_memberships(\?|\z)}, args: {user_id: "stub", organization_id: "stub", role: WorkOS::UserManagement::RoleSingle.new(role_slug: "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: :update_organization_membership, verb: :put, url: %r{\Ahttps://api\.workos\.com/user_management/organization_memberships/stub(\?|\z)}, args: {id: "stub", role: WorkOS::UserManagement::RoleSingle.new(role_slug: "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"}}, diff --git a/test/workos/test_webhooks.rb b/test/workos/test_webhooks.rb index ddf268f0..1a10bbf2 100644 --- a/test/workos/test_webhooks.rb +++ b/test/workos/test_webhooks.rb @@ -21,7 +21,7 @@ def test_list_webhook_endpoints_returns_expected_result def test_create_webhook_endpoint_returns_expected_result 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: []) + result = @client.webhooks.create_webhook_endpoint(endpoint_url: "stub", events: ["stub"]) refute_nil result end @@ -42,7 +42,7 @@ def test_delete_webhook_endpoint_returns_expected_result # 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: :create_webhook_endpoint, verb: :post, url: %r{\Ahttps://api\.workos\.com/webhook_endpoints(\?|\z)}, args: {endpoint_url: "stub", events: ["stub"]}}, {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| From 67283581886a122f36d907229a71211665623219 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sat, 2 May 2026 10:38:47 -0400 Subject: [PATCH 149/159] fix: set canonical User-Agent header format (#476) Co-authored-by: Claude Opus 4.7 (1M context) --- lib/workos/base_client.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/workos/base_client.rb b/lib/workos/base_client.rb index d5192d9e..adbe516f 100644 --- a/lib/workos/base_client.rb +++ b/lib/workos/base_client.rb @@ -34,7 +34,12 @@ class BaseClient 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})" + USER_AGENT = [ + "WorkOS", + "#{defined?(::RUBY_ENGINE) ? ::RUBY_ENGINE : "ruby"}/#{RUBY_VERSION}", + RUBY_PLATFORM, + "v#{WorkOS::VERSION}" + ].join("; ").freeze attr_reader :api_key, :base_url, :client_id, :timeout, :max_retries, :logger, :log_level From 1d8b4aaa26e77e6d7820feb7e2f81278a77b0cf4 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 5 May 2026 23:08:00 -0700 Subject: [PATCH 150/159] fix: decode legacy v6 sealed sessions on unseal (#479) --- lib/workos/encryptors/aes_gcm.rb | 38 ++++++++++++-- test/workos/test_encryptors_aes_gcm.rb | 21 ++++++++ test/workos/test_session.rb | 68 ++++++++++++++++++++++++++ 3 files changed, 124 insertions(+), 3 deletions(-) diff --git a/lib/workos/encryptors/aes_gcm.rb b/lib/workos/encryptors/aes_gcm.rb index f40be22b..82ac9bcf 100644 --- a/lib/workos/encryptors/aes_gcm.rb +++ b/lib/workos/encryptors/aes_gcm.rb @@ -27,6 +27,18 @@ def seal(data, key) def unseal(sealed, key) raw = Base64.decode64(sealed.to_s) + decode_v7(raw, key) + rescue ArgumentError, OpenSSL::Cipher::CipherError => original_error + begin + decode_old(raw, key) + rescue ArgumentError, OpenSSL::Cipher::CipherError + raise original_error + end + end + + private + + def decode_v7(raw, key) 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 @@ -37,7 +49,29 @@ def unseal(sealed, key) cipher.key = derive_key(key) cipher.iv = iv cipher.auth_tag = tag - decoded = cipher.update(ciphertext) + cipher.final + + parse_decoded(cipher.update(ciphertext) + cipher.final) + end + + def decode_old(raw, key) + # v6 sealed sessions were Base64(iv + ciphertext + auth_tag) using the + # `encryptor` gem without the v7 version byte or key derivation. + raise ArgumentError, "Legacy sealed payload too short" if raw.bytesize < 12 + 16 + + iv = raw.byteslice(0, 12) + encrypted = raw.byteslice(12, raw.bytesize - 12) + ciphertext = encrypted.byteslice(0, encrypted.bytesize - 16) + tag = encrypted.byteslice(encrypted.bytesize - 16, 16) + + cipher = OpenSSL::Cipher.new("aes-256-gcm").decrypt + cipher.key = key.to_s + cipher.iv = iv + cipher.auth_tag = tag + + parse_decoded(cipher.update(ciphertext) + cipher.final) + end + + def parse_decoded(decoded) decoded.force_encoding(Encoding::UTF_8) begin JSON.parse(decoded) @@ -46,8 +80,6 @@ def unseal(sealed, key) end end - private - def derive_key(passphrase) Digest::SHA256.digest(passphrase.to_s) end diff --git a/test/workos/test_encryptors_aes_gcm.rb b/test/workos/test_encryptors_aes_gcm.rb index 1a90413f..a518e4c1 100644 --- a/test/workos/test_encryptors_aes_gcm.rb +++ b/test/workos/test_encryptors_aes_gcm.rb @@ -3,6 +3,9 @@ # @oagen-ignore-file require "test_helper" require "base64" +require "json" +require "openssl" +require "securerandom" class EncryptorsAesGcmTest < Minitest::Test PASSWORD = "test-cookie-password-at-least-32" @@ -51,4 +54,22 @@ def test_each_seal_produces_unique_output sealed2 = @enc.seal(data, PASSWORD) refute_equal sealed1, sealed2 end + + def test_unseal_reads_legacy_v6_payload + data = {"access_token" => "tok_abc", "refresh_token" => "ref_xyz"} + sealed = legacy_v6_seal(data, PASSWORD) + assert_equal data, @enc.unseal(sealed, PASSWORD) + end + + private + + def legacy_v6_seal(data, key) + cipher = OpenSSL::Cipher.new("aes-256-gcm").encrypt + iv = SecureRandom.random_bytes(12) + cipher.key = key + cipher.iv = iv + ciphertext = cipher.update(JSON.generate(data)) + cipher.final + + Base64.encode64(iv + ciphertext + cipher.auth_tag) + end end diff --git a/test/workos/test_session.rb b/test/workos/test_session.rb index 1fc6d116..21988887 100644 --- a/test/workos/test_session.rb +++ b/test/workos/test_session.rb @@ -6,6 +6,7 @@ require "openssl" require "jwt" require "base64" +require "securerandom" class SessionTest < Minitest::Test PASSWORD = "very-long-cookie-password-secret" @@ -84,6 +85,22 @@ def test_authenticate_returns_success_with_decoded_claims assert_equal "u_1", result.user["id"] end + def test_authenticate_reads_legacy_v6_sealed_session + rsa, pub = signing_key_pair + access_token = make_jwt({"sid" => "session_v6", "org_id" => "org_legacy", "exp" => Time.now.to_i + 60}, rsa) + sealed = legacy_v6_seal({"access_token" => access_token, "user" => {"id" => "u_legacy"}}, 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) + assert_kind_of WorkOS::SessionManager::AuthSuccess, result + assert result.authenticated + assert_equal "session_v6", result.session_id + assert_equal "org_legacy", result.organization_id + assert_equal "u_legacy", result.user["id"] + end + def test_authenticate_merges_custom_claims_from_block rsa, pub = signing_key_pair access_token = make_jwt( @@ -244,6 +261,45 @@ def test_refresh_seals_session_client_side_and_returns_refresh_success assert_equal "rt_new", unsealed["refresh_token"] end + def test_refresh_reads_legacy_v6_sealed_session + rsa, pub = signing_key_pair + old_access = make_jwt({"sid" => "session_old_v6", "exp" => Time.now.to_i - 60}, rsa) + sealed = legacy_v6_seal( + {"access_token" => old_access, "refresh_token" => "rt_old_v6", "user" => {"id" => "u_v6"}}, + PASSWORD + ) + + new_access = make_jwt({"sid" => "session_new_v6", "org_id" => "org_v6", "role" => "member", "exp" => Time.now.to_i + 300}, rsa) + api_response = { + "access_token" => new_access, + "refresh_token" => "rt_new_v6", + "user" => {"id" => "u_v6", "email" => "legacy@example.com"}, + "impersonator" => nil + } + + stub_request(:post, "https://api.workos.com/user_management/authenticate") + .with(body: hash_including("grant_type" => "refresh_token", "refresh_token" => "rt_old_v6")) + .to_return(status: 200, body: api_response.to_json) + stub_request(:get, "https://api.workos.com/sso/jwks/client_001") + .to_return(status: 200, body: jwks_payload(pub).to_json) + + session = @sm.load(seal_data: sealed, cookie_password: PASSWORD) + result = session.refresh + + assert_kind_of WorkOS::SessionManager::RefreshSuccess, result + assert result.authenticated + assert_equal "session_new_v6", result.session_id + assert_equal "org_v6", result.organization_id + assert_equal "member", result.role + assert_equal "u_v6", result.user["id"] + + refute_empty result.sealed_session + unsealed = @sm.unseal_data(result.sealed_session, PASSWORD) + assert_equal new_access, unsealed["access_token"] + assert_equal "rt_new_v6", unsealed["refresh_token"] + assert_equal "u_v6", unsealed["user"]["id"] + end + def test_refresh_updates_internal_seal_data_for_subsequent_authenticate rsa, pub = signing_key_pair old_access = make_jwt({"sid" => "session_old", "exp" => Time.now.to_i - 60}, rsa) @@ -383,4 +439,16 @@ def custom.unseal(sealed, _key) assert_kind_of WorkOS::SessionManager::AuthSuccess, result assert_equal "s_custom", result.session_id end + + private + + def legacy_v6_seal(data, key) + cipher = OpenSSL::Cipher.new("aes-256-gcm").encrypt + iv = SecureRandom.random_bytes(12) + cipher.key = key + cipher.iv = iv + ciphertext = cipher.update(JSON.generate(data)) + cipher.final + + Base64.encode64(iv + ciphertext + cipher.auth_tag) + end end From 5f970beade19515ed54ba9c242472527bd3afa26 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 23:09:27 -0700 Subject: [PATCH 151/159] chore(main): release 7.1.2 (#474) Co-authored-by: workos-sdk-automation[bot] <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ Gemfile.lock | 4 ++-- lib/workos/version.rb | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4e9d6c7e..fe9d29ad 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "7.1.1" + ".": "7.1.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c5b6fc5..b0f56a0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [7.1.2](https://github.com/workos/workos-ruby/compare/v7.1.1...v7.1.2) (2026-05-06) + + +### Bug Fixes + +* decode legacy v6 sealed sessions on unseal ([#479](https://github.com/workos/workos-ruby/issues/479)) ([1d8b4aa](https://github.com/workos/workos-ruby/commit/1d8b4aaa26e77e6d7820feb7e2f81278a77b0cf4)) +* replace parameter-group hashes with typed variant classes ([#473](https://github.com/workos/workos-ruby/issues/473)) ([a66c15b](https://github.com/workos/workos-ruby/commit/a66c15b6070ad8c26f0ca0b9ad7414f7b2ce8d8a)) +* set canonical User-Agent header format ([#476](https://github.com/workos/workos-ruby/issues/476)) ([6728358](https://github.com/workos/workos-ruby/commit/67283581886a122f36d907229a71211665623219)) + ## [7.1.1](https://github.com/workos/workos-ruby/compare/v7.1.0...v7.1.1) (2026-04-29) diff --git a/Gemfile.lock b/Gemfile.lock index f3997384..5dd595f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (7.1.1) + workos (7.1.2) jwt (~> 3.1) logger (~> 1.7) zeitwerk (~> 2.6) @@ -124,7 +124,7 @@ CHECKSUMS unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42 unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90 - workos (7.1.1) + workos (7.1.2) zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd BUNDLED WITH diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 824922b5..61c9de8f 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -2,5 +2,5 @@ # @oagen-ignore-file module WorkOS - VERSION = "7.1.1" + VERSION = "7.1.2" end From 117eeac5d25c896c7a9b989592f3525f51e52a3d Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Wed, 6 May 2026 14:51:37 -0700 Subject: [PATCH 152/159] feat(docs): publish YARD API docs + llms.txt to GitHub Pages (#480) Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 (1M context) --- .github/workflows/docs.yml | 46 ++++++++++++++++++++++++++++++++++++++ .gitignore | 2 ++ .yardopts | 6 +++++ Gemfile | 6 +++++ Gemfile.lock | 31 +++++++++++++++++++++++++ script/docs | 16 +++++++++++++ script/docs-serve | 12 ++++++++++ script/llms-txt | 37 ++++++++++++++++++++++++++++++ 8 files changed, 156 insertions(+) create mode 100644 .github/workflows/docs.yml create mode 100644 .yardopts create mode 100755 script/docs create mode 100755 script/docs-serve create mode 100755 script/llms-txt diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..458de94e --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,46 @@ +name: Publish API Docs +on: + push: + tags: ['v*'] + workflow_dispatch: +permissions: + contents: read +concurrency: + group: pages + cancel-in-progress: false +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 + with: + bundler-cache: true + - run: ./script/docs + - uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 + - name: Archive site + run: | + tar \ + --dereference --hard-dereference \ + --directory docs/_site \ + -cvf "$RUNNER_TEMP/artifact.tar" \ + --exclude=.git \ + --exclude=.github \ + . + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: github-pages + path: ${{ runner.temp }}/artifact.tar + retention-days: 1 + if-no-files-found: error + deploy: + needs: build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 + id: deployment diff --git a/.gitignore b/.gitignore index 28a094d7..c0369d5d 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,5 @@ .vscode .idea/ +docs/_site/ +.yardoc/ diff --git a/.yardopts b/.yardopts new file mode 100644 index 00000000..9e582e14 --- /dev/null +++ b/.yardopts @@ -0,0 +1,6 @@ +--output-dir docs/_site +--markup markdown +lib/**/*.rb +- +README.md +CHANGELOG.md diff --git a/Gemfile b/Gemfile index be173b20..fb35914d 100644 --- a/Gemfile +++ b/Gemfile @@ -3,3 +3,9 @@ source "https://rubygems.org" gemspec + +group :docs do + gem "yard" + gem "yard-markdown" + gem "webrick" +end diff --git a/Gemfile.lock b/Gemfile.lock index 5dd595f1..3ca8ae45 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,7 +17,10 @@ GEM crack (1.0.1) bigdecimal rexml + csv (3.3.5) + date (3.5.1) drb (2.2.3) + erb (6.0.4) hashdiff (1.2.1) json (2.19.4) jwt (3.1.2) @@ -33,10 +36,17 @@ GEM ast (~> 2.4.1) racc prism (1.9.0) + psych (5.3.1) + date + stringio public_suffix (7.0.5) racc (1.8.1) rainbow (3.1.1) rake (13.4.2) + rdoc (7.2.0) + erb + psych (>= 4.0.0) + tsort regexp_parser (2.12.0) rexml (3.4.4) rubocop (1.84.2) @@ -70,6 +80,8 @@ GEM standard-performance (1.9.0) lint_roller (~> 1.1) rubocop-performance (~> 1.26.0) + stringio (3.2.0) + tsort (0.2.0) unicode-display_width (3.2.0) unicode-emoji (~> 4.1) unicode-emoji (4.2.0) @@ -77,6 +89,12 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.2) + yard (0.9.43) + yard-markdown (0.7.1) + csv + rdoc + yard zeitwerk (2.7.5) PLATFORMS @@ -89,7 +107,10 @@ DEPENDENCIES rake standard (~> 1.49) webmock (~> 3.26) + webrick workos! + yard + yard-markdown CHECKSUMS addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af @@ -97,7 +118,10 @@ CHECKSUMS base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd crack (1.0.1) sha256=ff4a10390cd31d66440b7524eb1841874db86201d5b70032028553130b6d4c7e + csv (3.3.5) sha256=6e5134ac3383ef728b7f02725d9872934f523cb40b961479f69cf3afa6c8e73f + date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0 drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373 + erb (6.0.4) sha256=38e3803694be357fe2bfe312487c74beaf9fb4e5beb3e22498952fe1645b95d9 hashdiff (1.2.1) sha256=9c079dbc513dfc8833ab59c0c2d8f230fa28499cc5efb4b8dd276cf931457cd1 json (2.19.4) sha256=670a7d333fb3b18ca5b29cb255eb7bef099e40d88c02c80bd42a3f30fe5239ac jwt (3.1.2) sha256=af6991f19a6bb4060d618d9add7a66f0eeb005ac0bc017cd01f63b42e122d535 @@ -108,10 +132,12 @@ CHECKSUMS parallel (1.28.0) sha256=33e6de1484baf2524792d178b0913fc8eb94c628d6cfe45599ad4458c638c970 parser (3.3.11.1) sha256=d17ace7aabe3e72c3cc94043714be27cc6f852f104d81aa284c2281aecc65d54 prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85 + psych (5.3.1) sha256=eb7a57cef10c9d70173ff74e739d843ac3b2c019a003de48447b2963d81b1974 public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623 racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701 + rdoc (7.2.0) sha256=8650f76cd4009c3b54955eb5d7e3a075c60a57276766ebf36f9085e8c9f23192 regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f @@ -121,10 +147,15 @@ CHECKSUMS standard (1.54.0) sha256=7a4b08f83d9893083c8f03bc486f0feeb6a84d48233b40829c03ef4767ea0100 standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2 + stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1 + tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42 unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90 + webrick (1.9.2) sha256=beb4a15fc474defed24a3bda4ffd88a490d517c9e4e6118c3edce59e45864131 workos (7.1.2) + yard (0.9.43) sha256=cf8733a8f0485df2a162927e9b5f182215a61f6d22de096b8f402c726a1c5821 + yard-markdown (0.7.1) sha256=06c378632dfe7ba053be9ba469eb4701aa0470e36bcf7e5546f353eb90c1bfd1 zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd BUNDLED WITH diff --git a/script/docs b/script/docs new file mode 100755 index 00000000..64f4e986 --- /dev/null +++ b/script/docs @@ -0,0 +1,16 @@ +#!/bin/sh +set -eu +cd "$(dirname "$0")/.." +bundle config set --local with 'docs' +bundle install +rm -rf docs/_site +# 1. Generate HTML docs (default YARD format). +bundle exec yard doc +# 2. Generate Markdown docs alongside the HTML, using the yard-markdown plugin. +# We point output at the same docs/_site directory so .md files land next to .html. +# --no-cache forces a re-parse so the markdown formatter sees fresh registry data. +# --plugin yard-markdown ensures the plugin is loaded without relying on ~/.yard/config. +bundle exec yard doc --plugin yard-markdown --format markdown --no-cache --output-dir docs/_site +# 3. Generate llms.txt (index) from the markdown output, so the published site +# is consumable by LLM tooling. +bundle exec ./script/llms-txt diff --git a/script/docs-serve b/script/docs-serve new file mode 100755 index 00000000..bba4cc2d --- /dev/null +++ b/script/docs-serve @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +cd "$(dirname "$0")/.." +bundle config set --local with 'docs' +bundle install --quiet +if [ "${1:-}" = "--static" ]; then + if [ ! -d docs/_site ]; then + ./script/docs + fi + exec bundle exec ruby -run -e httpd -- docs/_site -p 4000 +fi +exec bundle exec yard server --reload --port 4000 diff --git a/script/llms-txt b/script/llms-txt new file mode 100755 index 00000000..ca82b7e8 --- /dev/null +++ b/script/llms-txt @@ -0,0 +1,37 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# Generates llms.txt (curated index) from the Markdown docs produced by +# `yard --format markdown` in docs/_site. See https://llmstxt.org for the format. + +require "pathname" + +ROOT = Pathname.new(__dir__).join("..").expand_path +SITE = ROOT.join("docs/_site") +require ROOT.join("lib/workos/version").to_s + +abort "docs/_site is missing — run script/docs first" unless SITE.directory? + +md_files = Pathname.glob(SITE.join("**/*.md")).sort_by { |p| p.relative_path_from(SITE).to_s } + +title_for = lambda do |path| + first_heading = path.each_line.lazy.map(&:strip).find { |l| l.start_with?("# ") } + first_heading ? first_heading.sub(/^#\s+/, "").sub(/\s*\s*$/, "").strip : path.basename(".md").to_s +end + +index_lines = [] +index_lines << "# WorkOS Ruby SDK v#{WorkOS::VERSION}" +index_lines << "" +index_lines << "> API client for WorkOS. This file indexes the auto-generated YARD documentation for the `workos` gem so language models can locate per-class references." +index_lines << "" +index_lines << "## API Reference" +index_lines << "" +md_files.each do |path| + rel = path.relative_path_from(SITE).to_s + index_lines << "- [#{title_for.call(path)}](#{rel})" +end +index_lines << "" + +SITE.join("llms.txt").write(index_lines.join("\n")) + +puts "Wrote #{SITE.join("llms.txt")} (#{md_files.size} entries)" From 956386a27cb0f8a8707442fa98b74a317f3f9920 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 15:39:07 -0700 Subject: [PATCH 153/159] feat(generated)!: regenerate from spec (13 changes) (#478) Co-authored-by: workos-sdk-automation[bot] <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Co-authored-by: Garen J. Torikian --- .last-synced-sha | 2 +- .oagen-manifest.json | 101 +++-- lib/workos/api_keys.rb | 92 ++--- lib/workos/api_keys/api_key.rb | 2 +- lib/workos/api_keys/api_key_created_data.rb | 2 +- lib/workos/api_keys/organization_api_key.rb | 43 +++ .../organization_api_key_owner.rb} | 4 +- .../organization_api_key_with_value.rb | 46 +++ .../organization_api_key_with_value_owner.rb} | 4 +- lib/workos/audit_logs.rb | 8 +- lib/workos/authorization.rb | 144 +++++-- ..._organization_membership_base_list_data.rb | 7 +- ..._assignment.rb => user_role_assignment.rb} | 7 +- ...ce.rb => user_role_assignment_resource.rb} | 2 +- lib/workos/client.rb | 8 +- lib/workos/connect.rb | 4 +- lib/workos/directory_sync.rb | 12 +- lib/workos/directory_sync/directory_user.rb | 3 + .../directory_user_with_groups.rb | 5 +- .../directory_sync/dsync_user_updated_data.rb | 3 + lib/workos/events.rb | 4 +- lib/workos/feature_flags.rb | 12 +- lib/workos/groups.rb | 8 +- lib/workos/multi_factor_auth.rb | 4 +- lib/workos/organizations.rb | 4 +- lib/workos/sso.rb | 4 +- lib/workos/sso/profile.rb | 3 + lib/workos/types/authorization_order.rb | 9 - lib/workos/types/connections_order.rb | 9 - lib/workos/types/directories_order.rb | 9 - lib/workos/types/directory_groups_order.rb | 9 - lib/workos/types/directory_users_order.rb | 9 - .../types/event_context_actor_source.rb | 3 +- lib/workos/types/feature_flags_order.rb | 9 - .../types/organizations_api_keys_order.rb | 9 - .../organizations_feature_flags_order.rb | 9 - lib/workos/types/organizations_order.rb | 9 - ...lications_order.rb => pagination_order.rb} | 2 +- lib/workos/types/permissions_order.rb | 9 - .../user_management_invitations_order.rb | 9 - ...ement_multi_factor_authentication_order.rb | 9 - ...nt_organization_membership_groups_order.rb | 9 - ...anagement_organization_membership_order.rb | 9 - ...ent_users_authorized_applications_order.rb | 9 - ...er_management_users_feature_flags_order.rb | 9 - .../types/user_management_users_order.rb | 9 - ...provider.rb => vault_byok_key_provider.rb} | 2 +- lib/workos/user_management.rb | 117 +++++- .../user_management/create_user_api_key.rb | 25 ++ .../organization_membership.rb | 7 +- lib/workos/user_management/user_api_key.rb | 43 +++ .../user_api_key_created_data_owner.rb | 25 ++ .../user_api_key_owner.rb} | 2 +- .../user_api_key_revoked_data_owner.rb} | 4 +- .../user_api_key_with_value.rb} | 4 +- .../user_api_key_with_value_owner.rb} | 4 +- .../user_organization_membership.rb | 7 +- ...nagement_organization_membership_groups.rb | 4 +- lib/workos/vault/vault_byok_key_deleted.rb | 34 ++ .../vault/vault_byok_key_deleted_data.rb | 22 ++ lib/workos/webhooks.rb | 4 +- rbi/workos/api_key.rbi | 4 +- rbi/workos/api_key_created_data.rbi | 4 +- rbi/workos/api_key_revoked_data.rbi | 4 +- rbi/workos/api_keys.rbi | 34 +- rbi/workos/authorization.rbi | 28 +- rbi/workos/client.rbi | 6 +- rbi/workos/create_user_api_key.rbi | 36 ++ rbi/workos/directory_user.rbi | 6 + rbi/workos/directory_user_with_groups.rbi | 6 + rbi/workos/dsync_user_updated_data.rbi | 6 + rbi/workos/organization_api_key.rbi | 72 ++++ ...ner.rbi => organization_api_key_owner.rbi} | 2 +- .../organization_api_key_with_value.rbi | 78 ++++ .../organization_api_key_with_value_owner.rbi | 30 ++ rbi/workos/organization_membership.rbi | 6 + rbi/workos/profile.rbi | 6 + rbi/workos/user_api_key.rbi | 72 ++++ .../user_api_key_created_data_owner.rbi | 36 ++ rbi/workos/user_api_key_owner.rbi | 36 ++ .../user_api_key_revoked_data_owner.rbi | 36 ++ ..._value.rbi => user_api_key_with_value.rbi} | 6 +- rbi/workos/user_api_key_with_value_owner.rbi | 36 ++ rbi/workos/user_management.rbi | 31 ++ rbi/workos/user_organization_membership.rbi | 6 + ...organization_membership_base_list_data.rbi | 6 + ...ssignment.rbi => user_role_assignment.rbi} | 12 +- ....rbi => user_role_assignment_resource.rbi} | 2 +- rbi/workos/vault_byok_key_deleted.rbi | 54 +++ rbi/workos/vault_byok_key_deleted_data.rbi | 30 ++ test/workos/test_api_keys.rb | 34 +- test/workos/test_authorization.rb | 16 + test/workos/test_model_round_trip.rb | 361 ++++++++++++++---- test/workos/test_user_management.rb | 26 +- 94 files changed, 1652 insertions(+), 476 deletions(-) create mode 100644 lib/workos/api_keys/organization_api_key.rb rename lib/workos/{types/events_order.rb => api_keys/organization_api_key_owner.rb} (64%) create mode 100644 lib/workos/api_keys/organization_api_key_with_value.rb rename lib/workos/{types/audit_logs_order.rb => api_keys/organization_api_key_with_value_owner.rb} (63%) rename lib/workos/authorization/{role_assignment.rb => user_role_assignment.rb} (67%) rename lib/workos/authorization/{role_assignment_resource.rb => user_role_assignment_resource.rb} (89%) delete mode 100644 lib/workos/types/authorization_order.rb delete mode 100644 lib/workos/types/connections_order.rb delete mode 100644 lib/workos/types/directories_order.rb delete mode 100644 lib/workos/types/directory_groups_order.rb delete mode 100644 lib/workos/types/directory_users_order.rb delete mode 100644 lib/workos/types/feature_flags_order.rb delete mode 100644 lib/workos/types/organizations_api_keys_order.rb delete mode 100644 lib/workos/types/organizations_feature_flags_order.rb delete mode 100644 lib/workos/types/organizations_order.rb rename lib/workos/types/{applications_order.rb => pagination_order.rb} (89%) delete mode 100644 lib/workos/types/permissions_order.rb delete mode 100644 lib/workos/types/user_management_invitations_order.rb delete mode 100644 lib/workos/types/user_management_multi_factor_authentication_order.rb delete mode 100644 lib/workos/types/user_management_organization_membership_groups_order.rb delete mode 100644 lib/workos/types/user_management_organization_membership_order.rb delete mode 100644 lib/workos/types/user_management_users_authorized_applications_order.rb delete mode 100644 lib/workos/types/user_management_users_feature_flags_order.rb delete mode 100644 lib/workos/types/user_management_users_order.rb rename lib/workos/types/{vault_byok_key_verification_completed_data_key_provider.rb => vault_byok_key_provider.rb} (82%) create mode 100644 lib/workos/user_management/create_user_api_key.rb create mode 100644 lib/workos/user_management/user_api_key.rb create mode 100644 lib/workos/user_management/user_api_key_created_data_owner.rb rename lib/workos/{api_keys/api_key_with_value_owner.rb => user_management/user_api_key_owner.rb} (68%) rename lib/workos/{types/webhooks_order.rb => user_management/user_api_key_revoked_data_owner.rb} (63%) rename lib/workos/{api_keys/api_key_with_value.rb => user_management/user_api_key_with_value.rb} (87%) rename lib/workos/{types/groups_order.rb => user_management/user_api_key_with_value_owner.rb} (64%) create mode 100644 lib/workos/vault/vault_byok_key_deleted.rb create mode 100644 lib/workos/vault/vault_byok_key_deleted_data.rb create mode 100644 rbi/workos/create_user_api_key.rbi create mode 100644 rbi/workos/organization_api_key.rbi rename rbi/workos/{api_key_with_value_owner.rbi => organization_api_key_owner.rbi} (95%) create mode 100644 rbi/workos/organization_api_key_with_value.rbi create mode 100644 rbi/workos/organization_api_key_with_value_owner.rbi create mode 100644 rbi/workos/user_api_key.rbi create mode 100644 rbi/workos/user_api_key_created_data_owner.rbi create mode 100644 rbi/workos/user_api_key_owner.rbi create mode 100644 rbi/workos/user_api_key_revoked_data_owner.rbi rename rbi/workos/{api_key_with_value.rbi => user_api_key_with_value.rbi} (90%) create mode 100644 rbi/workos/user_api_key_with_value_owner.rbi rename rbi/workos/{role_assignment.rbi => user_role_assignment.rbi} (75%) rename rbi/workos/{role_assignment_resource.rbi => user_role_assignment_resource.rbi} (95%) create mode 100644 rbi/workos/vault_byok_key_deleted.rbi create mode 100644 rbi/workos/vault_byok_key_deleted_data.rbi diff --git a/.last-synced-sha b/.last-synced-sha index f72eb0e2..047fc7ee 100644 --- a/.last-synced-sha +++ b/.last-synced-sha @@ -1 +1 @@ -92db0495807c86fbbc4d45bd266a6c1f5bcbb59c +a10d9ecb766d2dd996aecb19aa9c801d78bb7c26 diff --git a/.oagen-manifest.json b/.oagen-manifest.json index 3dd2b3da..7c73f868 100644 --- a/.oagen-manifest.json +++ b/.oagen-manifest.json @@ -1,7 +1,7 @@ { "version": 2, "language": "ruby", - "generatedAt": "2026-04-30T17:41:02.756Z", + "generatedAt": "2026-05-06T22:30:35.198Z", "files": [ "lib/workos.rb", "lib/workos/admin_portal.rb", @@ -20,9 +20,11 @@ "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/organization_api_key.rb", + "lib/workos/api_keys/organization_api_key_owner.rb", + "lib/workos/api_keys/organization_api_key_with_value.rb", + "lib/workos/api_keys/organization_api_key_with_value_owner.rb", "lib/workos/api_keys/validate_api_key.rb", "lib/workos/audit_logs.rb", "lib/workos/audit_logs/audit_log_action_json.rb", @@ -60,8 +62,6 @@ "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", @@ -76,6 +76,8 @@ "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/authorization/user_role_assignment.rb", + "lib/workos/authorization/user_role_assignment_resource.rb", "lib/workos/client.rb", "lib/workos/connect.rb", "lib/workos/connect/application_credentials_list_item.rb", @@ -283,19 +285,16 @@ "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_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", "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", @@ -311,20 +310,16 @@ "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", @@ -333,8 +328,6 @@ "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", @@ -342,7 +335,6 @@ "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/groups_order.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", @@ -374,10 +366,7 @@ "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/pagination_order.rb", "lib/workos/types/profile_connection_type.rb", "lib/workos/types/radar_action.rb", "lib/workos/types/radar_standalone_assess_request_action.rb", @@ -400,19 +389,12 @@ "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_groups_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_byok_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", @@ -424,7 +406,6 @@ "lib/workos/types/vault_names_listed_data_actor_source.rb", "lib/workos/types/waitlist_user_state.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", "lib/workos/user_management/action_authentication_denied.rb", @@ -490,6 +471,7 @@ "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_api_key.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", @@ -544,6 +526,12 @@ "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_api_key.rb", + "lib/workos/user_management/user_api_key_created_data_owner.rb", + "lib/workos/user_management/user_api_key_owner.rb", + "lib/workos/user_management/user_api_key_revoked_data_owner.rb", + "lib/workos/user_management/user_api_key_with_value.rb", + "lib/workos/user_management/user_api_key_with_value_owner.rb", "lib/workos/user_management/user_created.rb", "lib/workos/user_management/user_deleted.rb", "lib/workos/user_management/user_identities_get_item.rb", @@ -555,6 +543,8 @@ "lib/workos/user_management/verify_email_address.rb", "lib/workos/user_management/verify_email_response.rb", "lib/workos/user_management_organization_membership_groups.rb", + "lib/workos/vault/vault_byok_key_deleted.rb", + "lib/workos/vault/vault_byok_key_deleted_data.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", @@ -597,8 +587,6 @@ "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", @@ -730,6 +718,7 @@ "rbi/workos/create_redirect_uri.rbi", "rbi/workos/create_role.rbi", "rbi/workos/create_user.rbi", + "rbi/workos/create_user_api_key.rbi", "rbi/workos/create_user_invite_options.rbi", "rbi/workos/create_user_organization_membership.rbi", "rbi/workos/create_webhook_endpoint.rbi", @@ -856,6 +845,10 @@ "rbi/workos/multi_factor_auth.rbi", "rbi/workos/new_connect_application_secret.rbi", "rbi/workos/organization.rbi", + "rbi/workos/organization_api_key.rbi", + "rbi/workos/organization_api_key_owner.rbi", + "rbi/workos/organization_api_key_with_value.rbi", + "rbi/workos/organization_api_key_with_value_owner.rbi", "rbi/workos/organization_created.rbi", "rbi/workos/organization_created_data.rbi", "rbi/workos/organization_created_data_domain.rbi", @@ -927,8 +920,6 @@ "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", @@ -968,6 +959,12 @@ "rbi/workos/update_user_organization_membership.rbi", "rbi/workos/update_webhook_endpoint.rbi", "rbi/workos/user.rbi", + "rbi/workos/user_api_key.rbi", + "rbi/workos/user_api_key_created_data_owner.rbi", + "rbi/workos/user_api_key_owner.rbi", + "rbi/workos/user_api_key_revoked_data_owner.rbi", + "rbi/workos/user_api_key_with_value.rbi", + "rbi/workos/user_api_key_with_value_owner.rbi", "rbi/workos/user_authentication_factor_enroll_response.rbi", "rbi/workos/user_consent_option.rbi", "rbi/workos/user_consent_option_choice.rbi", @@ -981,10 +978,14 @@ "rbi/workos/user_object.rbi", "rbi/workos/user_organization_membership.rbi", "rbi/workos/user_organization_membership_base_list_data.rbi", + "rbi/workos/user_role_assignment.rbi", + "rbi/workos/user_role_assignment_resource.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_deleted.rbi", + "rbi/workos/vault_byok_key_deleted_data.rbi", "rbi/workos/vault_byok_key_verification_completed.rbi", "rbi/workos/vault_byok_key_verification_completed_data.rbi", "rbi/workos/vault_data_created.rbi", @@ -1038,14 +1039,6 @@ "test/workos/test_widgets.rb" ], "operations": { - "POST /api_keys/validations": { - "sdkMethod": "create_validation", - "service": "api_keys" - }, - "DELETE /api_keys/{id}": { - "sdkMethod": "delete_api_key", - "service": "api_keys" - }, "POST /auth/challenges/{id}/verify": { "sdkMethod": "verify_challenge", "service": "multi_factor_auth" @@ -1150,6 +1143,10 @@ "sdkMethod": "list_memberships_for_resource_by_external_id", "service": "authorization" }, + "GET /authorization/organizations/{organization_id}/resources/{resource_type_slug}/{external_id}/role_assignments": { + "sdkMethod": "list_role_assignments_for_resource_by_external_id", + "service": "authorization" + }, "GET /authorization/resources": { "sdkMethod": "list_resources", "service": "authorization" @@ -1174,6 +1171,10 @@ "sdkMethod": "list_memberships_for_resource", "service": "authorization" }, + "GET /authorization/resources/{resource_id}/role_assignments": { + "sdkMethod": "list_role_assignments_for_resource", + "service": "authorization" + }, "GET /authorization/roles": { "sdkMethod": "list_environment_roles", "service": "authorization" @@ -1622,6 +1623,10 @@ "sdkMethod": "revoke_invitation", "service": "user_management" }, + "GET /user_management/jwt_template": { + "sdkMethod": "list_jwt_template", + "service": "user_management" + }, "PUT /user_management/jwt_template": { "sdkMethod": "update_jwt_template", "service": "user_management" @@ -1722,6 +1727,22 @@ "sdkMethod": "create_token", "service": "widgets" }, + "POST /api_keys/validations": { + "sdkMethod": "create_validation", + "service": "api_keys" + }, + "DELETE /api_keys/{id}": { + "sdkMethod": "delete_api_key", + "service": "api_keys" + }, + "GET /user_management/users/{userId}/api_keys": { + "sdkMethod": "list_user_api_keys", + "service": "user_management" + }, + "POST /user_management/users/{userId}/api_keys": { + "sdkMethod": "create_user_api_key", + "service": "user_management" + }, "GET /audit_logs/actions": { "sdkMethod": "list_actions", "service": "audit_logs" diff --git a/lib/workos/api_keys.rb b/lib/workos/api_keys.rb index 5fb3a995..5f105047 100644 --- a/lib/workos/api_keys.rb +++ b/lib/workos/api_keys.rb @@ -10,59 +10,19 @@ def initialize(client) @client = client end - # Validate API key - # @param value [String] The value for an API key. - # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::ApiKeyValidationResponse] - def create_validation( - value:, - request_options: {} - ) - body = { - "value" => value - } - response = @client.request( - method: :post, - path: "/api_keys/validations", - auth: true, - body: body, - request_options: request_options - ) - 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] (see WorkOS::Types::RequestOptions) - # @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 order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::Types::ListStruct] + # @return [WorkOS::Types::ListStruct] def list_organization_api_keys( organization_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -91,7 +51,7 @@ def list_organization_api_keys( } WorkOS::Types::ListStruct.from_response( response, - model: WorkOS::ApiKey, + model: WorkOS::OrganizationApiKey, filters: {organization_id: organization_id, before: before, limit: limit, order: order}, fetch_next: fetch_next ) @@ -102,7 +62,7 @@ def list_organization_api_keys( # @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] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::ApiKeyWithValue] + # @return [WorkOS::OrganizationApiKeyWithValue] def create_organization_api_key( organization_id:, name:, @@ -120,9 +80,49 @@ def create_organization_api_key( body: body, request_options: request_options ) - result = WorkOS::ApiKeyWithValue.new(response.body) + result = WorkOS::OrganizationApiKeyWithValue.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 + + # Validate API key + # @param value [String] The value for an API key. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::ApiKeyValidationResponse] + def create_validation( + value:, + request_options: {} + ) + body = { + "value" => value + } + response = @client.request( + method: :post, + path: "/api_keys/validations", + auth: true, + body: body, + request_options: request_options + ) + 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] (see WorkOS::Types::RequestOptions) + # @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 end end diff --git a/lib/workos/api_keys/api_key.rb b/lib/workos/api_keys/api_key.rb index 94020562..c69d2fa9 100644 --- a/lib/workos/api_keys/api_key.rb +++ b/lib/workos/api_keys/api_key.rb @@ -31,7 +31,7 @@ def initialize(json) hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] - @owner = hash[:owner] ? WorkOS::ApiKeyOwner.new(hash[:owner]) : nil + @owner = hash[:owner] ? (case hash[:owner][:type] when "organization" then WorkOS::ApiKeyOwner.new(hash[:owner]) when "user" then WorkOS::UserApiKeyOwner.new(hash[:owner]) else hash[:owner] end) : nil @name = hash[:name] @obfuscated_value = hash[:obfuscated_value] @last_used_at = hash[:last_used_at] diff --git a/lib/workos/api_keys/api_key_created_data.rb b/lib/workos/api_keys/api_key_created_data.rb index 024af96c..8128befc 100644 --- a/lib/workos/api_keys/api_key_created_data.rb +++ b/lib/workos/api_keys/api_key_created_data.rb @@ -31,7 +31,7 @@ def initialize(json) hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] - @owner = hash[:owner] ? WorkOS::ApiKeyCreatedDataOwner.new(hash[:owner]) : nil + @owner = hash[:owner] ? (case hash[:owner][:type] when "organization" then WorkOS::ApiKeyCreatedDataOwner.new(hash[:owner]) when "user" then WorkOS::UserApiKeyCreatedDataOwner.new(hash[:owner]) else hash[:owner] end) : nil @name = hash[:name] @obfuscated_value = hash[:obfuscated_value] @last_used_at = hash[:last_used_at] diff --git a/lib/workos/api_keys/organization_api_key.rb b/lib/workos/api_keys/organization_api_key.rb new file mode 100644 index 00000000..f2131bae --- /dev/null +++ b/lib/workos/api_keys/organization_api_key.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationApiKey < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @object = hash[:object] + @id = hash[:id] + @owner = hash[:owner] ? WorkOS::OrganizationApiKeyOwner.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/types/events_order.rb b/lib/workos/api_keys/organization_api_key_owner.rb similarity index 64% rename from lib/workos/types/events_order.rb rename to lib/workos/api_keys/organization_api_key_owner.rb index 4f73381f..6b8527a8 100644 --- a/lib/workos/types/events_order.rb +++ b/lib/workos/api_keys/organization_api_key_owner.rb @@ -3,7 +3,5 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - module Types - EventsOrder = ApplicationsOrder - end + OrganizationApiKeyOwner = ApiKeyCreatedDataOwner end diff --git a/lib/workos/api_keys/organization_api_key_with_value.rb b/lib/workos/api_keys/organization_api_key_with_value.rb new file mode 100644 index 00000000..c8bced69 --- /dev/null +++ b/lib/workos/api_keys/organization_api_key_with_value.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class OrganizationApiKeyWithValue < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @object = hash[:object] + @id = hash[:id] + @owner = hash[:owner] ? WorkOS::OrganizationApiKeyWithValueOwner.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/types/audit_logs_order.rb b/lib/workos/api_keys/organization_api_key_with_value_owner.rb similarity index 63% rename from lib/workos/types/audit_logs_order.rb rename to lib/workos/api_keys/organization_api_key_with_value_owner.rb index 598b6279..8b685426 100644 --- a/lib/workos/types/audit_logs_order.rb +++ b/lib/workos/api_keys/organization_api_key_with_value_owner.rb @@ -3,7 +3,5 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - module Types - AuditLogsOrder = ApplicationsOrder - end + OrganizationApiKeyWithValueOwner = ApiKeyCreatedDataOwner end diff --git a/lib/workos/audit_logs.rb b/lib/workos/audit_logs.rb index 45226db3..e70e9eb0 100644 --- a/lib/workos/audit_logs.rb +++ b/lib/workos/audit_logs.rb @@ -58,13 +58,13 @@ def update_organization_audit_logs_retention( # @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 order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_actions( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -103,14 +103,14 @@ def 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 order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_action_schemas( action_name:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/authorization.rb b/lib/workos/authorization.rb index fcdc09aa..d7c29cd6 100644 --- a/lib/workos/authorization.rb +++ b/lib/workos/authorization.rb @@ -93,7 +93,7 @@ def check( # @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 order [WorkOS::Types::PaginationOrder, 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 parent_resource [WorkOS::Authorization::ParentResourceById, WorkOS::Authorization::ParentResourceByExternalId] Identifies the parent resource. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) @@ -104,7 +104,7 @@ def list_resources_for_membership( parent_resource:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -157,7 +157,7 @@ def list_resources_for_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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_effective_permissions( @@ -165,7 +165,7 @@ def list_effective_permissions( resource_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -208,7 +208,7 @@ def list_effective_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::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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_effective_permissions_by_external_id( @@ -217,7 +217,7 @@ def list_effective_permissions_by_external_id( external_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -259,14 +259,14 @@ def list_effective_permissions_by_external_id( # @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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::Types::ListStruct] + # @return [WorkOS::Types::ListStruct] def list_role_assignments( organization_membership_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -295,7 +295,7 @@ def list_role_assignments( } WorkOS::Types::ListStruct.from_response( response, - model: WorkOS::RoleAssignment, + model: WorkOS::UserRoleAssignment, filters: {organization_membership_id: organization_membership_id, before: before, limit: limit, order: order}, fetch_next: fetch_next ) @@ -306,7 +306,7 @@ def list_role_assignments( # @param role_slug [String] The slug of the role to assign. # @param resource_target [WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId] Identifies the resource target. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) - # @return [WorkOS::RoleAssignment] + # @return [WorkOS::UserRoleAssignment] def assign_role( organization_membership_id:, role_slug:, @@ -332,7 +332,7 @@ def assign_role( body: body, request_options: request_options ) - result = WorkOS::RoleAssignment.new(response.body) + result = WorkOS::UserRoleAssignment.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 @@ -671,7 +671,7 @@ def delete_resource_by_external_id( organization_id:, resource_type_slug:, external_id:, - cascade_delete: nil, + cascade_delete: false, request_options: {} ) params = { @@ -694,7 +694,7 @@ def delete_resource_by_external_id( # @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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) @@ -706,7 +706,7 @@ def list_memberships_for_resource_by_external_id( permission_slug:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", assignment: nil, request_options: {} @@ -748,11 +748,64 @@ def list_memberships_for_resource_by_external_id( ) end + # List role assignments 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. + # @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::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_role_assignments_for_resource_by_external_id( + organization_id:, + resource_type_slug:, + external_id:, + before: nil, + after: nil, + limit: 10, + order: "desc", + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.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)}/role_assignments", + auth: true, + params: params, + request_options: request_options + ) + fetch_next = ->(cursor) { + list_role_assignments_for_resource_by_external_id( + organization_id: organization_id, + resource_type_slug: resource_type_slug, + external_id: external_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserRoleAssignment, + filters: {organization_id: organization_id, resource_type_slug: resource_type_slug, external_id: external_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + 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 order [WorkOS::Types::PaginationOrder, 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 resource_external_id [String, nil] Filter resources by external ID. @@ -763,7 +816,7 @@ def list_memberships_for_resource_by_external_id( def list_resources( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization_id: nil, resource_type_slug: nil, @@ -937,7 +990,7 @@ def update_resource( # @return [void] def delete_resource( resource_id:, - cascade_delete: nil, + cascade_delete: false, request_options: {} ) params = { @@ -958,7 +1011,7 @@ def delete_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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) @@ -968,7 +1021,7 @@ def list_memberships_for_resource( permission_slug:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", assignment: nil, request_options: {} @@ -1008,6 +1061,53 @@ def list_memberships_for_resource( ) end + # List role assignments for a 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::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_role_assignments_for_resource( + resource_id:, + before: nil, + after: nil, + limit: 10, + order: "desc", + request_options: {} + ) + params = { + "before" => before, + "after" => after, + "limit" => limit, + "order" => order + }.compact + response = @client.request( + method: :get, + path: "/authorization/resources/#{WorkOS::Util.encode_path(resource_id)}/role_assignments", + auth: true, + params: params, + request_options: request_options + ) + fetch_next = ->(cursor) { + list_role_assignments_for_resource( + resource_id: resource_id, + before: before, + after: cursor, + limit: limit, + order: order, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserRoleAssignment, + filters: {resource_id: resource_id, before: before, limit: limit, order: order}, + fetch_next: fetch_next + ) + end + # List environment roles # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::RoleList] @@ -1156,13 +1256,13 @@ def set_environment_role_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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_permissions( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) 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 c52c73d0..5403c5df 100644 --- a/lib/workos/authorization/user_organization_membership_base_list_data.rb +++ b/lib/workos/authorization/user_organization_membership_base_list_data.rb @@ -14,7 +14,8 @@ class UserOrganizationMembershipBaseListData < WorkOS::Types::BaseModel organization_name: :organization_name, custom_attributes: :custom_attributes, created_at: :created_at, - updated_at: :updated_at + updated_at: :updated_at, + user: :user }.freeze attr_accessor \ @@ -27,7 +28,8 @@ class UserOrganizationMembershipBaseListData < WorkOS::Types::BaseModel :organization_name, :custom_attributes, :created_at, - :updated_at + :updated_at, + :user def initialize(json) hash = self.class.normalize(json) @@ -41,6 +43,7 @@ def initialize(json) @custom_attributes = hash[:custom_attributes] || {} @created_at = hash[:created_at] @updated_at = hash[:updated_at] + @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil end end end diff --git a/lib/workos/authorization/role_assignment.rb b/lib/workos/authorization/user_role_assignment.rb similarity index 67% rename from lib/workos/authorization/role_assignment.rb rename to lib/workos/authorization/user_role_assignment.rb index b2281332..0a0ff87e 100644 --- a/lib/workos/authorization/role_assignment.rb +++ b/lib/workos/authorization/user_role_assignment.rb @@ -3,10 +3,11 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - class RoleAssignment < WorkOS::Types::BaseModel + class UserRoleAssignment < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, + organization_membership_id: :organization_membership_id, role: :role, resource: :resource, created_at: :created_at, @@ -16,6 +17,7 @@ class RoleAssignment < WorkOS::Types::BaseModel attr_accessor \ :object, :id, + :organization_membership_id, :role, :resource, :created_at, @@ -25,8 +27,9 @@ def initialize(json) hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] + @organization_membership_id = hash[:organization_membership_id] @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil - @resource = hash[:resource] ? WorkOS::RoleAssignmentResource.new(hash[:resource]) : nil + @resource = hash[:resource] ? WorkOS::UserRoleAssignmentResource.new(hash[:resource]) : nil @created_at = hash[:created_at] @updated_at = hash[:updated_at] end diff --git a/lib/workos/authorization/role_assignment_resource.rb b/lib/workos/authorization/user_role_assignment_resource.rb similarity index 89% rename from lib/workos/authorization/role_assignment_resource.rb rename to lib/workos/authorization/user_role_assignment_resource.rb index bcdae5f2..9128e967 100644 --- a/lib/workos/authorization/role_assignment_resource.rb +++ b/lib/workos/authorization/user_role_assignment_resource.rb @@ -3,7 +3,7 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - class RoleAssignmentResource < WorkOS::Types::BaseModel + class UserRoleAssignmentResource < WorkOS::Types::BaseModel HASH_ATTRS = { id: :id, external_id: :external_id, diff --git a/lib/workos/client.rb b/lib/workos/client.rb index 36aa03a9..fa9b29bb 100644 --- a/lib/workos/client.rb +++ b/lib/workos/client.rb @@ -4,10 +4,6 @@ module WorkOS 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 @@ -48,6 +44,10 @@ def organizations @organizations ||= WorkOS::Organizations.new(self) end + def api_keys + @api_keys ||= WorkOS::ApiKeys.new(self) + end + def groups @groups ||= WorkOS::Groups.new(self) end diff --git a/lib/workos/connect.rb b/lib/workos/connect.rb index 3a46e737..09bb810a 100644 --- a/lib/workos/connect.rb +++ b/lib/workos/connect.rb @@ -43,14 +43,14 @@ def complete_oauth2( # @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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_applications( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization_id: nil, request_options: {} diff --git a/lib/workos/directory_sync.rb b/lib/workos/directory_sync.rb index 70e856d1..ac473f94 100644 --- a/lib/workos/directory_sync.rb +++ b/lib/workos/directory_sync.rb @@ -14,7 +14,7 @@ def initialize(client) # @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 order [WorkOS::Types::PaginationOrder, 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. @@ -23,7 +23,7 @@ def initialize(client) def list_directories( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization_id: nil, search: nil, @@ -106,7 +106,7 @@ def delete_directory( # @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::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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) @@ -114,7 +114,7 @@ def delete_directory( def list_groups( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", directory: nil, user: nil, @@ -177,7 +177,7 @@ def get_group( # @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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) @@ -185,7 +185,7 @@ def get_group( def list_users( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", directory: nil, group: nil, diff --git a/lib/workos/directory_sync/directory_user.rb b/lib/workos/directory_sync/directory_user.rb index b3b06b43..e5c7d28e 100644 --- a/lib/workos/directory_sync/directory_user.rb +++ b/lib/workos/directory_sync/directory_user.rb @@ -13,6 +13,7 @@ class DirectoryUser < WorkOS::Types::BaseModel email: :email, first_name: :first_name, last_name: :last_name, + name: :name, emails: :emails, job_title: :job_title, username: :username, @@ -43,6 +44,7 @@ class DirectoryUser < WorkOS::Types::BaseModel :email, :first_name, :last_name, + :name, :state, :custom_attributes, :role, @@ -88,6 +90,7 @@ def initialize(json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] + @name = hash[:name] @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DirectoryUserEmail.new(item) : nil } @job_title = hash[:job_title] @username = hash[:username] diff --git a/lib/workos/directory_sync/directory_user_with_groups.rb b/lib/workos/directory_sync/directory_user_with_groups.rb index b75d84fc..7bcbf7c0 100644 --- a/lib/workos/directory_sync/directory_user_with_groups.rb +++ b/lib/workos/directory_sync/directory_user_with_groups.rb @@ -13,6 +13,7 @@ class DirectoryUserWithGroups < WorkOS::Types::BaseModel email: :email, first_name: :first_name, last_name: :last_name, + name: :name, emails: :emails, job_title: :job_title, username: :username, @@ -35,7 +36,7 @@ class DirectoryUserWithGroups < WorkOS::Types::BaseModel # @!attribute raw_attributes # @deprecated The raw attributes received from the directory provider. # @!attribute groups - # @deprecated The directory groups the user belongs to. Use the List Directory Groups endpoint with a user filter instead. + # @deprecated The directory groups the user belongs to. Deprecated: starting May 1, 2026, this field returns an empty array by default for newly created teams. Existing teams currently depending on this field should migrate to the new access pattern for better throughput performance — the field is unbounded by user, so users with many group memberships produce large, slow response payloads. Use the List Directory Groups endpoint with a `user` filter to fetch a user's group memberships. attr_accessor \ :object, @@ -46,6 +47,7 @@ class DirectoryUserWithGroups < WorkOS::Types::BaseModel :email, :first_name, :last_name, + :name, :state, :custom_attributes, :role, @@ -98,6 +100,7 @@ def initialize(json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] + @name = hash[:name] @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DirectoryUserWithGroupsEmail.new(item) : nil } @job_title = hash[:job_title] @username = hash[:username] diff --git a/lib/workos/directory_sync/dsync_user_updated_data.rb b/lib/workos/directory_sync/dsync_user_updated_data.rb index 8298a54c..55791806 100644 --- a/lib/workos/directory_sync/dsync_user_updated_data.rb +++ b/lib/workos/directory_sync/dsync_user_updated_data.rb @@ -13,6 +13,7 @@ class DsyncUserUpdatedData < WorkOS::Types::BaseModel email: :email, first_name: :first_name, last_name: :last_name, + name: :name, emails: :emails, job_title: :job_title, username: :username, @@ -44,6 +45,7 @@ class DsyncUserUpdatedData < WorkOS::Types::BaseModel :email, :first_name, :last_name, + :name, :state, :custom_attributes, :role, @@ -90,6 +92,7 @@ def initialize(json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] + @name = hash[:name] @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DsyncUserUpdatedDataEmail.new(item) : nil } @job_title = hash[:job_title] @username = hash[:username] diff --git a/lib/workos/events.rb b/lib/workos/events.rb index fbe5f618..b8b97111 100644 --- a/lib/workos/events.rb +++ b/lib/workos/events.rb @@ -14,7 +14,7 @@ def initialize(client) # @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 order [WorkOS::Types::PaginationOrder, 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. @@ -24,7 +24,7 @@ def initialize(client) def list_events( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", events: nil, range_start: nil, diff --git a/lib/workos/feature_flags.rb b/lib/workos/feature_flags.rb index e1b1a195..00019cad 100644 --- a/lib/workos/feature_flags.rb +++ b/lib/workos/feature_flags.rb @@ -14,13 +14,13 @@ def initialize(client) # @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 order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_feature_flags( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -154,14 +154,14 @@ def remove_flag_target( # @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 order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_organization_feature_flags( organization_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -201,14 +201,14 @@ def list_organization_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::UserManagementUsersFeatureFlagsOrder, nil] Order the results by the creation time. + # @param order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_user_feature_flags( user_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/groups.rb b/lib/workos/groups.rb index d506e1f9..934f0e76 100644 --- a/lib/workos/groups.rb +++ b/lib/workos/groups.rb @@ -15,14 +15,14 @@ def initialize(client) # @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::GroupsOrder, 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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_organization_groups( organization_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -161,7 +161,7 @@ def delete_organization_group( # @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::GroupsOrder, 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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_group_organization_memberships( @@ -169,7 +169,7 @@ def list_group_organization_memberships( group_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/multi_factor_auth.rb b/lib/workos/multi_factor_auth.rb index 59b66850..fb38831f 100644 --- a/lib/workos/multi_factor_auth.rb +++ b/lib/workos/multi_factor_auth.rb @@ -136,14 +136,14 @@ def challenge_factor( # @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 order [WorkOS::Types::PaginationOrder, nil] Order the results by the creation time. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_user_auth_factors( userland_user_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/organizations.rb b/lib/workos/organizations.rb index f886ded7..d03fd37b 100644 --- a/lib/workos/organizations.rb +++ b/lib/workos/organizations.rb @@ -14,7 +14,7 @@ def initialize(client) # @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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) @@ -22,7 +22,7 @@ def initialize(client) def list_organizations( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", domains: nil, search: nil, diff --git a/lib/workos/sso.rb b/lib/workos/sso.rb index 6f71c5ed..080093d7 100644 --- a/lib/workos/sso.rb +++ b/lib/workos/sso.rb @@ -14,7 +14,7 @@ def initialize(client) # @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 order [WorkOS::Types::PaginationOrder, 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. @@ -24,7 +24,7 @@ def initialize(client) def list_connections( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", connection_type: nil, domain: nil, diff --git a/lib/workos/sso/profile.rb b/lib/workos/sso/profile.rb index 39b3520c..ba35eeb5 100644 --- a/lib/workos/sso/profile.rb +++ b/lib/workos/sso/profile.rb @@ -14,6 +14,7 @@ class Profile < WorkOS::Types::BaseModel email: :email, first_name: :first_name, last_name: :last_name, + name: :name, role: :role, roles: :roles, groups: :groups, @@ -31,6 +32,7 @@ class Profile < WorkOS::Types::BaseModel :email, :first_name, :last_name, + :name, :role, :roles, :groups, @@ -48,6 +50,7 @@ def initialize(json) @email = hash[:email] @first_name = hash[:first_name] @last_name = hash[:last_name] + @name = hash[:name] @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil @roles = (hash[:roles] || []).map { |item| item ? WorkOS::SlimRole.new(item) : nil } @groups = hash[:groups] || [] diff --git a/lib/workos/types/authorization_order.rb b/lib/workos/types/authorization_order.rb deleted file mode 100644 index 76c3a7e4..00000000 --- a/lib/workos/types/authorization_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - AuthorizationOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/connections_order.rb b/lib/workos/types/connections_order.rb deleted file mode 100644 index 97175e72..00000000 --- a/lib/workos/types/connections_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - ConnectionsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/directories_order.rb b/lib/workos/types/directories_order.rb deleted file mode 100644 index 4fc0eff0..00000000 --- a/lib/workos/types/directories_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - DirectoriesOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/directory_groups_order.rb b/lib/workos/types/directory_groups_order.rb deleted file mode 100644 index 1cc006ec..00000000 --- a/lib/workos/types/directory_groups_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - DirectoryGroupsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/directory_users_order.rb b/lib/workos/types/directory_users_order.rb deleted file mode 100644 index 37052177..00000000 --- a/lib/workos/types/directory_users_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - DirectoryUsersOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/event_context_actor_source.rb b/lib/workos/types/event_context_actor_source.rb index 8ba757fa..d49ea597 100644 --- a/lib/workos/types/event_context_actor_source.rb +++ b/lib/workos/types/event_context_actor_source.rb @@ -7,8 +7,9 @@ module Types class EventContextActorSource API = "api" DASHBOARD = "dashboard" + ADMIN_PORTAL = "admin_portal" SYSTEM = "system" - ALL = [API, DASHBOARD, SYSTEM].freeze + ALL = [API, DASHBOARD, ADMIN_PORTAL, SYSTEM].freeze end end end diff --git a/lib/workos/types/feature_flags_order.rb b/lib/workos/types/feature_flags_order.rb deleted file mode 100644 index c66da69e..00000000 --- a/lib/workos/types/feature_flags_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - FeatureFlagsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/organizations_api_keys_order.rb b/lib/workos/types/organizations_api_keys_order.rb deleted file mode 100644 index 01c79f57..00000000 --- a/lib/workos/types/organizations_api_keys_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - OrganizationsApiKeysOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/organizations_feature_flags_order.rb b/lib/workos/types/organizations_feature_flags_order.rb deleted file mode 100644 index d7e5414e..00000000 --- a/lib/workos/types/organizations_feature_flags_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - OrganizationsFeatureFlagsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/organizations_order.rb b/lib/workos/types/organizations_order.rb deleted file mode 100644 index 38fad388..00000000 --- a/lib/workos/types/organizations_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - OrganizationsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/applications_order.rb b/lib/workos/types/pagination_order.rb similarity index 89% rename from lib/workos/types/applications_order.rb rename to lib/workos/types/pagination_order.rb index 779a57ee..b85f0705 100644 --- a/lib/workos/types/applications_order.rb +++ b/lib/workos/types/pagination_order.rb @@ -4,7 +4,7 @@ module WorkOS module Types - class ApplicationsOrder + class PaginationOrder NORMAL = "normal" DESC = "desc" ASC = "asc" diff --git a/lib/workos/types/permissions_order.rb b/lib/workos/types/permissions_order.rb deleted file mode 100644 index a55d8a97..00000000 --- a/lib/workos/types/permissions_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - PermissionsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/user_management_invitations_order.rb b/lib/workos/types/user_management_invitations_order.rb deleted file mode 100644 index 59339740..00000000 --- a/lib/workos/types/user_management_invitations_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - 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 deleted file mode 100644 index 32948f79..00000000 --- a/lib/workos/types/user_management_multi_factor_authentication_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementMultiFactorAuthenticationOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/user_management_organization_membership_groups_order.rb b/lib/workos/types/user_management_organization_membership_groups_order.rb deleted file mode 100644 index 5b8749cf..00000000 --- a/lib/workos/types/user_management_organization_membership_groups_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementOrganizationMembershipGroupsOrder = 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 deleted file mode 100644 index 54b5bc4c..00000000 --- a/lib/workos/types/user_management_organization_membership_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementOrganizationMembershipOrder = ApplicationsOrder - 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 deleted file mode 100644 index e3b383f3..00000000 --- a/lib/workos/types/user_management_users_authorized_applications_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - 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 deleted file mode 100644 index 8ab6a151..00000000 --- a/lib/workos/types/user_management_users_feature_flags_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementUsersFeatureFlagsOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/user_management_users_order.rb b/lib/workos/types/user_management_users_order.rb deleted file mode 100644 index 6caafaf0..00000000 --- a/lib/workos/types/user_management_users_order.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file is auto-generated by oagen. Do not edit. - -module WorkOS - module Types - UserManagementUsersOrder = ApplicationsOrder - end -end diff --git a/lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb b/lib/workos/types/vault_byok_key_provider.rb similarity index 82% rename from lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb rename to lib/workos/types/vault_byok_key_provider.rb index f50670b3..7061c81f 100644 --- a/lib/workos/types/vault_byok_key_verification_completed_data_key_provider.rb +++ b/lib/workos/types/vault_byok_key_provider.rb @@ -4,7 +4,7 @@ module WorkOS module Types - class VaultByokKeyVerificationCompletedDataKeyProvider + class VaultByokKeyProvider AWS_KMS = "AWS_KMS" GCP_KMS = "GCP_KMS" AZURE_KEY_VAULT = "AZURE_KEY_VAULT" diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index b76145fa..4916649c 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -580,7 +580,7 @@ def get_password_reset( # @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 order [WorkOS::Types::PaginationOrder, 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. @@ -589,7 +589,7 @@ def get_password_reset( def list_users( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization: nil, organization_id: nil, @@ -911,14 +911,14 @@ def get_user_identities( # @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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_sessions( id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -957,7 +957,7 @@ def list_sessions( # @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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) @@ -965,7 +965,7 @@ def list_sessions( def list_invitations( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization_id: nil, email: nil, @@ -1144,6 +1144,21 @@ def revoke_invitation( result end + # Get JWT template + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::JWTTemplateResponse] + def list_jwt_template(request_options: {}) + response = @client.request( + method: :get, + path: "/user_management/jwt_template", + auth: true, + request_options: request_options + ) + 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 + # Update JWT template # @param content [String] The JWT template content as a Liquid template string. # @param request_options [Hash] (see WorkOS::Types::RequestOptions) @@ -1216,7 +1231,7 @@ def get_magic_auth( # @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 order [WorkOS::Types::PaginationOrder, 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). @@ -1225,7 +1240,7 @@ def get_magic_auth( def list_organization_memberships( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", organization_id: nil, statuses: nil, @@ -1441,14 +1456,14 @@ def create_redirect_uri( # @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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_user_authorized_applications( user_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) @@ -1502,6 +1517,88 @@ def delete_user_authorized_application( nil end + # List API keys for a user + # @param user_id [String] Unique identifier 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::PaginationOrder, nil] Order the results by the creation time. + # @param organization_id [String, nil] The ID of the organization to filter user API keys by. When provided, only API keys created against that organization membership are returned. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::Types::ListStruct] + def list_user_api_keys( + user_id:, + before: nil, + after: nil, + limit: 10, + order: "desc", + 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: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/api_keys", + auth: true, + params: params, + request_options: request_options + ) + fetch_next = ->(cursor) { + list_user_api_keys( + user_id: user_id, + before: before, + after: cursor, + limit: limit, + order: order, + organization_id: organization_id, + request_options: request_options + ) + } + WorkOS::Types::ListStruct.from_response( + response, + model: WorkOS::UserApiKey, + filters: {user_id: user_id, before: before, limit: limit, order: order, organization_id: organization_id}, + fetch_next: fetch_next + ) + end + + # Create an API key for a user + # @param user_id [String] Unique identifier of the user. + # @param name [String] A descriptive name for the API key. + # @param organization_id [String] The ID of the organization the user API key is associated with. The user must have an active membership in this organization. + # @param permissions [Array, nil] The permission slugs to assign to the API key. Each permission must be enabled for user API keys. + # @param request_options [Hash] (see WorkOS::Types::RequestOptions) + # @return [WorkOS::UserApiKeyWithValue] + def create_user_api_key( + user_id:, + name:, + organization_id:, + permissions: nil, + request_options: {} + ) + body = { + "name" => name, + "organization_id" => organization_id, + "permissions" => permissions + }.compact + response = @client.request( + method: :post, + path: "/user_management/users/#{WorkOS::Util.encode_path(user_id)}/api_keys", + auth: true, + body: body, + request_options: request_options + ) + result = WorkOS::UserApiKeyWithValue.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) # H13 — Build the JWKS URL for a given client_id (no HTTP call). # Pair with #get_jwks (generated) to fetch the keyset. diff --git a/lib/workos/user_management/create_user_api_key.rb b/lib/workos/user_management/create_user_api_key.rb new file mode 100644 index 00000000..17cf44f5 --- /dev/null +++ b/lib/workos/user_management/create_user_api_key.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class CreateUserApiKey < WorkOS::Types::BaseModel + HASH_ATTRS = { + name: :name, + organization_id: :organization_id, + permissions: :permissions + }.freeze + + attr_accessor \ + :name, + :organization_id, + :permissions + + def initialize(json) + hash = self.class.normalize(json) + @name = hash[:name] + @organization_id = hash[:organization_id] + @permissions = hash[:permissions] || [] + end + end +end diff --git a/lib/workos/user_management/organization_membership.rb b/lib/workos/user_management/organization_membership.rb index e2d9cf95..e73f24f3 100644 --- a/lib/workos/user_management/organization_membership.rb +++ b/lib/workos/user_management/organization_membership.rb @@ -15,7 +15,8 @@ class OrganizationMembership < WorkOS::Types::BaseModel custom_attributes: :custom_attributes, created_at: :created_at, updated_at: :updated_at, - role: :role + role: :role, + user: :user }.freeze attr_accessor \ @@ -29,7 +30,8 @@ class OrganizationMembership < WorkOS::Types::BaseModel :custom_attributes, :created_at, :updated_at, - :role + :role, + :user def initialize(json) hash = self.class.normalize(json) @@ -44,6 +46,7 @@ def initialize(json) @created_at = hash[:created_at] @updated_at = hash[:updated_at] @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil end end end diff --git a/lib/workos/user_management/user_api_key.rb b/lib/workos/user_management/user_api_key.rb new file mode 100644 index 00000000..cd68aec5 --- /dev/null +++ b/lib/workos/user_management/user_api_key.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserApiKey < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @object = hash[:object] + @id = hash[:id] + @owner = hash[:owner] ? WorkOS::UserApiKeyOwner.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/user_management/user_api_key_created_data_owner.rb b/lib/workos/user_management/user_api_key_created_data_owner.rb new file mode 100644 index 00000000..d1e1d25b --- /dev/null +++ b/lib/workos/user_management/user_api_key_created_data_owner.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class UserApiKeyCreatedDataOwner < WorkOS::Types::BaseModel + HASH_ATTRS = { + type: :type, + id: :id, + organization_id: :organization_id + }.freeze + + attr_accessor \ + :type, + :id, + :organization_id + + def initialize(json) + hash = self.class.normalize(json) + @type = hash[:type] + @id = hash[:id] + @organization_id = hash[:organization_id] + end + end +end diff --git a/lib/workos/api_keys/api_key_with_value_owner.rb b/lib/workos/user_management/user_api_key_owner.rb similarity index 68% rename from lib/workos/api_keys/api_key_with_value_owner.rb rename to lib/workos/user_management/user_api_key_owner.rb index 20ed52cd..9a9ce16f 100644 --- a/lib/workos/api_keys/api_key_with_value_owner.rb +++ b/lib/workos/user_management/user_api_key_owner.rb @@ -3,5 +3,5 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - ApiKeyWithValueOwner = ApiKeyCreatedDataOwner + UserApiKeyOwner = UserApiKeyCreatedDataOwner end diff --git a/lib/workos/types/webhooks_order.rb b/lib/workos/user_management/user_api_key_revoked_data_owner.rb similarity index 63% rename from lib/workos/types/webhooks_order.rb rename to lib/workos/user_management/user_api_key_revoked_data_owner.rb index 955368cd..6482c3cc 100644 --- a/lib/workos/types/webhooks_order.rb +++ b/lib/workos/user_management/user_api_key_revoked_data_owner.rb @@ -3,7 +3,5 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - module Types - WebhooksOrder = ApplicationsOrder - end + UserApiKeyRevokedDataOwner = UserApiKeyCreatedDataOwner end diff --git a/lib/workos/api_keys/api_key_with_value.rb b/lib/workos/user_management/user_api_key_with_value.rb similarity index 87% rename from lib/workos/api_keys/api_key_with_value.rb rename to lib/workos/user_management/user_api_key_with_value.rb index 196bcce0..6016ae72 100644 --- a/lib/workos/api_keys/api_key_with_value.rb +++ b/lib/workos/user_management/user_api_key_with_value.rb @@ -3,7 +3,7 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - class ApiKeyWithValue < WorkOS::Types::BaseModel + class UserApiKeyWithValue < WorkOS::Types::BaseModel HASH_ATTRS = { object: :object, id: :id, @@ -33,7 +33,7 @@ def initialize(json) hash = self.class.normalize(json) @object = hash[:object] @id = hash[:id] - @owner = hash[:owner] ? WorkOS::ApiKeyWithValueOwner.new(hash[:owner]) : nil + @owner = hash[:owner] ? WorkOS::UserApiKeyWithValueOwner.new(hash[:owner]) : nil @name = hash[:name] @obfuscated_value = hash[:obfuscated_value] @last_used_at = hash[:last_used_at] diff --git a/lib/workos/types/groups_order.rb b/lib/workos/user_management/user_api_key_with_value_owner.rb similarity index 64% rename from lib/workos/types/groups_order.rb rename to lib/workos/user_management/user_api_key_with_value_owner.rb index a000ce31..5c506d62 100644 --- a/lib/workos/types/groups_order.rb +++ b/lib/workos/user_management/user_api_key_with_value_owner.rb @@ -3,7 +3,5 @@ # This file is auto-generated by oagen. Do not edit. module WorkOS - module Types - GroupsOrder = ApplicationsOrder - end + UserApiKeyWithValueOwner = UserApiKeyCreatedDataOwner end diff --git a/lib/workos/user_management/user_organization_membership.rb b/lib/workos/user_management/user_organization_membership.rb index ff127f31..22a8b2fb 100644 --- a/lib/workos/user_management/user_organization_membership.rb +++ b/lib/workos/user_management/user_organization_membership.rb @@ -15,7 +15,8 @@ class UserOrganizationMembership < WorkOS::Types::BaseModel custom_attributes: :custom_attributes, created_at: :created_at, updated_at: :updated_at, - role: :role + role: :role, + user: :user }.freeze attr_accessor \ @@ -29,7 +30,8 @@ class UserOrganizationMembership < WorkOS::Types::BaseModel :custom_attributes, :created_at, :updated_at, - :role + :role, + :user def initialize(json) hash = self.class.normalize(json) @@ -44,6 +46,7 @@ def initialize(json) @created_at = hash[:created_at] @updated_at = hash[:updated_at] @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil + @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil end end end diff --git a/lib/workos/user_management_organization_membership_groups.rb b/lib/workos/user_management_organization_membership_groups.rb index ddecd12c..f2cad83f 100644 --- a/lib/workos/user_management_organization_membership_groups.rb +++ b/lib/workos/user_management_organization_membership_groups.rb @@ -15,14 +15,14 @@ def initialize(client) # @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::UserManagementOrganizationMembershipGroupsOrder, 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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_organization_membership_groups( om_id:, before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/lib/workos/vault/vault_byok_key_deleted.rb b/lib/workos/vault/vault_byok_key_deleted.rb new file mode 100644 index 00000000..8ad39249 --- /dev/null +++ b/lib/workos/vault/vault_byok_key_deleted.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultByokKeyDeleted < WorkOS::Types::BaseModel + 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 = self.class.normalize(json) + @id = hash[:id] + @event = hash[:event] + @data = hash[:data] ? WorkOS::VaultByokKeyDeletedData.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_deleted_data.rb b/lib/workos/vault/vault_byok_key_deleted_data.rb new file mode 100644 index 00000000..9c3a51f9 --- /dev/null +++ b/lib/workos/vault/vault_byok_key_deleted_data.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +module WorkOS + class VaultByokKeyDeletedData < WorkOS::Types::BaseModel + HASH_ATTRS = { + organization_id: :organization_id, + key_provider: :key_provider + }.freeze + + attr_accessor \ + :organization_id, + :key_provider + + def initialize(json) + hash = self.class.normalize(json) + @organization_id = hash[:organization_id] + @key_provider = hash[:key_provider] + end + end +end diff --git a/lib/workos/webhooks.rb b/lib/workos/webhooks.rb index 8b86d12c..c4b6dba1 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -14,13 +14,13 @@ def initialize(client) # @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 order [WorkOS::Types::PaginationOrder, 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] (see WorkOS::Types::RequestOptions) # @return [WorkOS::Types::ListStruct] def list_webhook_endpoints( before: nil, after: nil, - limit: nil, + limit: 10, order: "desc", request_options: {} ) diff --git a/rbi/workos/api_key.rbi b/rbi/workos/api_key.rbi index 1a91ee61..016787a3 100644 --- a/rbi/workos/api_key.rbi +++ b/rbi/workos/api_key.rbi @@ -21,10 +21,10 @@ module WorkOS sig { params(value: String).returns(String) } def id=(value); end - sig { returns(WorkOS::ApiKeyOwner) } + sig { returns(T.any(WorkOS::ApiKeyOwner, WorkOS::UserApiKeyOwner)) } def owner; end - sig { params(value: WorkOS::ApiKeyOwner).returns(WorkOS::ApiKeyOwner) } + sig { params(value: T.any(WorkOS::ApiKeyOwner, WorkOS::UserApiKeyOwner)).returns(T.any(WorkOS::ApiKeyOwner, WorkOS::UserApiKeyOwner)) } def owner=(value); end sig { returns(String) } diff --git a/rbi/workos/api_key_created_data.rbi b/rbi/workos/api_key_created_data.rbi index dfab3a6f..b676aada 100644 --- a/rbi/workos/api_key_created_data.rbi +++ b/rbi/workos/api_key_created_data.rbi @@ -21,10 +21,10 @@ module WorkOS sig { params(value: String).returns(String) } def id=(value); end - sig { returns(WorkOS::ApiKeyCreatedDataOwner) } + sig { returns(T.any(WorkOS::ApiKeyCreatedDataOwner, WorkOS::UserApiKeyCreatedDataOwner)) } def owner; end - sig { params(value: WorkOS::ApiKeyCreatedDataOwner).returns(WorkOS::ApiKeyCreatedDataOwner) } + sig { params(value: T.any(WorkOS::ApiKeyCreatedDataOwner, WorkOS::UserApiKeyCreatedDataOwner)).returns(T.any(WorkOS::ApiKeyCreatedDataOwner, WorkOS::UserApiKeyCreatedDataOwner)) } def owner=(value); end sig { returns(String) } diff --git a/rbi/workos/api_key_revoked_data.rbi b/rbi/workos/api_key_revoked_data.rbi index 2fe10d3a..ffb02ca8 100644 --- a/rbi/workos/api_key_revoked_data.rbi +++ b/rbi/workos/api_key_revoked_data.rbi @@ -21,10 +21,10 @@ module WorkOS sig { params(value: String).returns(String) } def id=(value); end - sig { returns(WorkOS::ApiKeyRevokedDataOwner) } + sig { returns(T.any(WorkOS::ApiKeyRevokedDataOwner, WorkOS::UserApiKeyRevokedDataOwner)) } def owner; end - sig { params(value: WorkOS::ApiKeyRevokedDataOwner).returns(WorkOS::ApiKeyRevokedDataOwner) } + sig { params(value: T.any(WorkOS::ApiKeyRevokedDataOwner, WorkOS::UserApiKeyRevokedDataOwner)).returns(T.any(WorkOS::ApiKeyRevokedDataOwner, WorkOS::UserApiKeyRevokedDataOwner)) } def owner=(value); end sig { returns(String) } diff --git a/rbi/workos/api_keys.rbi b/rbi/workos/api_keys.rbi index 059df93a..ae85f013 100644 --- a/rbi/workos/api_keys.rbi +++ b/rbi/workos/api_keys.rbi @@ -9,22 +9,6 @@ module WorkOS 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, @@ -43,9 +27,25 @@ module WorkOS name: String, permissions: T.nilable(T::Array[String]), request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::ApiKeyWithValue) + ).returns(WorkOS::OrganizationApiKeyWithValue) end def create_organization_api_key(organization_id:, name:, permissions:, request_options:); 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 + end end diff --git a/rbi/workos/authorization.rbi b/rbi/workos/authorization.rbi index 5e4eea64..6d2d35e0 100644 --- a/rbi/workos/authorization.rbi +++ b/rbi/workos/authorization.rbi @@ -162,7 +162,7 @@ module WorkOS role_slug: String, resource_target: T.any(WorkOS::Authorization::ResourceTargetById, WorkOS::Authorization::ResourceTargetByExternalId), request_options: T::Hash[Symbol, T.untyped] - ).returns(WorkOS::RoleAssignment) + ).returns(WorkOS::UserRoleAssignment) end def assign_role(organization_membership_id:, role_slug:, resource_target:, request_options:); end @@ -313,6 +313,20 @@ module WorkOS end def list_memberships_for_resource_by_external_id(organization_id:, resource_type_slug:, external_id:, permission_slug:, before:, after:, limit:, order:, assignment:, request_options:); end + sig do + params( + organization_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_role_assignments_for_resource_by_external_id(organization_id:, resource_type_slug:, external_id:, before:, after:, limit:, order:, request_options:); end + sig do params( before: T.nilable(String), @@ -384,6 +398,18 @@ module WorkOS end def list_memberships_for_resource(resource_id:, permission_slug:, before:, after:, limit:, order:, assignment:, request_options:); end + sig do + params( + 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_role_assignments_for_resource(resource_id:, before:, after:, limit:, order:, request_options:); end + sig do params( request_options: T::Hash[Symbol, T.untyped] diff --git a/rbi/workos/client.rbi b/rbi/workos/client.rbi index ca3c8bc1..d2cf6514 100644 --- a/rbi/workos/client.rbi +++ b/rbi/workos/client.rbi @@ -6,9 +6,6 @@ module WorkOS class Client < BaseClient - sig { returns(WorkOS::ApiKeys) } - def api_keys; end - sig { returns(WorkOS::MultiFactorAuth) } def multi_factor_auth; end @@ -42,6 +39,9 @@ module WorkOS sig { returns(WorkOS::AuditLogs) } def audit_logs; end + sig { returns(WorkOS::ApiKeys) } + def api_keys; end + sig { returns(WorkOS::Groups) } def groups; end diff --git a/rbi/workos/create_user_api_key.rbi b/rbi/workos/create_user_api_key.rbi new file mode 100644 index 00000000..6186a001 --- /dev/null +++ b/rbi/workos/create_user_api_key.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class CreateUserApiKey + 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 organization_id; end + + sig { params(value: String).returns(String) } + def organization_id=(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/directory_user.rbi b/rbi/workos/directory_user.rbi index baaaaa95..a0e65e9a 100644 --- a/rbi/workos/directory_user.rbi +++ b/rbi/workos/directory_user.rbi @@ -57,6 +57,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def last_name=(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::Array[WorkOS::DirectoryUserEmail])) } def emails; end diff --git a/rbi/workos/directory_user_with_groups.rbi b/rbi/workos/directory_user_with_groups.rbi index 55fba4d7..61bddd7b 100644 --- a/rbi/workos/directory_user_with_groups.rbi +++ b/rbi/workos/directory_user_with_groups.rbi @@ -57,6 +57,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def last_name=(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::Array[WorkOS::DirectoryUserWithGroupsEmail])) } def emails; end diff --git a/rbi/workos/dsync_user_updated_data.rbi b/rbi/workos/dsync_user_updated_data.rbi index a96b6925..f1d26b09 100644 --- a/rbi/workos/dsync_user_updated_data.rbi +++ b/rbi/workos/dsync_user_updated_data.rbi @@ -57,6 +57,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def last_name=(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::Array[WorkOS::DsyncUserUpdatedDataEmail])) } def emails; end diff --git a/rbi/workos/organization_api_key.rbi b/rbi/workos/organization_api_key.rbi new file mode 100644 index 00000000..c2413b53 --- /dev/null +++ b/rbi/workos/organization_api_key.rbi @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationApiKey + 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::OrganizationApiKeyOwner) } + def owner; end + + sig { params(value: WorkOS::OrganizationApiKeyOwner).returns(WorkOS::OrganizationApiKeyOwner) } + 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_with_value_owner.rbi b/rbi/workos/organization_api_key_owner.rbi similarity index 95% rename from rbi/workos/api_key_with_value_owner.rbi rename to rbi/workos/organization_api_key_owner.rbi index 4dcca49b..00ddb120 100644 --- a/rbi/workos/api_key_with_value_owner.rbi +++ b/rbi/workos/organization_api_key_owner.rbi @@ -5,7 +5,7 @@ # typed: strong module WorkOS - class ApiKeyWithValueOwner + class OrganizationApiKeyOwner sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } def initialize(json); end diff --git a/rbi/workos/organization_api_key_with_value.rbi b/rbi/workos/organization_api_key_with_value.rbi new file mode 100644 index 00000000..ddf7c6a1 --- /dev/null +++ b/rbi/workos/organization_api_key_with_value.rbi @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationApiKeyWithValue + 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::OrganizationApiKeyWithValueOwner) } + def owner; end + + sig { params(value: WorkOS::OrganizationApiKeyWithValueOwner).returns(WorkOS::OrganizationApiKeyWithValueOwner) } + 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/organization_api_key_with_value_owner.rbi b/rbi/workos/organization_api_key_with_value_owner.rbi new file mode 100644 index 00000000..3a470243 --- /dev/null +++ b/rbi/workos/organization_api_key_with_value_owner.rbi @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class OrganizationApiKeyWithValueOwner + 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/organization_membership.rbi b/rbi/workos/organization_membership.rbi index f51180a2..90776d84 100644 --- a/rbi/workos/organization_membership.rbi +++ b/rbi/workos/organization_membership.rbi @@ -75,6 +75,12 @@ module WorkOS sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } def role=(value); 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 diff --git a/rbi/workos/profile.rbi b/rbi/workos/profile.rbi index fc021e14..d2ff5e40 100644 --- a/rbi/workos/profile.rbi +++ b/rbi/workos/profile.rbi @@ -63,6 +63,12 @@ module WorkOS sig { params(value: T.nilable(String)).returns(T.nilable(String)) } def last_name=(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(WorkOS::SlimRole)) } def role; end diff --git a/rbi/workos/user_api_key.rbi b/rbi/workos/user_api_key.rbi new file mode 100644 index 00000000..3da15af1 --- /dev/null +++ b/rbi/workos/user_api_key.rbi @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserApiKey + 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::UserApiKeyOwner) } + def owner; end + + sig { params(value: WorkOS::UserApiKeyOwner).returns(WorkOS::UserApiKeyOwner) } + 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/user_api_key_created_data_owner.rbi b/rbi/workos/user_api_key_created_data_owner.rbi new file mode 100644 index 00000000..fce87524 --- /dev/null +++ b/rbi/workos/user_api_key_created_data_owner.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserApiKeyCreatedDataOwner + 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(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/user_api_key_owner.rbi b/rbi/workos/user_api_key_owner.rbi new file mode 100644 index 00000000..272e6d62 --- /dev/null +++ b/rbi/workos/user_api_key_owner.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserApiKeyOwner + 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(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/user_api_key_revoked_data_owner.rbi b/rbi/workos/user_api_key_revoked_data_owner.rbi new file mode 100644 index 00000000..944e5f15 --- /dev/null +++ b/rbi/workos/user_api_key_revoked_data_owner.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserApiKeyRevokedDataOwner + 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(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/api_key_with_value.rbi b/rbi/workos/user_api_key_with_value.rbi similarity index 90% rename from rbi/workos/api_key_with_value.rbi rename to rbi/workos/user_api_key_with_value.rbi index 6519584f..66c5296e 100644 --- a/rbi/workos/api_key_with_value.rbi +++ b/rbi/workos/user_api_key_with_value.rbi @@ -5,7 +5,7 @@ # typed: strong module WorkOS - class ApiKeyWithValue + class UserApiKeyWithValue sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } def initialize(json); end @@ -21,10 +21,10 @@ module WorkOS sig { params(value: String).returns(String) } def id=(value); end - sig { returns(WorkOS::ApiKeyWithValueOwner) } + sig { returns(WorkOS::UserApiKeyWithValueOwner) } def owner; end - sig { params(value: WorkOS::ApiKeyWithValueOwner).returns(WorkOS::ApiKeyWithValueOwner) } + sig { params(value: WorkOS::UserApiKeyWithValueOwner).returns(WorkOS::UserApiKeyWithValueOwner) } def owner=(value); end sig { returns(String) } diff --git a/rbi/workos/user_api_key_with_value_owner.rbi b/rbi/workos/user_api_key_with_value_owner.rbi new file mode 100644 index 00000000..1f1b7566 --- /dev/null +++ b/rbi/workos/user_api_key_with_value_owner.rbi @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class UserApiKeyWithValueOwner + 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(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/user_management.rbi b/rbi/workos/user_management.rbi index 2d2c0bca..c0e19532 100644 --- a/rbi/workos/user_management.rbi +++ b/rbi/workos/user_management.rbi @@ -333,6 +333,13 @@ module WorkOS end def revoke_invitation(id:, request_options:); end + sig do + params( + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::JWTTemplateResponse) + end + def list_jwt_template(request_options:); end + sig do params( content: String, @@ -452,5 +459,29 @@ module WorkOS end def delete_user_authorized_application(application_id:, user_id:, 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), + organization_id: T.nilable(String), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::Types::ListStruct) + end + def list_user_api_keys(user_id:, before:, after:, limit:, order:, organization_id:, request_options:); end + + sig do + params( + user_id: String, + name: String, + organization_id: String, + permissions: T.nilable(T::Array[String]), + request_options: T::Hash[Symbol, T.untyped] + ).returns(WorkOS::UserApiKeyWithValue) + end + def create_user_api_key(user_id:, name:, organization_id:, permissions:, request_options:); end + end end diff --git a/rbi/workos/user_organization_membership.rbi b/rbi/workos/user_organization_membership.rbi index 5ebf5d51..06990a12 100644 --- a/rbi/workos/user_organization_membership.rbi +++ b/rbi/workos/user_organization_membership.rbi @@ -75,6 +75,12 @@ module WorkOS sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } def role=(value); 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 diff --git a/rbi/workos/user_organization_membership_base_list_data.rbi b/rbi/workos/user_organization_membership_base_list_data.rbi index 33d6d634..d720fe76 100644 --- a/rbi/workos/user_organization_membership_base_list_data.rbi +++ b/rbi/workos/user_organization_membership_base_list_data.rbi @@ -69,6 +69,12 @@ module WorkOS sig { params(value: String).returns(String) } def updated_at=(value); 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 diff --git a/rbi/workos/role_assignment.rbi b/rbi/workos/user_role_assignment.rbi similarity index 75% rename from rbi/workos/role_assignment.rbi rename to rbi/workos/user_role_assignment.rbi index a5f17a46..2e6c4882 100644 --- a/rbi/workos/role_assignment.rbi +++ b/rbi/workos/user_role_assignment.rbi @@ -5,7 +5,7 @@ # typed: strong module WorkOS - class RoleAssignment + class UserRoleAssignment sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } def initialize(json); end @@ -21,16 +21,22 @@ module WorkOS sig { params(value: String).returns(String) } def 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(WorkOS::SlimRole) } def role; end sig { params(value: WorkOS::SlimRole).returns(WorkOS::SlimRole) } def role=(value); end - sig { returns(WorkOS::RoleAssignmentResource) } + sig { returns(WorkOS::UserRoleAssignmentResource) } def resource; end - sig { params(value: WorkOS::RoleAssignmentResource).returns(WorkOS::RoleAssignmentResource) } + sig { params(value: WorkOS::UserRoleAssignmentResource).returns(WorkOS::UserRoleAssignmentResource) } def resource=(value); end sig { returns(String) } diff --git a/rbi/workos/role_assignment_resource.rbi b/rbi/workos/user_role_assignment_resource.rbi similarity index 95% rename from rbi/workos/role_assignment_resource.rbi rename to rbi/workos/user_role_assignment_resource.rbi index cce0558b..0cff34c4 100644 --- a/rbi/workos/role_assignment_resource.rbi +++ b/rbi/workos/user_role_assignment_resource.rbi @@ -5,7 +5,7 @@ # typed: strong module WorkOS - class RoleAssignmentResource + class UserRoleAssignmentResource sig { params(json: T.any(String, T::Hash[Symbol, T.untyped])).void } def initialize(json); end diff --git a/rbi/workos/vault_byok_key_deleted.rbi b/rbi/workos/vault_byok_key_deleted.rbi new file mode 100644 index 00000000..c82e4f2d --- /dev/null +++ b/rbi/workos/vault_byok_key_deleted.rbi @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultByokKeyDeleted + 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::VaultByokKeyDeletedData) } + def data; end + + sig { params(value: WorkOS::VaultByokKeyDeletedData).returns(WorkOS::VaultByokKeyDeletedData) } + 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_deleted_data.rbi b/rbi/workos/vault_byok_key_deleted_data.rbi new file mode 100644 index 00000000..37dff254 --- /dev/null +++ b/rbi/workos/vault_byok_key_deleted_data.rbi @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# This file is auto-generated by oagen. Do not edit. + +# typed: strong + +module WorkOS + class VaultByokKeyDeletedData + 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::Hash[Symbol, T.untyped]) } + def to_h; end + + sig { params(args: T.untyped).returns(String) } + def to_json(*args); end + end +end diff --git a/test/workos/test_api_keys.rb b/test/workos/test_api_keys.rb index 0e3737f2..f2695f69 100644 --- a/test/workos/test_api_keys.rb +++ b/test/workos/test_api_keys.rb @@ -11,20 +11,6 @@ def setup @client = WorkOS::Client.new(api_key: "sk_test_123") end - def test_create_validation_returns_expected_result - 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_delete_api_key_returns_expected_result - 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 - end - def test_list_organization_api_keys_returns_expected_result stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) @@ -39,12 +25,26 @@ def test_create_organization_api_key_returns_expected_result refute_nil result end + def test_create_validation_returns_expected_result + 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_delete_api_key_returns_expected_result + 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 + end + # 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"}} + {name: :create_organization_api_key, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/api_keys(\?|\z)}, args: {organization_id: "stub", name: "stub"}}, + {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"}} ].each do |spec| define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do stub_request(spec[:verb], spec[:url]) diff --git a/test/workos/test_authorization.rb b/test/workos/test_authorization.rb index 56de8137..3f074b6c 100644 --- a/test/workos/test_authorization.rb +++ b/test/workos/test_authorization.rb @@ -192,6 +192,13 @@ def test_list_memberships_for_resource_by_external_id_returns_expected_result assert_kind_of WorkOS::Types::ListStruct, result end + def test_list_role_assignments_for_resource_by_external_id_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub/role_assignments(\?|\z)}) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_role_assignments_for_resource_by_external_id(organization_id: "stub", resource_type_slug: "stub", external_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + def test_list_resources_returns_expected_result stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}) .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) @@ -259,6 +266,13 @@ def test_list_memberships_for_resource_returns_expected_result assert_kind_of WorkOS::Types::ListStruct, result end + def test_list_role_assignments_for_resource_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/resources/stub/role_assignments(\?|\z)}) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.authorization.list_role_assignments_for_resource(resource_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + def test_list_environment_roles_returns_expected_result stub_request(:get, %r{\Ahttps://api\.workos\.com/authorization/roles(\?|\z)}) .to_return(body: "{}", status: 200) @@ -358,12 +372,14 @@ def test_delete_permission_returns_expected_result {name: :update_resource_by_external_id, 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", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_id: "stub")}}, {name: :delete_resource_by_external_id, 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_memberships_for_resource_by_external_id, 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_role_assignments_for_resource_by_external_id, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/organizations/stub/resources/stub/stub/role_assignments(\?|\z)}, args: {organization_id: "stub", resource_type_slug: "stub", external_id: "stub"}}, {name: :list_resources, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources(\?|\z)}, args: {parent: WorkOS::Authorization::ParentById.new(parent_resource_id: "stub")}}, {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", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_resource_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", parent_resource: WorkOS::Authorization::ParentResourceById.new(parent_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_role_assignments_for_resource, verb: :get, url: %r{\Ahttps://api\.workos\.com/authorization/resources/stub/role_assignments(\?|\z)}, args: {resource_id: "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"}}, diff --git a/test/workos/test_model_round_trip.rb b/test/workos/test_model_round_trip.rb index b5b481c7..1df43396 100644 --- a/test/workos/test_model_round_trip.rb +++ b/test/workos/test_model_round_trip.rb @@ -709,6 +709,20 @@ def test_update_user_organization_membership_round_trip 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_api_key_round_trip + fixture = { + "name" => "stub", + "organization_id" => "stub", + "permissions" => [] + } + model = WorkOS::CreateUserApiKey.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] + 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 fixture = { "email" => "stub", @@ -1183,19 +1197,21 @@ def test_slim_role_round_trip 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 + def test_user_role_assignment_round_trip fixture = { "object" => "role_assignment", "id" => "stub", + "organization_membership_id" => "stub", "role" => {}, "resource" => {}, "created_at" => "stub", "updated_at" => "stub" } - model = WorkOS::RoleAssignment.new(fixture.to_json) + model = WorkOS::UserRoleAssignment.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] + assert_equal fixture["organization_membership_id"], json[:organization_membership_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}" } @@ -1238,6 +1254,38 @@ def test_role_list_round_trip 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 + 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] + 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 fixture = { "object" => "connection", @@ -1341,6 +1389,7 @@ def test_directory_user_with_groups_round_trip "email" => nil, "first_name" => nil, "last_name" => nil, + "name" => nil, "emails" => [], "job_title" => nil, "username" => nil, @@ -1427,6 +1476,7 @@ def test_directory_user_round_trip "email" => nil, "first_name" => nil, "last_name" => nil, + "name" => nil, "emails" => [], "job_title" => nil, "username" => nil, @@ -1451,38 +1501,6 @@ def test_directory_user_round_trip 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 - 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] - fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } - end - def test_waitlist_user_round_trip fixture = { "object" => "waitlist_user", @@ -1657,6 +1675,20 @@ def test_api_key_created_data_owner_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_user_api_key_created_data_owner_round_trip + fixture = { + "type" => "user", + "id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::UserApiKeyCreatedDataOwner.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] + 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 fixture = { "id" => "stub", @@ -1710,6 +1742,20 @@ def test_api_key_revoked_data_owner_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_user_api_key_revoked_data_owner_round_trip + fixture = { + "type" => "user", + "id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::UserApiKeyRevokedDataOwner.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] + 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 fixture = { "id" => "stub", @@ -3109,6 +3155,7 @@ def test_dsync_user_updated_data_round_trip "email" => nil, "first_name" => nil, "last_name" => nil, + "name" => nil, "emails" => [], "job_title" => nil, "username" => nil, @@ -5161,6 +5208,35 @@ def test_user_updated_round_trip 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_deleted_round_trip + fixture = { + "id" => "stub", + "event" => "vault.byok_key.deleted", + "data" => {}, + "created_at" => "stub", + "context" => {}, + "object" => "event" + } + model = WorkOS::VaultByokKeyDeleted.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] + 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_deleted_data_round_trip + fixture = { + "organization_id" => "stub", + "key_provider" => "stub" + } + model = WorkOS::VaultByokKeyDeletedData.new(fixture.to_json) + 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_vault_byok_key_verification_completed_round_trip fixture = { "id" => "stub", @@ -5548,22 +5624,6 @@ def test_waitlist_user_denied_round_trip 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 - 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] - 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 fixture = { "object" => "organization_domain", @@ -5616,7 +5676,31 @@ def test_flag_round_trip 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 + def test_organization_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::OrganizationApiKey.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] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_organization_api_key_with_value_round_trip fixture = { "object" => "api_key", "id" => "stub", @@ -5629,7 +5713,7 @@ def test_api_key_with_value_round_trip "updated_at" => "stub", "value" => "stub" } - model = WorkOS::ApiKeyWithValue.new(fixture.to_json) + model = WorkOS::OrganizationApiKeyWithValue.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] @@ -5879,7 +5963,8 @@ def test_user_organization_membership_round_trip "custom_attributes" => {}, "created_at" => "stub", "updated_at" => "stub", - "role" => {} + "role" => {}, + "user" => {} } model = WorkOS::UserOrganizationMembership.new(fixture.to_json) json = model.to_h @@ -5893,6 +5978,56 @@ def test_user_organization_membership_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_user_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::UserApiKey.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] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_user_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::UserApiKeyWithValue.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] + 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 fixture = { "object" => "email_verification", @@ -6081,6 +6216,7 @@ def test_profile_round_trip "email" => "stub", "first_name" => nil, "last_name" => nil, + "name" => nil, "role" => nil, "roles" => nil, "groups" => [], @@ -6097,6 +6233,7 @@ def test_profile_round_trip assert_equal fixture["email"], json[:email] assert_nil json[:first_name] assert_nil json[:last_name] + 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 @@ -6139,6 +6276,22 @@ def test_jwks_response_round_trip 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 + 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] + 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 fixture = { "alg" => "RS256", @@ -6209,6 +6362,34 @@ def test_authenticate_response_oauth_token_round_trip fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } end + def test_user_api_key_with_value_owner_round_trip + fixture = { + "type" => "user", + "id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::UserApiKeyWithValueOwner.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] + fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" } + end + + def test_user_api_key_owner_round_trip + fixture = { + "type" => "user", + "id" => "stub", + "organization_id" => "stub" + } + model = WorkOS::UserApiKeyOwner.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] + 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 fixture = { "object" => "data_provider", @@ -6295,12 +6476,24 @@ def test_organization_domain_round_trip 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 + def test_organization_api_key_with_value_owner_round_trip fixture = { "type" => "organization", "id" => "stub" } - model = WorkOS::ApiKeyWithValueOwner.new(fixture.to_json) + model = WorkOS::OrganizationApiKeyWithValueOwner.new(fixture.to_json) + 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_organization_api_key_owner_round_trip + fixture = { + "type" => "organization", + "id" => "stub" + } + model = WorkOS::OrganizationApiKeyOwner.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] @@ -6358,6 +6551,32 @@ def test_event_context_google_analytics_session_round_trip 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 + 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", + "user" => {} + } + 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] + 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 fixture = { "primary" => true, @@ -6407,38 +6626,13 @@ def test_connection_option_round_trip 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 - 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] - 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 + def test_user_role_assignment_resource_round_trip fixture = { "id" => "stub", "external_id" => "stub", "resource_type_slug" => "stub" } - model = WorkOS::RoleAssignmentResource.new(fixture.to_json) + model = WorkOS::UserRoleAssignmentResource.new(fixture.to_json) json = model.to_h assert_kind_of Hash, json assert_equal fixture["id"], json[:id] @@ -6990,7 +7184,8 @@ def test_organization_membership_round_trip "custom_attributes" => {}, "created_at" => "stub", "updated_at" => "stub", - "role" => {} + "role" => {}, + "user" => {} } model = WorkOS::OrganizationMembership.new(fixture.to_json) json = model.to_h diff --git a/test/workos/test_user_management.rb b/test/workos/test_user_management.rb index f2520e0b..b2aebf55 100644 --- a/test/workos/test_user_management.rb +++ b/test/workos/test_user_management.rb @@ -345,6 +345,13 @@ def test_revoke_invitation_returns_expected_result refute_nil result end + def test_list_jwt_template_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/jwt_template(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.user_management.list_jwt_template + refute_nil result + end + def test_update_jwt_template_returns_expected_result stub_request(:put, %r{\Ahttps://api\.workos\.com/user_management/jwt_template(\?|\z)}) .to_return(body: "{}", status: 200) @@ -454,6 +461,20 @@ def test_delete_user_authorized_application_returns_expected_result assert_nil result end + def test_list_user_api_keys_returns_expected_result + stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}) + .to_return(body: '{"data": [], "list_metadata": {}}', status: 200) + result = @client.user_management.list_user_api_keys(user_id: "stub") + assert_kind_of WorkOS::Types::ListStruct, result + end + + def test_create_user_api_key_returns_expected_result + stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}) + .to_return(body: "{}", status: 200) + result = @client.user_management.create_user_api_key(user_id: "stub", name: "stub", organization_id: "stub") + refute_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"}}, @@ -484,6 +505,7 @@ def test_delete_user_authorized_application_returns_expected_result {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: :list_jwt_template, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/jwt_template(\?|\z)}}, {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"}}, @@ -496,7 +518,9 @@ def test_delete_user_authorized_application_returns_expected_result {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"}} + {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"}}, + {name: :list_user_api_keys, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}, args: {user_id: "stub"}}, + {name: :create_user_api_key, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}, args: {user_id: "stub", name: "stub", organization_id: "stub"}} ].each do |spec| define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do stub_request(spec[:verb], spec[:url]) From 54e3ad6790319f14bfb6c2d7d85f38d946091901 Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 15:42:08 -0700 Subject: [PATCH 154/159] chore(main): release 8.0.0 (#481) Co-authored-by: workos-sdk-automation[bot] <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] --- .release-please-manifest.json | 2 +- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ Gemfile.lock | 4 ++-- lib/workos/version.rb | 2 +- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fe9d29ad..32ac6588 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "7.1.2" + ".": "8.0.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index b0f56a0e..a20fa42a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## [8.0.0](https://github.com/workos/workos-ruby/compare/v7.1.2...v8.0.0) (2026-05-06) + + +### ⚠ BREAKING CHANGES + +* **authorization:** Consolidate order enums to PaginationOrder +* **api_keys:** Separate organization and user API key types +* **user_management:** Consolidate order enums to PaginationOrder +* **vault:** Add BYOK key deleted event and consolidate key provider enum +* **types:** Consolidate pagination order enums +* **authorization:** Rename RoleAssignment to UserRoleAssignment + +### Features + +* **api_keys:** Separate organization and user API key types ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **authorization:** Add new role assignment listing endpoints ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **authorization:** Consolidate order enums to PaginationOrder ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **authorization:** Rename RoleAssignment to UserRoleAssignment ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **directory_sync:** Add name field to directory users ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **docs:** publish YARD API docs + llms.txt to GitHub Pages ([#480](https://github.com/workos/workos-ruby/issues/480)) ([117eeac](https://github.com/workos/workos-ruby/commit/117eeac5d25c896c7a9b989592f3525f51e52a3d)) +* **events:** Add admin_portal source to event context actor ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **sso:** Add name field to SSO profile ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **types:** Consolidate pagination order enums ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **user_management:** Add get JWT template endpoint ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **user_management:** Add user API key management ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **user_management:** Add user field to membership and organization membership ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **user_management:** Consolidate order enums to PaginationOrder ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) +* **vault:** Add BYOK key deleted event and consolidate key provider enum ([956386a](https://github.com/workos/workos-ruby/commit/956386a27cb0f8a8707442fa98b74a317f3f9920)) + ## [7.1.2](https://github.com/workos/workos-ruby/compare/v7.1.1...v7.1.2) (2026-05-06) diff --git a/Gemfile.lock b/Gemfile.lock index 3ca8ae45..e7a12e29 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (7.1.2) + workos (8.0.0) jwt (~> 3.1) logger (~> 1.7) zeitwerk (~> 2.6) @@ -153,7 +153,7 @@ CHECKSUMS unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90 webrick (1.9.2) sha256=beb4a15fc474defed24a3bda4ffd88a490d517c9e4e6118c3edce59e45864131 - workos (7.1.2) + workos (8.0.0) yard (0.9.43) sha256=cf8733a8f0485df2a162927e9b5f182215a61f6d22de096b8f402c726a1c5821 yard-markdown (0.7.1) sha256=06c378632dfe7ba053be9ba469eb4701aa0470e36bcf7e5546f353eb90c1bfd1 zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd diff --git a/lib/workos/version.rb b/lib/workos/version.rb index 61c9de8f..f40997e6 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -2,5 +2,5 @@ # @oagen-ignore-file module WorkOS - VERSION = "7.1.2" + VERSION = "8.0.0" end From f6ed491ec22de67e0226e534f35a53af79914574 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Wed, 6 May 2026 15:45:24 -0700 Subject: [PATCH 155/159] ci(docs): trigger Pages deploy from main instead of tags The github-pages environment's branch/tag protection rules block deploys from version tags, so the deploy job failed after release. Switching to push-on-main avoids the rule and still publishes docs on every release merge. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 458de94e..ad66d8ce 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,7 +1,7 @@ name: Publish API Docs on: push: - tags: ['v*'] + branches: [main] workflow_dispatch: permissions: contents: read From 50e9de824367cc0c9f202bdedbfab83a0f3e5512 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Wed, 6 May 2026 15:51:32 -0700 Subject: [PATCH 156/159] ci(docs): grant deploy job pages and id-token write permissions The deploy job inherited the workflow-level `contents: read` permissions and was missing `id-token: write` (required for OIDC) and `pages: write`, causing actions/deploy-pages to fail with "Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable". Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/docs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ad66d8ce..27ab7560 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -37,6 +37,9 @@ jobs: if-no-files-found: error deploy: needs: build + permissions: + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} From 318ac3b1075892a0ea51de4d2b0efd2c34da0c79 Mon Sep 17 00:00:00 2001 From: "Garen J. Torikian" Date: Thu, 7 May 2026 10:02:51 -0700 Subject: [PATCH 157/159] ci(release): attribute Gemfile.lock commit to SDK automation bot Use the workos-sdk-automation[bot] identity (matching the token already generated for the push) instead of github-actions[bot], so the commit on the release-please PR is correctly attributed. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/release-please.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 0f09d3cf..e7ad5233 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -45,8 +45,8 @@ jobs: if git diff --quiet Gemfile.lock; then echo "Gemfile.lock is up to date" else - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" + git config user.name "workos-sdk-automation[bot]" + git config user.email "255426317+workos-sdk-automation[bot]@users.noreply.github.com" git add Gemfile.lock git commit -m "chore: update Gemfile.lock" git push From 347fe1edf296778d7ea331e666a7957870074b9f Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 12 May 2026 16:56:13 -0400 Subject: [PATCH 158/159] fix: harden session sealing, log redaction, and webhook tolerance checks (#482) Co-authored-by: Claude Opus 4.7 (1M context) --- README.md | 19 +++++++ docs/V7_MIGRATION_GUIDE.md | 21 +++++++ lib/workos/actions.rb | 2 +- lib/workos/base_client.rb | 76 ++++++++++++++++++++++++-- lib/workos/encryptors/aes_gcm.rb | 24 ++++++-- lib/workos/session.rb | 35 +++++++++--- lib/workos/session_manager.rb | 25 ++++++++- lib/workos/user_management.rb | 7 +++ lib/workos/webhooks.rb | 2 +- test/workos/test_actions.rb | 9 +++ test/workos/test_base_client.rb | 44 +++++++++++++++ test/workos/test_encryptors_aes_gcm.rb | 17 +++++- test/workos/test_session.rb | 47 ++++++++++++++-- test/workos/test_webhook_verify.rb | 11 ++++ 14 files changed, 314 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 66b81300..8365ac0f 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,25 @@ user = WorkOS.client.user_management.create_user( puts user.id ``` +### Sealed sessions (cookie_password requirements) + +When you use `client.session_manager` to seal session cookies, the +`cookie_password` you supply must be **at least 32 bytes** of high-entropy +secret material (typically 32 random bytes encoded as base64 or a 64-char +hex string). The SDK derives the AES-256-GCM key from this password via +SHA-256, and a passphrase shorter than 32 bytes makes the resulting key +materially easier to brute-force offline. + +Generate a suitable secret once and store it as an environment variable: + +```sh +ruby -rsecurerandom -e 'puts SecureRandom.base64(32)' +``` + +Anything shorter than 32 bytes (including `nil` or `""`) raises +`ArgumentError` at SDK init time — sealing or unsealing will not silently +proceed with a weakened key. + ### Verify a webhook ```ruby diff --git a/docs/V7_MIGRATION_GUIDE.md b/docs/V7_MIGRATION_GUIDE.md index ed9e1873..11166fb7 100644 --- a/docs/V7_MIGRATION_GUIDE.md +++ b/docs/V7_MIGRATION_GUIDE.md @@ -501,6 +501,27 @@ Session management was one of the largest refactors in v7. The old `WorkOS::Sess 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. +#### `cookie_password` minimum length (32 bytes) + +v7 enforces a **minimum 32-byte length** on every `cookie_password` you supply +to the session manager (`load`, `seal_data`, `unseal_data`, +`seal_session_from_auth_response`, and the underlying `Encryptors::AesGcm`). + +Anything shorter — including `nil` or `""` — now raises `ArgumentError` at the +moment the SDK is asked to seal or unseal. Older deployments that used a +short passphrase (e.g. a 16-character secret) will start erroring at app +boot or the next sealed-session request. + +Pick a 32+ byte secret once and store it as an environment variable: + +```sh +ruby -rsecurerandom -e 'puts SecureRandom.base64(32)' +``` + +The KDF itself (single-pass SHA-256) is unchanged in this release, so +existing sealed cookies continue to round-trip as long as the same +(now-length-validated) password is in use. + #### Sealing a cookie from an authentication response In v6, you asked `authenticate_with_*` to seal the cookie for you: diff --git a/lib/workos/actions.rb b/lib/workos/actions.rb index 6113e7a9..ed145a79 100644 --- a/lib/workos/actions.rb +++ b/lib/workos/actions.rb @@ -35,7 +35,7 @@ module Actions 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 + if (Time.now.to_f - issued_at).abs > tolerance raise WorkOS::SignatureVerificationError.new( message: "Timestamp outside the tolerance zone", http_status: nil diff --git a/lib/workos/base_client.rb b/lib/workos/base_client.rb index adbe516f..f6495644 100644 --- a/lib/workos/base_client.rb +++ b/lib/workos/base_client.rb @@ -134,7 +134,8 @@ def execute_request(request:, request_options: nil) attempt = 0 loop do - log(:debug, "request start", method: request.method, path: request.path, attempt: attempt + 1) + loggable_path = redact_path(request.path) + log(:debug, "request start", method: request.method, path: loggable_path, attempt: attempt + 1) http = connection_for(base, timeout) response = http.request(request) return response if response.is_a?(Net::HTTPSuccess) @@ -142,11 +143,11 @@ def execute_request(request:, request_options: nil) 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) + log(:info, "request retry", method: request.method, path: loggable_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"]) + log(:warn, "request error", method: request.method, path: loggable_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, @@ -155,11 +156,11 @@ def execute_request(request:, request_options: nil) 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) + log(:info, "request retry", method: request.method, path: loggable_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) + log(:warn, "connection error", method: request.method, path: loggable_path, error: e.class.name, message: e.message) raise WorkOS::APIConnectionError.new(message: e.message) end end @@ -179,6 +180,71 @@ def shutdown private + # Redact path segments that carry bearer-equivalent tokens (e.g. + # `/user_management/invitations/by_token/`, + # `/user_management/magic_auth/`, password-reset / email- + # verification token paths) before the path is written to a logger. + # The WorkOS API exposes a small number of "by_token" endpoints whose + # path segments are themselves authentication material; redacting them + # here means the SDK never emits the token in its own log/retry/error + # messages even when the host application configures verbose logging. + REDACTED_TOKEN_PREFIXES = %w[ + /user_management/invitations/by_token + /user_management/magic_auth + /user_management/password_reset + /user_management/email_verification + ].freeze + private_constant :REDACTED_TOKEN_PREFIXES + + # Query-string keys whose values are bearer-equivalent or otherwise + # sensitive and should never appear in SDK log lines. Defense-in-depth + # for any path that flows through execute_request with a sensitive + # query parameter (most WorkOS-issued tokens are path segments or POST + # bodies, but a few flows — e.g. authorize/logout redirects — surface + # them in the query string). + REDACTED_QUERY_KEYS = %w[ + token + code + code_challenge + code_verifier + session_id + refresh_token + access_token + ].freeze + private_constant :REDACTED_QUERY_KEYS + + def redact_path(path) + return path if path.nil? || path.empty? + + # Strip query string for the prefix match; reattach (scrubbed) after. + path_only, query = path.split("?", 2) + REDACTED_TOKEN_PREFIXES.each do |prefix| + next unless path_only.start_with?("#{prefix}/") + + # Replace every segment after the matched prefix with "[REDACTED]". + remainder = path_only[(prefix.length + 1)..] + next if remainder.nil? || remainder.empty? + + redacted = remainder.split("/").map { "[REDACTED]" }.join("/") + path_only = "#{prefix}/#{redacted}" + break + end + query ? "#{path_only}?#{redact_query(query)}" : path_only + end + + def redact_query(query) + return query if query.nil? || query.empty? + + query.split("&").map { |pair| + key, value = pair.split("=", 2) + if value && !value.empty? && REDACTED_QUERY_KEYS.include?(key) + "#{key}=[REDACTED]" + else + pair + end + }.join("&") + end + def append_query(path, params) return path unless params.is_a?(Hash) && !params.empty? diff --git a/lib/workos/encryptors/aes_gcm.rb b/lib/workos/encryptors/aes_gcm.rb index 82ac9bcf..451c7918 100644 --- a/lib/workos/encryptors/aes_gcm.rb +++ b/lib/workos/encryptors/aes_gcm.rb @@ -14,8 +14,14 @@ module WorkOS module Encryptors class AesGcm SEAL_VERSION = 0x01 + # Minimum cookie_password byte length. AES-256-GCM derives a 32-byte + # key from the password via SHA-256; a passphrase shorter than the + # output it derives to provides less than the full keyspace and makes + # offline brute-force feasible. See README + V7_MIGRATION_GUIDE.md. + MIN_KEY_BYTES = 32 def seal(data, key) + validate_key!(key) json = data.is_a?(String) ? data : JSON.generate(data) cipher = OpenSSL::Cipher.new("aes-256-gcm").encrypt cipher.key = derive_key(key) @@ -26,13 +32,16 @@ def seal(data, key) end def unseal(sealed, key) + validate_key!(key) raw = Base64.decode64(sealed.to_s) - decode_v7(raw, key) - rescue ArgumentError, OpenSSL::Cipher::CipherError => original_error begin - decode_old(raw, key) - rescue ArgumentError, OpenSSL::Cipher::CipherError - raise original_error + decode_v7(raw, key) + rescue ArgumentError, OpenSSL::Cipher::CipherError => original_error + begin + decode_old(raw, key) + rescue ArgumentError, OpenSSL::Cipher::CipherError + raise original_error + end end end @@ -83,6 +92,11 @@ def parse_decoded(decoded) def derive_key(passphrase) Digest::SHA256.digest(passphrase.to_s) end + + def validate_key!(key) + raise ArgumentError, "cookie_password is required" if key.nil? || key.to_s.empty? + raise ArgumentError, "cookie_password must be at least #{MIN_KEY_BYTES} bytes" if key.to_s.bytesize < MIN_KEY_BYTES + end end end end diff --git a/lib/workos/session.rb b/lib/workos/session.rb index 5165fb32..28371731 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -21,8 +21,16 @@ module WorkOS # @example Build a logout URL # url = session.get_logout_url(return_to: "https://app.example.com") class Session + # Minimum cookie_password byte length. AES-256-GCM derives a 32-byte + # key from the password via SHA-256; a passphrase shorter than the + # output it derives to provides less than the full keyspace and makes + # offline brute-force feasible. Require callers to supply at least 32 + # bytes of high-entropy secret. See README + V7_MIGRATION_GUIDE.md. + MIN_COOKIE_PASSWORD_BYTES = 32 + def initialize(manager, seal_data:, cookie_password:) raise ArgumentError, "cookie_password is required" if cookie_password.nil? || cookie_password.empty? + raise ArgumentError, "cookie_password must be at least #{MIN_COOKIE_PASSWORD_BYTES} bytes" if cookie_password.bytesize < MIN_COOKIE_PASSWORD_BYTES @manager = manager @client = manager.client @seal_data = seal_data @@ -57,7 +65,7 @@ def authenticate(include_expired: false, &claim_extractor) return SessionManager::AuthError.new(authenticated: false, reason: SessionManager::INVALID_JWT) end - is_expired = decoded["exp"] && decoded["exp"] < Time.now.to_i + is_expired = decoded["exp"].nil? || decoded["exp"] < Time.now.to_i SessionManager::AuthSuccess.new( authenticated: !is_expired, @@ -77,6 +85,11 @@ def authenticate(include_expired: false, &claim_extractor) def refresh(organization_id: nil, cookie_password: nil) effective_password = cookie_password || @cookie_password + # Validate up front so a caller-supplied short password raises ArgumentError + # (matching Session#initialize) instead of being swallowed by the + # unseal_data rescue and surfacing as INVALID_SESSION_COOKIE. + raise ArgumentError, "cookie_password is required" if effective_password.nil? || effective_password.empty? + raise ArgumentError, "cookie_password must be at least #{MIN_COOKIE_PASSWORD_BYTES} bytes" if effective_password.bytesize < MIN_COOKIE_PASSWORD_BYTES session = begin @manager.unseal_data(@seal_data, effective_password) @@ -105,17 +118,20 @@ def refresh(organization_id: nil, cookie_password: nil) impersonator: auth_response["impersonator"] ) - # Decode before mutating session state so a malformed access_token - # doesn't leave the Session half-updated. - decoded = @manager.decode_jwt(auth_response["access_token"]) - + # Persist the new seal/password BEFORE decoding the JWT, so a transient + # JWKS fetch error (or any decode failure on the freshly-minted token) + # leaves the Session with a usable sealed cookie that the caller can + # re-#authenticate against, rather than half-updated state. @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"], + organization_id: auth_response["organization_id"] || decoded["org_id"], role: decoded["role"], roles: decoded["roles"], permissions: decoded["permissions"], @@ -127,7 +143,12 @@ def refresh(organization_id: nil, cookie_password: nil) rescue WorkOS::AuthenticationError, WorkOS::InvalidRequestError => e SessionManager::RefreshError.new(authenticated: false, reason: e.message) rescue JWT::DecodeError => e - SessionManager::RefreshError.new(authenticated: false, reason: e.message) + # The refresh token was already rotated server-side before decode failed, + # so @seal_data holds the freshly-minted cookie. Surface it on the error + # struct so the caller can write the rotated cookie back to the browser + # and recover on a subsequent #authenticate, rather than re-sending the + # now-revoked refresh token. + SessionManager::RefreshError.new(authenticated: false, reason: e.message, sealed_session: @seal_data) end # Build the WorkOS session-logout URL for the currently authenticated session. diff --git a/lib/workos/session_manager.rb b/lib/workos/session_manager.rb index 7d787536..64bbaa53 100644 --- a/lib/workos/session_manager.rb +++ b/lib/workos/session_manager.rb @@ -107,7 +107,7 @@ def normalize_custom_claims(custom_claims) :roles, :permissions, :entitlements, :user, :impersonator, :feature_flags, keyword_init: true ) - RefreshError = Struct.new(:authenticated, :reason, keyword_init: true) + RefreshError = Struct.new(:authenticated, :reason, :sealed_session, keyword_init: true) # Failure reason constants NO_SESSION_COOKIE_PROVIDED = "no_session_cookie_provided" @@ -150,12 +150,14 @@ def refresh(seal_data:, cookie_password:, organization_id: nil) # H06 — Raw seal: encrypt arbitrary data with a key string. # Delegates to the configured encryptor (default: AES-256-GCM). def seal_data(data, key) + validate_cookie_password!(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) + validate_cookie_password!(key) @encryptor.unseal(sealed, key) end @@ -164,11 +166,20 @@ def seal_session_from_auth_response(access_token:, refresh_token:, cookie_passwo payload = {"access_token" => access_token, "refresh_token" => refresh_token} payload["user"] = user if user payload["impersonator"] = impersonator if impersonator + # Delegates to seal_data, which calls validate_cookie_password!; no need + # to validate here too. 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. + # + # NOTE on iss/aud/required_claims: this method intentionally does not + # enforce iss, aud, or required_claims. workos-node's `jose` call and + # workos-php's `isset($exp) && $exp < time()` accept exp-less tokens, and + # cross-SDK parity is required for the planned coordinated hardening of + # these claims. See commit 9ce069f for the rationale behind dropping the + # required_claims: ['exp'] tightening that was considered here. def decode_jwt(access_token, verify_expiration: true) jwks = fetch_jwks JWT.decode( @@ -182,6 +193,18 @@ def decode_jwt(access_token, verify_expiration: true) ).first end + private + + # Validate a cookie_password is non-empty and at least the minimum + # byte length required by Session::MIN_COOKIE_PASSWORD_BYTES (32). + # Defense-in-depth — Session#initialize enforces the same invariant + # on the load path; this guards the inline #seal_data / #unseal_data + # entry points. + def validate_cookie_password!(key) + raise ArgumentError, "cookie_password is required" if key.nil? || key.empty? + raise ArgumentError, "cookie_password must be at least #{Session::MIN_COOKIE_PASSWORD_BYTES} bytes" if key.bytesize < Session::MIN_COOKIE_PASSWORD_BYTES + end + # Cached JWKS fetch (5-minute TTL, thread-safe). def fetch_jwks(now: Time.now) @jwks_mutex.synchronize do diff --git a/lib/workos/user_management.rb b/lib/workos/user_management.rb index 4916649c..d6a7e012 100644 --- a/lib/workos/user_management.rb +++ b/lib/workos/user_management.rb @@ -1641,6 +1641,13 @@ def get_authorization_url(redirect_uri:, client_id: nil, provider: nil, connecti 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 + # Strip caller-supplied PKCE params: this helper exists specifically + # to generate them, so a caller-provided value would either silently + # override our freshly-generated challenge (defeating the helper) or + # collide with the keyword args below and raise. Mirror the existing + # opts.delete(:state) pattern. + opts.delete(:code_challenge) + opts.delete(:code_challenge_method) url = get_authorization_url( redirect_uri: redirect_uri, client_id: client_id, diff --git a/lib/workos/webhooks.rb b/lib/workos/webhooks.rb index c4b6dba1..1b77bc19 100644 --- a/lib/workos/webhooks.rb +++ b/lib/workos/webhooks.rb @@ -193,7 +193,7 @@ def verify_header(payload:, sig_header:, secret:, tolerance: DEFAULT_TOLERANCE_S 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 + if (Time.now.to_f - issued_at).abs > max_age raise WorkOS::SignatureVerificationError.new( message: "Timestamp outside the tolerance zone", http_status: nil diff --git a/test/workos/test_actions.rb b/test/workos/test_actions.rb index a87c115c..2481fde6 100644 --- a/test/workos/test_actions.rb +++ b/test/workos/test_actions.rb @@ -49,6 +49,15 @@ def test_verify_header_uses_30s_default_tolerance end end + def test_verify_header_raises_on_future_timestamp + payload = '{"x":1}' + future_ts = now_ms + 60_000 # 60s ahead, beyond default 30s tolerance + sig = OpenSSL::HMAC.hexdigest("SHA256", SECRET, "#{future_ts}.#{payload}") + assert_raises(WorkOS::SignatureVerificationError) do + @actions.verify_header(payload: payload, sig_header: "t=#{future_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"] diff --git a/test/workos/test_base_client.rb b/test/workos/test_base_client.rb index 1d6f338e..773620f7 100644 --- a/test/workos/test_base_client.rb +++ b/test/workos/test_base_client.rb @@ -170,4 +170,48 @@ def test_evict_connection_removes_matching_pooled_connections assert evict.finished refute keep.finished end + + def test_redact_path_strips_invitation_token_segment + redacted = @client.send(:redact_path, "/user_management/invitations/by_token/invtoken_secret123") + assert_equal "/user_management/invitations/by_token/[REDACTED]", redacted + end + + def test_redact_path_strips_magic_auth_token_segment + redacted = @client.send(:redact_path, "/user_management/magic_auth/magic_secret/extra") + assert_equal "/user_management/magic_auth/[REDACTED]/[REDACTED]", redacted + end + + def test_redact_path_preserves_non_token_paths + assert_equal "/organizations/org_123", @client.send(:redact_path, "/organizations/org_123") + end + + def test_redact_path_preserves_query_string + redacted = @client.send(:redact_path, "/user_management/invitations/by_token/secret?foo=bar") + assert_equal "/user_management/invitations/by_token/[REDACTED]?foo=bar", redacted + end + + def test_redact_path_handles_nil_and_empty + assert_nil @client.send(:redact_path, nil) + assert_equal "", @client.send(:redact_path, "") + end + + def test_redact_path_scrubs_sensitive_query_params + redacted = @client.send(:redact_path, "/user_management/sessions/logout?session_id=ses_abc123&return_to=https://app.example.com") + assert_equal "/user_management/sessions/logout?session_id=[REDACTED]&return_to=https://app.example.com", redacted + end + + def test_redact_path_scrubs_authorize_code_query_param + redacted = @client.send(:redact_path, "/user_management/authorize?client_id=client_1&code=auth_code_secret&state=xyz") + assert_equal "/user_management/authorize?client_id=client_1&code=[REDACTED]&state=xyz", redacted + end + + def test_redact_path_leaves_non_sensitive_query_params_untouched + redacted = @client.send(:redact_path, "/user_management/users?limit=10&order=desc") + assert_equal "/user_management/users?limit=10&order=desc", redacted + end + + def test_redact_path_scrubs_query_alongside_path_segment_redaction + redacted = @client.send(:redact_path, "/user_management/magic_auth/magic_secret?token=qs_token") + assert_equal "/user_management/magic_auth/[REDACTED]?token=[REDACTED]", redacted + end end diff --git a/test/workos/test_encryptors_aes_gcm.rb b/test/workos/test_encryptors_aes_gcm.rb index a518e4c1..24e87280 100644 --- a/test/workos/test_encryptors_aes_gcm.rb +++ b/test/workos/test_encryptors_aes_gcm.rb @@ -28,11 +28,26 @@ def test_seal_unseal_round_trip_string def test_unseal_with_wrong_key_raises sealed = @enc.seal({"x" => 1}, PASSWORD) + # Wrong key is the same length (>= 32 bytes) so the length guard doesn't + # short-circuit; we want to assert the underlying cipher rejection. assert_raises(OpenSSL::Cipher::CipherError) do - @enc.unseal(sealed, "wrong-password") + @enc.unseal(sealed, "wrong-cookie-password-32-bytes--") end end + def test_unseal_rejects_short_key + sealed = @enc.seal({"x" => 1}, PASSWORD) + assert_raises(ArgumentError) do + @enc.unseal(sealed, "too-short") + end + end + + def test_seal_rejects_short_key + assert_raises(ArgumentError) { @enc.seal({"x" => 1}, "too-short") } + assert_raises(ArgumentError) { @enc.seal({"x" => 1}, nil) } + assert_raises(ArgumentError) { @enc.seal({"x" => 1}, "") } + end + def test_unseal_rejects_short_payload assert_raises(ArgumentError) do @enc.unseal(Base64.strict_encode64("short"), PASSWORD) diff --git a/test/workos/test_session.rb b/test/workos/test_session.rb index 21988887..25bfc134 100644 --- a/test/workos/test_session.rb +++ b/test/workos/test_session.rb @@ -26,11 +26,27 @@ def test_seal_then_unseal_round_trip_hash def test_unseal_with_wrong_key_raises sealed = @sm.seal_data({"x" => 1}, PASSWORD) + # Wrong key is the same length (>= 32 bytes) so the length guard doesn't + # short-circuit; we want to assert the underlying cipher rejection. assert_raises(OpenSSL::Cipher::CipherError) do - @sm.unseal_data(sealed, "wrong-password") + @sm.unseal_data(sealed, "wrong-cookie-password-32-bytes--") end end + def test_unseal_with_short_key_raises_argument_error + sealed = @sm.seal_data({"x" => 1}, PASSWORD) + assert_raises(ArgumentError) { @sm.unseal_data(sealed, "too-short") } + end + + def test_seal_with_short_key_raises_argument_error + assert_raises(ArgumentError) { @sm.seal_data({"x" => 1}, "too-short") } + end + + def test_session_load_requires_min_length_cookie_password + short = "x" * 31 + assert_raises(ArgumentError) { @sm.load(seal_data: "x", cookie_password: short) } + end + def test_unseal_rejects_short_payload assert_raises(ArgumentError) do @sm.unseal_data(Base64.strict_encode64("short"), PASSWORD) @@ -334,6 +350,19 @@ def test_refresh_returns_error_on_invalid_cookie assert_equal WorkOS::SessionManager::INVALID_SESSION_COOKIE, result.reason end + def test_refresh_raises_argument_error_for_short_cookie_password_override + sealed = @sm.seal_data({"access_token" => "at", "refresh_token" => "rt"}, PASSWORD) + session = @sm.load(seal_data: sealed, cookie_password: PASSWORD) + err = assert_raises(ArgumentError) { session.refresh(cookie_password: "x" * 31) } + assert_match(/at least 32 bytes/, err.message) + end + + def test_refresh_raises_argument_error_for_empty_cookie_password_override + sealed = @sm.seal_data({"access_token" => "at", "refresh_token" => "rt"}, PASSWORD) + session = @sm.load(seal_data: sealed, cookie_password: PASSWORD) + assert_raises(ArgumentError) { session.refresh(cookie_password: "") } + end + def test_refresh_returns_error_when_no_refresh_token sealed = @sm.seal_data({"access_token" => "at_only"}, PASSWORD) result = @sm.refresh(seal_data: sealed, cookie_password: PASSWORD) @@ -361,7 +390,7 @@ def test_refresh_does_not_send_session_param_to_api assert_requested(stub) end - def test_refresh_returns_error_on_malformed_access_token_without_mutating_state + def test_refresh_persists_seal_data_even_when_access_token_decode_fails rsa, pub = signing_key_pair old_access = make_jwt({"sid" => "session_old", "exp" => Time.now.to_i - 60}, rsa) sealed = @sm.seal_data({"access_token" => old_access, "refresh_token" => "rt_old", "user" => {"id" => "u_1"}}, PASSWORD) @@ -383,8 +412,18 @@ def test_refresh_returns_error_on_malformed_access_token_without_mutating_state assert_kind_of WorkOS::SessionManager::RefreshError, result refute result.authenticated - # Session state should not have been mutated - assert_equal sealed, session.seal_data + # Session state IS updated to the freshly-sealed cookie before decode runs, + # so a transient JWT/JWKS failure leaves a usable seal the caller can + # re-#authenticate against rather than half-updated state pinned to the + # stale (already-rotated) refresh token. + refute_equal sealed, session.seal_data + refute_nil session.seal_data + + # The rotated cookie is also reachable through the RefreshError result, so a + # caller that doesn't retain the Session object across requests (typical in + # a Rails request cycle) can still write the new cookie back to the browser + # rather than re-sending the now-revoked refresh token on the next request. + assert_equal session.seal_data, result.sealed_session end # --- Session constructor validation --------------------------------------- diff --git a/test/workos/test_webhook_verify.rb b/test/workos/test_webhook_verify.rb index e273b87a..b1e082e2 100644 --- a/test/workos/test_webhook_verify.rb +++ b/test/workos/test_webhook_verify.rb @@ -60,6 +60,17 @@ def test_verify_header_raises_on_stale_timestamp assert_match(/Timestamp outside the tolerance zone/, err.message) end + def test_verify_header_raises_on_future_timestamp + payload = '{"x":1}' + future_ts = now_ms + (10 * 60 * 1000) # 10 minutes ahead + sig = OpenSSL::HMAC.hexdigest("SHA256", SECRET, "#{future_ts}.#{payload}") + header = "t=#{future_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) From 8fca27378d1b0661d081310d95486a2137b4909c Mon Sep 17 00:00:00 2001 From: "workos-sdk-automation[bot]" <255426317+workos-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 16:57:37 -0400 Subject: [PATCH 159/159] chore(main): release 8.0.1 (#483) Co-authored-by: workos-sdk-automation[bot] <255426317+workos-sdk-automation[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ Gemfile.lock | 4 ++-- lib/workos/version.rb | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 32ac6588..c2430e7a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "8.0.0" + ".": "8.0.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index a20fa42a..f6cfc1ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [8.0.1](https://github.com/workos/workos-ruby/compare/v8.0.0...v8.0.1) (2026-05-12) + + +### Bug Fixes + +* harden session sealing, log redaction, and webhook tolerance checks ([#482](https://github.com/workos/workos-ruby/issues/482)) ([347fe1e](https://github.com/workos/workos-ruby/commit/347fe1edf296778d7ea331e666a7957870074b9f)) + ## [8.0.0](https://github.com/workos/workos-ruby/compare/v7.1.2...v8.0.0) (2026-05-06) diff --git a/Gemfile.lock b/Gemfile.lock index e7a12e29..562ccdf7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - workos (8.0.0) + workos (8.0.1) jwt (~> 3.1) logger (~> 1.7) zeitwerk (~> 2.6) @@ -153,7 +153,7 @@ CHECKSUMS unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f webmock (3.26.2) sha256=774556f2ea6371846cca68c01769b2eac0d134492d21f6d0ab5dd643965a4c90 webrick (1.9.2) sha256=beb4a15fc474defed24a3bda4ffd88a490d517c9e4e6118c3edce59e45864131 - workos (8.0.0) + workos (8.0.1) yard (0.9.43) sha256=cf8733a8f0485df2a162927e9b5f182215a61f6d22de096b8f402c726a1c5821 yard-markdown (0.7.1) sha256=06c378632dfe7ba053be9ba469eb4701aa0470e36bcf7e5546f353eb90c1bfd1 zeitwerk (2.7.5) sha256=d8da92128c09ea6ec62c949011b00ed4a20242b255293dd66bf41545398f73dd diff --git a/lib/workos/version.rb b/lib/workos/version.rb index f40997e6..7fa958d7 100644 --- a/lib/workos/version.rb +++ b/lib/workos/version.rb @@ -2,5 +2,5 @@ # @oagen-ignore-file module WorkOS - VERSION = "8.0.0" + VERSION = "8.0.1" end