workos 5.7.0 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/workos/profile.rb +3 -1
- data/lib/workos/types/widget_scope.rb +13 -0
- data/lib/workos/types.rb +1 -0
- data/lib/workos/version.rb +1 -1
- data/lib/workos/widgets.rb +46 -0
- data/lib/workos.rb +1 -0
- data/spec/lib/workos/sso_spec.rb +6 -0
- data/spec/lib/workos/widgets_spec.rb +73 -0
- data/spec/support/fixtures/vcr_cassettes/sso/profile.yml +1 -1
- data/spec/support/fixtures/vcr_cassettes/widgets/get_token.yml +82 -0
- data/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml +74 -0
- data/spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml +74 -0
- data/spec/support/profile.txt +1 -1
- metadata +12 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 47230d64b8cf21f97c3c7d0e9d0c7e90fa7c4f73071744532c6f41d10a27cde3
         | 
| 4 | 
            +
              data.tar.gz: afe55ccfecaccf2685f6317b7e5d1131e7f92450f41419ab564f6e69faea1876
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: cd786ea513509e1a1a692143c4af0ae2db289a4ef62bcdea139f854b735334e7768324b4ed8f5fbd1317648149a10bdcf69fc99547cf62c3282e183e4108215f
         | 
| 7 | 
            +
              data.tar.gz: 295e13fab2ab3d3adcf6828f0259387de68b50256d575e737c5d00343fad62ee2c3096e235cc0cd687582f6f20076b3666e908f2313772e5b4a2160abd788a81
         | 
    
        data/.rubocop.yml
    CHANGED
    
    | @@ -12,7 +12,7 @@ Layout/LineLength: | |
| 12 12 | 
             
                - 'VCR\.use_cassette'
         | 
| 13 13 | 
             
                - '(\A|\s)/.*?/'
         | 
| 14 14 | 
             
            Metrics/BlockLength:
         | 
| 15 | 
            -
              ExcludedMethods: ['describe', 'context', 'before']
         | 
| 15 | 
            +
              ExcludedMethods: ['describe', 'context', 'before', 'it']
         | 
| 16 16 | 
             
            Metrics/MethodLength:
         | 
| 17 17 | 
             
              Max: 30
         | 
| 18 18 | 
             
            Metrics/ModuleLength:
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/workos/profile.rb
    CHANGED
    
    | @@ -9,7 +9,7 @@ module WorkOS | |
| 9 9 | 
             
              class Profile
         | 
| 10 10 | 
             
                include HashProvider
         | 
| 11 11 |  | 
| 12 | 
            -
                attr_accessor :id, :email, :first_name, :last_name, :groups, :organization_id,
         | 
| 12 | 
            +
                attr_accessor :id, :email, :first_name, :last_name, :role, :groups, :organization_id,
         | 
| 13 13 | 
             
                              :connection_id, :connection_type, :idp_id, :raw_attributes
         | 
| 14 14 |  | 
| 15 15 | 
             
                def initialize(profile_json)
         | 
| @@ -19,6 +19,7 @@ module WorkOS | |
| 19 19 | 
             
                  @email = hash[:email]
         | 
| 20 20 | 
             
                  @first_name = hash[:first_name]
         | 
| 21 21 | 
             
                  @last_name = hash[:last_name]
         | 
| 22 | 
            +
                  @role = hash[:role]
         | 
| 22 23 | 
             
                  @groups = hash[:groups]
         | 
| 23 24 | 
             
                  @organization_id = hash[:organization_id]
         | 
| 24 25 | 
             
                  @connection_id = hash[:connection_id]
         | 
| @@ -37,6 +38,7 @@ module WorkOS | |
| 37 38 | 
             
                    email: email,
         | 
| 38 39 | 
             
                    first_name: first_name,
         | 
| 39 40 | 
             
                    last_name: last_name,
         | 
| 41 | 
            +
                    role: role,
         | 
| 40 42 | 
             
                    groups: groups,
         | 
| 41 43 | 
             
                    organization_id: organization_id,
         | 
| 42 44 | 
             
                    connection_id: connection_id,
         | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module WorkOS
         | 
| 4 | 
            +
              module Types
         | 
| 5 | 
            +
                # The WidgetScope constants are declarations of a fixed set of values for
         | 
| 6 | 
            +
                # scopes while generating a widget token.
         | 
| 7 | 
            +
                module WidgetScope
         | 
