workos 5.1.0 → 5.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 928be28f91db58c18a6348d67d6a2db1ffd1de55a1bf84e65dad4b250cbd3c85
4
- data.tar.gz: adc3b8e361b4e4da51155a8f68bb79209ad48946b650dcc930c6130dbb3261ee
3
+ metadata.gz: bc46ab0187a370d044b03dae3f4e13bf9124305cab1102fe9c0bb8a88774638c
4
+ data.tar.gz: ab0cf69dabead6e03c6aae8e58959355dc7a7a555d9e7bdcd342aa8efc61f0bb
5
5
  SHA512:
6
- metadata.gz: 82560b233bd0361d6be1ae87f71c92ebf6af803cfabd1ff0864470769a5a1b1892f052f62c1cd6c4c3f51472a4b1d4e59b720c22100f0e9f7664637ef80e77ed
7
- data.tar.gz: 161ab6186cc0ed7230714da2d3a216d3a5727a73e478bddd674110cce88457a31dc70df2f20f4085535bd223f7f7bd14a3b432440ca04d6f863a4e05639827eb
6
+ metadata.gz: 5ba12562e6d3c50deda2584aaeb42175571c94aff5b069bc1e84cbe1ef3424cd9ffe355ee5007e1eee7f8775d5d408bea80f92137d5641ef96ee5c3fa1615f3b
7
+ data.tar.gz: 8766524298eefa04e4297f9429618970da35274eff3177ea1a1c32ae41ad33fd0d0228d595c6f00bea1e17ded32223da30bc9a02133b356d7b351db283ebbc06
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (5.1.0)
4
+ workos (5.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -8,7 +8,7 @@ module WorkOS
8
8
  include HashProvider
9
9
 
10
10
  attr_accessor :id, :idp_id, :emails, :first_name, :last_name, :job_title, :username, :state,
11
- :groups, :custom_attributes, :raw_attributes, :directory_id, :organization_id,
11
+ :groups, :role, :custom_attributes, :raw_attributes, :directory_id, :organization_id,
12
12
  :created_at, :updated_at
13
13
 
14
14
  # rubocop:disable Metrics/AbcSize
@@ -26,6 +26,7 @@ module WorkOS
26
26
  @username = hash[:username]
27
27
  @state = hash[:state]
28
28
  @groups = hash[:groups]
29
+ @role = hash[:role]
29
30
  @custom_attributes = hash[:custom_attributes]
30
31
  @raw_attributes = hash[:raw_attributes]
31
32
  @created_at = hash[:created_at]
@@ -48,6 +49,7 @@ module WorkOS
48
49
  username: username,
49
50
  state: state,
50
51
  groups: groups,
52
+ role: role,
51
53
  custom_attributes: custom_attributes,
52
54
  raw_attributes: raw_attributes,
53
55
  created_at: created_at,
@@ -7,7 +7,7 @@ module WorkOS
7
7
  class OrganizationMembership
8
8
  include HashProvider
9
9
 
10
- attr_accessor :id, :user_id, :organization_id, :status, :created_at, :updated_at
10
+ attr_accessor :id, :user_id, :organization_id, :status, :role, :created_at, :updated_at
11
11
 
12
12
  def initialize(json)
13
13
  hash = JSON.parse(json, symbolize_names: true)
@@ -16,6 +16,7 @@ module WorkOS
16
16
  @user_id = hash[:user_id]
17
17
  @organization_id = hash[:organization_id]
18
18
  @status = hash[:status]
19
+ @role = hash[:role]
19
20
  @created_at = hash[:created_at]
20
21
  @updated_at = hash[:updated_at]
21
22
  end
@@ -26,6 +27,7 @@ module WorkOS
26
27
  user_id: user_id,
27
28
  organization_id: organization_id,
28
29
  status: status,
30
+ role: role,
29
31
  created_at: created_at,
30
32
  updated_at: updated_at,
31
33
  }
@@ -841,14 +841,37 @@ module WorkOS
841
841
  #
842
842
  # @param [String] user_id The ID of the User.
843
843
  # @param [String] organization_id The ID of the Organization to which the user belongs to.
844
+ # @param [String] role_slug The slug of the role to grant to this membership. (Optional)
844
845
  #
845
846
  # @return [WorkOS::OrganizationMembership]
