diff --git a/lib/workos/organization_membership.rb b/lib/workos/organization_membership.rb index 4d1bc8d6..213bb715 100644 --- a/lib/workos/organization_membership.rb +++ b/lib/workos/organization_membership.rb @@ -16,9 +16,9 @@ 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] - @role = T.let(raw.role, RoleStruct) end def to_json(*) diff --git a/spec/lib/workos/directory_user_spec.rb b/spec/lib/workos/directory_user_spec.rb index e7056bb8..6e89df4f 100644 --- a/spec/lib/workos/directory_user_spec.rb +++ b/spec/lib/workos/directory_user_spec.rb @@ -43,7 +43,7 @@ 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":"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":[],"role":{"slug":"member"},"created_at":"2022-05-13T17:45:31.732Z", "updated_at":"2022-07-13T17:45:42.618Z"}') - expect(user.role.slug).to eq('member') + expect(user.role).to eq({slug:'member'}) end end end 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