| 8 | 
            +
                  USERS_TABLE_MANAGE = 'widgets:users-table:manage'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  ALL = [USERS_TABLE_MANAGE].freeze
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
            end
         | 
    
        data/lib/workos/types.rb
    CHANGED
    
    
    
        data/lib/workos/version.rb
    CHANGED
    
    
| @@ -0,0 +1,46 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'net/http'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module WorkOS
         | 
| 6 | 
            +
              # The Widgets module provides resource methods for working with the Widgets APIs
         | 
| 7 | 
            +
              module Widgets
         | 
| 8 | 
            +
                class << self
         | 
| 9 | 
            +
                  include Client
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  WIDGET_SCOPES = WorkOS::Types::WidgetScope::ALL
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  # Generate a widget token.
         | 
| 14 | 
            +
                  #
         | 
| 15 | 
            +
                  # @param [String] organization_id The ID of the organization to generate the token for.
         | 
| 16 | 
            +
                  # @param [String] user_id The ID of the user to generate the token for.
         | 
| 17 | 
            +
                  # @param [WidgetScope[]] The scopes to generate the token for.
         | 
| 18 | 
            +
                  def get_token(organization_id:, user_id:, scopes:)
         | 
| 19 | 
            +
                    validate_scopes(scopes)
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                    request = post_request(
         | 
| 22 | 
            +
                      auth: true,
         | 
| 23 | 
            +
                      body: {
         | 
| 24 | 
            +
                        organization_id: organization_id,
         | 
| 25 | 
            +
                        user_id: user_id,
         | 
| 26 | 
            +
                        scopes: scopes,
         | 
| 27 | 
            +
                      },
         | 
| 28 | 
            +
                      path: '/widgets/token',
         | 
| 29 | 
            +
                    )
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                    response = execute_request(request: request)
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                    JSON.parse(response.body)['token']
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  private
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  def validate_scopes(scopes)
         | 
| 39 | 
            +
                    return if scopes.all? { |scope| WIDGET_SCOPES.include?(scope) }
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                    raise ArgumentError, 'scopes contains an invalid value.' \
         | 
| 42 | 
            +
                    " Every item in `scopes` must be in #{WIDGET_SCOPES}"
         | 
| 43 | 
            +
                  end
         | 
| 44 | 
            +
                end
         | 
| 45 | 
            +
              end
         | 
| 46 | 
            +
            end
         | 
    
        data/lib/workos.rb
    CHANGED
    
    
    
        data/spec/lib/workos/sso_spec.rb
    CHANGED
    
    | @@ -302,6 +302,9 @@ describe WorkOS::SSO do | |
| 302 302 | 
             
                      id: 'prof_01EEJTY9SZ1R350RB7B73SNBKF',
         | 
| 303 303 | 
             
                      idp_id: '116485463307139932699',
         | 
| 304 304 | 
             
                      last_name: 'Loblaw',
         | 
| 305 | 
            +
                      role: {
         | 
| 306 | 
            +
                        slug: 'member',
         | 
| 307 | 
            +
                      },
         | 
| 305 308 | 
             
                      groups: nil,
         | 
| 306 309 | 
             
                      organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB',
         | 