846
- def create_organization_membership(user_id:, organization_id:)
847
+ def create_organization_membership(user_id:, organization_id:, role_slug: nil)
847
848
  request = post_request(
848
849
  path: '/user_management/organization_memberships',
849
850
  body: {
850
851
  user_id: user_id,
851
852
  organization_id: organization_id,
853
+ role_slug: role_slug,
854
+ },
855
+ auth: true,
856
+ )
857
+
858
+ response = execute_request(request: request)
859
+
860
+ WorkOS::OrganizationMembership.new(response.body)
861
+ end
862
+
863
+ # Update an Organization Membership
864
+ #
865
+ # @param [String] organization_membership_id The ID of the Organization Membership.
866
+ # @param [String] role_slug The slug of the role to grant to this membership.
867
+ #
868
+ # @return [WorkOS::OrganizationMembership]
869
+ def update_organization_membership(id:, role_slug:)
870
+ request = put_request(
871
+ path: "/user_management/organization_memberships/#{id}",
872
+ body: {
873
+ id: id,
874
+ role_slug: role_slug,
852
875
  },
853
876
  auth: true,
854
877
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkOS
4
- VERSION = '5.1.0'
4
+ VERSION = '5.2.1'
5
5
  end
@@ -462,10 +462,10 @@ describe WorkOS::DirectorySync do
462
462
  'directory_user_01FAZYNPC8M0HRYTKFP2GNX852',
463
463
  )
464
464
 
465
- expect(user['first_name']).to eq('Logan')
465
+ expect(user['first_name']).to eq('Bob')
466
466
  expect(user.directory_id).to eq('directory_01FAZYMST676QMTFN1DDJZZX87')
467
467
  expect(user.organization_id).to eq('org_01FAZWCWR03DVWA83NCJYKKD54')
468
- expect(user.first_name).to eq('Logan')
468
+ expect(user.first_name).to eq('Bob')
469
469
  end
470
470
  end
471
471
  end
@@ -5,31 +5,47 @@ describe WorkOS::DirectoryUser do
5
5
  describe '.get_primary_email' do
6
6
  context 'with one primary email' do
7
7
  it 'returns the primary email' do
8
- 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"}')
9
- expect(user.primary_email).to eq('logan@workos.com')
8
+ 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"}')
9
+ expect(user.primary_email).to eq('bob.fakename@workos.com')
10
10
  end
11
11
  end
12
12
 
13
13
  context 'with multiple primary emails' do
14
14
  it 'returns the first email marked as primary' do
15
- 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"}')
16
- expect(user.primary_email).to eq('logan@workos.com')
15
+ 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"}')
16
+ expect(user.primary_email).to eq('bob.fakename@workos.com')
17
17
  end
18
18
  end
19
19
 
20
20
  context 'with no primary emails' do
21
21
  it 'returns nil' do
22
- 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"}')
22
+ 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"}')
23
23
  expect(user.primary_email).to eq(nil)
24
24
  end
25
25
  end
26
26
 
27
27
  context 'with an empty email array' do
28
28
  it 'returns nil' do
29
- 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"}')
29
+ 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"}')
30
30
  expect(user.primary_email).to eq(nil)
31
31
  end
32
32
  end
33
33
  end
34
+
35
+ describe '.get_role' do
36
+ context 'with no role' do
37
+ it 'returns no role' do
38
+ 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"}')
39
+ expect(user.role).to eq(nil)
40
+ end
41
+ end
42
+
43
+ context 'with a role' do
44
+ it 'returns the role slug' do
45
+ 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"}')
46
+ expect(user.role).to eq({ slug: 'member' })
47
+ end
48
+ end
49
+ end
34
50
  # rubocop:enable Layout/LineLength
35
51
  end
@@ -1039,19 +1039,63 @@ describe WorkOS::UserManagement do
1039
1039
 
1040
1040
  expect(organization_membership.organization_id).to eq('organization_01H5JQDV7R7ATEYZDEG0W5PRYS')
1041
1041
  expect(organization_membership.user_id).to eq('user_01H5JQDV7R7ATEYZDEG0W5PRYS')
1042
+ expect(organization_membership.role).to eq({ slug: 'member' })
1042
1043
  end
1043
1044
  end
1045
+ end
1044
1046
 