| 307 310 | 
             
                      raw_attributes: {
         | 
| @@ -373,6 +376,9 @@ describe WorkOS::SSO do | |
| 373 376 | 
             
                      id: 'prof_01DRA1XNSJDZ19A31F183ECQW5',
         | 
| 374 377 | 
             
                      idp_id: '00u1klkowm8EGah2H357',
         | 
| 375 378 | 
             
                      last_name: 'Demo',
         | 
| 379 | 
            +
                      role: {
         | 
| 380 | 
            +
                        slug: 'admin',
         | 
| 381 | 
            +
                      },
         | 
| 376 382 | 
             
                      groups: %w[Admins Developers],
         | 
| 377 383 | 
             
                      organization_id: 'org_01FG53X8636WSNW2WEKB2C31ZB',
         | 
| 378 384 | 
             
                      raw_attributes: {
         | 
| @@ -0,0 +1,73 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe WorkOS::Widgets do
         | 
| 4 | 
            +
              it_behaves_like 'client'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              describe '.get_token' do
         | 
| 7 | 
            +
                let(:organization_id) { 'org_01JCP9G67MNAH0KC4B72XZ67M7' }
         | 
| 8 | 
            +
                let(:user_id) { 'user_01JCP9H4SHS4N3J6XTKDT7JNPE' }
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                describe 'with a valid organization_id and user_id and scopes' do
         | 
| 11 | 
            +
                  it 'returns a widget token' do
         | 
| 12 | 
            +
                    VCR.use_cassette 'widgets/get_token' do
         | 
| 13 | 
            +
                      token = described_class.get_token(
         | 
| 14 | 
            +
                        organization_id: organization_id,
         | 
| 15 | 
            +
                        user_id: user_id,
         | 
| 16 | 
            +
                        scopes: ['widgets:users-table:manage'],
         | 
| 17 | 
            +
                      )
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                      expect(token).to start_with('eyJhbGciOiJSUzI1NiIsImtpZ')
         | 
| 20 | 
            +
                    end
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                describe 'with an invalid organization_id' do
         | 
| 25 | 
            +
                  it 'raises an error' do
         | 
| 26 | 
            +
                    VCR.use_cassette 'widgets/get_token_invalid_organization_id' do
         | 
| 27 | 
            +
                      expect do
         | 
| 28 | 
            +
                        described_class.get_token(
         | 
| 29 | 
            +
                          organization_id: 'bogus-id',
         | 
| 30 | 
            +
                          user_id: user_id,
         | 
| 31 | 
            +
                          scopes: ['widgets:users-table:manage'],
         | 
| 32 | 
            +
                        )
         | 
| 33 | 
            +
                      end.to raise_error(
         | 
| 34 | 
            +
                        WorkOS::NotFoundError,
         | 
| 35 | 
            +
                        /Organization not found: 'bogus-id'/,
         | 
| 36 | 
            +
                      )
         | 
| 37 | 
            +
                    end
         | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                describe 'with an invalid user_id' do
         | 
| 42 | 
            +
                  it 'raises an error' do
         | 
| 43 | 
            +
                    VCR.use_cassette 'widgets/get_token_invalid_user_id' do
         | 
| 44 | 
            +
                      expect do
         | 
| 45 | 
            +
                        described_class.get_token(
         | 
| 46 | 
            +
                          organization_id: organization_id,
         | 
| 47 | 
            +
                          user_id: 'bogus-id',
         | 
| 48 | 
            +
                          scopes: ['widgets:users-table:manage'],
         | 
| 49 | 
            +
                        )
         | 
| 50 | 
            +
                      end.to raise_error(
         | 
| 51 | 
            +
                        WorkOS::NotFoundError,
         | 
| 52 | 
            +
                        /User not found: 'bogus-id'/,
         | 
| 53 | 
            +
                      )
         | 
| 54 | 
            +
                    end
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                describe 'with invalid scopes' do
         | 
| 59 | 
            +
                  it 'raises an error' do
         | 
| 60 | 
            +
                    expect do
         | 
| 61 | 
            +
                      described_class.get_token(
         | 
| 62 | 
            +
                        organization_id: organization_id,
         | 
| 63 | 
            +
                        user_id: user_id,
         | 
| 64 | 
            +
                        scopes: ['bogus-scope'],
         | 
| 65 | 
            +
                      )
         | 
| 66 | 
            +
                    end.to raise_error(
         | 
| 67 | 
            +
                      ArgumentError,
         | 
| 68 | 
            +
                      /scopes contains an invalid value/,
         | 
| 69 | 
            +
                    )
         | 
| 70 | 
            +
                  end
         | 
| 71 | 
            +
                end
         | 
| 72 | 
            +
              end
         | 
| 73 | 
            +
            end
         | 
| @@ -67,7 +67,7 @@ http_interactions: | |
| 67 67 | 
             
                  body:
         | 
| 68 68 | 
             
                    encoding: UTF-8
         | 
| 69 69 | 
             
                    string:
         | 
| 70 | 
            -
                      '{"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
         | 
| 70 | 
            +
                      '{"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
         | 
| 71 71 | 
             
                      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}}'
         | 
| 72 72 | 
             
                  http_version:
         | 
| 73 73 | 
             
                recorded_at: Tue, 18 May 2021 22:55:21 GMT
         | 
| @@ -0,0 +1,82 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: post
         | 
| 5 | 
            +
                uri: https://api.workos.com/widgets/token
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: UTF-8
         | 
| 8 | 
            +
                  string: '{"organization_id":"org_01JCP9G67MNAH0KC4B72XZ67M7","user_id":"user_01JCP9H4SHS4N3J6XTKDT7JNPE","scopes":["widgets:users-table:manage"]}'
         | 
| 9 | 
            +
                headers:
         | 
| 10 | 
            +
                  Content-Type:
         | 
| 11 | 
            +
                  - application/json
         | 
| 12 | 
            +
                  Accept-Encoding:
         | 
| 13 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 14 | 
            +
                  Accept:
         | 
| 15 | 
            +
                  - "*/*"
         | 
| 16 | 
            +
                  User-Agent:
         | 
| 17 | 
            +
                  - WorkOS; ruby/3.3.6; arm64-darwin23; v5.8.0
         | 
| 18 | 
            +
                  Authorization:
         | 
| 19 | 
            +
                  - Bearer <API_KEY>
         | 
| 20 | 
            +
              response:
         | 
| 21 | 
            +
                status:
         | 
| 22 | 
            +
                  code: 201
         | 
| 23 | 
            +
                  message: Created
         | 
| 24 | 
            +
                headers:
         | 
| 25 | 
            +
                  Date:
         | 
| 26 | 
            +
                  - Thu, 14 Nov 2024 21:51:34 GMT
         | 
| 27 | 
            +
                  Content-Type:
         | 
| 28 | 
            +
                  - application/json; charset=utf-8
         | 
| 29 | 
            +
                  Content-Length:
         | 
| 30 | 
            +
                  - '791'
         | 
| 31 | 
            +
                  Connection:
         | 
| 32 | 
            +
                  - keep-alive
         | 
| 33 | 
            +
                  Cf-Ray:
         | 
| 34 | 
            +
                  - 8e2a394198f8c9b8-IAD
         | 
| 35 | 
            +
                  Cf-Cache-Status:
         | 
| 36 | 
            +
                  - DYNAMIC
         | 
| 37 | 
            +
                  Etag:
         | 
| 38 | 
            +
                  - W/"317-Nylo8f8lWbsA0UUWqqV59mFy5jo"
         | 
| 39 | 
            +
                  Strict-Transport-Security:
         | 
| 40 | 
            +
                  - max-age=15552000; includeSubDomains
         | 
| 41 | 
            +
                  Vary:
         | 
| 42 | 
            +
                  - Origin, Accept-Encoding
         | 
| 43 | 
            +
                  Access-Control-Allow-Credentials:
         | 
| 44 | 
            +
                  - 'true'
         | 
| 45 | 
            +
                  Content-Security-Policy:
         | 
| 46 | 
            +
                  - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
         | 
| 47 | 
            +
                    https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
         | 
| 48 | 
            +
                    ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
         | 
| 49 | 
            +
                  Expect-Ct:
         | 
| 50 | 
            +
                  - max-age=0
         | 
| 51 | 
            +
                  Referrer-Policy:
         | 
| 52 | 
            +
                  - no-referrer
         | 
| 53 | 
            +
                  X-Content-Type-Options:
         | 
| 54 | 
            +
                  - nosniff
         | 
| 55 | 
            +
                  X-Dns-Prefetch-Control:
         | 
| 56 | 
            +
                  - 'off'
         | 
| 57 | 
            +
                  X-Download-Options:
         | 
| 58 | 
            +
                  - noopen
         | 
| 59 | 
            +
                  X-Frame-Options:
         | 
| 60 | 
            +
                  - SAMEORIGIN
         | 
| 61 | 
            +
                  X-Permitted-Cross-Domain-Policies:
         | 
| 62 | 
            +
                  - none
         | 
| 63 | 
            +
                  X-Request-Id:
         | 
| 64 | 
            +
                  - bf98d35e-d9ca-437f-b937-150e937af0f1
         | 
| 65 | 
            +
                  X-Xss-Protection:
         | 
| 66 | 
            +
                  - '0'
         | 
| 67 | 
            +
                  Set-Cookie:
         | 
| 68 | 
            +
                  - __cf_bm=GsR9Veicl9ZRIR1pUSamJ5m95HmklSbWNwtyp_fSpB4-1731621094-1.0.1.1-VW09qjPlT4T.AGwnsHxe7p_A.Onr9Oe7YnxumCz7B9XmzqYbLz9fx7cF6Qtw3KW0PIshpAVkluIsGWSCJQ5AjQ;
         | 