1045
- context 'with an invalid payload' do
1046
- it 'returns an error' do
1047
- VCR.use_cassette 'user_management/create_organization_membership/invalid' do
1048
- expect do
1049
- described_class.create_organization_membership(user_id: '', organization_id: '')
1050
- end.to raise_error(
1051
- WorkOS::UnprocessableEntityError,
1052
- /user_id_string_required/,
1053
- )
1054
- end
1047
+ context 'with an invalid payload' do
1048
+ it 'returns an error' do
1049
+ VCR.use_cassette 'user_management/create_organization_membership/invalid' do
1050
+ expect do
1051
+ described_class.create_organization_membership(user_id: '', organization_id: '')
1052
+ end.to raise_error(
1053
+ WorkOS::UnprocessableEntityError,
1054
+ /user_id_string_required/,
1055
+ )
1056
+ end
1057
+ end
1058
+ end
1059
+
1060
+ context 'with a role slug' do
1061
+ it 'creates an organization with the given role slug ' do
1062
+ VCR.use_cassette 'user_management/create_organization_membership/valid' do
1063
+ organization_membership = described_class.create_organization_membership(
1064
+ user_id: 'user_01H5JQDV7R7ATEYZDEG0W5PRYS',
1065
+ organization_id: 'org_01H5JQDV7R7ATEYZDEG0W5PRYS',
1066
+ role_slug: 'member',
1067
+ )
1068
+
1069
+ expect(organization_membership.organization_id).to eq('organization_01H5JQDV7R7ATEYZDEG0W5PRYS')
1070
+ expect(organization_membership.user_id).to eq('user_01H5JQDV7R7ATEYZDEG0W5PRYS')
1071
+ expect(organization_membership.role).to eq({ slug: 'member' })
1072
+ end
1073
+ end
1074
+ end
1075
+ end
1076
+
1077
+ describe '.update_organization_membership' do
1078
+ context 'with a valid id' do
1079
+ it 'returns true' do
1080
+ VCR.use_cassette('user_management/update_organization_membership/valid') do
1081
+ organization_membership = WorkOS::UserManagement.update_organization_membership(
1082
+ id: 'om_01H5JQDV7R7ATEYZDEG0W5PRYS',
1083
+ role_slug: 'admin',
1084
+ )
1085
+
1086
+ expect(organization_membership.organization_id).to eq('organization_01H5JQDV7R7ATEYZDEG0W5PRYS')
1087
+ expect(organization_membership.user_id).to eq('user_01H5JQDV7R7ATEYZDEG0W5PRYS')
1088
+ expect(organization_membership.role).to eq({ slug: 'admin' })
1089
+ end
1090
+ end
1091
+ end
1092
+
1093
+ context 'with an invalid id' do
1094
+ it 'raises an error' do
1095
+ VCR.use_cassette('user_management/update_organization_membership/invalid') do
1096
+ expect do
1097
+ WorkOS::UserManagement.update_organization_membership(id: 'invalid', role_slug: 'admin')
1098
+ end.to raise_error(WorkOS::NotFoundError, /Organization Membership not found/)
1055
1099
  end
1056
1100
  end
1057
1101
  end
@@ -74,10 +74,10 @@ http_interactions:
74
74
  - 72abbbf2b93e8ca5-EWR
75
75
  body:
76
76
  encoding: ASCII-8BIT
77
- 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
78
- 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
77
+ 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
78
+ 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
79
79
  - 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
80
- - 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"}}]}'
80
+ - 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"}}]}'
81
81
  http_version:
82
82
  recorded_at: Thu, 14 Jul 2022 16:46:23 GMT
83
83
  recorded_with: VCR 5.0.0
@@ -77,8 +77,8 @@ http_interactions:
77
77
  ma=86400
78
78
  body:
79
79
  encoding: ASCII-8BIT
80
- 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
81
- 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
80
+ 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
81
+ 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
82
82
  - Infra","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae4a","name":"Infra","parent":"5f27ada9a5e9bc0001a0ae48"}},{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team
83
83
  - 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
84
84
  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
@@ -183,8 +183,8 @@ http_interactions:
183
183
  - 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
184
184
  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
185
185
  - Platform","raw_attributes":{"id":"5f696c8e9a63a60e965aaca8","name":"Platform","parent":null}},{"object":"directory_group","id":"directory_group_01FAZYNMV2TDE78FEAH724YGMP","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Department