| 69 | 
            +
                    path=/; expires=Thu, 14-Nov-24 22:21:34 GMT; domain=.workos.com; HttpOnly;
         | 
| 70 | 
            +
                    Secure; SameSite=None
         | 
| 71 | 
            +
                  - __cfruid=022c638e9216cb6be687ace27cb356d48cbd4256-1731621094; path=/; domain=.workos.com;
         | 
| 72 | 
            +
                    HttpOnly; Secure; SameSite=None
         | 
| 73 | 
            +
                  - _cfuvid=kczJ.JXlRroyPs5B7UjNUynSmsUjYTWP_jcLNj2iiuM-1731621094755-0.0.1.1-604800000;
         | 
| 74 | 
            +
                    path=/; domain=.workos.com; HttpOnly; Secure; SameSite=None
         | 
| 75 | 
            +
                  Server:
         | 
| 76 | 
            +
                  - cloudflare
         | 
| 77 | 
            +
                body:
         | 
| 78 | 
            +
                  encoding: UTF-8
         | 
| 79 | 
            +
                  string: '{"token":"eyJhbGciOiJSUzI1NiIsImtpZCI6InNzb19vaWRjX2tleV9wYWlyXzAxSFY3SlpGWEtQOVhCQjc2NjY0TkdUQlpYIn0.eyJhdWQiOiJodHRwczovL2FwaS53b3Jrb3MuY29tIiwiaXNzIjoiaHR0cHM6Ly9hcGkud29ya29zLmNvbSIsInN1YiI6InVzZXJfMDFKQ1A5SDRTSFM0TjNKNlhUS0RUN0pOUEUiLCJqdGkiOiIwMUpDUEFKMUFHWDVESzFNM0hDQTk5MFM1SiIsIm9yZ19pZCI6Im9yZ18wMUpDUDlHNjdNTkFIMEtDNEI3MlhaNjdNNyIsInBlcm1pc3Npb25zIjpbInVzZXJzOm1hbmFnZSIsInVzZXJzOnZpZXciXSwiZXhwIjoxNzMxNjI0Njk0LCJpYXQiOjE3MzE2MjEwOTR9.CTYliFAGFjw-_Lyla-yVBOUAn1ZqU-J7aOdWhAW8fiEsNMz73Fb5nRACa0PFWBE3HK1a8waV-S5lBCGHyxgYOaew5URNnlYXVwlgpKwujHDrW47FrYpxkyxVovY9z9SqDDNRHWBqJM3mH_4Fn9jaHwAVT0SPJrJ7Q4-jxfTc0_sZMR7RVJaBIXPEU8og6Zwc84Gx-9A-mBUA3PPUXfaa8JrCr5OGc482vbD1rF5sjk0jx_FovHrlI3qRo5nkQ3_5WEi7LzdxSPviITxY1-dtm0HbeULz8IL7Ic5O4Ok4lB2c8s8XoZT1JqUMmEHfugkWyQ4juN5aHpmf6ux8cJSJWg"}'
         | 
| 80 | 
            +
                http_version:
         | 
| 81 | 
            +
              recorded_at: Thu, 14 Nov 2024 21:51:34 GMT
         | 
| 82 | 
            +
            recorded_with: VCR 5.0.0
         | 
| @@ -0,0 +1,74 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: post
         | 
| 5 | 
            +
                uri: https://api.workos.com/widgets/token
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: UTF-8
         | 
| 8 | 
            +
                  string: '{"organization_id":"bogus-id","user_id":"user_01JCP9H4SHS4N3J6XTKDT7JNPE","scopes":["widgets:users-table:manage"]}'
         | 
| 9 | 
            +
                headers:
         | 
| 10 | 
            +
                  Content-Type:
         | 
| 11 | 
            +
                  - application/json
         | 
| 12 | 
            +
                  Accept-Encoding:
         | 
| 13 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 14 | 
            +
                  Accept:
         | 
| 15 | 
            +
                  - "*/*"
         | 
| 16 | 
            +
                  User-Agent:
         | 
| 17 | 
            +
                  - WorkOS; ruby/3.3.6; arm64-darwin23; v5.8.0
         | 
| 18 | 
            +
                  Authorization:
         | 
| 19 | 
            +
                  - Bearer <API_KEY>
         | 
| 20 | 
            +
              response:
         | 
| 21 | 
            +
                status:
         | 
| 22 | 
            +
                  code: 404
         | 
| 23 | 
            +
                  message: Not Found
         | 
| 24 | 
            +
                headers:
         | 
| 25 | 
            +
                  Date:
         | 
| 26 | 
            +
                  - Thu, 14 Nov 2024 22:02:40 GMT
         | 
| 27 | 
            +
                  Content-Type:
         | 
| 28 | 
            +
                  - application/json; charset=utf-8
         | 
| 29 | 
            +
                  Transfer-Encoding:
         | 
| 30 | 
            +
                  - chunked
         | 
| 31 | 
            +
                  Connection:
         | 
| 32 | 
            +
                  - keep-alive
         | 
| 33 | 
            +
                  Cf-Ray:
         | 
| 34 | 
            +
                  - 8e2a49858b5a7fa2-IAD
         | 
| 35 | 
            +
                  Cf-Cache-Status:
         | 
| 36 | 
            +
                  - DYNAMIC
         | 
| 37 | 
            +
                  Etag:
         | 
| 38 | 
            +
                  - W/"62-XNhANyOqo4doKt47ORHxpVuFTYg"
         | 
| 39 | 
            +
                  Strict-Transport-Security:
         | 
| 40 | 
            +
                  - max-age=15552000; includeSubDomains
         | 
| 41 | 
            +
                  Vary:
         | 
| 42 | 
            +
                  - Origin, Accept-Encoding
         | 
| 43 | 
            +
                  Access-Control-Allow-Credentials:
         | 
| 44 | 
            +
                  - 'true'
         | 
| 45 | 
            +
                  Content-Security-Policy:
         | 
| 46 | 
            +
                  - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
         | 
| 47 | 
            +
                    https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
         | 
| 48 | 
            +
                    ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
         | 
| 49 | 
            +
                  Expect-Ct:
         | 
| 50 | 
            +
                  - max-age=0
         | 
| 51 | 
            +
                  Referrer-Policy:
         | 
| 52 | 
            +
                  - no-referrer
         | 
| 53 | 
            +
                  X-Content-Type-Options:
         | 
| 54 | 
            +
                  - nosniff
         | 
| 55 | 
            +
                  X-Dns-Prefetch-Control:
         | 
| 56 | 
            +
                  - 'off'
         | 
| 57 | 
            +
                  X-Download-Options:
         | 
| 58 | 
            +
                  - noopen
         | 
| 59 | 
            +
                  X-Frame-Options:
         | 
| 60 | 
            +
                  - SAMEORIGIN
         | 
| 61 | 
            +
                  X-Permitted-Cross-Domain-Policies:
         | 
| 62 | 
            +
                  - none
         | 
| 63 | 
            +
                  X-Request-Id:
         | 
| 64 | 
            +
                  - 3d383216-51fe-42cd-87e2-7fee32719353
         | 
| 65 | 
            +
                  X-Xss-Protection:
         | 
| 66 | 
            +
                  - '0'
         | 
| 67 | 
            +
                  Server:
         | 
| 68 | 
            +
                  - cloudflare
         | 
| 69 | 
            +
                body:
         | 
| 70 | 
            +
                  encoding: ASCII-8BIT
         | 
| 71 | 
            +
                  string: '{"message":"Organization not found: ''bogus-id''.","code":"entity_not_found","entity_id":"bogus-id"}'
         | 
| 72 | 
            +
                http_version:
         | 
| 73 | 
            +
              recorded_at: Thu, 14 Nov 2024 22:02:40 GMT
         | 
| 74 | 
            +
            recorded_with: VCR 5.0.0
         | 
| @@ -0,0 +1,74 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            http_interactions:
         | 
| 3 | 
            +
            - request:
         | 
| 4 | 
            +
                method: post
         | 
| 5 | 
            +
                uri: https://api.workos.com/widgets/token
         | 
| 6 | 
            +
                body:
         | 
| 7 | 
            +
                  encoding: UTF-8
         | 
| 8 | 
            +
                  string: '{"organization_id":"org_01JCP9G67MNAH0KC4B72XZ67M7","user_id":"bogus-id","scopes":["widgets:users-table:manage"]}'
         | 
| 9 | 
            +
                headers:
         | 
| 10 | 
            +
                  Content-Type:
         | 
| 11 | 
            +
                  - application/json
         | 
| 12 | 
            +
                  Accept-Encoding:
         | 
| 13 | 
            +
                  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
         | 
| 14 | 
            +
                  Accept:
         | 