186
- - 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
187
- 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
186
+ - 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
187
+ 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
188
188
  - Infra","raw_attributes":{"id":"5f27ada9a5e9bc0001a0ae4a","name":"Infra","parent":"5f27ada9a5e9bc0001a0ae48"}},{"object":"directory_group","id":"directory_group_01FAZYNNQ4HQ6EBF29MPTH7VKB","directory_id":"directory_01FAZYMST676QMTFN1DDJZZX87","name":"Team
189
189
  - 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
190
190
  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
@@ -76,7 +76,7 @@ http_interactions:
76
76
  - cloudflare
77
77
  body:
78
78
  encoding: UTF-8
79
- 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"}'
79
+ 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"}'
80
80
  http_version:
81
81
  recorded_at: Thu, 17 Aug 2023 14:20:07 GMT
82
82
  recorded_with: VCR 5.0.0
@@ -76,7 +76,7 @@ http_interactions:
76
76
  - cloudflare
77
77
  body:
78
78
  encoding: ASCII-8BIT
79
- 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"}'
79
+ 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"}'
80
80
  http_version:
81
81
  recorded_at: Mon, 14 Aug 2023 21:42:04 GMT
82
82
  recorded_with: VCR 5.0.0
@@ -76,7 +76,7 @@ http_interactions:
76
76
  - cloudflare
77
77
  body:
78
78
  encoding: ASCII-8BIT
79
- 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}}'
79
+ 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}}'
80
80
  http_version:
81
81
  recorded_at: Tue, 15 Aug 2023 14:12:43 GMT
82
82
  recorded_with: VCR 5.0.0
@@ -76,7 +76,7 @@ http_interactions:
76
76
  - cloudflare
77
77
  body:
78
78
  encoding: ASCII-8BIT
79
- 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}}'
79
+ 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}}'
80
80
  http_version:
81
81
  recorded_at: Tue, 15 Aug 2023 16:37:20 GMT
82
82
  recorded_with: VCR 5.0.0