| 15 | 
            +
                  - "*/*"
         | 
| 16 | 
            +
                  User-Agent:
         | 
| 17 | 
            +
                  - WorkOS; ruby/3.3.6; arm64-darwin23; v5.8.0
         | 
| 18 | 
            +
                  Authorization:
         | 
| 19 | 
            +
                  - Bearer <API_KEY>
         | 
| 20 | 
            +
              response:
         | 
| 21 | 
            +
                status:
         | 
| 22 | 
            +
                  code: 404
         | 
| 23 | 
            +
                  message: Not Found
         | 
| 24 | 
            +
                headers:
         | 
| 25 | 
            +
                  Date:
         | 
| 26 | 
            +
                  - Thu, 14 Nov 2024 22:02:46 GMT
         | 
| 27 | 
            +
                  Content-Type:
         | 
| 28 | 
            +
                  - application/json; charset=utf-8
         | 
| 29 | 
            +
                  Transfer-Encoding:
         | 
| 30 | 
            +
                  - chunked
         | 
| 31 | 
            +
                  Connection:
         | 
| 32 | 
            +
                  - keep-alive
         | 
| 33 | 
            +
                  Cf-Ray:
         | 
| 34 | 
            +
                  - 8e2a49a82b31c54f-IAD
         | 
| 35 | 
            +
                  Cf-Cache-Status:
         | 
| 36 | 
            +
                  - DYNAMIC
         | 
| 37 | 
            +
                  Etag:
         | 
| 38 | 
            +
                  - W/"5a-TOigA+IvFyAtHvUdIXFXZWRdn8I"
         | 
| 39 | 
            +
                  Strict-Transport-Security:
         | 
| 40 | 
            +
                  - max-age=15552000; includeSubDomains
         | 
| 41 | 
            +
                  Vary:
         | 
| 42 | 
            +
                  - Origin, Accept-Encoding
         | 
| 43 | 
            +
                  Access-Control-Allow-Credentials:
         | 
| 44 | 
            +
                  - 'true'
         | 
| 45 | 
            +
                  Content-Security-Policy:
         | 
| 46 | 
            +
                  - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
         | 
| 47 | 
            +
                    https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
         | 
| 48 | 
            +
                    ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
         | 
| 49 | 
            +
                  Expect-Ct:
         | 
| 50 | 
            +
                  - max-age=0
         | 
| 51 | 
            +
                  Referrer-Policy:
         | 
| 52 | 
            +
                  - no-referrer
         | 
| 53 | 
            +
                  X-Content-Type-Options:
         | 
| 54 | 
            +
                  - nosniff
         | 
| 55 | 
            +
                  X-Dns-Prefetch-Control:
         | 
| 56 | 
            +
                  - 'off'
         | 
| 57 | 
            +
                  X-Download-Options:
         | 
| 58 | 
            +
                  - noopen
         | 
| 59 | 
            +
                  X-Frame-Options:
         | 
| 60 | 
            +
                  - SAMEORIGIN
         | 
| 61 | 
            +
                  X-Permitted-Cross-Domain-Policies:
         | 
| 62 | 
            +
                  - none
         | 
| 63 | 
            +
                  X-Request-Id:
         | 
| 64 | 
            +
                  - 0aeb3b90-0fd7-4de9-8d76-3d0e340ed583
         | 
| 65 | 
            +
                  X-Xss-Protection:
         | 
| 66 | 
            +
                  - '0'
         | 
| 67 | 
            +
                  Server:
         | 
| 68 | 
            +
                  - cloudflare
         | 
| 69 | 
            +
                body:
         | 
| 70 | 
            +
                  encoding: ASCII-8BIT
         | 
| 71 | 
            +
                  string: '{"message":"User not found: ''bogus-id''.","code":"entity_not_found","entity_id":"bogus-id"}'
         | 
| 72 | 
            +
                http_version:
         | 
| 73 | 
            +
              recorded_at: Thu, 14 Nov 2024 22:02:46 GMT
         | 
| 74 | 
            +
            recorded_with: VCR 5.0.0
         | 
    
        data/spec/support/profile.txt
    CHANGED
    
    | @@ -1 +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"}
         | 
| 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"}
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: workos
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 5. | 
| 4 | 
            +
              version: 5.9.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - WorkOS
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024- | 
| 11 | 
            +
            date: 2024-11-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: encryptor
         | 
| @@ -172,6 +172,7 @@ files: | |
| 172 172 | 
             
            - lib/workos/types/list_struct.rb
         | 
| 173 173 | 
             
            - lib/workos/types/passwordless_session_struct.rb
         | 
| 174 174 | 
             
            - lib/workos/types/provider.rb
         | 
| 175 | 
            +
            - lib/workos/types/widget_scope.rb
         | 
| 175 176 | 
             
            - lib/workos/user.rb
         | 
| 176 177 | 
             
            - lib/workos/user_and_token.rb
         | 
| 177 178 | 
             
            - lib/workos/user_management.rb
         | 
| @@ -180,6 +181,7 @@ files: | |
| 180 181 | 
             
            - lib/workos/version.rb
         | 
| 181 182 | 
             
            - lib/workos/webhook.rb
         | 
| 182 183 | 
             
            - lib/workos/webhooks.rb
         | 
| 184 | 
            +
            - lib/workos/widgets.rb
         | 
| 183 185 | 
             
            - spec/lib/workos/audit_logs_spec.rb
         | 
| 184 186 | 
             
            - spec/lib/workos/client.rb
         | 
| 185 187 | 
             
            - spec/lib/workos/configuration_spec.rb
         | 
| @@ -194,6 +196,7 @@ files: | |
| 194 196 | 
             
            - spec/lib/workos/sso_spec.rb
         | 
| 195 197 | 
             
            - spec/lib/workos/user_management_spec.rb
         | 
| 196 198 | 
             
            - spec/lib/workos/webhooks_spec.rb
         | 
| 199 | 
            +
            - spec/lib/workos/widgets_spec.rb
         | 
| 197 200 | 
             
            - spec/spec_helper.rb
         | 
| 198 201 | 
             
            - spec/support/fixtures/vcr_cassettes/audit_logs/create_event.yml
         | 
| 199 202 | 
             
            - spec/support/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml
         | 
| @@ -364,6 +367,9 @@ files: | |
| 364 367 | 
             
            - spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml
         | 
| 365 368 | 
             
            - spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml
         | 
| 366 369 | 
             
            - spec/support/fixtures/vcr_cassettes/user_management/verify_email/valid.yml
         | 
| 370 | 
            +
            - spec/support/fixtures/vcr_cassettes/widgets/get_token.yml
         | 
| 371 | 
            +
            - spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml
         | 
| 372 | 
            +
            - spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml
         | 
| 367 373 | 
             
            - spec/support/profile.txt
         | 
| 368 374 | 
             
            - spec/support/shared_examples/client.rb
         | 
| 369 375 | 
             
            - spec/support/webhook_payload.txt
         | 
| @@ -407,6 +413,7 @@ test_files: | |
| 407 413 | 
             
            - spec/lib/workos/sso_spec.rb
         | 
| 408 414 | 
             
            - spec/lib/workos/user_management_spec.rb
         | 
| 409 415 | 
             
            - spec/lib/workos/webhooks_spec.rb
         | 
| 416 | 
            +
            - spec/lib/workos/widgets_spec.rb
         | 
| 410 417 | 
             
            - spec/spec_helper.rb
         | 
| 411 418 | 
             
            - spec/support/fixtures/vcr_cassettes/audit_logs/create_event.yml
         | 
| 412 419 | 
             
            - spec/support/fixtures/vcr_cassettes/audit_logs/create_event_custom_idempotency_key.yml
         | 
| @@ -577,6 +584,9 @@ test_files: | |
| 577 584 | 
             
            - spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_code.yml
         | 
| 578 585 | 
             
            - spec/support/fixtures/vcr_cassettes/user_management/verify_email/invalid_magic_auth_challenge.yml
         | 
| 579 586 | 
             
            - spec/support/fixtures/vcr_cassettes/user_management/verify_email/valid.yml
         | 
| 587 | 
            +
            - spec/support/fixtures/vcr_cassettes/widgets/get_token.yml
         | 
| 588 | 
            +
            - spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_organization_id.yml
         | 
| 589 | 
            +
            - spec/support/fixtures/vcr_cassettes/widgets/get_token_invalid_user_id.yml
         | 
| 580 590 | 
             
            - spec/support/profile.txt
         | 
| 581 591 | 
             
            - spec/support/shared_examples/client.rb
         | 
| 582 592 | 
             
            - spec/support/webhook_payload.txt
         |