@@ -0,0 +1,82 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://api.workos.com/user_management/organization_memberships/invalid
6
+ body:
7
+ encoding: US-ASCII
8
+ string: '{"id":"invalid","role_slug":"admin"}'
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.0.2; arm64-darwin21; v2.16.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 404
23
+ message: Not Found
24
+ headers:
25
+ Date:
26
+ - Wed, 15 May 2024 19:13:06 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Cf-Ray:
34
+ - 7fc6fbe4ef26ec80-SEA
35
+ Cf-Cache-Status:
36
+ - DYNAMIC
37
+ Etag:
38
+ - W/"58-5GtYccQgavNavjEU+gaKkOl1gq4"
39
+ Strict-Transport-Security:
40
+ - max-age=15552000; includeSubDomains
41
+ Vary:
42
+ - Origin, Accept-Encoding
43
+ Via:
44
+ - 1.1 spaces-router (devel)
45
+ Access-Control-Allow-Credentials:
46
+ - 'true'
47
+ Content-Security-Policy:
48
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
49
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
50
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
51
+ Expect-Ct:
52
+ - max-age=0
53
+ Referrer-Policy:
54
+ - no-referrer
55
+ X-Content-Type-Options:
56
+ - nosniff
57
+ X-Dns-Prefetch-Control:
58
+ - 'off'
59
+ X-Download-Options:
60
+ - noopen
61
+ X-Frame-Options:
62
+ - SAMEORIGIN
63
+ X-Permitted-Cross-Domain-Policies:
64
+ - none
65
+ X-Request-Id:
66
+ - f3bf3ce2-ed1c-4fdf-9bba-065c2ab4e5e3
67
+ X-Xss-Protection:
68
+ - '0'
69
+ Set-Cookie:
70
+ - __cf_bm=VyJvcfBZAdCVUhGKRtHsl9enJXaR64T8urur5ClUQWY-1692999527-0-AahBwhyZ59RlA2LkZ5bsanqtnkJWCPSngTzr7vokapEBcsZzjppDl90U6KcM3t3w2iZ0p7uHvZZ5zI0G74Wlmg4=;
71
+ path=/; expires=Fri, 25-Aug-23 22:08:47 GMT; domain=.workos.com; HttpOnly;
72
+ Secure; SameSite=None
73
+ - __cfruid=1a7b02324f49135ba91ab0fc79714ad620549ae5-1692999527; path=/; domain=.workos.com;
74
+ HttpOnly; Secure; SameSite=None
75
+ Server:
76
+ - cloudflare
77
+ body:
78
+ encoding: ASCII-8BIT
79
+ string: '{"message":"Organization Membership not found: ''invalid''.","code":"entity_not_found","entity_id":"invalid"}'
80
+ http_version:
81
+ recorded_at: Wed, 15 May 2024 19:13:06 GMT
82
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,83 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://api.workos.com/user_management/organization_memberships/om_01H5JQDV7R7ATEYZDEG0W5PRYS
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"id":"om_01H5JQDV7R7ATEYZDEG0W5PRYS","role_slug":"admin"}'
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.0.2; arm64-darwin22; v2.16.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Wed, 15 May 2024 19:13:06 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '335'
31
+ Connection:
32
+ - keep-alive
33
+ Cf-Ray:
34
+ - 7f828e50ac5dc41d-EWR
35
+ Cf-Cache-Status:
36
+ - DYNAMIC
37
+ Etag:
38
+ - W/"14f-2n2KgFcHBXf1Yz7SYqzpAxR3E/E"
39
+ Strict-Transport-Security:
40
+ - max-age=15552000; includeSubDomains
41
+ Vary:
42
+ - Origin, Accept-Encoding
43
+ Via:
44
+ - 1.1 spaces-router (devel)
45
+ Access-Control-Allow-Credentials:
46
+ - 'true'
47
+ Content-Security-Policy:
48
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
49
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
50
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
51
+ Expect-Ct:
52
+ - max-age=0
53
+ Referrer-Policy:
54
+ - no-referrer
55
+ X-Content-Type-Options:
56
+ - nosniff
57
+ X-Dns-Prefetch-Control:
58
+ - 'off'
59
+ X-Download-Options:
60
+ - noopen
61
+ X-Frame-Options:
62
+ - SAMEORIGIN
63
+ X-Permitted-Cross-Domain-Policies:
64
+ - none
65
+ X-Request-Id:
66
+ - 8d277b87-b703-40d2-95ac-5f40bf96fcbf
67
+ X-Xss-Protection:
68
+ - '0'
69
+ Set-Cookie:
70
+ - __cf_bm=Pd2y8tPXDzQthhv7HAd93AsNAjT9V0tbWdH6PzS_iyA-1692282007-0-AUsV9W08vMNk02vMMYwMWj3KVIAJtXMGZdhGaWVL9yL3e4S5D1cGL2925nELffPsxoejtsVqyeqdvIixzD7UnL8=;
71
+ path=/; expires=Thu, 17-Aug-23 14:50:07 GMT; domain=.workos.com; HttpOnly;
72
+ Secure; SameSite=None
73
+ - __cfruid=432b4f1724bbd993a76e1e2e8c4d5e2381680fb1-1692282007; path=/; domain=.workos.com;
74
+ HttpOnly; Secure; SameSite=None
75
+ Server:
76
+ - cloudflare
77
+ body:
78
+ encoding: UTF-8
79
+ 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"}'
80
+ http_version:
81
+ recorded_at: Wed, 15 May 2024 19:13:06 GMT
82
+ recorded_with: VCR 5.0.0
83
+
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.1.0
4
+ version: 5.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - WorkOS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-20 00:00:00.000000000 Z
11
+ date: 2024-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -323,6 +323,8 @@ files:
323
323
  - spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml
324
324
  - spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml
325
325
  - spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml
326
+ - spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml
327
+ - spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml
326
328
  - spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml
327
329
  - spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml
328
330
  - spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml
@@ -531,6 +533,8 @@ test_files:
531
533
  - spec/support/fixtures/vcr_cassettes/user_management/send_password_reset_email/valid.yml
532
534
  - spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/invalid.yml
533
535
  - spec/support/fixtures/vcr_cassettes/user_management/send_verification_email/valid.yml
536
+ - spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/invalid.yml
537
+ - spec/support/fixtures/vcr_cassettes/user_management/update_organization_membership/valid.yml
534
538
  - spec/support/fixtures/vcr_cassettes/user_management/update_user/invalid.yml
535
539
  - spec/support/fixtures/vcr_cassettes/user_management/update_user/valid.yml
536
540
  - spec/support/fixtures/vcr_cassettes/user_management/update_user_password/invalid.yml